|
@@ -33,14 +33,14 @@ import com.goafanti.news.service.PolicyService;
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping(value = "/api/admin/policy")
|
|
@RequestMapping(value = "/api/admin/policy")
|
|
|
public class AdminPolicyApiController extends BaseApiController {
|
|
public class AdminPolicyApiController extends BaseApiController {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private JDBCIdGenerator idGenerator;
|
|
private JDBCIdGenerator idGenerator;
|
|
|
@Resource
|
|
@Resource
|
|
|
private PolicyService policyService;
|
|
private PolicyService policyService;
|
|
|
/*
|
|
/*
|
|
|
* 新增
|
|
* 新增
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* */
|
|
* */
|
|
|
@RequestMapping(value="/apply",method=RequestMethod.POST)
|
|
@RequestMapping(value="/apply",method=RequestMethod.POST)
|
|
|
public Result insertPolicy(@Valid Policy policy,String[]publishPages,BindingResult bindingResult) {
|
|
public Result insertPolicy(@Valid Policy policy,String[]publishPages,BindingResult bindingResult) {
|
|
@@ -48,7 +48,7 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
|
result.getError().add(
|
|
result.getError().add(
|
|
|
buildErrorByMsg(bindingResult.getFieldError()
|
|
buildErrorByMsg(bindingResult.getFieldError()
|
|
|
- .getDefaultMessage(), NewsFields
|
|
|
|
|
|
|
+ .getDefaultMessage(), NewsFields
|
|
|
.getFieldDesc(bindingResult.getFieldError()
|
|
.getFieldDesc(bindingResult.getFieldError()
|
|
|
.getField())));
|
|
.getField())));
|
|
|
return result;
|
|
return result;
|
|
@@ -72,12 +72,12 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
policy.setType(0);
|
|
policy.setType(0);
|
|
|
if(policy.getAuditStatus()!=null &&policy.getAuditStatus() == 2) {
|
|
if(policy.getAuditStatus()!=null &&policy.getAuditStatus() == 2) {
|
|
|
policy.setReleaseDate(new Date());
|
|
policy.setReleaseDate(new Date());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
result.setData(policyService.saveNewPolicy(policy, webPages, appPages));
|
|
result.setData(policyService.saveNewPolicy(policy, webPages, appPages));
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private void disposePolicyParams(Policy policy,Result result) {
|
|
private void disposePolicyParams(Policy policy,Result result) {
|
|
|
if(StringUtils.isBlank(policy.getTitle())) {
|
|
if(StringUtils.isBlank(policy.getTitle())) {
|
|
@@ -102,9 +102,9 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
}
|
|
}
|
|
|
/*
|
|
/*
|
|
|
* 删除
|
|
* 删除
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* */
|
|
* */
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@RequestMapping(value="/delete",method=RequestMethod.POST)
|
|
@RequestMapping(value="/delete",method=RequestMethod.POST)
|
|
|
public Result deleteById(Long id) {
|
|
public Result deleteById(Long id) {
|
|
|
Result result=new Result();
|
|
Result result=new Result();
|
|
@@ -118,7 +118,7 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* 详情
|
|
* 详情
|
|
|
* */
|
|
* */
|
|
@@ -131,10 +131,10 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
result.setData(policyService.getPolicyDetail(id));
|
|
result.setData(policyService.getPolicyDetail(id));
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* 修改
|
|
* 修改
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* */
|
|
* */
|
|
|
@RequestMapping(value="/update",method=RequestMethod.POST)
|
|
@RequestMapping(value="/update",method=RequestMethod.POST)
|
|
|
public Result updateNews(@Valid Policy policy,BindingResult bindingResult,String[] publishPages) {
|
|
public Result updateNews(@Valid Policy policy,BindingResult bindingResult,String[] publishPages) {
|
|
@@ -142,7 +142,7 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
|
result.getError().add(
|
|
result.getError().add(
|
|
|
buildErrorByMsg(bindingResult.getFieldError()
|
|
buildErrorByMsg(bindingResult.getFieldError()
|
|
|
- .getDefaultMessage(), NewsFields
|
|
|
|
|
|
|
+ .getDefaultMessage(), NewsFields
|
|
|
.getFieldDesc(bindingResult.getFieldError()
|
|
.getFieldDesc(bindingResult.getFieldError()
|
|
|
.getField())));
|
|
.getField())));
|
|
|
return result;
|
|
return result;
|
|
@@ -161,22 +161,22 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
if(policy.getAuditStatus()!=null ) {
|
|
if(policy.getAuditStatus()!=null ) {
|
|
|
policy.setReleaseDate(new Date());
|
|
policy.setReleaseDate(new Date());
|
|
|
if(policy.getAuditStatus() ==2){
|
|
if(policy.getAuditStatus() ==2){
|
|
|
- policy.setReleaseDate(new Date());
|
|
|
|
|
|
|
+
|
|
|
policyService.addJtCollectSearch(policy);
|
|
policyService.addJtCollectSearch(policy);
|
|
|
}
|
|
}
|
|
|
if(policy.getAuditStatus()==4) {
|
|
if(policy.getAuditStatus()==4) {
|
|
|
policyService.updateJtCollectSearch(policy);
|
|
policyService.updateJtCollectSearch(policy);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
policy.setEditTime(new Date());
|
|
policy.setEditTime(new Date());
|
|
|
-
|
|
|
|
|
- result.setData(policyService.updateSelectively( policy,webPages,appPages));
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ result.setData(policyService.updateSelectively( policy,webPages,appPages));
|
|
|
|
|
+
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* 变更发布状态、发布时间
|
|
* 变更发布状态、发布时间
|
|
|
* */
|
|
* */
|
|
@@ -199,7 +199,7 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
}
|
|
}
|
|
|
policy.setReleaseDate(new Date());}
|
|
policy.setReleaseDate(new Date());}
|
|
|
if(auditStatus!=null) {
|
|
if(auditStatus!=null) {
|
|
|
- policy.setAuditStatus(auditStatus);
|
|
|
|
|
|
|
+ policy.setAuditStatus(auditStatus);
|
|
|
if(auditStatus ==2){
|
|
if(auditStatus ==2){
|
|
|
policy.setReleaseDate(new Date());
|
|
policy.setReleaseDate(new Date());
|
|
|
policyService.updateJtCollectSearch(policy);
|
|
policyService.updateJtCollectSearch(policy);
|
|
@@ -209,12 +209,12 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
policyService.updateJtCollectSearch(policy);
|
|
policyService.updateJtCollectSearch(policy);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- result.setData(policyService.updateSelectivelyWithoutPages(policy));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ result.setData(policyService.updateSelectivelyWithoutPages(policy));
|
|
|
return result;
|
|
return result;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* 政策搜索
|
|
* 政策搜索
|
|
|
* */
|
|
* */
|
|
@@ -226,8 +226,8 @@ public class AdminPolicyApiController extends BaseApiController {
|
|
|
result.setData(policyService.searchPolicy(title,auditStatus,startReleaseDate,endReleaseDate,publishPage,pageNo,pageSize,null));
|
|
result.setData(policyService.searchPolicy(title,auditStatus,startReleaseDate,endReleaseDate,publishPage,pageNo,pageSize,null));
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|