Browse Source

Merge branch 'dev_exception_handle' into dev_group_edit

dev_shibei_match
wxz 5 years ago
parent
commit
9984a549b0
  1. 16
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java
  3. 102
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java
  4. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  5. 4
      epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java
  6. 4
      epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java
  7. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java
  8. 8
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java
  9. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
  10. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml
  11. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml
  12. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml
  13. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml
  14. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml
  15. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  16. 4
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java
  17. 4
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java
  18. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java
  19. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java
  20. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java
  21. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java
  22. 13
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml
  23. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  24. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java
  25. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

16
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java

@ -66,7 +66,7 @@ public abstract class BaseRequestLogAspect {
resultInfoLog(transactionSerial, getExecPeriod(startTime), result); resultInfoLog(transactionSerial, getExecPeriod(startTime), result);
} catch (RenException e) { } catch (RenException e) {
result = handleRenException(e); result = handleRenException(e);
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e));
} catch (ValidateException e) { } catch (ValidateException e) {
result = handleValidateException(e); result = handleValidateException(e);
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e));
@ -174,14 +174,20 @@ public abstract class BaseRequestLogAspect {
*/ */
private Result handleRenException(RenException e) { private Result handleRenException(RenException e) {
if (e.getCode() > 8000) { if (e.getCode() > 8000) {
// 原样返回 Result result;
Result result=new Result().error(e.getCode()); if (StringUtils.isNotBlank(e.getMsg())) {
result.setInternalMsg(e.getMsg()); // 抛出异常的时候填写了自定义显示信息,把显示信息返回
result = new Result().error(e.getCode(), e.getMsg());
} else {
// 没有填写显示信息,则根据code找固定的显示信息
result = new Result().error(e.getCode());
}
result.setInternalMsg(e.getInternalMsg());
return result; return result;
} }
// 转化成服务器开小差... // 转化成服务器开小差...
Result result=new Result().error(); Result result=new Result().error();
result.setInternalMsg(e.getMsg()); result.setInternalMsg(e.getInternalMsg());
//result.setMsg(e.getMsg()); //result.setMsg(e.getMsg());
return result; return result;
} }

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java

@ -1,7 +1,6 @@
package com.epmet.commons.tools.distributedlock; package com.epmet.commons.tools.distributedlock;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
@ -9,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* @Author zxc * @Author zxc
@ -23,6 +21,7 @@ public class DistributedLock {
/** /**
* @Description 抢锁🔒 每个锁持有十分钟 * @Description 抢锁🔒 每个锁持有十分钟
* watchDog模式每隔10s自动更改持锁时间,假设宕机持锁时间达到时会自动释放锁
* @Param name * @Param name
* @author zxc * @author zxc
* @date 2020/10/28 2:52 下午 * @date 2020/10/28 2:52 下午

102
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java

@ -19,28 +19,75 @@ import org.apache.commons.lang3.StringUtils;
* @since 1.0.0 * @since 1.0.0
*/ */
public class RenException extends RuntimeException { public class RenException extends RuntimeException {
public enum MessageMode {
//code_内部信息_外部信息
CODE_INTERNAL_EXTERNAL
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int code; private int code;
/**
* 显示给客户的消息
*/
private String msg; private String msg;
/**
* 内部消息用于服务之间传递错误信息排错用
*/
private String internalMsg;
public RenException(int code) { public RenException(int code) {
this(code, ""); this(code, "");
} }
public RenException(int code, String internalMsg) {
super(internalMsg);
this.code = code;
if (StringUtils.isBlank(internalMsg)) {
this.internalMsg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.internalMsg)) {
this.internalMsg = MessageUtils.getMessage(code, internalMsg);
}
} else {
this.internalMsg = internalMsg;
}
}
public RenException(int code, String internalMsg, String msg, MessageMode mode) {
this(code, internalMsg);
this.msg = msg;
}
public RenException(String internalMsg) {
super(internalMsg);
// this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.internalMsg = internalMsg;
}
public RenException(String internalMsg, String msg) {
this(internalMsg);
this.msg = msg;
}
public RenException(int code, String... params) { public RenException(int code, String... params) {
this.code = code; this.code = code;
this.msg = EpmetErrorCode.getMsg(code); this.internalMsg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) { if (StringUtils.isBlank(this.internalMsg)) {
this.msg = MessageUtils.getMessage(code, params); this.internalMsg = MessageUtils.getMessage(code, params);
} }
} }
public RenException(int code, Throwable e) { public RenException(int code, Throwable e) {
super(e); super(e);
this.code = code; this.code = code;
this.msg = EpmetErrorCode.getMsg(code); this.internalMsg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) { if (StringUtils.isBlank(this.internalMsg)) {
this.msg = MessageUtils.getMessage(code); this.internalMsg = MessageUtils.getMessage(code);
} }
} }
@ -50,40 +97,18 @@ public class RenException extends RuntimeException {
} }
public RenException(int code, String msg) { public RenException(String internalMsg, Throwable e) {
super(msg); super(internalMsg, e);
this.code = code;
if (StringUtils.isBlank(msg)) {
this.msg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) {
this.msg = MessageUtils.getMessage(code, msg);
}
} else {
this.msg = msg;
}
}
public RenException(String msg) {
super(msg);
// this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.msg = msg;
}
public RenException(String msg, Throwable e) {
super(msg, e);
// this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.code = EpmetErrorCode.SERVER_ERROR.getCode(); this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.msg = msg; this.internalMsg = internalMsg;
} }
public String getMsg() { public String getInternalMsg() {
return msg; return internalMsg;
} }
public void setMsg(String msg) { public void setInternalMsg(String internalMsg) {
this.msg = msg; this.internalMsg = internalMsg;
} }
public int getCode() { public int getCode() {
@ -94,4 +119,11 @@ public class RenException extends RuntimeException {
this.code = code; this.code = code;
} }
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
} }

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Date; import java.util.Date;
@ -56,12 +55,12 @@ public class RenExceptionHandler {
public Result handleRRException(RenException ex){ public Result handleRRException(RenException ex){
if (ex.getCode() > 8000) { if (ex.getCode() > 8000) {
Result result=new Result().error(ex.getCode()); Result result=new Result().error(ex.getCode());
result.setData(ex.getMsg()); result.setData(ex.getInternalMsg());
return result; return result;
} }
logger.error(ExceptionUtils.getErrorStackTrace(ex)); logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result().error(); Result result=new Result().error();
result.setData(ex.getMsg()); result.setData(ex.getInternalMsg());
return result; return result;
// return new Result().error(); // return new Result().error();
} }

4
epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java

@ -3,7 +3,6 @@ package com.epmet.auth;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.filter.CpProperty; import com.epmet.filter.CpProperty;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -15,7 +14,6 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/** /**
* 外部应用认证 * 外部应用认证
@ -93,7 +91,7 @@ public class ExternalAuthProcessor extends AuthProcessor {
} }
} catch (RenException e) { } catch (RenException e) {
//return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); //return response(exchange, new Result<>().error(e.getCode(), e.getMsg()));
throw new RenException(e.getCode(),e.getMsg()); throw new RenException(e.getCode(),e.getInternalMsg());
} catch (Exception e) { } catch (Exception e) {
logger.error("外部应用请求认证发生未知错误:" + ExceptionUtils.getErrorStackTrace(e)); logger.error("外部应用请求认证发生未知错误:" + ExceptionUtils.getErrorStackTrace(e));
//return response(exchange, new Result<>().error("外部应用请求认证发生未知错误")); //return response(exchange, new Result<>().error("外部应用请求认证发生未知错误"));

4
epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java

@ -54,7 +54,7 @@ public class InternalAuthProcessor extends AuthProcessor {
baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); baseTokenDto = getBaseTokenDto(token, jwtTokenUtils);
}catch(RenException e){ }catch(RenException e){
//return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); //return response(exchange,new Result<>().error(e.getCode(),e.getMsg()));
throw new RenException(e.getCode(), e.getMsg()); throw new RenException(e.getCode(), e.getInternalMsg());
} }
}else{ }else{
baseTokenDto = null; baseTokenDto = null;
@ -97,7 +97,7 @@ public class InternalAuthProcessor extends AuthProcessor {
validateTokenDto(baseTokenDto, token); validateTokenDto(baseTokenDto, token);
} catch (RenException e) { } catch (RenException e) {
//return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); //return response(exchange, new Result<>().error(e.getCode(), e.getMsg()));
throw new RenException(e.getCode(), e.getMsg()); throw new RenException(e.getCode(), e.getInternalMsg());
} }
} }

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java

@ -19,7 +19,7 @@ public class AblityListResultDTO implements Serializable {
*/ */
private String name; private String name;
/** /**
* 指标对应值数值或百分比 * 指标对应值数值或百分比原始值
*/ */
private String value = "0"; private String value = "0";
/** /**
@ -36,4 +36,6 @@ public class AblityListResultDTO implements Serializable {
*/ */
private BigDecimal weight; private BigDecimal weight;
private Double score;
} }

