Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

dev_shibei_match
jianjun 4 years ago
parent
commit
aa87f5e3c1
  1. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java
  2. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java
  3. 14
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java
  4. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java
  5. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java
  6. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java
  7. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java
  8. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java
  9. 107
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java
  10. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
  11. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml
  12. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml
  13. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java
  14. 21
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StaffPatrolService.java
  15. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StaffPatrolServiceImpl.java
  16. 40
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EndPatrolTask.java
  17. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java
  18. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  19. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  20. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java
  21. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java
  22. 32
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java

@ -19,6 +19,7 @@ package com.epmet.evaluationindex.index.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -37,20 +38,24 @@ public class IndexExplainFormDTO implements Serializable {
/**
* 客户id
*/
@NotBlank(message = "客户ID不能为空")
private String customerId;
/**
* 组织级别网格级grid;社区级community;街道:street;区县级: district;市级: city;省级:province
*/
@NotBlank(message = "组织级别不能为空")
private String orgLevel;
/**
* 组织id
*/
@NotBlank(message = "组织ID不能为空")
private String orgId;
/**
* 月份Id
*/
@NotBlank(message = "月份不能为空")
private String monthId;

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java

@ -1,5 +1,6 @@
package com.epmet.evaluationindex.index.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.util.ArrayList;
@ -49,5 +50,8 @@ public class IndexExplainResult {
*/
private String tableDesc;
@JsonIgnore
private String indexCode;
}

14
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java

@ -23,6 +23,15 @@ public class IndexScoreResult implements Serializable {
*/
private BigDecimal score;
/**
* 本级分数
*/
private BigDecimal selfScore;
/**
* 下级分数
*/
private BigDecimal subScore;
/**
* 指标对应的权重
*/
@ -43,4 +52,9 @@ public class IndexScoreResult implements Serializable {
*/
private String valueType;
/**
* 是否是总分
*/
private Boolean isTotal;
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java

@ -24,17 +24,25 @@ public class IndexConstant {
public static final String ZB_CN = "指标";
public static final String BEN_JI_CN = "本级";
public static final String XIA_JI_CN = "下级";
public static final String BEN_JI_EN = "self";
public static final String XIA_JI_EN = "sub";
public static final String ZI_SHEN = "zishen";
public static final String XIA_JI = "xiaji";
public static final String THRESHOLD_TEXT = "给定阈值%d%%,超过阈值不加分";
public static final String TABLE_DESC = "详见下表:";
public static final String INDEX_SCORE_TITLE = "当月指数";
public static final String INDEX_SCORE_DESC = "自然月周期内,当月指数得分=党建指数得分*相关权重+治理指数得分*相关权重+服务指数得分*相关权重";
public static final String INDEX_SCORE_DESC = "自然月周期内,当月指数得分#(totalScore)#=党建指数得分#(dangjiannengli)#*相关权重#(dangjiannengliweight)#" +
"+治理指数得分#(zhilinengli)#*相关权重#(zhilinengliweight)#+服务指数得分#(fuwunengli)#*相关权重#(fuwunengliweight)#";
public static final String INDEX_DISTRINCT_TABLE1_INDEX_CODE = "suoyoujiedaozlnlpjz";
public static final String INDEX_DISTRINCT_TABLE2_INDEX_CODE = "suoyouzhishubmzlnlpjz";
public static final String ZHI_LI_NENG_LI = "zhilinengli";
public static final String PATTERN_FIX = "#";
public static final String PATTERN_D = "d";
public static final String PATTERN_WEIGHT = "weight";
public static final String PATTERN_TOTAL = "totalScore";
public static final String QUAN_QU_ZHI_LI_INDEX_CODE = "quanquxiangguan:zhilinengli";
public static final String PATTERN_ALL = "[#][^#]+[#]";
/**

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java

@ -17,12 +17,15 @@
package com.epmet.datareport.controller.index;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.index.IndexExplainService;
import com.epmet.evaluationindex.index.form.IndexExplainFormDTO;
import com.epmet.evaluationindex.index.form.IndexScoreFormDTO;
import com.epmet.evaluationindex.index.result.IndexExplainResult;
import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -56,6 +59,8 @@ public class IndexExplainController {
*/
@PostMapping("detail")
public Result<List<IndexExplainResult>> getScoreDetail(@RequestBody IndexExplainFormDTO formDTO){
formDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId());
ValidatorUtils.validateEntity(formDTO);
Result<List<IndexExplainResult>> ok = new Result<List<IndexExplainResult>>().ok(indexExplainService.getScoreDetail(formDTO));
return ok;
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
@ -24,6 +25,7 @@ import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.LinkedList;
import java.util.List;
@ -57,4 +59,6 @@ public interface FactIndexAgencyScoreDao {
* @author sun
*/
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> selectAgencyMonthWeightScoreList(MonthScoreListFormDTO formDTO);
List<IndexScoreResult> selectAgencyScoreList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("monthId") String monthId);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
@ -24,6 +25,7 @@ import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.LinkedList;
import java.util.List;
@ -57,4 +59,6 @@ public interface FactIndexCommunityScoreDao {
* @author sun
*/
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> selectCommunityMonthWeightScoreList(MonthScoreListFormDTO formDTO);
List<IndexScoreResult> selectComunityScoreList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("monthId") String monthId);
}

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
@ -24,6 +25,7 @@ import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.LinkedList;
import java.util.List;
@ -57,4 +59,7 @@ public interface FactIndexGridScoreDao {
* @author sun
*/
LinkedList<MonthScoreListResultDTO.ScoreListResultDTO> selectGridMonthWeightScoreList(MonthScoreListFormDTO formDTO);
List<IndexScoreResult> selectGridScoreList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("monthId") String monthId);
}

107
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java

@ -19,6 +19,7 @@ package com.epmet.datareport.service.evaluationindex.index.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.OrgLevelEnum;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
@ -67,13 +68,19 @@ public class IndexExplainServiceImpl implements IndexExplainService {
@Autowired
private FactIndexGridSubScoreDao gridSubScoreDao;
@Autowired
private FactIndexGridScoreDao gridScoreDao;
@Autowired
private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao;
@Autowired
private FactIndexCommunitySubScoreDao communitySubScoreDao;
@Autowired
private FactIndexCommunityScoreDao communityScoreDao;
@Autowired
private FactIndexAgencySubScoreDao agencySubScoreDao;
@Autowired
private FactIndexDeptSubScoreDao deptSubScoreDao;
@Autowired
private FactIndexAgencyScoreDao agencyScoreDao;
@Override
@ -83,6 +90,7 @@ public class IndexExplainServiceImpl implements IndexExplainService {
first.setTitle(IndexConstant.INDEX_SCORE_TITLE);
first.setMeaning(IndexConstant.INDEX_SCORE_DESC);
results.add(first);
List<IndexExplainTreeDTO> explainDTOList = indexExplainDao.getIndexExplainTreeByOrgType(formDTO.getOrgLevel());
if (CollectionUtils.isEmpty(explainDTOList)) {
return null;
@ -100,20 +108,33 @@ public class IndexExplainServiceImpl implements IndexExplainService {
results.add(result);
result.setTitle(explainDTO.getTitle());
result.setMeaning(explainDTO.getMeaning());
result.setIndexCode(explainDTO.getIndexCode());
//全区相关的服务能力的含义中 有权重 所以特殊处理下
if (explainDTO.getOrgLevel().equals(OrgLevelEnum.DISTRICT.getCode()) && IndexConstant.ZLZS_CN.equals(explainDTO.getTitle())) {
List<IndexGroupDetailResult> detailResults = detailEntityMap.get(IndexConstant.QUAN_QU_ZHI_LI_INDEX_CODE);
detailResults.forEach(index -> {
String newMeaning = result.getMeaning().replaceFirst(IndexConstant.PATTERN_D,
index.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString());
//获取分数 补充下
IndexScoreFormDTO ablityListFormDTO = new IndexScoreFormDTO();
ablityListFormDTO.setCustomerId(formDTO.getCustomerId());
ablityListFormDTO.setOrgId(formDTO.getOrgId());
ablityListFormDTO.setAllParentIndexCode(explainDTO.getIndexCode());
ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId());
List<IndexScoreResult> scoreResults = agencySubScoreDao.selectSubScore(ablityListFormDTO);
scoreResults.forEach(e -> {
String newMeaning = result.getMeaning().replaceFirst(e.getIndexCode(), e.getScore().toString())
.replaceFirst(IndexConstant.PATTERN_D,
e.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString());
result.setMeaning(newMeaning);
});
}
//设置表格数据
setTableData(formDTO, detailEntityMap, explainDTO, result);
//子节点
setChildren(formDTO, detailEntityMap, result, explainDTO, explainDTO.getChildren());
//设置 新的含义 带分数的
setCurrentMonthScore(formDTO, first, result);
}
return results;
@ -124,6 +145,72 @@ public class IndexExplainServiceImpl implements IndexExplainService {
return indexDictDao.selectIndexDict(formDTO.getIndexCode());
}
private void setCurrentMonthScore(IndexExplainFormDTO formDTO, IndexExplainResult first, IndexExplainResult second) {
String orgLevel = formDTO.getOrgLevel();
OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel);
List<IndexScoreResult> list = null;
switch (anEnum) {
case GRID:
list = gridScoreDao.selectGridScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId());
break;
case COMMUNITY:
list = communityScoreDao.selectComunityScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId());
break;
case STREET:
list = agencyScoreDao.selectAgencyScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId());
break;
case DISTRICT:
list = agencyScoreDao.selectAgencyScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId());
break;
default:
log.error("暂不支持更高级别的查询,level:{}", orgLevel);
}
setNewMeaningWithScore(list, first, second);
}
private void setNewMeaningWithScore(List<IndexScoreResult> list, IndexExplainResult first, IndexExplainResult second) {
String firstMeaning = first.getMeaning();
String secondMeaning = second.getMeaning();
for (IndexScoreResult score : list) {
String indexCode = score.getIndexCode();
if (score.getIsTotal()) {
firstMeaning = firstMeaning.replaceFirst(IndexConstant.PATTERN_TOTAL, score.getScore().toString());
continue;
}
firstMeaning = firstMeaning.replaceFirst(indexCode, score.getScore().toString()).replace(indexCode.concat(IndexConstant.PATTERN_WEIGHT), score.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString() + "%");
if (second.getIndexCode().contains(score.getIndexCode())) {
secondMeaning = secondMeaning.replaceFirst(IndexConstant.PATTERN_TOTAL, score.getScore().toString())
.replaceFirst(IndexConstant.BEN_JI_EN, score.getSelfScore().toString())
.replaceFirst(IndexConstant.XIA_JI_EN, score.getSubScore().toString());
}
}
if (CollectionUtils.isEmpty(list)) {
firstMeaning = firstMeaning.replaceAll(IndexConstant.PATTERN_ALL, StrConstant.EPMETY_STR);
secondMeaning = secondMeaning.replaceAll(IndexConstant.PATTERN_ALL, StrConstant.EPMETY_STR);
}
first.setMeaning(firstMeaning.replaceAll(IndexConstant.PATTERN_FIX, StrConstant.EPMETY_STR));
second.setMeaning(secondMeaning.replaceAll(IndexConstant.PATTERN_FIX, StrConstant.EPMETY_STR));
}
public static void main(String[] args) {
String patern = "(?<=\\{).*?(?=(\\}|$))";
patern = "[#][^#]+[#]";
String str = "1234#qwert#134";
System.out.println(str.replaceAll(patern, ""));
String str2 = "自然月周期内,当月指数得分P(totalScore)P=党建指数得分#(65.7)#*相关权重#(40%)#+治理指数得分#(68.2)#*相关权重#(40%)#+服务指数得分#(77.5)#*相关权重#(20%)#";
String totalP = "P".concat(IndexConstant.PATTERN_TOTAL).concat("P");
System.out.println(str2.replaceFirst(totalP, ""));
}
private void setTableData(IndexExplainFormDTO formDTO, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainTreeDTO explainDTO, IndexExplainResult result) {
if (NumConstant.ONE == explainDTO.getIsSearch()) {
List<IndexScoreResult> realScoreList = null;
@ -174,6 +261,9 @@ public class IndexExplainServiceImpl implements IndexExplainService {
List<IndexGroupDetailResult> indexGroupDetailEntities = new ArrayList<>();
for (IndexGroupDetailResult index : detailResults) {
if (IndexConstant.INDEX_DISTRINCT_TABLE1_INDEX_CODE.equals(index.getIndexCode())) {
String newMeaning = result.getMeaning().replaceFirst(IndexConstant.PATTERN_D,
index.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString());
result.setMeaning(newMeaning);
indexGroupDetailEntities.add(index);
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, indexGroupDetailEntities);
//不下钻
@ -251,14 +341,14 @@ public class IndexExplainServiceImpl implements IndexExplainService {
}
}
private List<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap,
private void setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap,
IndexExplainResult result, String allIndexCodePath, List<IndexGroupDetailResult> indexGroupDetailEntities) {
if (indexGroupDetailEntities == null) {
indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath);
}
if (CollectionUtils.isEmpty(indexGroupDetailEntities)) {
log.warn("setDefaultTableData allINdexCodePath:{} is config error", allIndexCodePath);
return null;
return;
}
List<IndexScoreDetailResult> tableList = new ArrayList<>();
List<String> threlodList = new ArrayList<>();
@ -287,7 +377,6 @@ public class IndexExplainServiceImpl implements IndexExplainService {
result.setTableDataList(tableList);
result.setThresholdList(threlodList);
result.setTableDesc(IndexConstant.TABLE_DESC);
return tableList;
}
private void setChildren(IndexExplainFormDTO formDTO, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainResult result, IndexExplainTreeDTO parentNode, List<IndexExplainTreeDTO> children) {
@ -305,10 +394,6 @@ public class IndexExplainServiceImpl implements IndexExplainService {
result.setChildren(childrenList);
}
public static void main(String[] args) {
}
private List<String> getTableHeaders(String type, String allIndexCode, String orgLevel) {
List<String> headers = new ArrayList<>();
OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel);

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

@ -74,5 +74,22 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectAgencyScoreList" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
ROUND(fact.score,1) AS "score",
fact.index_code ,
fact.WEIGHT,
fact.IS_TOTAL,
ROUND(fiasss.SELF_SCORE,1) AS "selfScore",
ROUND(fiasss.SUB_SCORE,1) AS "subScore"
FROM
fact_index_agency_score fact
LEFT JOIN fact_index_agency_self_sub_score fiasss ON fact.AGENCY_ID = fiasss.AGENCY_ID AND fact.INDEX_CODE = fiasss.PARENT_INDEX_CODE AND fact.MONTH_ID = fiasss.MONTH_ID
WHERE
fact.del_flag = '0'
AND fact.customer_id = #{customerId}
AND fact.AGENCY_ID = #{orgId}
AND fact.month_id = #{monthId}
</select>
</mapper>

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

@ -74,5 +74,22 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectComunityScoreList" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
ROUND(fact.score,1) AS "score",
fact.index_code ,
fact.WEIGHT,
fact.IS_TOTAL,
ROUND(fiasss.SELF_SCORE,1) AS "selfScore",
ROUND(fiasss.SUB_SCORE,1) AS "subScore"
FROM
fact_index_community_score fact
LEFT JOIN fact_index_community_self_sub_score fiasss ON fact.AGENCY_ID = fiasss.AGENCY_ID AND fact.INDEX_CODE = fiasss.PARENT_INDEX_CODE AND fact.MONTH_ID = fiasss.MONTH_ID
WHERE
fact.del_flag = '0'
AND fact.customer_id = #{customerId}
AND fact.AGENCY_ID = #{orgId}
AND fact.month_id = #{monthId}
</select>
</mapper>

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

@ -76,5 +76,22 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectGridScoreList" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
ROUND(fact.score,1) AS "score",
fact.index_code ,
fact.WEIGHT,
fact.IS_TOTAL,
ROUND(fiasss.SELF_SCORE,1) AS "selfScore",
ROUND(fiasss.SUB_SCORE,1) AS "subScore"
FROM
fact_index_grid_score fact
LEFT JOIN fact_index_grid_self_sub_score fiasss ON fact.GRID_ID = fiasss.GRID_ID AND fact.INDEX_CODE = fiasss.PARENT_INDEX_CODE AND fact.MONTH_ID = fiasss.MONTH_ID
WHERE
fact.del_flag = '0'
AND fact.customer_id = #{customerId}
AND fact.grid_id = #{orgId}
AND fact.month_id = #{monthId}
</select>
</mapper>

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java

@ -78,10 +78,16 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
String redisKey = RedisKeys.getProjectChangedMsgDistinceKey(msgObj.getCustomerId());
if (redisUtils.get(redisKey) == null) {
// 该线程启动消费之后,其他线程再收到该客户id的消费请求,则不消费
redisUtils.set(redisKey, msg, 30);
try {
consumeMessage(msgObj);
} catch (Exception e) {
// 如果消费失败了,清楚该key,收到消息之后可以继续消费
redisUtils.delete(redisKey);
throw e;
}
log.info("消费了项目变动消息,customer id:{}", msgObj.getCustomerId());
// 有效期30秒
redisUtils.set(redisKey, msg, 30);
} else {
log.info("该客户的项目变动消息刚刚消费,请等待30秒,customer id:{}", msgObj.getCustomerId());
}

21
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StaffPatrolService.java

@ -0,0 +1,21 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.StartPatrolFormDTO;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/7/12 17:39
*/
public interface StaffPatrolService {
/**
* 结束巡查
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/7/12 17:40
*/
Result endPatrol(StartPatrolFormDTO formDTO);
}

33
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StaffPatrolServiceImpl.java

@ -0,0 +1,33 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.StartPatrolFormDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.StaffPatrolService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/7/12 17:40
*/
@Service
public class StaffPatrolServiceImpl implements StaffPatrolService {
@Resource
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* 结束巡查
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/7/12 17:40
*/
@Override
public Result endPatrol(StartPatrolFormDTO formDTO) {
return epmetUserOpenFeignClient.endPatrolJob(formDTO);
}
}

40
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EndPatrolTask.java

@ -0,0 +1,40 @@
package com.epmet.task;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.form.StartPatrolFormDTO;
import com.epmet.service.StaffPatrolService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/7/12 17:36
*/
@Component("endPatrolTask")
@Slf4j
public class EndPatrolTask implements ITask {
@Resource
private StaffPatrolService staffPatrolService;
@Override
public void run(String params) {
log.info("EndPatrolTask定时任务正在执行,参数为:{}", params);
ExtractOriginFormDTO dto = new ExtractOriginFormDTO();
StartPatrolFormDTO formDTO = new StartPatrolFormDTO();
if (StringUtils.isNotBlank(params)) {
dto = JSON.parseObject(params, ExtractOriginFormDTO.class);
formDTO.setCustomerId(dto.getCustomerId());
}
Result result = staffPatrolService.endPatrol(formDTO);
if (result.success()) {
log.info("EndPatrolTask定时任务执行成功");
} else {
log.error("EndPatrolTask定时任务执行失败:" + result.getMsg());
}
}
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java

@ -39,4 +39,6 @@ public class StartPatrolFormDTO implements Serializable {
private String staffPatrolRecId;
private String patrolEndTime;
private String customerId;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -595,4 +595,14 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/staffrole/getroles")
Result<CustomerAgencyUserRoleDTO> getUserRoles(@RequestBody CustomerAgencyUserRoleFormDTO formDTO);
/**
* 结束巡查 定时任务
* @author zhaoqifeng
* @date 2021/7/12 17:32
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/epmetuser/staffpatrol/endpatrolJob")
Result endPatrolJob(@RequestBody StartPatrolFormDTO formDTO);
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -409,4 +409,17 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoles", formDTO);
}
/**
* 结束巡查 定时任务
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/7/12 17:32
*/
@Override
public Result endPatrolJob(StartPatrolFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "endPatrolJob", formDTO);
}
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java

@ -87,6 +87,20 @@ public class StaffPatrolController {
}
/**
* 结束巡查 定时任务
* @author zhaoqifeng
* @date 2021/7/12 17:00
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("endpatrolJob")
public Result endPatrolJob(@RequestBody StartPatrolFormDTO formDTO) {
staffPatrolRecordService.endPatrolJob(formDTO);
return new Result();
}
/**
* 上传巡查记录
*

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java

@ -72,6 +72,14 @@ public interface StaffPatrolRecordService extends BaseService<StaffPatrolRecordE
*/
void endPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO);
/**
* 结束巡查 定时任务
* @author zhaoqifeng
* @date 2021/7/12 16:59
* @param formDTO
* @return void
*/
void endPatrolJob(StartPatrolFormDTO formDTO);
/**
* 上传巡查记录
*

32
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java

@ -276,6 +276,38 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
statsPatrolUpdateEnd(tokenDto.getUserId(),totalTime,record.getPatrolStartTime(),patrolEndTime,record.getGrid());
}
/**
* 结束巡查 定时任务
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/7/12 16:59
*/
@Override
public void endPatrolJob(StartPatrolFormDTO formDTO) {
LambdaQueryWrapper<StaffPatrolRecordEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StaffPatrolRecordEntity :: getStatus, PatrolConstant.PATROLLING);
wrapper.eq(StringUtils.isNotBlank(formDTO.getCustomerId()), StaffPatrolRecordEntity :: getCustomerId, formDTO.getCustomerId());
List<StaffPatrolRecordEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(item -> {
String endTimeStr = DateUtils.format(item.getPatrolStartTime(), DateUtils.DATE_PATTERN_YYYYMMDD);
endTimeStr = endTimeStr.concat("235959");
Date endTime = DateUtils.parse(endTimeStr, DateUtils.DATE_TIME_NO_SPLIT);
item.setPatrolEndTime(endTime);
item.setActrualEndTime(endTime);
item.setStatus(PatrolConstant.END);
Integer totalTime = DateUtils.calculateSecond(item.getPatrolStartTime(), endTime) + 59;
item.setTotalTime(totalTime);
item.setUpdatedTime(null);
statsPatrolUpdateEnd(item.getStaffId(),totalTime, item.getPatrolStartTime(), endTime, item.getGrid());
});
updateBatchById(list);
}
}
/**
* @Description 巡查结束时添加巡查统计表逻辑
* @Param userId

Loading…
Cancel
Save