Browse Source

【网格党建平面图】饼图

dev
HAHA 3 years ago
parent
commit
a2b1612d6f
  1. 15
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VolunteerPolyPieFormDTO.java
  2. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyListResultDTO.java
  3. 15
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyPieResultDTO.java
  4. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVolunteerPolyController.java
  5. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVolunteerPolyDao.java
  6. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVolunteerPolyService.java
  7. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java
  8. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml

15
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VolunteerPolyPieFormDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
@Data
public class VolunteerPolyPieFormDTO implements Serializable {
private static final long serialVersionUID = 6284245738483042805L;
private String agencyId;
private String customerId;
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyListResultDTO.java

@ -28,4 +28,8 @@ public class VolunteerPolyListResultDTO implements Serializable {
* 手机号 * 手机号
*/ */
private String mobile; private String mobile;
private String userId;
private String icResiUser;
} }

15
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyPieResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class VolunteerPolyPieResultDTO implements Serializable {
private static final long serialVersionUID = 777585539653982139L;
private String label;
private String value;
private String code;
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVolunteerPolyController.java

@ -14,7 +14,9 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.IcVolunteerPolyDTO;
import com.epmet.dto.form.VolunteerPolyListFormDTO; import com.epmet.dto.form.VolunteerPolyListFormDTO;
import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; import com.epmet.dto.form.VolunteerPolyMapDataFormDTO;
import com.epmet.dto.form.VolunteerPolyPieFormDTO;
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO;
import com.epmet.dto.result.VolunteerPolyPieResultDTO;
import com.epmet.service.IcVolunteerPolyService; import com.epmet.service.IcVolunteerPolyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -107,6 +109,7 @@ public class IcVolunteerPolyController {
/** /**
* 抽取志愿者数据 * 抽取志愿者数据
*
* @Param customerId * @Param customerId
* @Return {@link Result} * @Return {@link Result}
* @Author zhaoqifeng * @Author zhaoqifeng
@ -120,6 +123,7 @@ public class IcVolunteerPolyController {
/** /**
* 志愿者变动 * 志愿者变动
*
* @Param form * @Param form
* @Return {@link Result} * @Return {@link Result}
* @Author zhaoqifeng * @Author zhaoqifeng
@ -130,4 +134,19 @@ public class IcVolunteerPolyController {
icVolunteerPolyService.volunteerChanged(form); icVolunteerPolyService.volunteerChanged(form);
return new Result(); return new Result();
} }
/**
* 网格党建平面图饼图
*
* @param form
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.VolunteerPolyPieResultDTO>
* @author LZN
* @date 2022/5/19 17:21
*/
@PostMapping("statistics")
public Result<List<VolunteerPolyPieResultDTO>> getStatistics(@RequestBody VolunteerPolyPieFormDTO form) {
List<VolunteerPolyPieResultDTO> dto = icVolunteerPolyService.getStatistics(form);
return new Result<List<VolunteerPolyPieResultDTO>>().ok(dto);
}
} }

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVolunteerPolyDao.java

@ -1,8 +1,10 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.VolunteerPolyPieFormDTO;
import com.epmet.dto.result.VolunteerPolyListResultDTO; import com.epmet.dto.result.VolunteerPolyListResultDTO;
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO;
import com.epmet.dto.result.VolunteerPolyPieResultDTO;
import com.epmet.entity.IcVolunteerPolyEntity; import com.epmet.entity.IcVolunteerPolyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -34,4 +36,6 @@ public interface IcVolunteerPolyDao extends BaseDao<IcVolunteerPolyEntity> {
void deleteDataByCustomerId(@Param("customerId") String customerId); void deleteDataByCustomerId(@Param("customerId") String customerId);
void deleteCategoryByCustomerId(@Param("customerId") String customerId); void deleteCategoryByCustomerId(@Param("customerId") String customerId);
List<VolunteerPolyPieResultDTO> getStatistics(VolunteerPolyPieFormDTO form);
} }

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVolunteerPolyService.java

@ -6,7 +6,9 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.IcVolunteerPolyDTO;
import com.epmet.dto.form.VolunteerPolyListFormDTO; import com.epmet.dto.form.VolunteerPolyListFormDTO;
import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; import com.epmet.dto.form.VolunteerPolyMapDataFormDTO;
import com.epmet.dto.form.VolunteerPolyPieFormDTO;
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO;
import com.epmet.dto.result.VolunteerPolyPieResultDTO;
import com.epmet.entity.IcVolunteerPolyEntity; import com.epmet.entity.IcVolunteerPolyEntity;
import java.util.List; import java.util.List;
@ -102,6 +104,7 @@ public interface IcVolunteerPolyService extends BaseService<IcVolunteerPolyEntit
/** /**
* 志愿者数据抽取 * 志愿者数据抽取
*
* @Param customerId * @Param customerId
* @Return void * @Return void
* @Author zhaoqifeng * @Author zhaoqifeng
@ -118,4 +121,14 @@ public interface IcVolunteerPolyService extends BaseService<IcVolunteerPolyEntit
* @Date 2022/5/19 16:02 * @Date 2022/5/19 16:02
*/ */
void volunteerChanged(MqBaseFormDTO dto); void volunteerChanged(MqBaseFormDTO dto);
/**
* 网格党建平面图饼图
*
* @param form
* @return com.epmet.dto.result.VolunteerPolyPieResultDTO
* @author LZN
* @date 2022/5/19 17:21
*/
List<VolunteerPolyPieResultDTO> getStatistics(VolunteerPolyPieFormDTO form);
} }