8
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java

@ -25,9 +25,17 @@ public class ScoreListResultDTO implements Serializable {
* 本级分数(保留一位小数) * 本级分数(保留一位小数)
*/ */
private Double agencyScore; private Double agencyScore;
private Double selfOriginScore;
private Double agencyWeight;
/** /**
* 下级分数(保留一位小数) * 下级分数(保留一位小数)
*/ */
private Double subAgencyScore; private Double subAgencyScore;
private Double subAgencyWeight;
private Double subOriginScore;
} }

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml

@ -26,7 +26,11 @@
fact.index_code AS "indexCode", fact.index_code AS "indexCode",
ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal", ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal",
ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore", ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore",
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore" self.self_score AS selfOriginScore,
self.SELF_WEIGHT AS agencyWeight,
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore",
self.sub_score AS subOriginScore,
self.SUB_WEIGHT AS subAgencyWeight
FROM FROM
fact_index_agency_score fact fact_index_agency_score fact
INNER JOIN fact_index_agency_self_sub_score self ON fact.agency_id = self.agency_id INNER JOIN fact_index_agency_self_sub_score self ON fact.agency_id = self.agency_id

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

@ -7,6 +7,7 @@
SELECT SELECT
fact.index_code AS "key", fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
fact.score AS score,
dict.index_name AS "name", dict.index_name AS "name",
round(fact.WEIGHT,2) AS weight round(fact.WEIGHT,2) AS weight
FROM FROM

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml

