Browse Source

先锋模范查询修改

dev_shibei_match
wangchao 5 years ago
parent
commit
39a40e6b1f
  1. 3
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java
  2. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java
  3. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java
  4. 47
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java
  5. 35
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

3
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -21,4 +22,6 @@ public class FineExampleFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {FineExample.class})
private String agencyId;
private String customerId;
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java

@ -6,10 +6,7 @@ import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadServic
import com.epmet.evaluationindex.screen.dto.form.*;
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;
@ -33,7 +30,7 @@ public class PartyMemberLeadController {
* @date 2020/8/20 1:56 下午
*/
@PostMapping("fineexample")
public Result<FineExampleResultDTO> fineExample(@RequestBody FineExampleFormDTO fineExampleFormDTO){
public Result<FineExampleResultDTO> fineExample(@RequestHeader("CustomerId") String customerId, @RequestBody FineExampleFormDTO fineExampleFormDTO){
ValidatorUtils.validateEntity(fineExampleFormDTO, FineExampleFormDTO.FineExample.class);
return new Result<FineExampleResultDTO>().ok(partyMemberLeadService.fineExample(fineExampleFormDTO));
}

13
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java

@ -21,6 +21,8 @@ import com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 党建引领-先锋模范数据
*
@ -37,5 +39,16 @@ public interface ScreenPioneerDataDao{
* @date 2020/8/20 5:22 下午
*/
FineExampleResultDTO selectFineExample(@Param("agencyId")String agencyId);
/**
* @Description 根据地区码查询先锋模范
* @param areaCode
* @param customerId
* @param customerIds - 子级客户列表
* @return com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO
* @author wangc
* @date 2021.02.24 15:39
*/
FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode")String areaCode,@Param("customerId")String customerId,@Param("list") List<String> customerIds);
}

47
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java

@ -2,18 +2,22 @@ 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.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.PartyMemberLeadService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.datareport.utils.ModuleConstant;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ContactMassLineChartFormDTO;
import com.epmet.evaluationindex.screen.dto.form.FineExampleFormDTO;
import com.epmet.evaluationindex.screen.dto.form.VolunteerServiceFormDTO;
import com.epmet.evaluationindex.screen.dto.result.*;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -48,7 +52,10 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
private DateUtils dateUtils;
@Autowired
private ScreenPartyUserRankDataDao screenPartyUserRankDataDao;
@Autowired
private ScreenCustomerAgencyDao customerAgencyDao;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
/**
* @Description 1先锋模范
* @param fineExampleFormDTO
@ -58,17 +65,35 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) {
FineExampleResultDTO fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());
if (null == fineExampleResultDTO){
return new FineExampleResultDTO();
String customerId = fineExampleFormDTO.getCustomerId();
String areaCode = null;
if(StringUtils.isBlank(customerId)){
ScreenCustomerAgencyDTO agencyInfo = customerAgencyDao.selectByAgencyId(fineExampleFormDTO.getAgencyId());
if(null == agencyInfo) throw new RenException("未找到对应的机关");
customerId = agencyInfo.getCustomerId();
areaCode = agencyInfo.getAreaCode();
}
fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA()));
fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA()));
fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA()));
fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA()));
fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA()));
fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio())));
return fineExampleResultDTO;
Result<List<String>> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId);
if(null == crmResponse || !crmResponse.success()){
throw new RenException("获取子客户列表失败");
}
List<String> subCustomers = crmResponse.getData();
FineExampleResultDTO fineExampleResultDTO;
if(CollectionUtils.isEmpty(subCustomers))
fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());
else
fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(areaCode,customerId,subCustomers);
if (null == fineExampleResultDTO) {
return new FineExampleResultDTO();
}
fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA()));
fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA()));
fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA()));
fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA()));
fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA()));
fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio())));
return fineExampleResultDTO;
}
/**

35
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

@ -26,4 +26,39 @@
ORDER BY data_end_time DESC
LIMIT 1
</select>
<!-- 根据地区码查询先锋模范 -->
<select id="selectFineExampleByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO">
SELECT
CEILING(avg(data.issue_total)) AS issueTotal,
IFNULL(avg(data.issue_ratio),0) AS issueRatioA,
CEILING(avg(data.topic_total)) AS topicTotal,
IFNULL(avg(data.topic_ratio),0) AS topicRatioA,
CEILING(avg(data.shift_project_total)) AS shiftProjectTotal,
IFNULL(avg(data.shift_project_Ratio),0) AS shiftProjectRatioA,
CEILING(avg(data.resolved_project_total)) AS resolvedProjectTotal,
IFNULL(avg(data.resolved_project_ratio),0) AS resolvedProjectRatioA,
CEILING(avg(data.publish_issue_total)) AS publishIssueTotal,
IFNULL(avg(data.publish_issue_ratio),0) AS publishIssueRatioA,
CEILING(avg(data.PLAT_ISSUE_TOTAL)) AS platIssueTotal,
IFNULL(avg(data.PLAT_JOIN_PARTY_RATIO),0) AS platJoinPartyRatio
FROM
screen_pioneer_data data
LEFT JOIN
screen_customer_agency agency
ON data.org_id = agency.agency_id
WHERE
data.del_flag = '0'
AND data.org_type = 'agency'
AND agency.area_code LIKE concat(#{areaCode},'%')
<foreach collection="list" item="subId" open="AND ( agency.customer_id = #{customerId} OR " separator=" OR " close=" )">
agency.customer_id = #{subId}
</foreach>
ORDER BY data.data_end_time DESC
LIMIT 1
</select>
</mapper>

Loading…
Cancel
Save