47
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java

@ -10,12 +10,15 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.enums.IcFormCodeEnum;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcVolunteerPolyCategoryDao; import com.epmet.dao.IcVolunteerPolyCategoryDao;
@ -23,17 +26,21 @@ import com.epmet.dao.IcVolunteerPolyDao;
import com.epmet.dao.UserBaseInfoDao; import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.IcVolunteerPolyDTO;
import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.IcFormOptionsQueryFormDTO;
import com.epmet.dto.form.VolunteerPolyListFormDTO; import com.epmet.dto.form.VolunteerPolyListFormDTO;
import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; import com.epmet.dto.form.VolunteerPolyMapDataFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO; import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.VolunteerPolyListResultDTO; import com.epmet.dto.result.VolunteerPolyListResultDTO;
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO;
import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcResiUserEntity;
import com.epmet.dto.form.VolunteerPolyPieFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcVolunteerPolyCategoryEntity; import com.epmet.entity.IcVolunteerPolyCategoryEntity;
import com.epmet.entity.IcVolunteerPolyEntity; import com.epmet.entity.IcVolunteerPolyEntity;
import com.epmet.entity.UserBaseInfoEntity; import com.epmet.entity.UserBaseInfoEntity;
import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.service.IcVolunteerPolyCategoryService; import com.epmet.service.IcVolunteerPolyCategoryService;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcVolunteerPolyService; import com.epmet.service.IcVolunteerPolyService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -45,10 +52,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import javax.annotation.Resource;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -61,6 +66,8 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyDao, IcVolunteerPolyEntity> implements IcVolunteerPolyService { public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyDao, IcVolunteerPolyEntity> implements IcVolunteerPolyService {
@Resource
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Resource @Resource
private IcResiUserDao icResiUserDao; private IcResiUserDao icResiUserDao;
@Resource @Resource
@ -431,4 +438,36 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD
return userBaseInfoDao.selectList(userInfoWrapper); return userBaseInfoDao.selectList(userInfoWrapper);
} }
/**
* 网格党建平面图饼图
*
* @param form
* @return com.epmet.dto.result.VolunteerPolyPieResultDTO
* @author LZN
* @date 2022/5/19 17:21
*/
@Override
public List<VolunteerPolyPieResultDTO> getStatistics(VolunteerPolyPieFormDTO form) {
List<VolunteerPolyPieResultDTO> list = baseDao.getStatistics(form);
Map<String, String> map = list.stream().collect(Collectors.toMap(VolunteerPolyPieResultDTO::getCode, VolunteerPolyPieResultDTO::getValue));
//获取志愿者类别
IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO();
optionsForm.setCustomerId(form.getCustomerId());
optionsForm.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode());
optionsForm.setColumnName("VOLUNTEER_CATEGORY");
Result<Map<String, String>> volunteerMap = operCustomizeOpenFeignClient.getOptionsMap(optionsForm);
Map<String, String> data = volunteerMap.getData();
return list.stream().map(item -> {
VolunteerPolyPieResultDTO dto = new VolunteerPolyPieResultDTO();
dto.setCode(item.getCode());
dto.setValue(item.getValue());
dto.setLabel(data.get(item.getValue()));
return dto;
}).collect(Collectors.toList());
}
} }

14
epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml

@ -46,7 +46,9 @@
SELECT SELECT
p.id, p.id,
p.NAME, p.NAME,
p.mobile p.mobile,
p.user_id,
p.IC_RESI_USER
FROM FROM
ic_volunteer_poly p ic_volunteer_poly p
LEFT JOIN ic_volunteer_poly_category c ON p.ID_CARD = c.ID_CARD AND c.del_flag = '0' LEFT JOIN ic_volunteer_poly_category c ON p.ID_CARD = c.ID_CARD AND c.del_flag = '0'
@ -54,6 +56,16 @@
c.VOLUNTEER_CATEGORY = #{code} c.VOLUNTEER_CATEGORY = #{code}
AND c.CUSTOMER_ID = #{customerId} AND c.CUSTOMER_ID = #{customerId}
</select> </select>
<select id="getStatistics" resultType="com.epmet.dto.result.VolunteerPolyPieResultDTO">
SELECT
c.VOLUNTEER_CATEGORY AS CODE,
count( p.id ) AS value
FROM
ic_volunteer_poly p
LEFT JOIN ic_volunteer_poly_category c ON p.ID_CARD = c.ID_CARD
GROUP BY
c.VOLUNTEER_CATEGORY
</select>
<delete id="deleteDataByCustomerId"> <delete id="deleteDataByCustomerId">
delete from ic_volunteer_poly where CUSTOMER_ID = #{customerId} delete from ic_volunteer_poly where CUSTOMER_ID = #{customerId}
</delete> </delete>

Loading…
Cancel
Save