diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java new file mode 100644 index 0000000000..d2a7c0f0e1 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/18 17:21 + */ +@Data +public class ParameterFormDTO implements Serializable { + private static final long serialVersionUID = 3007336627437933281L; + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空", groups = DefaultGroup.class) + private String customerId; + /** + * 已开启审核:open; 无需审核:close + */ + @NotBlank(message = "可滞留天数不能为空", groups = AddGroup.class) + private String auditSwitch; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ParameterResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ParameterResultDTO.java new file mode 100644 index 0000000000..40f3ff5c58 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ParameterResultDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/18 17:25 + */ +@Data +public class ParameterResultDTO implements Serializable { + private static final long serialVersionUID = 2557066213008529836L; + private String auditSwitch; +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java index 42090ef7ff..8987746d81 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java @@ -94,5 +94,8 @@ public interface IssueConstant { String REVIEW_ISSUE = "议题评论失败,评论内容为:%s"; + String AUDIT_SWITCH = "audit_switch"; + String AUDIT_SWITCH_NAME = "议题发布前经网格员审核"; + String GRID = "grid"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCustomerParameterController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCustomerParameterController.java index f6ef0513a6..a7164ec296 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCustomerParameterController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCustomerParameterController.java @@ -26,6 +26,8 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.IssueCustomerParameterDTO; +import com.epmet.dto.form.ParameterFormDTO; +import com.epmet.dto.result.ParameterResultDTO; import com.epmet.excel.IssueCustomerParameterExcel; import com.epmet.service.IssueCustomerParameterService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +93,46 @@ public class IssueCustomerParameterController { ExcelUtils.exportExcelToTarget(response, null, list, IssueCustomerParameterExcel.class); } + /** + * 议题发布审核-初始化 + * @author zhaoqifeng + * @date 2020/11/18 15:26 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("reviewinit") + public Result reviewInit(@RequestBody ParameterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); + ParameterResultDTO result = issueCustomerParameterService.reviewInit(formDTO); + return new Result().ok(result); + } + + /** + * 议题发布审核-保存 + * @author zhaoqifeng + * @date 2020/11/18 15:26 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("reviewsave") + public Result reviewSave(@RequestBody ParameterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class); + issueCustomerParameterService.reviewSave(formDTO); + return new Result(); + } + + /** + * 议题发布审核-恢复默认 + * @author zhaoqifeng + * @date 2020/11/18 15:26 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("reviewdefault") + public Result reviewDefault(@RequestBody ParameterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); + issueCustomerParameterService.reviewDefault(formDTO); + return new Result(); + } + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCustomerParameterDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCustomerParameterDao.java index 48fa1e3491..2aa4bb50e9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCustomerParameterDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCustomerParameterDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueCustomerParameterDTO; import com.epmet.entity.IssueCustomerParameterEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 议题客户参数定制表 @@ -29,5 +33,23 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IssueCustomerParameterDao extends BaseDao { + + /** + * 获取客户配置 + * @author zhaoqifeng + * @date 2020/11/18 17:32 + * @param customerId + * @return java.util.List + */ + List selectParamByCustomer(@Param("customerId") String customerId); + + /** + * 删除客户配置 + * @author zhaoqifeng + * @date 2020/11/18 17:33 + * @param customerId + * @return int + */ + int deleteParamByCustomer(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCustomerParameterService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCustomerParameterService.java index 941d8efde9..ff2965b85d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCustomerParameterService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCustomerParameterService.java @@ -20,6 +20,8 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IssueCustomerParameterDTO; +import com.epmet.dto.form.ParameterFormDTO; +import com.epmet.dto.result.ParameterResultDTO; import com.epmet.entity.IssueCustomerParameterEntity; import java.util.List; @@ -92,4 +94,31 @@ public interface IssueCustomerParameterService extends BaseService list = baseDao.selectParamByCustomer(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(list)) { + list = baseDao.selectParamByCustomer("default"); + } + list.forEach(dto -> { + switch (dto.getParameterKey()) { + case IssueConstant.AUDIT_SWITCH: + result.setAuditSwitch(dto.getParameterValue()); + break; + default: + break; + } + }); + return result; + } + + /** + * 议题发布审核-保存 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/11/18 17:29 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void reviewSave(ParameterFormDTO formDTO) { + //删除旧配置 + baseDao.deleteParamByCustomer(formDTO.getCustomerId()); + IssueCustomerParameterEntity entity = new IssueCustomerParameterEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setParameterKey(IssueConstant.AUDIT_SWITCH); + entity.setParameterName(IssueConstant.AUDIT_SWITCH_NAME); + entity.setParameterValue(formDTO.getAuditSwitch()); + insert(entity); + } + + /** + * 议题发布审核-恢复默认 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/11/18 17:29 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void reviewDefault(ParameterFormDTO formDTO) { + //删除客户配置 + baseDao.deleteParamByCustomer(formDTO.getCustomerId()); + } + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCustomerParameterDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCustomerParameterDao.xml index d0934a775e..f4fd66235a 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCustomerParameterDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCustomerParameterDao.xml @@ -17,6 +17,18 @@ + + DELETE FROM issue_customer_parameter + WHERE CUSTOMER_ID = #{customerId} + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java index 2d5ae69fbb..57564203de 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java @@ -11,17 +11,17 @@ public interface ParameterKeyConstant { * 可滞留天数 */ String DETENTION_DAYS = "detention_days"; - + String DETENTION_DAYS_NAME = "可滞留天数"; /** * 计算方式 */ String CALCULATION = "calculation"; + String CALCULATION_NAME = "计算方式"; /** * 计算方式-工作日 */ String WORK = "work"; - /** * 计算方式-日历天 */ @@ -31,14 +31,26 @@ public interface ParameterKeyConstant { * 即将超期提醒时间 */ String REMIND_TIME = "remind_time"; + String REMIND_TIME_NAME = "即将超期提醒时间"; /** * 推送时间 */ String PUSH_TIME = "push_time"; + String PUSH_TIME_NAME = "推送时间"; /** * 起止时间 */ String START_AND_END_TIME = "start_and_end_time"; + /** + * 设定核算单位天开始时间 + */ + String START_TIME = "start_time"; + String START_TIME_NAME = "设定核算单位天开始时间"; + /** + * 设定核算单位天结束时间 + */ + String END_TIME = "end_time"; + String END_TIME_NAME = "设定核算单位天结束时间"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java index 349b07308b..f7ae09d16e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java @@ -70,4 +70,13 @@ public interface CustomerProjectParameterDao extends BaseDao list = getParameterByCustomer(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(list)) { + list = getParameterByCustomer("default"); + } + list.forEach(dto -> { + switch (dto.getParameterKey()) { + case ParameterKeyConstant.DETENTION_DAYS: + result.setDetentionDays(dto.getParameterValue()); + break; + case ParameterKeyConstant.CALCULATION: + result.setCalculation(dto.getParameterValue()); + break; + case ParameterKeyConstant.REMIND_TIME: + result.setRemindTime(dto.getParameterValue()); + break; + case ParameterKeyConstant.PUSH_TIME: + result.setPushTime(dto.getParameterValue()); + break; + case ParameterKeyConstant.START_TIME: + result.setStartTime(dto.getParameterValue()); + break; + case ParameterKeyConstant.END_TIME: + result.setEndTime(dto.getParameterValue()); + break; + default: + break; + } + }); + return result; } /** @@ -181,7 +219,54 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl list = new ArrayList<>(); + //删除旧数据 + baseDao.deleteByCustomer(formDTO.getCustomerId()); + //可滞留天数 + CustomerProjectParameterEntity detentionDays = new CustomerProjectParameterEntity(); + detentionDays.setCustomerId(formDTO.getCustomerId()); + detentionDays.setParameterKey(ParameterKeyConstant.DETENTION_DAYS); + detentionDays.setParameterValue(formDTO.getDetentionDays()); + detentionDays.setParameterName(ParameterKeyConstant.DETENTION_DAYS_NAME); + list.add(detentionDays); + //计算方式 工作日work 日历天calendar + CustomerProjectParameterEntity calculation = new CustomerProjectParameterEntity(); + calculation.setCustomerId(formDTO.getCustomerId()); + calculation.setParameterKey(ParameterKeyConstant.CALCULATION); + calculation.setParameterValue(formDTO.getCalculation()); + calculation.setParameterName(ParameterKeyConstant.CALCULATION_NAME); + list.add(calculation); + //即将超期提醒时间 + CustomerProjectParameterEntity remindTime = new CustomerProjectParameterEntity(); + remindTime.setCustomerId(formDTO.getCustomerId()); + remindTime.setParameterKey(ParameterKeyConstant.REMIND_TIME); + remindTime.setParameterValue(formDTO.getRemindTime()); + remindTime.setParameterName(ParameterKeyConstant.REMIND_TIME_NAME); + list.add(remindTime); + //推送时间 + CustomerProjectParameterEntity pushTime = new CustomerProjectParameterEntity(); + pushTime.setCustomerId(formDTO.getCustomerId()); + pushTime.setParameterKey(ParameterKeyConstant.PUSH_TIME); + pushTime.setParameterValue(formDTO.getPushTime()); + pushTime.setParameterName(ParameterKeyConstant.PUSH_TIME_NAME); + list.add(pushTime); + //设定核算单位天开始时间 + CustomerProjectParameterEntity startTime = new CustomerProjectParameterEntity(); + startTime.setCustomerId(formDTO.getCustomerId()); + startTime.setParameterKey(ParameterKeyConstant.START_TIME); + startTime.setParameterValue(formDTO.getStartTime()); + startTime.setParameterName(ParameterKeyConstant.START_TIME_NAME); + list.add(startTime); + //设定核算单位天结束时间 + CustomerProjectParameterEntity endTime = new CustomerProjectParameterEntity(); + endTime.setCustomerId(formDTO.getCustomerId()); + endTime.setParameterKey(ParameterKeyConstant.END_TIME); + endTime.setParameterValue(formDTO.getEndTime()); + endTime.setParameterName(ParameterKeyConstant.END_TIME_NAME); + list.add(endTime); + insertBatch(list); } @@ -195,7 +280,8 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl + + DELETE FROM customer_project_parameter WHERE CUSTOMER_ID = #{customerId} +