Browse Source

运营端-客户高级配置

master
zhaoqifeng 5 years ago
parent
commit
461753e5dc
  1. 28
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java
  2. 16
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ParameterResultDTO.java
  3. 3
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java
  4. 44
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCustomerParameterController.java
  5. 22
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCustomerParameterDao.java
  6. 29
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCustomerParameterService.java
  7. 67
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCustomerParameterServiceImpl.java
  8. 12
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCustomerParameterDao.xml
  9. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java
  10. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java
  11. 90
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java
  12. 3
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/CustomerProjectParameterDao.xml

28
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;
}

16
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;
}

3
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";
}

44
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<com.epmet.dto.result.ParameterResultDTO>
*/
@PostMapping("reviewinit")
public Result<ParameterResultDTO> reviewInit(@RequestBody ParameterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
ParameterResultDTO result = issueCustomerParameterService.reviewInit(formDTO);
return new Result<ParameterResultDTO>().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();
}
}

22
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<IssueCustomerParameterEntity> {
/**
* 获取客户配置
* @author zhaoqifeng
* @date 2020/11/18 17:32
* @param customerId
* @return java.util.List<com.epmet.dto.IssueCustomerParameterDTO>
*/
List<IssueCustomerParameterDTO> selectParamByCustomer(@Param("customerId") String customerId);
/**
* 删除客户配置
* @author zhaoqifeng
* @date 2020/11/18 17:33
* @param customerId
* @return int
*/
int deleteParamByCustomer(@Param("customerId") String customerId);
}

29
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<IssueCustomer
* @date 2020-05-11
*/
void delete(String[] ids);
/**
* 议题发布审核-初始化
* @author zhaoqifeng
* @date 2020/11/18 17:29
* @param formDTO
* @return com.epmet.dto.result.ParameterResultDTO
*/
ParameterResultDTO reviewInit(ParameterFormDTO formDTO);
/**
* 议题发布审核-保存
* @author zhaoqifeng
* @date 2020/11/18 17:29
* @param formDTO
* @return void
*/
void reviewSave(ParameterFormDTO formDTO);
/**
* 议题发布审核-恢复默认
* @author zhaoqifeng
* @date 2020/11/18 17:29
* @param formDTO
* @return void
*/
void reviewDefault(ParameterFormDTO formDTO);
}

67
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCustomerParameterServiceImpl.java

@ -23,10 +23,14 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.constant.IssueConstant;
import com.epmet.dao.IssueCustomerParameterDao;
import com.epmet.dto.IssueCustomerParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.entity.IssueCustomerParameterEntity;
import com.epmet.service.IssueCustomerParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -96,4 +100,67 @@ public class IssueCustomerParameterServiceImpl extends BaseServiceImpl<IssueCust
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 议题发布审核-初始化
*
* @param formDTO
* @return com.epmet.dto.result.ParameterResultDTO
* @author zhaoqifeng
* @date 2020/11/18 17:29
*/
@Override
public ParameterResultDTO reviewInit(ParameterFormDTO formDTO) {
ParameterResultDTO result = new ParameterResultDTO();
List<IssueCustomerParameterDTO> 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());
}
}

12
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCustomerParameterDao.xml

@ -17,6 +17,18 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteParamByCustomer">
DELETE FROM issue_customer_parameter
WHERE CUSTOMER_ID = #{customerId}
</delete>
<select id="selectParamByCustomer" resultType="com.epmet.dto.IssueCustomerParameterDTO">
SELECT PARAMETER_KEY,
PARAMETER_NAME,
PARAMETER_VALUE
FROM
issue_customer_parameter
WHERE CUSTOMER_ID = #{customerId}
</select>
</mapper>

16
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 = "设定核算单位天结束时间";
}

9
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java

@ -70,4 +70,13 @@ public interface CustomerProjectParameterDao extends BaseDao<CustomerProjectPara
CustomerProjectParameterDTO getDefaultPushTime();
CustomerProjectParameterDTO getPushTimeConfig(@Param("customerId") String customerId);
/**
* 删除旧数据
* @author zhaoqifeng
* @date 2020/11/18 17:01
* @param customerId
* @return int
*/
int deleteByCustomer(@Param("customerId") String customerId);
}

90
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java

@ -23,6 +23,11 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.dao.CustomerProjectParameterDao;
import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO;
@ -30,11 +35,15 @@ import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity;
import com.epmet.redis.CustomerProjectParameterRedis;
import com.epmet.service.CustomerProjectParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -169,7 +178,36 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl<Custome
*/
@Override
public ParameterResultDTO remindInit(ParameterFormDTO formDTO) {
return null;
ParameterResultDTO result = new ParameterResultDTO();
List<CustomerProjectParameterDTO> 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<Custome
* @date 2020/11/18 15:33
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void remindSave(ParameterFormDTO formDTO) {
List<CustomerProjectParameterEntity> 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<Custome
*/
@Override
public void remindDefault(ParameterFormDTO formDTO) {
//删除配置
baseDao.deleteByCustomer(formDTO.getCustomerId());
}
}

3
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/CustomerProjectParameterDao.xml

@ -17,6 +17,9 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByCustomer">
DELETE FROM customer_project_parameter WHERE CUSTOMER_ID = #{customerId}
</delete>
<select id="selectParameterValueByKey" resultType="java.lang.String" parameterType="com.epmet.entity.CustomerProjectParameterEntity">
select
PARAMETER_VALUE

Loading…
Cancel
Save