Browse Source

党员志愿者服务查询

dev_shibei_match
yinzuomei 5 years ago
parent
commit
8226eec2bb
  1. 31
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java
  2. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java
  3. 30
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java
  4. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java
  5. 22
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java
  6. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java
  7. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java
  8. 11
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java
  9. 77
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  10. 30
      epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml
  11. 29
      epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml

31
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.plugins.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 19:53
*/
@Data
public class VoluntaryServiceTrendFormDTO {
/**
* 当前组织id
*/
@NotBlank(message = "agencyId不能为空")
private String agencyId;
@NotBlank(message = "目前只有平阴在传,默认赋值:370124")
private String areaCode;
@NotBlank(message = "customerId不能为空")
private String customerId;
/**
* 截止到某月格式yyyyMM目前没有让大屏前端赋值代码默认为为上个月
*/
private String endMonthId;
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java

@ -16,7 +16,7 @@ public class WorkRecordTrendFormDTO implements Serializable {
/**
* party:支部建设; union:联建共建党员志愿服务voluntaryservice
*/
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建;党员志愿服务:voluntaryservice")
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建")
private String dataType;
/**

30
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java

@ -0,0 +1,30 @@
package com.epmet.plugins.result;
import lombok.Data;
import java.io.Serializable;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/28 13:41
*/
@Data
public class VoluntaryServiceTrendDTO implements Serializable {
private String monthId;
/**
* 组织次数
*/
private Integer organizeTotal;
/**
* 参与人数
*/
private Integer participateUserTotal;
/**
* 平均参与人数
*/
private Integer avgParticipateUserTotal;
}

23
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.plugins.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 19:55
*/
@Data
public class VoluntaryServiceTrendResultDTO implements Serializable {
private static final long serialVersionUID = -560895826884970305L;
private List<String> xAxis=new ArrayList<>();
//组织次数:organize;参与人数:joinuser;平均参与人数:avguser
private List<Integer> organizeList=new ArrayList<>();
private List<Integer> joinUserList=new ArrayList<>();
private List<Integer> avgUserList=new ArrayList<>();
}

22
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java

@ -3,10 +3,14 @@ package com.epmet.datareport.controller.plugins;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService;
import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO;
import com.epmet.plugins.form.WorkRecordRankFormDTO;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.VoluntaryServiceTrendResultDTO;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
* @author yinzuomei@elink-cn.com
* @date 2021/2/21 19:51
*/
@Slf4j
@RestController
@RequestMapping("screen/plugins/workrecord")
public class WorkRecordController {
@ -47,4 +52,21 @@ public class WorkRecordController {
ValidatorUtils.validateEntity(formDTO);
return new Result<WorkRecordTrendResultDTO>().ok(screenWorkRecordOrgDailyService.trend(formDTO));
}
/**
* @param customerId
* @param formDTO
* @author yinzuomei
* @description 7工作日志党员志愿者服务近12月趋势图
* @Date 2021/2/27 19:56
**/
@PostMapping("voluntaryservicetrend")
public Result<VoluntaryServiceTrendResultDTO> voluntaryServiceTrend(@RequestHeader("CustomerId")String customerId, @RequestBody VoluntaryServiceTrendFormDTO formDTO){
formDTO.setCustomerId(customerId);
if (StringUtils.isBlank(formDTO.getEndMonthId())) {
formDTO.setEndMonthId(com.epmet.commons.tools.utils.DateUtils.getCurrentTimeBeforeMonthId());
}
ValidatorUtils.validateEntity(formDTO);
return new Result<VoluntaryServiceTrendResultDTO>().ok(screenWorkRecordOrgDailyService.voluntaryServiceTrend(formDTO));
}
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java

@ -63,4 +63,8 @@ public interface ScreenWorkRecordOrgDailyDao extends BaseDao<ScreenWorkRecordOrg
**/
String selectLatestDateId(@Param("customerIds")List<String> customerIds);
List<WorkRecordSubRank> selectCurrentAgency(@Param("agencyId") String agencyId,
@Param("dataType")String dataType,
@Param("customerId")String customerId,
@Param("dateId")String dateId);
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java

@ -20,8 +20,10 @@ package com.epmet.datareport.dao.plugins;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgMonthlyEntity;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.VoluntaryServiceTrendDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -39,4 +41,9 @@ public interface ScreenWorkRecordOrgMonthlyDao extends BaseDao<ScreenWorkRecordO
* @author sun
*/
List<WorkRecordTrendResultDTO.SeriesResultDTO> selectMonthList(WorkRecordTrendFormDTO formDTO);
List<VoluntaryServiceTrendDTO> selectVoluntaryServiceTrendDTO(@Param("customerId")String customerId,
@Param("orgIds") List<String> orgIds,
@Param("startMonth")String startMonth,
@Param("endMonth")String endMonth);
}

11
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java

@ -21,8 +21,10 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity;
import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO;
import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO;
import com.epmet.plugins.form.WorkRecordRankFormDTO;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.VoluntaryServiceTrendResultDTO;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
@ -104,4 +106,13 @@ public interface ScreenWorkRecordOrgDailyService extends BaseService<ScreenWorkR
* @author sun
*/
WorkRecordTrendResultDTO trend(WorkRecordTrendFormDTO formDTO);
/**
* @return com.epmet.plugins.result.VoluntaryServiceTrendResultDTO
* @param formDTO
* @author yinzuomei
* @description 7工作日志党员志愿者服务近12月趋势图
* @Date 2021/2/27 19:56
**/
VoluntaryServiceTrendResultDTO voluntaryServiceTrend(VoluntaryServiceTrendFormDTO formDTO);
}

77
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java

@ -36,13 +36,13 @@ import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.dto.AgencyInfoDTO;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO;
import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO;
import com.epmet.plugins.form.WorkRecordRankFormDTO;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordSubRank;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
import com.epmet.plugins.result.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -54,6 +54,7 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -142,18 +143,27 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
log.warn("selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds));
}
WorkRecordRankResultDTO returnDto = new WorkRecordRankResultDTO();
//当前组织的自身的数据
AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId());
//当前组织的自身的数据
List<WorkRecordSubRank> currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(),
formDTO.getDataType(),
formDTO.getCustomerId(),
dateId);
//下级所有组织
List<WorkRecordSubRank> subAgencyRankList = baseDao.selectSubList(
CollectionUtils.isNotEmpty(agencyInfoDTO.getSubAgencyIds()) ? agencyInfoDTO.getSubAgencyIds() : new ArrayList<>(),
formDTO.getDataType(),
formDTO.getCustomerId(),
dateId);
//直属网格
List<WorkRecordSubRank> subGridList = baseDao.selectSubGridList(
CollectionUtils.isNotEmpty(agencyInfoDTO.getSubGridIds()) ? agencyInfoDTO.getSubGridIds() : new ArrayList<>(),
formDTO.getDataType(),
formDTO.getCustomerId(),
dateId);
if (CollectionUtils.isNotEmpty(currentAgency)) {
returnDto.getSubRankList().addAll(currentAgency);
}
returnDto.getSubRankList().addAll(subAgencyRankList);
returnDto.getSubRankList().addAll(subGridList);
int participateUserTotal = 0;
@ -223,4 +233,63 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
return resultDTO;
}
/**
* @param formDTO
* @return com.epmet.plugins.result.VoluntaryServiceTrendResultDTO
* @author yinzuomei
* @description 7工作日志党员志愿者服务近12月趋势图
* @Date 2021/2/27 19:56
**/
@Override
public VoluntaryServiceTrendResultDTO voluntaryServiceTrend(VoluntaryServiceTrendFormDTO formDTO) {
VoluntaryServiceTrendResultDTO resultDTO = new VoluntaryServiceTrendResultDTO();
//近12个月的monthId集合,["202002","202003","202004","202005","202006","202007","202008","202009","202010","202011","202012","202101"]
List<String> monthIdList = com.epmet.commons.tools.utils.DateUtils.getMonthIdList(formDTO.getEndMonthId(), NumConstant.ELEVEN);
// log.info(JSON.toJSONString(monthIdList));
AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId());
List<String> orgIds = new ArrayList<>();
orgIds.addAll(agencyInfoDTO.getSubAgencyIds());
orgIds.add(agencyInfoDTO.getAgencyId());
orgIds.addAll(agencyInfoDTO.getSubGridIds());
List<VoluntaryServiceTrendDTO> list = screenWorkRecordOrgMonthlyDao.selectVoluntaryServiceTrendDTO(formDTO.getCustomerId(),
orgIds,
monthIdList.get(NumConstant.ZERO),
monthIdList.get(NumConstant.ELEVEN));
Map<String, VoluntaryServiceTrendDTO> dtoMap = new HashMap<>();
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
dtoMap = list.stream().collect(Collectors.toMap(VoluntaryServiceTrendDTO::getMonthId, Function.identity(), (key1, key2) -> key2));
}
//要返回的横坐标:["02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","01月"]
List<String> xAxis = new ArrayList<>();
List<Integer> organizeList = new ArrayList<>();
List<Integer> joinUserList = new ArrayList<>();
List<Integer> avgUserList = new ArrayList<>();
for (String monthId : monthIdList) {
xAxis.add(monthId.substring(NumConstant.FOUR, NumConstant.SIX).concat(ScreenConstant.MONTH));
if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getOrganizeTotal()) {
organizeList.add(dtoMap.get(monthId).getOrganizeTotal());
} else {
organizeList.add(NumConstant.ZERO);
}
if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getParticipateUserTotal()) {
joinUserList.add(dtoMap.get(monthId).getParticipateUserTotal());
} else {
joinUserList.add(NumConstant.ZERO);
}
if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getAvgParticipateUserTotal()) {
avgUserList.add(dtoMap.get(monthId).getAvgParticipateUserTotal());
} else {
avgUserList.add(NumConstant.ZERO);
}
}
resultDTO.setXAxis(xAxis);
resultDTO.setOrganizeList(organizeList);
resultDTO.setJoinUserList(joinUserList);
resultDTO.setAvgUserList(avgUserList);
return resultDTO;
}
}

