diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VolunteerPolyPieFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VolunteerPolyPieFormDTO.java new file mode 100644 index 0000000000..d0acad6b7e --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyListResultDTO.java index 804ff81027..bd4376c771 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyListResultDTO.java +++ b/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 userId; + + private String icResiUser; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyPieResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerPolyPieResultDTO.java new file mode 100644 index 0000000000..46a389125c --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVolunteerPolyController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVolunteerPolyController.java index 04e678b8de..110f2d7241 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVolunteerPolyController.java +++ b/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.form.VolunteerPolyListFormDTO; import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; +import com.epmet.dto.form.VolunteerPolyPieFormDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; +import com.epmet.dto.result.VolunteerPolyPieResultDTO; import com.epmet.service.IcVolunteerPolyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -37,20 +39,20 @@ public class IcVolunteerPolyController { private IcVolunteerPolyService icVolunteerPolyService; @RequestMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = icVolunteerPolyService.page(params); return new Result>().ok(page); } - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id) { IcVolunteerPolyDTO data = icVolunteerPolyService.get(id); return new Result().ok(data); } @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody IcVolunteerPolyDTO dto){ + public Result save(@RequestBody IcVolunteerPolyDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); icVolunteerPolyService.save(dto); @@ -59,7 +61,7 @@ public class IcVolunteerPolyController { @NoRepeatSubmit @PostMapping("update") - public Result update(@RequestBody IcVolunteerPolyDTO dto){ + public Result update(@RequestBody IcVolunteerPolyDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); icVolunteerPolyService.update(dto); @@ -67,7 +69,7 @@ public class IcVolunteerPolyController { } @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); icVolunteerPolyService.delete(ids); @@ -78,12 +80,12 @@ public class IcVolunteerPolyController { * 【网格党建平面图】地图 * * @param form - * @return com.epmet.commons.tools.utils.Result> + * @return com.epmet.commons.tools.utils.Result> * @author LZN * @date 2022/5/19 13:54 */ @PostMapping("/mapData") - public Result> getMapData(@RequestBody VolunteerPolyMapDataFormDTO form, @LoginUser TokenDto tokenDto){ + public Result> getMapData(@RequestBody VolunteerPolyMapDataFormDTO form, @LoginUser TokenDto tokenDto) { form.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(form); List dto = icVolunteerPolyService.getMapData(form); @@ -99,7 +101,7 @@ public class IcVolunteerPolyController { * @date 2022/5/19 14:49 */ @PostMapping("list") - public Result getList(@RequestBody VolunteerPolyListFormDTO form,@LoginUser TokenDto tokenDto){ + public Result getList(@RequestBody VolunteerPolyListFormDTO form, @LoginUser TokenDto tokenDto) { form.setCustomerId(tokenDto.getCustomerId()); PageData data = icVolunteerPolyService.getList(form); return new Result().ok(data); @@ -107,27 +109,44 @@ public class IcVolunteerPolyController { /** * 抽取志愿者数据 + * * @Param customerId * @Return {@link Result} * @Author zhaoqifeng * @Date 2022/5/19 15:41 */ @PostMapping("volunteerDataExtraction/{customerId}") - public Result volunteerDataExtraction(@PathVariable("customerId") String customerId){ + public Result volunteerDataExtraction(@PathVariable("customerId") String customerId) { icVolunteerPolyService.volunteerDataExtraction(customerId); return new Result(); } /** * 志愿者变动 + * * @Param form * @Return {@link Result} * @Author zhaoqifeng * @Date 2022/5/19 18:05 */ @PostMapping("volunteerChanged") - public Result volunteerChanged(@RequestBody MqBaseFormDTO form){ + public Result volunteerChanged(@RequestBody MqBaseFormDTO form) { icVolunteerPolyService.volunteerChanged(form); return new Result(); } + + /** + * 【网格党建平面图】饼图 + * + * @param form + * @return com.epmet.commons.tools.utils.Result + * @author LZN + * @date 2022/5/19 17:21 + */ + @PostMapping("statistics") + public Result> getStatistics(@RequestBody VolunteerPolyPieFormDTO form) { + List dto = icVolunteerPolyService.getStatistics(form); + return new Result>().ok(dto); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVolunteerPolyDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVolunteerPolyDao.java index d138a2a9d4..a0f779c0a0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVolunteerPolyDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVolunteerPolyDao.java @@ -1,8 +1,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.VolunteerPolyPieFormDTO; import com.epmet.dto.result.VolunteerPolyListResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; +import com.epmet.dto.result.VolunteerPolyPieResultDTO; import com.epmet.entity.IcVolunteerPolyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -34,4 +36,6 @@ public interface IcVolunteerPolyDao extends BaseDao { void deleteDataByCustomerId(@Param("customerId") String customerId); void deleteCategoryByCustomerId(@Param("customerId") String customerId); + + List getStatistics(VolunteerPolyPieFormDTO form); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVolunteerPolyService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVolunteerPolyService.java index 5f020d1eca..6297a12546 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVolunteerPolyService.java +++ b/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.form.VolunteerPolyListFormDTO; import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; +import com.epmet.dto.form.VolunteerPolyPieFormDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; +import com.epmet.dto.result.VolunteerPolyPieResultDTO; import com.epmet.entity.IcVolunteerPolyEntity; import java.util.List; @@ -102,6 +104,7 @@ public interface IcVolunteerPolyService extends BaseService getStatistics(VolunteerPolyPieFormDTO form); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java index 84ec52193e..4ea705b25d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java +++ b/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.exception.EpmetErrorCode; 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.redis.common.CustomerIcHouseRedis; 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.HouseInfoCache; 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.dao.IcResiUserDao; import com.epmet.dao.IcVolunteerPolyCategoryDao; @@ -23,17 +26,21 @@ import com.epmet.dao.IcVolunteerPolyDao; import com.epmet.dao.UserBaseInfoDao; import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.IcFormOptionsQueryFormDTO; import com.epmet.dto.form.VolunteerPolyListFormDTO; import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; import com.epmet.dto.result.ResiUserBaseInfoResultDTO; import com.epmet.dto.result.VolunteerPolyListResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; 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.IcVolunteerPolyEntity; import com.epmet.entity.UserBaseInfoEntity; import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.service.IcVolunteerPolyCategoryService; +import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.IcVolunteerPolyService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -45,10 +52,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import javax.annotation.Resource; +import java.util.*; import java.util.stream.Collectors; /** @@ -61,6 +66,8 @@ import java.util.stream.Collectors; @Slf4j public class IcVolunteerPolyServiceImpl extends BaseServiceImpl implements IcVolunteerPolyService { + @Resource + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; @Resource private IcResiUserDao icResiUserDao; @Resource @@ -88,8 +95,8 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -134,7 +141,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl getMapData(VolunteerPolyMapDataFormDTO form) { - List dto = baseDao.getMapData(form.getCode(),form.getCustomerId()); + List dto = baseDao.getMapData(form.getCode(), form.getCustomerId()); // 获取gridName for (VolunteerPolyMapDataResultDTO item : dto) { if (StringUtils.isNotEmpty(item.getGridId())) { @@ -144,9 +151,9 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl result = baseDao.getList(form.getCode(),form.getCustomerId()); + PageHelper.startPage(form.getPageNo(), form.getPageSize()); + List result = baseDao.getList(form.getCode(), form.getCustomerId()); PageInfo info = new PageInfo<>(result); return new PageData<>(result, info.getTotal()); } @@ -206,7 +213,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl userList.addAll(getUserInfoList(part))); Map userMap = userList.stream().collect(Collectors.toMap(UserBaseInfoEntity::getUserId, a -> a, (o, n) -> o)); //将居民志愿者转成map - Map volunteerMap = volunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard,a -> a, (o, n) -> o)); + Map volunteerMap = volunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard, a -> a, (o, n) -> o)); //小程序与居民信息匹配不上的志愿者 List notInList = new ArrayList<>(); appVolunteerList.forEach(item -> { @@ -224,7 +231,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl appVolunteerMap = appVolunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard,a -> a, (o, n) -> o)); + Map appVolunteerMap = appVolunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard, a -> a, (o, n) -> o)); ////小程序与居民信息匹配上的志愿者userId更新到居民志愿者列表 volunteerList.forEach(item -> { if (appVolunteerMap.containsKey(item.getIdCard())) { @@ -354,7 +361,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl volunteerResult = epmetHeartOpenFeignClient.queryUserVolunteerInfo(userId); + Result volunteerResult = epmetHeartOpenFeignClient.queryUserVolunteerInfo(userId); if (!volunteerResult.success()) { log.error("志愿者变更-获取小程序志愿者失败"); } @@ -431,4 +438,36 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl getStatistics(VolunteerPolyPieFormDTO form) { + + List list = baseDao.getStatistics(form); + Map 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> volunteerMap = operCustomizeOpenFeignClient.getOptionsMap(optionsForm); + + Map 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()); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml index 90e1558333..bcca166a47 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml @@ -46,7 +46,9 @@ SELECT p.id, p.NAME, - p.mobile + p.mobile, + p.user_id, + p.IC_RESI_USER FROM ic_volunteer_poly p 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} AND c.CUSTOMER_ID = #{customerId} + delete from ic_volunteer_poly where CUSTOMER_ID = #{customerId}