@ -26,7 +26,11 @@
fact.index_code AS "indexCode", fact.index_code AS "indexCode",
ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal", ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal",
ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore", ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore",
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore" self.self_score AS selfOriginScore,
self.SELF_WEIGHT AS agencyWeight,
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore",
self.sub_score AS subOriginScore,
self.SUB_WEIGHT AS subAgencyWeight
FROM FROM
fact_index_community_score fact fact_index_community_score fact
INNER JOIN fact_index_community_self_sub_score self ON fact.agency_id = self.agency_id INNER JOIN fact_index_community_self_sub_score self ON fact.agency_id = self.agency_id

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml

@ -8,6 +8,7 @@
fact.index_code AS "key", fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
dict.index_name AS "name", dict.index_name AS "name",
fact.score AS score,
round(fact.WEIGHT,2) AS weight round(fact.WEIGHT,2) AS weight
FROM FROM
fact_index_community_sub_score fact fact_index_community_sub_score fact

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml

@ -26,7 +26,11 @@
fact.index_code AS "indexCode", fact.index_code AS "indexCode",
ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal", ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal",
ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore", ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore",
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore" self.self_score AS selfOriginScore,
self.SELF_WEIGHT AS agencyWeight,
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore",
self.sub_score AS subOriginScore,
self.SUB_WEIGHT AS subAgencyWeight
FROM FROM
fact_index_grid_score fact fact_index_grid_score fact
INNER JOIN fact_index_grid_self_sub_score self ON fact.grid_id = self.grid_id INNER JOIN fact_index_grid_self_sub_score self ON fact.grid_id = self.grid_id

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml

@ -8,6 +8,7 @@
fact.index_code AS "key", fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
dict.index_name AS "name", dict.index_name AS "name",
fact.score AS score,
round(fact.WEIGHT,2) AS weight round(fact.WEIGHT,2) AS weight
FROM FROM
fact_index_grid_sub_score fact fact_index_grid_sub_score fact

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -1,10 +1,12 @@
package com.epmet.service.evaluationindex.indexcoll.impl; package com.epmet.service.evaluationindex.indexcoll.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.distributedlock.LockConstants; import com.epmet.commons.tools.distributedlock.LockConstants;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.OrgTypeConstant;
@ -29,6 +31,7 @@ import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -200,7 +203,17 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
} while (deleteNum > NumConstant.ZERO); } while (deleteNum > NumConstant.ZERO);
} }
if (!CollectionUtils.isEmpty(formDTO.getDataList())) { if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO.getDataList(), customerId); List<DeptGovrnAbilityFormDTO> dataList = formDTO.getDataList();
// 有 deptId字段为空时,报错提示
List<DeptGovrnAbilityFormDTO> deptIsNull = dataList.stream().filter(d -> null == d.getDeptId() || d.getDeptId().equals("")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deptIsNull)){
throw new RenException("治理能力-部门相关指标计算【deptId为空】的客户ID为:"+customerId+",具体信息信息为:"+ JSON.toJSONString(deptIsNull));
}
// 改成分批插入
List<List<DeptGovrnAbilityFormDTO>> partition = ListUtils.partition(dataList, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(p, customerId);
});
} }
} }