30
epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml

@ -90,4 +90,34 @@
participateTotal DESC
</select>
<select id="selectCurrentAgency" parameterType="map" resultType="com.epmet.plugins.result.WorkRecordSubRank">
SELECT
sca.AGENCY_ID AS orgId,
sca.AGENCY_NAME AS `NAME`,
IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal,
IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal
FROM
screen_customer_agency sca
left join (
select m.* from screen_work_record_org_daily m
where m.DEL_FLAG = '0'
AND m.DATE_ID = #{dateId}
and m.TYPE_CODE in(
select distinct dict.RESOURCE_CODE
from screen_customer_work_record_dict dict
where dict.DEL_FLAG = '0'
and dict.`LEVEL`='1'
AND dict.DATA_TYPE =#{dataType}
and dict.CUSTOMER_ID=#{customerId}
)
and org_id =#{agencyId}
)temp on(sca.AGENCY_ID = temp.ORG_ID)
WHERE
sca.DEL_FLAG = '0'
AND sca.AGENCY_ID=#{agencyId}
group by sca.AGENCY_ID,sca.AGENCY_NAME
ORDER BY
participateUserTotal DESC,
participateTotal DESC
</select>
</mapper>

29
epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml

@ -35,4 +35,33 @@
sw.month_id ASC
</select>
<select id="selectVoluntaryServiceTrendDTO" parameterType="map" resultType="com.epmet.plugins.result.VoluntaryServiceTrendDTO">
SELECT
m.MONTH_ID,
sum( m.ORGANIZE_TOTAL ) AS organizeTotal,
sum( m.PARTICIPATE_USER_TOTAL ) AS participateUserTotal,
sum( m.AVG_PARTICIPATE_USER_TOTAL ) AS avgParticipateUserTotal
FROM
screen_work_record_org_monthly m
WHERE m.DEL_FLAG = '0'
AND m.TYPE_CODE =(
SELECT
dict.RESOURCE_CODE
FROM
screen_customer_work_record_dict dict
WHERE
dict.DEL_FLAG = '0'
AND dict.`LEVEL` = '1'
AND dict.DATA_TYPE = 'voluntaryservice'
AND dict.CUSTOMER_ID = #{customerId}
)
AND m.ORG_ID IN
<foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
#{orgId}
</foreach>
AND m.MONTH_ID &gt;= #{startMonth}
AND m.MONTH_ID &lt;= #{endMonth}
GROUP BY
m.MONTH_ID
</select>
</mapper>
Loading…
Cancel
Save