diff --git a/epmet-auth/src/main/java/com/epmet/controller/SsoController.java b/epmet-auth/src/main/java/com/epmet/controller/SsoController.java index 61468e9ea4..6413ffb82b 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/SsoController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/SsoController.java @@ -51,7 +51,7 @@ public class SsoController { @PostMapping("oper/third/login") public Result thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class); - return new Result().ok(ssoService.thirdLoginOper(formDTO)); + return new Result().ok(ssoService.thirdLoginOperWork(formDTO)); } @PostMapping("test") diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java index fb960bcfce..2084287984 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java @@ -3,17 +3,15 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; -import java.io.Serializable; /** * @Author zxc * @DateTime 2021/1/18 下午4:43 */ @Data -public class SsoLoginOperFormDTO extends LoginCommonFormDTO implements Serializable { +public class SsoLoginOperFormDTO extends LoginCommonFormDTO { - - private static final long serialVersionUID = 8711491709544498082L; + private static final long serialVersionUID = -4215746830030486659L; public interface ThirdPlatformLoginForm { } @@ -25,10 +23,10 @@ public class SsoLoginOperFormDTO extends LoginCommonFormDTO implements Serializa private String thirdToken; /** - * 上游系统token + * 上游系统标识 * * @see com.epmet.enums.ThirdPlatformEnum */ - @NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) + @NotBlank(message = "平台标识不能为空", groups = {ThirdPlatformLoginForm.class}) private String platform; } diff --git a/epmet-auth/src/main/java/com/epmet/service/SsoService.java b/epmet-auth/src/main/java/com/epmet/service/SsoService.java index e9f9fac2b7..4514230228 100644 --- a/epmet-auth/src/main/java/com/epmet/service/SsoService.java +++ b/epmet-auth/src/main/java/com/epmet/service/SsoService.java @@ -33,6 +33,7 @@ public interface SsoService { * @Description 4、自动进入组织-返回token **/ UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO); + /** * desc: sso登陆运营端 * @@ -41,5 +42,5 @@ public interface SsoService { * @author LiuJanJun * @date 2021/2/24 1:28 下午 */ - UserTokenResultDTO thirdLoginOper(SsoLoginOperFormDTO formDTO); + UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index 98702d2216..c05df9f3a2 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java @@ -133,7 +133,7 @@ public class SsoServiceImpl implements SsoService { } @Override - public UserTokenResultDTO thirdLoginOper(SsoLoginOperFormDTO formDTO) { + public UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO) { ThirdPlatUserInfo thirdUser; try { ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform()); diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java index c5f176b073..958fd8b1bb 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java @@ -22,6 +22,12 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +/** + * desc: 平阴联动指挥平台sso登陆服务类 接入文档:http://note.youdao.com/noteshare?id=167ad65365f9eccf7925e8c2629d2021&sub=555AE50510344CB5AACD5C06B9AA3B3B + * + * @author LiuJanJun + * @date 2021/2/25 1:43 下午 + */ @Service public class PyldApiService extends AbstractApiService { @@ -59,9 +65,7 @@ public class PyldApiService extends AbstractApiService { buildHeaders()); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); - logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); - PyldUserInfoResultDTO resultDTO = this.parseResult(result); ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); @@ -71,7 +75,6 @@ public class PyldApiService extends AbstractApiService { } - /** * 构建请求头信息 * @@ -117,6 +120,4 @@ public class PyldApiService extends AbstractApiService { } return userInfo; } - - } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java index 4cec62dc66..f3c2a545c5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java @@ -8,10 +8,7 @@ import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java index 88c2aa0e77..bca8a573bf 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java @@ -39,4 +39,16 @@ public interface ScreenPublicPartiTotalDataDao{ * @date 2020.08.20 16:00 **/ List selectPublicPartiTotal(@Param("agencyId") String agencyId); + + + /** + * @Description 根据areaCode查询公众参与各类总数 + * @param areaCode + * @return + * @author wangc + * @date 2020.08.20 16:00 + **/ + List selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode, + @Param("customerId")String customerId, + @Param("list")List subCustomers); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java index 962691f625..64d5eefc21 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java @@ -42,6 +42,18 @@ public interface ScreenUserJoinDao { **/ UserJoinIndicatorGrowthRateResultDTO selectUserJoinData(@Param("agencyId") String agencyId, @Param("monthId")String monthId); + /** + * @Description 根据地区码查询用户参与数据 + * @param areaCode + * @return + * @author wangc + * @date 2020.08.20 15:07 + **/ + UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId, + @Param("list") List subCustomers, + @Param("customerId")String customerId); + + /** * @Description 查询月度用户参与数据 * @param agencyId 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 afdbf95f82..8dc27f6d18 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 @@ -3,16 +3,20 @@ package com.epmet.datareport.service.evaluationindex.screen.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.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.*; import com.epmet.datareport.service.evaluationindex.screen.GrassRootsGovernService; import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.ModuleConstant; +import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; +import com.epmet.feign.OperCrmOpenFeignClient; import com.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -48,6 +52,10 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { private ScreenGovernRankDataDao screenGovernRankDataDao; @Autowired private ScreenPublicPartiTotalDataDao screenPublicPartiTotalDataDao; + @Autowired + private OperCrmOpenFeignClient crmClient; + @Autowired + private ScreenCustomerAgencyDao agencyDao; /** * @Description 1、热心市民积分排行 @@ -110,15 +118,26 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) { + ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); + Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); + List subCustomers; + if(null == crmResp || !crmResp.success()) {subCustomers = null ;} + else {subCustomers = crmResp.getData();} String monthId = dateUtils.getCurrentMonthId(); - UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ? + screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : + screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId, + subCustomers,agencyInfo.getCustomerId()); //保证获取公众参与概率数据的最大可能性 int time = NumConstant.TWELVE; while (null == latest && time > NumConstant.ONE) { time--; monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); - latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + latest = CollectionUtils.isEmpty(subCustomers) ? + screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : + screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId, + subCustomers,agencyInfo.getCustomerId()); } if (null == latest) return new PublicPartiProfileResultDTO(); @@ -146,8 +165,18 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { if(NumConstant.ZERO == param.getTopNum()){ param.setTopNum(NumConstant.MAX); } + + ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()) ; + List subCustomers; + Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); + if(null == crmResp || !crmResp.success()) {subCustomers = null ;} + else {subCustomers = crmResp.getData();} PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - List result = screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId()); + List result = + CollectionUtils.isEmpty(subCustomers) ? + screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId()) + : screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode(),agencyInfo.getCustomerId(), + subCustomers); if(null == result) { return new ArrayList<>(); } @@ -254,6 +283,18 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { return percentStr.concat(ModuleConstant.SYMBOL_PERCENT); } + /** + * @Description 通过agencyId获取机关信息 + * @param agencyId + * @return java.lang.String + * @author wangc + * @date 2021.02.25 13:46 + */ + private ScreenCustomerAgencyDTO agencyInfo(String agencyId){ + ScreenCustomerAgencyDTO agencyInfo = agencyDao.selectByAgencyId(agencyId); + if(null == agencyInfo) throw new RenException("获取Agency信息失败"); + return agencyInfo; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java index 2de292f6ea..073f26ef94 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java @@ -74,10 +74,11 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { areaCode = agencyInfo.getAreaCode(); } Result> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); - if(null == crmResponse || !crmResponse.success()){ - throw new RenException("获取子客户列表失败"); - } - List subCustomers = crmResponse.getData(); + List subCustomers; + if(null == crmResponse || !crmResponse.success()) + {subCustomers = null;} + else + {subCustomers = crmResponse.getData();} FineExampleResultDTO fineExampleResultDTO; if(CollectionUtils.isEmpty(subCustomers)) fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index afbddb095b..6534512f8a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -55,9 +55,11 @@ data.del_flag = '0' AND data.org_type = 'agency' AND agency.area_code LIKE concat(#{areaCode},'%') - - agency.customer_id = #{subId} - + + + data.customer_id = #{subId} + + ORDER BY data.data_end_time DESC LIMIT 1 diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml index 277e6c17dc..04793de3ee 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml @@ -31,4 +31,43 @@ totalData.PROJECT_TOTAL desc + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index 42f6d5753c..c954dc41d3 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -24,6 +24,35 @@ AND MONTH_ID = #{monthId} + + + +