4
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java

@ -22,6 +22,10 @@ public class CustomerTemplateListFormDTO implements Serializable {
*/ */
@NotBlank(message="公共模板Id不能为空", groups = {AddUserInternalGroup.class}) @NotBlank(message="公共模板Id不能为空", groups = {AddUserInternalGroup.class})
private String publicId; private String publicId;
/**
* 模板关键词Id
*/
private String keyIds;
public interface AddUserInternalGroup {} public interface AddUserInternalGroup {}
} }

4
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java

@ -26,6 +26,10 @@ public class GetTemplateListFormDTO implements Serializable {
* 模板类型(站内信提醒) * 模板类型(站内信提醒)
*/ */
private String templateType; private String templateType;
/**
* 模板关键词Id
*/
private String keyIds;
public interface AddUserInternalGroup {} public interface AddUserInternalGroup {}
} }

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java

@ -94,4 +94,15 @@ public interface PersonalTemplateDao extends BaseDao<PersonalTemplateEntity> {
* @author sun * @author sun
*/ */
List<CustomerTemplateListResultDTO> selectCustomerTemplateList(CustomerTemplateListFormDTO formDTO); List<CustomerTemplateListResultDTO> selectCustomerTemplateList(CustomerTemplateListFormDTO formDTO);
/**
* 根据tid和keyIds查询是否已存在该模板类型数据
* @author zhaoqifeng
* @date 2020/11/2 10:31
* @param appId
* @param tid
* @param keyIds
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
*/
List<PersonalTemplateDTO> selectListByKey(@Param("appId") String appId, @Param("tid") String tid, @Param("keyIds") String keyIds);
} }

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java

@ -141,4 +141,15 @@ public interface PersonalTemplateService extends BaseService<PersonalTemplateEnt
* @author sun * @author sun
*/ */
List<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO); List<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO);
/**
* 根据tid和keyIds查询是否已存在该模板类型数据
* @author zhaoqifeng
* @date 2020/11/2 10:29
* @param appId
* @param tid
* @param keyIds
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
*/
List<PersonalTemplateDTO> getListByKey(String appId, String tid, String keyIds);
} }

17
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java

@ -127,6 +127,7 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl<PersonalTemplat
*/ */
@Override @Override
public List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO) { public List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO) {
formDTO.setKeyIds("5,4,2");
//根据客户Id、appId、模板类型查询小程序订阅消息模板列表 //根据客户Id、appId、模板类型查询小程序订阅消息模板列表
return baseDao.selectTemplateList(formDTO); return baseDao.selectTemplateList(formDTO);
} }
@ -138,7 +139,23 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl<PersonalTemplat
*/ */
@Override @Override
public List<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO) { public List<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO) {
formDTO.setKeyIds("5,4,2");
return baseDao.selectCustomerTemplateList(formDTO); return baseDao.selectCustomerTemplateList(formDTO);
} }
/**
* 根据tid和keyIds查询是否已存在该模板类型数据
*
* @param appId
* @param tid
* @param keyIds
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
* @author zhaoqifeng
* @date 2020/11/2 10:29
*/
@Override
public List<PersonalTemplateDTO> getListByKey(String appId, String tid, String keyIds) {
return baseDao.selectListByKey(appId, tid, keyIds);
}
} }

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java

