diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java index 16637a9896..e95933e1c1 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiProfileResultDTO.java @@ -34,7 +34,7 @@ public class PublicPartiProfileResultDTO implements Serializable { /** * 较上月趋势:incr上升,decr下降 - * */ + */ private String issueCompareLatestTrend = ""; /** @@ -42,6 +42,9 @@ public class PublicPartiProfileResultDTO implements Serializable { */ private BigDecimal averageJoin = new BigDecimal(NumConstant.ZERO); + /** + * 较上月百分比 + */ private String joinCompareLatestMonth = ""; private String joinCompareLatestTrend = ""; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index d750c1ee03..7afd0f4362 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -108,18 +108,17 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); //保证获取公众参与概率数据的最大可能性 int time = NumConstant.TWELVE; - while(null == latest && time > NumConstant.ONE) - { - time --; - monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); - latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); - } + while (null == latest && time > NumConstant.ONE) { + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + } - if(null == latest) return new PublicPartiProfileResultDTO(); - PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest,PublicPartiProfileResultDTO.class); - result.setMonthIncr(convertPercentStr(latest.getMonthIncr(),NumConstant.ZERO)); - result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth(),NumConstant.ZERO)); - result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth(),NumConstant.ZERO)); + if (null == latest) return new PublicPartiProfileResultDTO(); + PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class); + result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO)); + result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO)); + result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth().abs(), NumConstant.ZERO)); return result; } 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 8f8c57ea58..c8f51e8e40 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 @@ -7,8 +7,10 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CodeConstant; +import com.epmet.constant.ModuleConstant; import com.epmet.dao.AuthorizationInfoDao; import com.epmet.dao.ComponentAccessTokenDao; import com.epmet.dao.MiniInfoDao; @@ -17,7 +19,9 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OssFeignClient; +import com.epmet.redis.RedisThird; import com.epmet.service.*; +import com.epmet.wxapi.constant.WxMaCodeConstant; import com.epmet.wxapi.param.*; import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; @@ -27,6 +31,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -71,6 +76,11 @@ public class CodeServiceImpl implements CodeService { private MiniInfoDao miniInfoDao; @Autowired private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private RedisThird redisThird; + + @Value("${third.platform.appId}") + private String componentAppId; @Override public List templateList() { @@ -117,29 +127,42 @@ public class CodeServiceImpl implements CodeService { if (null == authInfo) { throw new RenException("未授权"); } - /*CustomerDTO customerFormDTO = new CustomerDTO(); - customerFormDTO.setId(formDTO.getCustomerId()); - Result result = operCrmOpenFeignClient.getCustomerInfo(customerFormDTO); - if (!result.success()) { - throw new RenException(result.getCode(), result.getMsg()); - }*/ + String customerName = ""; + Result> customerList = operCrmOpenFeignClient.getAllCustomerList(); + if (customerList.success()) { + for (CustomerDTO dto : customerList.getData()) { + if(formDTO.getCustomerId().equals(dto.getId())) { + customerName = dto.getCustomerName(); + } + } + } + String resiName = ""; + String workName = ""; + if(CodeConstant.RESI.equals(formDTO.getClientType())) { + resiName = getNickName(authInfo.getAuthorizerAppid()); + AuthorizationInfoDTO workAuthInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), CodeConstant.WORK); + workName = getNickName(workAuthInfo.getAuthorizerAppid()); + } else { + workName = getNickName(authInfo.getAuthorizerAppid()); + AuthorizationInfoDTO resiAuthInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), CodeConstant.RESI); + resiName = getNickName(resiAuthInfo.getAuthorizerAppid()); + } //获取小程序居民端与工作端名称 - String resiName = miniInfoDao.getNickName(formDTO.getCustomerId(), CodeConstant.RESI); - String workName = miniInfoDao.getNickName(formDTO.getCustomerId(), CodeConstant.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); - //wxExtJson.getExt().setCustomerName(null == result.getData().getCustomerName()?"":result.getData().getCustomerName()); - wxExtJson.getExt().setCustomerName(""); + wxExtJson.getExt().setCustomerName(customerName); if (CodeConstant.RESI.equals(formDTO.getClientType())) { wxExtJson.getWindow().setNavigationBarTitleText(resiName); } else { wxExtJson.getWindow().setNavigationBarTitleText(workName); } extJson = JSON.toJSONString(wxExtJson); + log.info(extJson); CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); if (null == codeExtDTO) { codeExtDTO = new CodeExtDTO(); @@ -729,4 +752,15 @@ public class CodeServiceImpl implements CodeService { codeOperationHistoryService.save(operationDTO); } + private String getNickName(String appId) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APP_ID,componentAppId); + jsonObject.put(ModuleConstant.AUTHORIZER_APP_ID,appId); + String componentAccessToken = componentAccessTokenDao.getComponentAccessToken(); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_GET_AUTHORIZER_INFO + componentAccessToken , JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + Map authInfo = (Map) map.get(ModuleConstant.AUTHORIZER_INFO); + return ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); + } + }