Browse Source

联建单位-按分类统计数量及占比

dev
HAHA 3 years ago
parent
commit
e69d596c1c
  1. 22
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyTypepercentFormDTO.java
  2. 33
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PartyTypepercentResultDTO.java
  3. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
  4. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java
  5. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  6. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  7. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml

22
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyTypepercentFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PartyTypepercentFormDTO {
private static final long serialVersionUID = -3833404131164761022L;
/**
* 组织id
*/
@NotBlank(message = "组织id不能为空")
private String agencyId;
}

33
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PartyTypepercentResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PartyTypepercentResultDTO {
private static final long serialVersionUID = -5256798094892121661L;
/**
* 联建单位类型
*/
private String label;
/**
* 数量
*/
private String value;
/**
* 联建单位编码
*/
private String code;
/**
* 联建单位数量占比(%)
*/
private String percent;
}

22
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java

@ -33,12 +33,10 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -167,6 +165,7 @@ public class IcPartyUnitController {
/**
* 数据导入
*
* @Param tokenDto
* @Param response
* @Param file
@ -251,6 +250,21 @@ public class IcPartyUnitController {
return new Result<PageData>().ok(data);
}
/**
* 联建单位-按分类统计数量及占比
*
* @param form
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.PartyTypepercentResultDTO>>
* @author LZN
* @date 2022/5/18 16:42
*/
@PostMapping("/statistics/typepercent")
public Result<List<PartyTypepercentResultDTO>> getTypepercent(@RequestBody PartyTypepercentFormDTO form) {
ValidatorUtils.validateEntity(form);
List<PartyTypepercentResultDTO> dto = icPartyUnitService.getTypepercent(form);
return new Result<List<PartyTypepercentResultDTO>>().ok(dto);
}
/**
* 计算区域化党建单位的群众满意度
*

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java

@ -19,7 +19,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.dto.form.PartyTypepercentFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -41,6 +43,7 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
/**
* 需求指派选择区域化党建单位调用此接口
*
* @param agencyIds
* @param unitName
* @return
@ -51,6 +54,7 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
/**
* 单位分类统计
*
* @Param agencyId
* @Return {@link java.util.List<com.epmet.commons.tools.dto.result.OptionDataResultDTO>}
* @Author zhaoqifeng
@ -78,4 +82,11 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
* @date 2022/5/18 13:54
*/
List<PartyUnitListbrieResultDTO> getListbrief(PartyUnitListbriefFormDTO form, String customerId);
/**
* 联建单位-按分类统计数量及占比
*
* @param agencyId
*/
List<PartyTypepercentResultDTO> getTypepercent(@Param("agencyId") String agencyId);
}

13
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java

@ -24,9 +24,11 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyTypepercentFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -126,6 +128,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 导入数据
*
* @Param tokenDto
* @Param response
* @Param file
@ -146,6 +149,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 联建单位分布
*
* @Param formDTO
* @Return {@link List< PartyUnitDistributionResultDTO>}
* @Author zhaoqifeng
@ -155,6 +159,7 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 计算区域化党建单位的群众满意度
*
* @param formDTO
*/
void calPartyUnitSatisfation(ServerSatisfactionCalFormDTO formDTO);
@ -163,7 +168,15 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 联建单位-简要信息列表
*
* @param form
*/
PageData getListbrief(PartyUnitListbriefFormDTO form, TokenDto tokenDto);
/**
* 联建单位-按分类统计数量及占比
*
* @param form
*/
List<PartyTypepercentResultDTO> getTypepercent(PartyTypepercentFormDTO form);
}

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

@ -39,7 +39,9 @@ import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelPoiUtils;
@ -48,11 +50,9 @@ import com.epmet.constant.UserDemandConstant;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcPartyUnitDao;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
@ -269,8 +269,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
}
/**
* @Description 获取组织下单位列表
* @param dto
* @Description 获取组织下单位列表
* @Return {@link List< OptionDTO>}
* @Author zhaoqifeng
* @Date 2021/11/22 14:35
@ -519,6 +519,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
throw new RenException(result.getInternalMsg());
}
}
/**
* @param formDTO
* @Description 按类型统计单位数量
@ -573,6 +574,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
/**
* 计算区域化党建单位的群众满意度
* 总分需求个数
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@ -604,6 +606,19 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
return new PageData<>(dto, info.getTotal());
}
@Override
public List<PartyTypepercentResultDTO> getTypepercent(PartyTypepercentFormDTO form) {
List<PartyTypepercentResultDTO> dto = baseDao.getTypepercent(form.getAgencyId());
int total = 0;
for (PartyTypepercentResultDTO item : dto) {
total = Integer.parseInt(item.getValue()) + total;
}
for (PartyTypepercentResultDTO item : dto) {
item.setPercent((Integer.parseInt(item.getValue()) * 100) / total + "%");
}
return dto;
}
private String getServiceMatter(Map<String, String> map, String matter) {
List<String> matters = Arrays.asList(matter.split(StrConstant.COLON));
List<String> list = matters.stream().map(map::get).collect(Collectors.toList());

13
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml

@ -110,6 +110,19 @@
order by
a.CREATED_TIME
</select>
<select id="getTypepercent" resultType="com.epmet.dto.result.PartyTypepercentResultDTO">
SELECT
a.type AS label,
count( a.type ) AS value,
a.id AS CODE
FROM
ic_party_unit a
WHERE
a.DEL_FLAG = '0'
AND a.AGENCY_ID = #{agencyId}
GROUP BY
a.type
</select>
<update id="updateSatisfaction" parameterType="map">
update ic_party_unit

Loading…
Cancel
Save