diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 53fc0b106a..a35f9df070 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -109,7 +109,7 @@ public enum EpmetErrorCode { OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"), OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"), OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"), - OPER_EXT_APP_SECRET_RESET_FAIL(8713, "秘钥更新失败"), + OPER_EXT_APP_SECRET_RESET_FAIL(8714, "秘钥更新失败"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 5c9c3ee45a..0daf2cabda 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -90,6 +90,8 @@ 8080 + dev + 0 192.168.1.130 @@ -206,6 +208,8 @@ 8080 + local + 0 192.168.1.130 @@ -322,6 +326,8 @@ 8080 + test + 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com @@ -409,6 +415,8 @@ 8080 + prod + 0 r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index 439cfa155a..5856241cbb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -100,7 +100,9 @@ public class DeptScoreServiceImpl extends BaseServiceImpl dangJianNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), - IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), - IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); - if (CollectionUtils.isEmpty(dangJianNengLiList)) { - log.warn("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); - throw new RenException("客户【网格相关:党建能力】指标权重信息不存在"); - } - calculateGridDangJian(formDTO, dangJianNengLiList); + calculateGridDangJian(formDTO); //2、计算网格相关-治理能力 - List zhiLiNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), - IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), - IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); - if (CollectionUtils.isEmpty(zhiLiNengLiList)) { - log.warn("calculateGridZhiLi customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); - throw new RenException("客户【网格相关:治理能力】指标权重信息不存在"); - } - calculateGridZhiLi(formDTO, zhiLiNengLiList); + calculateGridZhiLi(formDTO); //3、计算网格相关-服务能力 - List fuWuNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), - IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), - IndexCodeEnum.FU_WU_NENG_LI.getCode()); - if (CollectionUtils.isEmpty(fuWuNengLiList)) { - log.warn("calculateGridFuWu customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); - throw new RenException("客户【网格相关:服务能力】指标权重信息不存在"); - } - calculateGridFuWu(formDTO, fuWuNengLiList); + calculateGridFuWu(formDTO); //4、计算网格相关总分 - List wgxgList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), - IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); - if (CollectionUtils.isEmpty(wgxgList)) { - log.warn("calculateGridTotal customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); - throw new RenException("客户【网格相关】指标权重信息不存在"); - } - calculateGridTotal(formDTO, wgxgList, IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); - - resultFlag = true; - return resultFlag; + calculateGridTotal(formDTO); + return true; } /** * @param formDTO - * @param indexList * @return void * @author yinzuomei * @description 计算网格相关-党建能力 * @Date 2020/8/26 16:47 **/ @Transactional(rollbackFor = Exception.class) - public void calculateGridDangJian(CalculateCommonFormDTO formDTO, List indexList) { + public void calculateGridDangJian(CalculateCommonFormDTO formDTO) { + List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), + IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), + IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(indexList)) { + log.warn("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); + throw new RenException("客户【网格相关:党建能力】指标权重信息不存在"); + } //查询总记录数 int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO); if (NumConstant.ZERO == total) { log.warn(String.format("customerId=%s,monthId=%s,没有上传网格相关-党建能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); return; } - //只有一个网格的事实记录时无需处理以下代码注释 - /*else if (NumConstant.ONE == total) { - //只有一个网格时 - log.warn(String.format("indexCode:%s,customerId:%s,monthId:%s,only one fact_index_party_ablity_grid_monthly record",IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),formDTO.getCustomerId(),formDTO.getMonthId())); - this.handleOneGridScene(formDTO,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); - }*/ //总页数,进行批量查询,批量计算 int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); log.info(String.format("共%s条数据,分%s次计算", total, totalPage)); @@ -196,7 +166,6 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), - IndexCalConstant.GRID_DJ_ALL_PARENT_INDEX_CODE, NumConstant.ZERO_STR); } @@ -368,7 +337,6 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { private void saveGridCorreLationResult(CalculateCommonFormDTO formDTO, List> resultMapList, String indexCode, - String allParentIndexCode, String isTotal) { String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); String yearId = DateUtils.getYearId(formDTO.getMonthId()); @@ -442,8 +410,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); //如果想看每一个指标的分值调用下面的方法 - List listTemp=batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); - log.info("计算的结果(List)"+JSON.toJSONString(listTemp)); + /*List listTemp=batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); + log.info("计算的结果(List)"+JSON.toJSONString(listTemp));*/ HashMap resultMap = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); log.info("计算的结果{}", resultMap); @@ -531,25 +499,25 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { /** * @param formDTO - * @param indexList * @return void * @author yinzuomei * @description 计算网格相关-治理能力 * @Date 2020/8/26 16:47 **/ - private void calculateGridZhiLi(CalculateCommonFormDTO formDTO, List indexList) { + private void calculateGridZhiLi(CalculateCommonFormDTO formDTO) { + List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), + IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), + IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(indexList)) { + log.warn("calculateGridZhiLi customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); + throw new RenException("客户【网格相关:治理能力】指标权重信息不存在"); + } //查询总记录数 int total = factIndexGovrnAblityGridMonthlyDao.selectCount(formDTO); if (NumConstant.ZERO == total) { log.warn(String.format("customerId%s,monthId%s,没有上传网格相关-治理能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); return; } - //只有一个网格的事实记录时无需处理以下代码注释 - /*else if (NumConstant.ONE == total) { - //只有一个网格时 - log.warn(String.format("indexCode:%s,customerId:%s,monthId:%s,only one fact_index_govrn_ablity_grid_monthly record",IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),formDTO.getCustomerId(),formDTO.getMonthId())); - this.handleOneGridScene(formDTO,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); - }*/ //总页数,进行批量查询,批量计算 int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); log.info(String.format("共%s条数据,分%s次计算", total, totalPage)); @@ -598,32 +566,31 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), - IndexCalConstant.GRID_ZL_ALL_PARENT_INDEX_CODE, NumConstant.ZERO_STR); } /** * @param formDTO - * @param indexList * @return void * @author yinzuomei * @description 计算网格相关-服务能力 * @Date 2020/8/26 16:48 **/ - private void calculateGridFuWu(CalculateCommonFormDTO formDTO, List indexList) { + private void calculateGridFuWu(CalculateCommonFormDTO formDTO) { + List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), + IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), + IndexCodeEnum.FU_WU_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(indexList)) { + log.warn("calculateGridFuWu customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); + throw new RenException("客户【网格相关:服务能力】指标权重信息不存在"); + } //查询总记录数 int total = factIndexServiceAblityGridMonthlyDao.selectCount(formDTO); if (NumConstant.ZERO == total) { log.warn(String.format("customerId:%s,monthId:%s,没有上传网格相关-服务能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); return; } - //只有一个网格的事实记录时无需处理以下代码注释 - /*else if (NumConstant.ONE == total) { - //只有一个网格时 - log.warn(String.format("indexCode:%s,customerId:%s,monthId:%s,only one fact_index_service_ablity_grid_monthly record",IndexCodeEnum.FU_WU_NENG_LI.getCode(),formDTO.getCustomerId(),formDTO.getMonthId())); - this.handleOneGridScene(formDTO,IndexCodeEnum.FU_WU_NENG_LI.getCode()); - }*/ //总页数,进行批量查询,批量计算 int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); log.info(String.format("共%s条数据,分%s次计算", total, totalPage)); @@ -668,19 +635,23 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.FU_WU_NENG_LI.getCode(), - IndexCalConstant.GRID_FW_ALL_PARENT_INDEX_CODE, NumConstant.ZERO_STR); } /** * @param formDTO - * @param indexList * @return void * @author yinzuomei * @description 计算网格相关总分 * @Date 2020/8/26 16:50 **/ - private void calculateGridTotal(CalculateCommonFormDTO formDTO, List indexList, String indexCode) { + private void calculateGridTotal(CalculateCommonFormDTO formDTO) { + List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), + IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); + if (CollectionUtils.isEmpty(indexList)) { + log.warn("calculateGridTotal customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); + throw new RenException("客户【网格相关】指标权重信息不存在"); + } //查询总记录数 List gridScoreDTOList = gridScoreDao.selectList(formDTO); if(CollectionUtils.isEmpty(gridScoreDTOList)){ @@ -692,13 +663,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { for (GridScoreDTO gridScoreDTO : gridScoreDTOList) { GridScoreEntity gridScoreEntity = ConvertUtils.sourceToTarget(gridScoreDTO, GridScoreEntity.class); gridScoreEntity.setIsTotal(NumConstant.ONE_STR); - gridScoreEntity.setIndexCode(indexCode); + gridScoreEntity.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); gridScoreEntity.setScore(BigDecimal.ZERO); gridScoreEntity.setAllParentIndexCode(NumConstant.ZERO_STR); - /*if (!CollectionUtils.isEmpty(gridScoreDTO.getDetailList()) && gridScoreDTO.getDetailList().size() != 3) { - log.error("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失,无法计算总值"); - continue; - }*/ log.warn("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失"); for (GridScoreDetailDTO gridScoreDetailDTO : gridScoreDTO.getDetailList()) { BigDecimal indexScore = gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight()); @@ -711,7 +678,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { do { effectRow =gridScoreDao.deleteBatches(formDTO.getCustomerId(), formDTO.getMonthId(), - indexCode, + IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCalConstant.DELETE_SIZE); } while (effectRow > NumConstant.ZERO); //批量插入 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java index 0d29f738df..6add27be9a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java @@ -53,5 +53,15 @@ public interface MiniInfoDao extends BaseDao { * @author zxc */ CustomerIdAndClientResultDTO selectCustomerIdAndClientByToUserName(@Param("toUserName")String toUserName); + + /** + * 获取小程序名 + * @author zhaoqifeng + * @date 2020/9/7 17:25 + * @param customerId + * @param clientType + * @return java.lang.String + */ + String getNickName(@Param("customerId") String customerId, @Param("clientType") String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index 09f5f5a276..9a5640f22d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CodeConstant; import com.epmet.dao.AuthorizationInfoDao; import com.epmet.dao.ComponentAccessTokenDao; +import com.epmet.dao.MiniInfoDao; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -65,6 +66,8 @@ public class CodeServiceImpl implements CodeService { private OssFeignClient ossFeignClient; @Autowired private PaCustomerService paCustomerService; + @Autowired + private MiniInfoDao miniInfoDao; @Override public List templateList() { @@ -115,10 +118,15 @@ public class CodeServiceImpl implements CodeService { if (null == authInfo) { throw new RenException("未授权"); } + //获取小程序居民端与工作端名称 + String resiName = miniInfoDao.getNickName(formDTO.getCustomerId(), "resi"); + String workName = miniInfoDao.getNickName(formDTO.getCustomerId(), "work"); String extJson = getExtJson(formDTO); WxExtJson wxExtJson = JSONObject.parseObject(extJson, WxExtJson.class); wxExtJson.setExtAppid(authInfo.getAuthorizerAppid()); wxExtJson.getExt().setExtAppid(authInfo.getAuthorizerAppid()); + wxExtJson.getExt().setResiName(resiName); + wxExtJson.getExt().setWorkName(workName); extJson = JSON.toJSONString(wxExtJson); CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); if (null == codeExtDTO) { diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java index 8d6b843126..4ba45e37cf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java @@ -31,6 +31,10 @@ public class WxExtJson implements Serializable { @JSONField(ordinal = 1) private String extAppid; @JSONField(ordinal = 2) + private String resiName; + @JSONField(ordinal = 3) + private String workName; + @JSONField(ordinal = 4) private FootbarBean footbar; @NoArgsConstructor @Data diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniInfoDao.xml index 7a31b83279..f70597f4d5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniInfoDao.xml @@ -64,4 +64,10 @@ AND user_name = #{toUserName} LIMIT 1 + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 72f9c416b2..ec85e7b960 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -626,23 +626,25 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); - if (!customerInfo.success()) { - logger.error(String.format("获取根管理员信息失败,调用%s服务查询客户名称失败,入参%s", ServiceConstant.OPER_CRM_SERVER, JSON.toJSONString(staffDTO.getCustomerId()))); - } else { - if (null != customerInfo.getData()){ - CustomerListResultDTO resultDTO = new CustomerListResultDTO(); - resultDTO.setCustomerId(customerInfo.getData().getId()); - resultDTO.setCustomerName(customerInfo.getData().getCustomerName()); - listResultDTO.add(resultDTO); - } - } - } + if (null != roleKey){ + // 3.根据roleId + staff_id(即 userId) 查 staff_role表的主键id, 如果查到了,那这个userId就是 根管理员 + StaffRoleDTO staffRoleDTO = staffRoleDao.selectStaffRoleByStaffIdAndRoleId(staffDTO.getUserId(), roleKey.getId()); + if (null != staffRoleDTO){ + // 4.如果userID是根管理员的话,则根据customerId 去 customer表 查询 id、customer_name + customerDTO.setId(staffDTO.getCustomerId()); + Result customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); + if (!customerInfo.success()) { + logger.error(String.format("获取根管理员信息失败,调用%s服务查询客户名称失败,入参%s", ServiceConstant.OPER_CRM_SERVER, JSON.toJSONString(staffDTO.getCustomerId()))); + } else { + if (null != customerInfo.getData()){ + CustomerListResultDTO resultDTO = new CustomerListResultDTO(); + resultDTO.setCustomerId(customerInfo.getData().getId()); + resultDTO.setCustomerName(customerInfo.getData().getCustomerName()); + listResultDTO.add(resultDTO); + } + } + } + } } return new Result>().ok(listResultDTO); }