@ -180,6 +180,11 @@ public class SubscribeServiceImpl implements SubscribeService {
String keywords = String.join(",", formDTO.getNameList()); String keywords = String.join(",", formDTO.getNameList());
List<String> keyIdList = formDTO.getKidList().stream().map(Object::toString).collect(Collectors.toList()); List<String> keyIdList = formDTO.getKidList().stream().map(Object::toString).collect(Collectors.toList());
String keyIds = String.join(",", keyIdList); String keyIds = String.join(",", keyIdList);
//根据tid和keyIds查询是否已存在该模板类型数据
List<PersonalTemplateDTO> list = personalTemplateService.getListByKey(formDTO.getAppId(), formDTO.getTid(), keyIds);
if (null != list && list.size() > NumConstant.ZERO) {
throw new RenException(formDTO.getTitle() + "已存在所选关键词[" + keywords + "]的模板");
}
//将公共模板存入数据库 //将公共模板存入数据库
PersonalTemplateDTO personalTemplateDTO = new PersonalTemplateDTO(); PersonalTemplateDTO personalTemplateDTO = new PersonalTemplateDTO();
personalTemplateDTO.setCustomerId(authInfo.getCustomerId()); personalTemplateDTO.setCustomerId(authInfo.getCustomerId());

13
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml

@ -86,7 +86,8 @@
AND customer_id = #{customerId} AND customer_id = #{customerId}
AND app_id = #{appId} AND app_id = #{appId}
AND title = #{templateType} AND title = #{templateType}
ORDER BY CREATED_TIME DESC AND key_ids = '5,4,2'<!-- 消息更新,详情内容,时间 -->
ORDER BY created_time ASC
</select> </select>
<select id="selectCustomerTemplateList" resultType="com.epmet.dto.result.CustomerTemplateListResultDTO"> <select id="selectCustomerTemplateList" resultType="com.epmet.dto.result.CustomerTemplateListResultDTO">
@ -102,6 +103,16 @@
AND cm.del_flag = '0' AND cm.del_flag = '0'
AND pt.customer_id = #{customerId} AND pt.customer_id = #{customerId}
AND pt.tid = #{publicId} AND pt.tid = #{publicId}
AND key_ids = #{keyIds}<!-- 消息更新,详情内容,时间 -->
ORDER BY created_time ASC
</select>
<select id="selectListByKey" resultType="com.epmet.dto.PersonalTemplateDTO">
SELECT ID
FROM personal_template
WHERE DEL_FLAG = '0'
AND APP_ID=#{appId}
AND TID = #{tid}
AND KEY_IDS = #{keyIds}
</select> </select>
</mapper> </mapper>

5
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -31,7 +31,6 @@ import com.epmet.dto.result.*;
import com.epmet.entity.IssueEntity; import com.epmet.entity.IssueEntity;
import com.epmet.entity.IssueProcessEntity; import com.epmet.entity.IssueProcessEntity;
import com.epmet.entity.IssueProjectRelationEntity; import com.epmet.entity.IssueProjectRelationEntity;
import com.epmet.entity.IssueVoteStatisticalEntity;
import com.epmet.feign.*; import com.epmet.feign.*;
import com.epmet.redis.GovIssueRedis; import com.epmet.redis.GovIssueRedis;
import com.epmet.redis.IssueVoteDetailRedis; import com.epmet.redis.IssueVoteDetailRedis;
@ -440,7 +439,7 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
try { try {
issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null);
}catch (RenException e){ }catch (RenException e){
logger.error(e.getMsg()); logger.error(e.getInternalMsg());
} }
} }
@ -589,7 +588,7 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
try{ try{
issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null);
}catch(RenException e){ }catch(RenException e){
logger.error(e.getMsg()); logger.error(e.getInternalMsg());
} }
} }

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java

@ -79,6 +79,11 @@ public class ExtStaffInfoResultDTO implements Serializable {
* */ * */
private String adminFlag; private String adminFlag;
/**
* 手机号
* */
private String mobile;
/** /**
* 用户角色列表 * 用户角色列表
* */ * */

2
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -244,6 +244,7 @@
<result property="profile" column="profile"/> <result property="profile" column="profile"/>
<result property="realName" column="realName"/> <result property="realName" column="realName"/>
<result property="gridId" column="GRID_ID"/> <result property="gridId" column="GRID_ID"/>
<result property="mobile" column="MOBILE"/>
<result property="customerId" column="CUSTOMER_ID"/> <result property="customerId" column="CUSTOMER_ID"/>
<collection property="roleList" ofType="com.epmet.dto.result.ExtRoleMapResultDTO"> <collection property="roleList" ofType="com.epmet.dto.result.ExtRoleMapResultDTO">
<result property="roleKey" column="ROLE_KEY" /> <result property="roleKey" column="ROLE_KEY" />
@ -257,6 +258,7 @@
staff.REAL_NAME AS nickname, staff.REAL_NAME AS nickname,
'' AS PROFILE, '' AS PROFILE,
staff.REAL_NAME AS realName, staff.REAL_NAME AS realName,
staff.MOBILE,
role.ROLE_KEY, role.ROLE_KEY,
role.ROLE_NAME, role.ROLE_NAME,
vis.GRID_ID vis.GRID_ID

Loading…
Cancel
Save