diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index 86b39b69c8..28e9fae188 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://118.190.150.119:43306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://192.168.1.140:3306/epmet_gov_voice?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: root #oracle配置 diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index b0f7737940..4cd073f977 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -197,6 +197,11 @@ + + com.tencentcloudapi + tencentcloud-sdk-java + 3.1.322 + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java index a0d1520e43..a245051765 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java @@ -1,5 +1,7 @@ package com.epmet.commons.tools.enums; +import org.apache.commons.lang3.StringUtils; + public enum PartyOrgTypeEnum { PROVINCIAL("0", "省委"), @@ -34,4 +36,17 @@ public enum PartyOrgTypeEnum { public void setName(String name) { this.name = name; } + + public static PartyOrgTypeEnum getEnumByCode(String code) { + if (StringUtils.isBlank(code)) { + return null; + } + for (PartyOrgTypeEnum en : PartyOrgTypeEnum.values()) { + if (en.getCode().equals(code)) { + return en; + } + } + + return null; + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java new file mode 100644 index 0000000000..34647de7ec --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java @@ -0,0 +1,49 @@ +package com.epmet.commons.tools.utils.net; + +import com.tencentcloudapi.ccc.v20200210.CccClient; +import com.tencentcloudapi.ccc.v20200210.models.CreateSDKLoginTokenRequest; +import com.tencentcloudapi.ccc.v20200210.models.CreateSDKLoginTokenResponse; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import lombok.extern.slf4j.Slf4j; + + +@Slf4j +public class TCCCClientUtils { + + private static String SDKAPPID = "1400801042"; + + private static String USERID = "286388969@qq.com"; + + private static String SECRETID = "AKIDynW4oQr6ED0a2dIn6EC3wgFlDVjrqIbg"; + + private static String SECRETKEY = "ymRuDJI8mCRUUPFvQqCPQME0c2MbfaM2"; + + public static String getToken() { + try { + Credential cred = new Credential(SECRETID, SECRETKEY); + // 实例化一个http选项,可选的,没有特殊需求可以跳过 + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("ccc.ap-shanghai.tencentcloudapi.com"); + // 实例化一个client选项,可选的,没有特殊需求可以跳过 + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + // 实例化要请求产品的client对象,clientProfile是可选的 + CccClient client = new CccClient(cred, "", clientProfile); + // 实例化一个请求对象,每个接口都会对应一个request对象 + CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest(); + req.setSdkAppId(1400801042L); + req.setSeatUserId("286388969@qq.com"); + // 返回的resp是一个CreateSDKLoginTokenResponse的实例,与请求对象对应 + CreateSDKLoginTokenResponse resp = client.CreateSDKLoginToken(req); + // 输出json格式的字符串回包 + System.out.println(CreateSDKLoginTokenResponse.toJsonString(resp)); + return CreateSDKLoginTokenResponse.toJsonString(resp); + } catch (TencentCloudSDKException e) { + log.error(e.toString()); + return e.toString(); + } + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java new file mode 100644 index 0000000000..18c2baba6e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java @@ -0,0 +1,24 @@ +package com.epmet.controller.tccc; + +import com.epmet.commons.tools.utils.net.TCCCClientUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController +@RequestMapping("tccc") +public class TCCCAuthController { + + @RequestMapping("getTcccAuth") + public String getTcccAuth() { + try { + String tcccAuth = TCCCClientUtils.getToken(); + System.out.println(tcccAuth); + return tcccAuth; + } catch (Exception e) { + log.error(e.toString()); + return e.toString(); + } + } +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java index e71cf1dfd6..451c5c6790 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java @@ -16,6 +16,10 @@ public class HouseCountPictureFormDTO implements Serializable { private String orgIdPath; + private String orgId; + + private String orgType; + private Date timeStart; private Date timeEnd; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/ChooseGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/ChooseGridFormDTO.java new file mode 100644 index 0000000000..29e4de2b75 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/ChooseGridFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form.yt; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2023/4/19 14:13 + */ +@Data +public class ChooseGridFormDTO extends PageFormDTO { + /** + * 客户id + */ + private String customerId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 网格id + */ + private String gridId; + + /** + * 楼栋名 + */ + private String buildingName; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java index 5fc00d0691..6ca6168fa4 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java @@ -1,10 +1,12 @@ package com.epmet.dto.form.yt; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.NotBlank; import java.util.Date; /** @@ -14,9 +16,14 @@ import java.util.Date; */ @Data public class CommunityLoginFormDTO extends PageFormDTO { + public interface StreetTotalShowGroup extends CustomerClientShowGroup { + } + + /** * 所选择的组织id */ + @NotBlank(message = "请选择区县",groups = StreetTotalShowGroup.class) private String orgId; /** @@ -37,5 +44,11 @@ public class CommunityLoginFormDTO extends PageFormDTO { @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date endDate; + + /** + * exclude_zero:不展示登录次数为0的社区 + * all:全部展示 + */ + private String dataRange; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java index e1cb00a765..a8c1e4fb76 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java @@ -1,5 +1,8 @@ package com.epmet.dto.result.yt; +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; import lombok.Data; /** @@ -12,26 +15,36 @@ public class CommunityLoginResultDTO { /** * 组织id */ + @ExcelIgnore private String agencyId; /** * 组织名称 */ + @ColumnWidth(20) + @ExcelProperty(value = "社区名称") private String agencyName; /** * 组织级别(社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province) */ + @ExcelIgnore private String agencyLevel; /** * 所属街道名称; */ + @ColumnWidth(20) + @ExcelProperty(value = "所属街道") private String streetName; /** * 所属区县名称; */ + @ColumnWidth(20) + @ExcelProperty(value = "所属区县") private String districtName; /** * 登录次数 */ + @ColumnWidth(20) + @ExcelProperty(value = "登录次数") private Integer count; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index e0d4f9f644..3d26395c0e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -530,14 +530,14 @@ public class CustomerAgencyController { /** * @Description: 返回下级数量统计 - * @param agencyId: + * @param dto: * @Return com.epmet.commons.tools.utils.Result> * @Author: lichao * @Date: 2023/4/7 14:48 */ - @GetMapping("getAgencyCountList") - public Result> getAgencyCountList(@RequestParam String agencyId){ - return new Result>().ok(customerAgencyService.getAgencyCountList(agencyId)); + @PostMapping("getAgencyCountList") + public Result> getAgencyCountList(@RequestBody CommunityCountCensusFormDTO dto){ + return new Result>().ok(customerAgencyService.getAgencyCountList(dto)); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java index ab66b5aa4f..7e11a2d995 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java @@ -147,7 +147,7 @@ public class IcEnterpriseController implements ResultDataResolver { formDTO.setPageNo(NumConstant.ONE); formDTO.setPageSize(NumConstant.TEN_THOUSAND); try { - String fileName = "企事业单位" + DateUtils.format(new Date()) + ".xlsx"; + String fileName = "九小场所" + DateUtils.format(new Date()) + ".xlsx"; // 头的策略 WriteCellStyle headWriteCellStyle = new WriteCellStyle(); // 背景设置为红色 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java index 43b2d4bd60..1faa0d9221 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java @@ -40,6 +40,7 @@ import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.NeighborHoodOptionFormDTO; +import com.epmet.dto.form.yt.ChooseGridFormDTO; import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; @@ -183,8 +184,10 @@ public class IcNeighborHoodController { * @date 2022/8/19 15:56 */ @PostMapping("neighborhoodlist") - public Result> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody IcNeighborHoodDTO dto) { - return new Result>().ok(icNeighborHoodService.getNeighborhoodList(tokenDto, dto)); + public Result> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody ChooseGridFormDTO dto) { + ValidatorUtils.validateEntity(dto, ChooseGridFormDTO.AddUserInternalGroup.class); + dto.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(icNeighborHoodService.getNeighborhoodList(dto)); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java index c2967945f7..e79c65cd41 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java @@ -1,12 +1,22 @@ package com.epmet.controller; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.fastjson.JSON; import com.alibaba.nacos.client.naming.utils.CollectionUtils; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.yt.CommunityLoginFormDTO; import com.epmet.dto.form.yt.CountActivityFormDTO; import com.epmet.dto.form.yt.LoginLogCountByLevelFormDTO; @@ -16,6 +26,7 @@ import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.excel.yt.AccountActivityExcel; import com.epmet.excel.yt.AccountInactivityExcel; import com.epmet.service.StaffLoginLogService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -24,6 +35,8 @@ import org.springframework.web.bind.annotation.RestController; import com.epmet.dto.result.yt.AccountActivityInfo; import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.Date; import java.util.List; @@ -33,6 +46,7 @@ import java.util.List; * @author generator generator@elink-cn.com * @since v1.0.0 2023-04-04 */ +@Slf4j @RestController @RequestMapping("staffLoginLog") public class StaffLoginLogController { @@ -62,6 +76,46 @@ public class StaffLoginLogController { return new Result>().ok(staffLoginLogService.pageCommunityCount(formDTO)); } + /** + * 下级社区账号登录次数排名 + * + * @return + */ + @PostMapping("community-count-export") + public void communityCount(HttpServletResponse response, @RequestBody CommunityLoginFormDTO formDTO) throws Exception { + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "社区级账号登录情况" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), CommunityLoginResultDTO.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + // 默认查询本组织及下级 + data = staffLoginLogService.pageCommunityCount(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), CommunityLoginResultDTO.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("社区级账号登录情况export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + /** * 柱状图:下级组织账号登录次数汇总 * @@ -101,6 +155,21 @@ public class StaffLoginLogController { formDTO.getPageNo(), formDTO.getPageSize())); } + /** + * 柱状图点击区县,查看街道,调用此接口 + * 计算的是街道的工作人员+街道下所有社区的人 的总次数 + * @param formDTO + * @return + */ + @PostMapping("streetTotal") + public Result> streetTotal(@RequestBody CommunityLoginFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,CommunityLoginFormDTO.StreetTotalShowGroup.class); + return new Result>().ok(staffLoginLogService.streetTotal(formDTO.getOrgId(), + formDTO.getStartDate(), + formDTO.getEndDate(), + formDTO.getPageNo(), formDTO.getPageSize())); + } + /*** * 获取当前agencyid下 下级组织活跃情况 * @param formDTO @@ -141,11 +210,9 @@ public class StaffLoginLogController { PageData res = staffLoginLogService.getAccountActivityInfo(formDTO); if (!CollectionUtils.isEmpty(res.getList())) { if("1".equals(formDTO.getIsActivity())){ -// List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountActivityExcel.class); - ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountActivityExcel.class); + ExcelUtils.exportExcelToTarget(response, "社区活跃数据", res.getList(), AccountActivityExcel.class); }else { -// List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountInactivityExcel.class); - ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountInactivityExcel.class); + ExcelUtils.exportExcelToTarget(response, "社区不活跃数据", res.getList(), AccountInactivityExcel.class); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 5639d33894..b17ddb6de6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -434,11 +434,13 @@ public interface CustomerAgencyDao extends BaseDao { */ List getAllCommunity(String customerId); - List agencyCount(@Param("pids") String pids); + List agencyCount(@Param("pids") String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); - Integer agencyGridCount(@Param("pids") String pids); + Integer communityCount(@Param("pids") String pids); - Integer agencyStaffCount(@Param("pids") String pids); + Integer agencyGridCount(@Param("pids") String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); + + Integer agencyStaffCount(@Param("pids") String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); Integer getCommunityCount(@Param("pids")String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java index 4b10e94bf1..f70181c475 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java @@ -19,7 +19,6 @@ package com.epmet.dao; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.IcBuildingListFormDTO; @@ -240,12 +239,14 @@ public interface IcBuildingDao extends BaseDao { /** * 展示所有楼栋和小区信息 * - * @param dto * @return java.util.List * @author zhy * @date 2022/8/19 17:32 */ - List listBuildingInfo(IcNeighborHoodDTO dto); + List listBuildingInfo(@Param("customerId")String customerId, + @Param("agencyId")String agencyId, + @Param("gridId") String gridId, + @Param("buildingName")String buildingName); /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index f28987ad72..9f76843368 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -220,9 +220,9 @@ public interface IcHouseDao extends BaseDao { */ List selectGroupRentHouseList(GroupRentHouseFormDTO formDTO); - List getHousePurposeCount(@Param("orgId") String orgId, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); + List getHousePurposeCount(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); - List getHouseStatusCount(@Param("orgId") String orgId, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); + List getHouseStatusCount(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); - List getHousePictureList(@Param("orgId") String orgId, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd,@Param("purpose") String purpose,@Param("rentFlag") Integer rentFlag); + List getHousePictureList(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd,@Param("purpose") String purpose,@Param("rentFlag") Integer rentFlag); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java index 0db1338752..98879a4204 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java @@ -27,12 +27,17 @@ public interface StaffLoginLogDao extends BaseDao { * @param orgId * @param startDate * @param endDate + * @param dataRange exclude_zero:不展示登录次数为0的社区 all:全部展示 * @return */ List pageCommunityCount(@Param("orgId") String orgId, @Param("startDate") Date startDate, - @Param("endDate") Date endDate); + @Param("endDate") Date endDate, + @Param("dataRange")String dataRange); + List selectCommunityCount(@Param("orgId") String orgId, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); /** * 柱状图:下级组织账号登录次数汇总 * @@ -72,4 +77,10 @@ public interface StaffLoginLogDao extends BaseDao { ActivityTatalInfo selectOneActivityTotal(CountActivityFormDTO formDTO); + + Integer selectLoginTotalByPath(@Param("orgIdPath") String orgIdPath, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); + + List selectStreetTotal(@Param("orgId") String orgId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index f43de77102..ceac3653a9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -368,10 +368,10 @@ public interface CustomerAgencyService extends BaseService /** * 返回下级数量 - * @param agencyId + * @param dto * @return */ - List getAgencyCountList(String agencyId); + List getAgencyCountList(CommunityCountCensusFormDTO dto); /** * @Description: 获取下级组织的社区数量 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java index 5ffb6a19e8..e5766ce0d3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java @@ -20,7 +20,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.ImportGeneralDTO; @@ -28,6 +27,7 @@ import com.epmet.dto.NeighborHoodAndManagementDTO; import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.NeighborHoodOptionFormDTO; +import com.epmet.dto.form.yt.ChooseGridFormDTO; import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.IcNeighborHoodDetailDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; @@ -123,13 +123,12 @@ public interface IcNeighborHoodService extends BaseService /** * 获取用户组织下小区列表 * - * @param tokenDto * @param dto * @return java.util.List * @author zhy * @date 2022/8/19 15:57 */ - List getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto); + List getNeighborhoodList(ChooseGridFormDTO dto); /** * @Description 通过ID查询小区信息 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java index 5d39463647..ed1a49aa6e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java @@ -84,6 +84,12 @@ public interface StaffLoginLogService extends BaseService { */ PageData streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize); + /** + * 柱状图点击区县,查看街道,调用此接口 + * 计算的是街道的工作人员+街道下所有社区的人 的总次数 + * @return + */ + PageData streetTotal(String orgId, Date startDate, Date endDate, Integer pageNo, Integer pageSize); /*** * 获取登陆情况 * @param formDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 31d49852b7..a972cd9797 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -1147,12 +1147,15 @@ public class AgencyServiceImpl implements AgencyService { calendar.set(Calendar.MILLISECOND, 0); Date endTime = calendar.getTime(); - AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); +/* AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); agencyOrgIdPath = getOrgIdPath(agencyInfo.getPids(), agencyInfo.getId()); - List currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null); + List currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null);*/ // List preferUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, endTime); // return new UsingCommunityStatsResultDTO(currentUsingCommunityList.size(), currentUsingCommunityList.size() - preferUsingCommunityList.size()); - return new UsingCommunityStatsResultDTO(currentUsingCommunityList.size(), 0); + CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(orgId); + String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); + + return new UsingCommunityStatsResultDTO(customerAgencyDao.communityCount(pids), 0); } else if ("grid".equals(orgType)) { // 网格下不会有该数据,给个0 return new UsingCommunityStatsResultDTO(0, 0); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 91a6a52dc8..edc89ba21c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1662,34 +1662,55 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl * @Author: lichao * @Date: 2023/4/7 14:17 */ @Override - public List getAgencyCountList(String agencyId) { + public List getAgencyCountList(CommunityCountCensusFormDTO dto) { List agencyCountCensusResultDTOS = new ArrayList<>(); - CustomerAgencyEntity customerAgency = baseDao.selectById(agencyId); + CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId()); if (customerAgency != null){ + + Map type = new HashMap<>(); String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); - agencyCountCensusResultDTOS = baseDao.agencyCount(pids); + agencyCountCensusResultDTOS = baseDao.agencyCount(pids,dto.getTimeStart(),dto.getTimeEnd()); + agencyCountCensusResultDTOS.forEach( + agencyCountCensusResultDTO ->{ + type.put(agencyCountCensusResultDTO.getLevel(),agencyCountCensusResultDTO.getLevel()); + } + ); AgencyCountCensusResultDTO agencyCountCensusResultDTOGrid = new AgencyCountCensusResultDTO(); agencyCountCensusResultDTOGrid.setLevel("grid"); - agencyCountCensusResultDTOGrid.setCount(baseDao.agencyGridCount(pids)); + agencyCountCensusResultDTOGrid.setCount(baseDao.agencyGridCount(pids,dto.getTimeStart(),dto.getTimeEnd())); agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOGrid); AgencyCountCensusResultDTO agencyCountCensusResultDTOStaff = new AgencyCountCensusResultDTO(); agencyCountCensusResultDTOStaff.setLevel("staff"); - agencyCountCensusResultDTOStaff.setCount(baseDao.agencyStaffCount(pids)); + agencyCountCensusResultDTOStaff.setCount(baseDao.agencyStaffCount(pids,dto.getTimeStart(),dto.getTimeEnd())); agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOStaff); + if (type.get("community") == null){ + AgencyCountCensusResultDTO agencyCountCensusResultDTOcom = new AgencyCountCensusResultDTO(); + agencyCountCensusResultDTOcom.setLevel("community"); + agencyCountCensusResultDTOcom.setCount(0); + agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOcom); + } + if (type.get("street") == null){ + AgencyCountCensusResultDTO agencyCountCensusResultDTOstree = new AgencyCountCensusResultDTO(); + agencyCountCensusResultDTOstree.setLevel("street"); + agencyCountCensusResultDTOstree.setCount(0); + agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOstree); + } }else{ throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); } + + return agencyCountCensusResultDTOS; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 654304466c..9c844639ec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -416,14 +416,66 @@ public class IcHouseServiceImpl extends BaseServiceImpl type = new HashMap<>(); + resultDTO.setTotal(0); - resultDTO.setList(baseDao.getHousePurposeCount(dto.getOrgIdPath(),dto.getTimeStart(),dto.getTimeEnd())); + if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ + dto.setOrgType("agency"); + } - resultDTO.getList().forEach( - result->resultDTO.setTotal(resultDTO.getTotal()+result.getCount()) - ); + List list = baseDao.getHousePurposeCount(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd()); + list.forEach( + result->{ + resultDTO.setTotal(resultDTO.getTotal()+result.getCount()); + type.put(result.getType(),result.getType()); + } + ); + HouseCountPictureListResultDTO houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + if (type.get("1") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("1"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("2") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("2"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("3") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("3"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("4") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("4"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("5") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("5"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("6") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("6"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("7") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("7"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + resultDTO.setList(list); return resultDTO; } @@ -432,14 +484,51 @@ public class IcHouseServiceImpl extends BaseServiceImpl type = new HashMap<>(); + resultDTO.setTotal(0); - resultDTO.setList(baseDao.getHouseStatusCount(dto.getOrgIdPath(),dto.getTimeStart(),dto.getTimeEnd())); + if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ + dto.setOrgType("agency"); + } + + List list =baseDao.getHouseStatusCount(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd()); + + list.forEach( + result->{ + type.put(result.getType(),result.getType()); + resultDTO.setTotal(resultDTO.getTotal()+result.getCount()); + } - resultDTO.getList().forEach( - result->resultDTO.setTotal(resultDTO.getTotal()+result.getCount()) ); + HouseCountPictureListResultDTO houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + if (type.get("1") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("1"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("2") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("2"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("3") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("3"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + if (type.get("0") == null){ + houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); + houseCountPictureListResultDTO.setType("0"); + houseCountPictureListResultDTO.setCount(0); + list.add(houseCountPictureListResultDTO); + } + resultDTO.setList(list); + return resultDTO; } @@ -447,7 +536,12 @@ public class IcHouseServiceImpl extends BaseServiceImpl getHousePictureList(HouseCountPictureFormDTO dto) { // 列表/导出查询 PageHelper.startPage(dto.getPageNo(), dto.getPageSize()); - List list = baseDao.getHousePictureList(dto.getOrgIdPath(),dto.getTimeStart(),dto.getTimeEnd(),dto.getPurpose(),dto.getRentFlag()); + + if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ + dto.setOrgType("agency"); + } + + List list = baseDao.getHousePictureList(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd(),dto.getPurpose(),dto.getRentFlag()); list.forEach(entity->{ String[] agencyIds = entity.getOrgIdPath().split(":"); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java index 751abc9199..3b6a79691c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java @@ -41,7 +41,6 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; 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.Result; import com.epmet.constant.CustomerGridConstant; @@ -52,6 +51,7 @@ import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.NeighborHoodOptionFormDTO; +import com.epmet.dto.form.yt.ChooseGridFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.excel.IcNeighborHoodExcel; @@ -223,8 +223,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto) { - dto.setCustomerId(tokenDto.getCustomerId()); + public List getNeighborhoodList(ChooseGridFormDTO dto) { // if (StringUtils.isBlank(dto.getAgencyId()) && StringUtils.isEmpty(dto.getGridId())) { // log.info("agencyId与gridId都为空时,默认查询当前工作人员所属组织下的小区"); // CustomerStaffInfoCacheResult result= CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); @@ -234,7 +233,9 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl list = icBuildingDao.listBuildingInfo(dto.getCustomerId(), dto.getAgencyId(), dto.getGridId(), dto.getBuildingName()); + return list; } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java index f1a00216b5..cd56d4dac1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java @@ -9,17 +9,20 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.StaffLoginLogDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.yt.CommunityLoginFormDTO; import com.epmet.dto.form.yt.CountActivityFormDTO; +import com.epmet.dto.result.yt.AccountActivityInfo; import com.epmet.dto.result.yt.ActivityTatalInfo; import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; -import com.epmet.dto.result.yt.AccountActivityInfo; +import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.StaffLoginLogEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.CustomerAgencyService; @@ -32,6 +35,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -45,6 +49,8 @@ import java.util.List; public class StaffLoginLogServiceImpl extends BaseServiceImpl implements StaffLoginLogService { @Autowired private EpmetUserOpenFeignClient userOpenFeignClient; + @Autowired + private CustomerAgencyDao customerAgencyDao; /** @@ -189,8 +195,8 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl accountActivityInfos = baseDao.selectListActivityInfo(formDTO); - int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size(); - return new PageData<>(accountActivityInfos, total); + PageInfo pageInfo = new PageInfo<>(accountActivityInfos); + return new PageData<>(accountActivityInfos, pageInfo.getTotal(),formDTO.getPageSize()); } List accountActivityInfos = baseDao.selectListActivityInfo(formDTO); int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size(); @@ -217,12 +223,12 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); + List list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate(),formDTO.getDataRange()); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal(), formDTO.getPageSize()); } // 不分页 - List list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); + List list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate(),formDTO.getDataRange()); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); return new PageData<>(list, total, total); } @@ -242,8 +248,31 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.selectCommunityCount(orgId, startDate, endDate); + int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); + return new PageData(list, total, total); } - List list = baseDao.querySubCount(orgId, startDate, endDate); + //先查询出下级组织 + LambdaQueryWrapper agencyWrapper=new LambdaQueryWrapper<>(); + agencyWrapper.eq(CustomerAgencyEntity::getPid,orgId).orderByAsc(CustomerAgencyEntity::getCreatedTime); + List subAgencyList=customerAgencyDao.selectList(agencyWrapper); + List list=new ArrayList<>(); + //横坐标展示所有组织 + for(CustomerAgencyEntity agencyEntity:subAgencyList){ + CommunityLoginResultDTO resultDTO=new CommunityLoginResultDTO(); + resultDTO.setAgencyId(agencyEntity.getId()); + resultDTO.setAgencyName(agencyEntity.getOrganizationName()); + resultDTO.setAgencyLevel(agencyEntity.getLevel()); + String orgIdPath=PidUtils.convertPid2OrgIdPath(agencyEntity.getId(),agencyEntity.getPids()); + //查询本组织及下级登录次数!!!!!!!! + resultDTO.setCount(baseDao.selectLoginTotalByPath(orgIdPath,startDate,endDate)); + list.add(resultDTO); + } + // List list = baseDao.querySubCount(orgId, startDate, endDate); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); return new PageData(list, total, total); } @@ -307,4 +336,20 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl(list, total, total); } + + /** + * 柱状图点击区县,查看街道,调用此接口 + * 计算的是街道的工作人员+街道下所有社区的人 的总次数 + * @return + */ + @Override + public PageData streetTotal(String orgId, Date startDate, Date endDate,Integer pageNo, Integer pageSize){ + PageHelper.startPage(pageNo, pageSize); + // todo + List list = baseDao.selectStreetTotal(orgId, startDate, endDate); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(), pageSize); + } + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 7f3f76b2d0..8005814843 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -889,16 +889,38 @@ from customer_agency where DEL_FLAG = 0 and PIDS like concat(#{pids},'%') + + and UPDATED_TIME >= #{timeStart} + + + and UPDATED_TIME <= #{timeEnd} + group by level + + @@ -911,6 +933,12 @@ and staff.DEL_FLAG = 0 and agency.PIDS like concat(#{pids},'%') + + and agency.UPDATED_TIME >= #{timeStart} + + + and agency.UPDATED_TIME <= #{timeEnd} + @@ -1094,102 +1122,102 @@ select t.ID from (select ca.ID , ca.CREATED_TIME created_time - , count(csa.ID) community_count - from customer_agency ca - inner join customer_staff_agency csa on (ca.ID = csa.AGENCY_ID and csa.DEL_FLAG = 0) - where ca.DEL_FLAG = 0 - and ca.CUSTOMER_ID=#{customerId} - and ca.LEVEL = 'community' - - and csa.CREATED_TIME #{endDate} - - and (ca.ID = #{agencyId} or ca.PIDS like CONCAT(#{agencyOrgIdPath}, '%')) - group by ca.ID, ca.CREATED_TIME - having community_count > 0 - order by created_time desc) t - - + + + - - - - + (SELECT ca.ID as id, ca.ORGANIZATION_NAME as label, - ca.LONGITUDE as longitude, - ca.LATITUDE as latitude, - ca.`LEVEL` as level, - ca.PID as pId, - 'agency' AS orgType - FROM - customer_agency ca - WHERE - ca.ID = #{agencyId} - AND ca.DEL_FLAG = '0' - - - - - - - + ca.LONGITUDE as longitude, + ca.LATITUDE as latitude, + ca.`LEVEL` as level, + ca.PID as pId, + 'agency' AS orgType + FROM customer_agency ca + WHERE ca.PID = #{agencyId} + AND ca.DEL_FLAG = '0' + ORDER BY CAST(ca.organization_name AS SIGNED), CONVERT(ca.organization_name using gbk)) + union all + (SELECT cg.id, + cg.GRID_NAME AS label, + cg.LONGITUDE, + cg.LATITUDE, + 'grid' AS LEVEL, + cg.PID, + 'grid' AS orgType + FROM customer_grid cg + WHERE cg.DEL_FLAG = '0' + AND cg.PID = #{agencyId} + ORDER BY cg.sort, CAST(cg.GRID_NAME AS SIGNED), CONVERT(cg.GRID_NAME using gbk)) + + + + + SELECT - CONCAT( n.NEIGHBOR_HOOD_NAME, b.BUILDING_NAME ) AS label, - b.id AS buildingId, - b.BUILDING_NAME AS buildingName, - n.id AS neighborhoodId, - n.NEIGHBOR_HOOD_NAME AS neighborhoodName, - n.GRID_ID, - g.GRID_NAME, - a.ALL_PARENT_NAME, - a.ORGANIZATION_NAME AS AGENCY_NAME, - n.CUSTOMER_ID - FROM - ic_building b - LEFT JOIN ic_neighbor_hood n ON b.NEIGHBOR_HOOD_ID = n.id - LEFT JOIN customer_grid g ON n.GRID_ID = g.id - LEFT JOIN customer_agency a ON a.id = g.pid + CONCAT( n.NEIGHBOR_HOOD_NAME, b.BUILDING_NAME ) AS label, + b.id AS buildingId, + b.BUILDING_NAME AS buildingName, + n.id AS neighborhoodId, + n.NEIGHBOR_HOOD_NAME AS neighborhoodName, + n.GRID_ID, + g.GRID_NAME, + a.ALL_PARENT_NAME, + a.ORGANIZATION_NAME AS AGENCY_NAME, + n.CUSTOMER_ID + FROM ic_building b + LEFT JOIN ic_neighbor_hood n + ON b.NEIGHBOR_HOOD_ID = n.id + LEFT JOIN customer_grid g + ON n.GRID_ID = g.id + LEFT JOIN customer_agency a + ON a.id = g.pid WHERE - n.DEL_FLAG = '0' - AND b.DEL_FLAG = '0' - AND g.DEL_FLAG = '0' - AND a.DEL_FLAG = '0' - AND n.CUSTOMER_ID = #{customerId} - - AND n.GRID_ID = #{gridId} - - - AND (n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%') OR b.BUILDING_NAME LIKE CONCAT('%', #{buildingName}, '%')) - - - AND ( - n.AGENCY_ID = #{agencyId} - OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%')) - + n.DEL_FLAG = '0' + AND b.DEL_FLAG = '0' + AND g.DEL_FLAG = '0' + AND a.DEL_FLAG = '0' + AND n.CUSTOMER_ID = #{customerId} + + AND n.GRID_ID = #{gridId} + + + AND n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%') + + + AND ( + n.AGENCY_ID = #{agencyId} + OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%')) + + order by n.CREATED_TIME asc,n.id asc + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java new file mode 100644 index 0000000000..bbbce73e60 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Data +public class CategoryDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 分类栏目名称 + */ + private String categoryName; + + /** + * 父栏目ID + */ + private String pid; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java index 568943b537..207fb75bcc 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java @@ -31,6 +31,9 @@ public class AddOrSaveDraftFormDTO implements Serializable { @Length(max = 50, message = "标题最长为50个字") private String title; + @NotBlank(message = "栏目分类不能为空",groups = {AddArticleForm.class}) + private String category; + /** * 发布范围IDs */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java index 6d4b81cc2a..fb472b3096 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java @@ -42,6 +42,11 @@ public class DraftAttrFromDTO implements Serializable { @NotBlank(message = "草稿ID不能为空") private String draftId; + /** + * 栏目 + */ + private String category; + /** * 封面图片地址 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java index 09c6818ac2..717930c62e 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java @@ -43,6 +43,11 @@ public class DraftContentFromDTO implements Serializable { */ private String draftId; + /** + * 栏目 + */ + private String category; + /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java index b575bf90c6..860e0fd6e6 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java @@ -28,6 +28,9 @@ public class UpdateArticleFormDTO { @NotBlank(message = "articleId不能为空", groups = {AddUserInternalGroup.class}) private String articleId; + @NotBlank(message = "栏目不能为空", groups = {AddUserInternalGroup.class}) + private String category; + @NotBlank(message = "文章标题不能为空", groups = {AddUserShowGroup.class}) @Length(max = 50, message = "文章标题最长为50个字") private String title; diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java index e3f62d12d5..f3c5e77a86 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java @@ -19,6 +19,10 @@ public class DraftListResultDTO implements Serializable { * 文章ID */ private String draftId; + /** + * 栏目 + */ + private String category; /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java index 2f14da3dc6..814d1e797c 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java @@ -19,6 +19,11 @@ public class DraftPcListResultDTO implements Serializable { * 文章草稿ID */ private String draftId; + + /** + * 栏目 + */ + private String category; /** * 组织Id */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java index 5ca995d10e..9e30604875 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java @@ -21,7 +21,10 @@ public class GovArticleDetailResultDTO implements Serializable { * 文章id */ private String articleId; - + /** + * 栏目 + */ + private String category; /** * 标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java index e277f6cd7a..c7e86d113f 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java @@ -19,6 +19,11 @@ public class OfflineListResultDTO implements Serializable { * 文章ID */ private String articleId; + + /** + * 栏目 + */ + private String category; /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java index e73acb6294..78ff5fe7f9 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java @@ -21,6 +21,11 @@ public class PublishedListResultDTO implements Serializable { * 文章ID */ private String articleId; + + /** + * 分类 + */ + private String category; /** * 组织Id */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java new file mode 100644 index 0000000000..40d67f975f --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java @@ -0,0 +1,72 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CategoryDictDTO; +import com.epmet.service.CategoryDictService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@RestController +@RequestMapping("categoryDict") +public class CategoryDictController { + + @Autowired + private CategoryDictService categoryDictService; + + @RequestMapping("list") + public Result> list(@RequestParam Integer pageNo, @RequestParam Integer pageSize){ + List list = categoryDictService.list(pageNo, pageSize); + return new Result>().ok(list); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + CategoryDictDTO data = categoryDictService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody CategoryDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + categoryDictService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody CategoryDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + categoryDictService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + categoryDictService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java index 6cf5a28000..39e70e953e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java @@ -68,7 +68,7 @@ public class DraftController { } @PostMapping("draftlist") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_LIST) + // @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_LIST) public Result> draftList(@LoginUser TokenDto tokenDto, @RequestBody DraftListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(draftService.draftList(tokenDto, formDTO).getList()); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java new file mode 100644 index 0000000000..6797882a8a --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Mapper +public interface CategoryDictDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java index 87a4c76078..828bc985a6 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java @@ -42,6 +42,15 @@ public class ArticleEntity extends BaseEpmetEntity { */ private String customerId; + /** + * @description: 分类 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/12 4:39 PM + */ + private String category; + /** * 草稿ID */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java new file mode 100644 index 0000000000..e6cd84571c --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java @@ -0,0 +1,44 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("category_dict") +public class CategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 分类栏目名称 + */ + private String categoryName; + + /** + * 父栏目ID + */ + private String pid; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java index 1c93cfc7cf..354ea0e01a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java @@ -47,6 +47,15 @@ public class DraftEntity extends BaseEpmetEntity { */ private String title; + /** + * @description: 分类 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/12 2:09 PM + */ + private String category; + /** * 标题审核状态 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java new file mode 100644 index 0000000000..b070fd1c34 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java @@ -0,0 +1,88 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CategoryDictDTO; +import com.epmet.entity.CategoryDictEntity; + +import java.util.List; +import java.util.Map; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +public interface CategoryDictService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2023-04-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2023-04-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CategoryDictDTO + * @author generator + * @date 2023-04-11 + */ + CategoryDictDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2023-04-11 + */ + void save(CategoryDictDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2023-04-11 + */ + void update(CategoryDictDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2023-04-11 + */ + void delete(String[] ids); + + /** + * @description: 列表 + * @param pageNo: + * @param pageSize: + * @return java.util.List + * @author: WangXianZhang + * @date: 2023/4/11 7:06 PM + */ + List list(Integer pageNo, Integer pageSize); +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index f51705afdd..49c9350819 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -187,6 +187,7 @@ public class ArticleServiceImpl extends BaseServiceImpl draftContentList = null; if (StringUtils.isNotBlank(fromDTO.getDraftId())) { draftEntity = this.checkDraftStatus(fromDTO.getDraftId()); + draftEntity.setCategory(fromDTO.getCategory()); draftEntity.setTitle(StringUtils.isBlank(fromDTO.getTitle()) ? "" : fromDTO.getTitle()); buildPreviewContent(fromDTO, draftEntity); draftDao.updateById(draftEntity); @@ -212,6 +213,7 @@ public class ArticleServiceImpl extends BaseServiceImpl publishRangeEntityList = buildDraftPublishRange(draftEntity, tokenDto, fromDTO); - - + // 栏目 + draftEntity.setCategory(fromDTO.getCategory()); executeSaveDraftAttr(draftEntity, coverEntity, publishRangeEntityList); return true; } @@ -933,6 +935,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); article.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); article.setPublisherId(formDTO.getPublisher()); @@ -1617,6 +1621,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); draft.setPublisherId(StringUtils.isBlank(formDTO.getPublisher()) ? "" : formDTO.getPublisher()); draft.setPublishDate(StringUtils.isBlank(formDTO.getPublishDate()) ? null : DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); @@ -1841,6 +1846,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); articleEntity.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); articleEntity.setPublisherId(formDTO.getPublisher()); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java new file mode 100644 index 0000000000..e48f6fd893 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java @@ -0,0 +1,149 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.dao.CategoryDictDao; +import com.epmet.dto.CategoryDictDTO; +import com.epmet.entity.CategoryDictEntity; +import com.epmet.service.CategoryDictService; +import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RLock; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 文章栏目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-11 + */ +@Service +public class CategoryDictServiceImpl extends BaseServiceImpl implements CategoryDictService { + + @Autowired + private DistributedLock distributedLock; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CategoryDictDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CategoryDictDTO.class); + } + + 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); + + return wrapper; + } + + @Override + public CategoryDictDTO get(String id) { + CategoryDictEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CategoryDictDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CategoryDictDTO dto) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + // 重名检查,客户下不能重名 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CategoryDictEntity::getCustomerId, customerId); + query.eq(CategoryDictEntity::getCategoryName, dto.getCategoryName()); + + // 加锁 + RLock lock = distributedLock.getLock("voice:categorydict"); + try { + if (baseDao.selectCount(query) > 0) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "栏目名称已存在"); + } + + dto.setCustomerId(customerId); + CategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, CategoryDictEntity.class); + insert(entity); + + } catch (EpmetException ee) { + throw ee; + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【文章】新增文章栏目失败:" + ExceptionUtils.getErrorStackTrace(e)); + } finally { + // 解锁 + lock.unlock(); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CategoryDictDTO dto) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + // 重名检查,客户下不能重名 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CategoryDictEntity::getCustomerId, customerId); + query.eq(CategoryDictEntity::getCategoryName, dto.getCategoryName()); + + RLock lock = distributedLock.getLock("voice:categorydict"); + try { + CategoryDictEntity inDb = null; + // 能查询到一条数据,并且该条数据的ID不是当前修改的这条数据的ID,说明已存在同名的其他标签,该名字已被其他标签占用 + if ((inDb = baseDao.selectOne(query)) != null + && !inDb.getId().equals(dto.getId())) { + + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "栏目名称已存在"); + } + + dto.setCustomerId(customerId); + CategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, CategoryDictEntity.class); + updateById(entity); + + } catch (EpmetException ee) { + throw ee; + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【文章】新增文章栏目失败:" + ExceptionUtils.getErrorStackTrace(e)); + } finally { + // 解锁 + lock.unlock(); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List list(Integer pageNo, Integer pageSize) { + List list = baseDao.selectList(null); + return ConvertUtils.sourceToTarget(list, CategoryDictDTO.class); + } +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index 04b8d0d712..19daac0379 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -7,6 +7,7 @@ SELECT id AS ARTICLE_ID, TITLE, + CATEGORY AS "category", PUBLISHER_NAME, PUBLISH_DATE, ( SELECT count( 1 ) FROM article_visit_record avr WHERE avr.DEL_FLAG = '0' AND avr.ARTICLE_ID =#{articleId}) AS VISIT_RECORD_COUNT, @@ -51,6 +52,7 @@ + select t.TYPE_KEY actTypeKey + , t.TYPE_NAME name + , count(*) as value + from ic_party_act a + inner join ic_party_act_type_dict t on (a.ACT_TYPE = t.TYPE_KEY and t.DEL_FLAG = 0) + where a.DEL_FLAG = 0 + and a.CUSTOMER_ID = #{customerId} + and a.ORG_ID_PATH like CONCAT(#{orgIdPath}, '%') + group by t.TYPE_KEY + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml index 410a074121..0f096e641d 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml @@ -249,4 +249,48 @@ ORDER BY org_pids ASC + + + + + + + + + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml index a9d4f8c583..b33c53a9d0 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml @@ -35,8 +35,9 @@ + - SELECT * FROM ( diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java index 9679258c91..d5f763ceb4 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form.resi; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; /** @@ -8,7 +9,7 @@ import lombok.Data; * @Date 2023/4/11 17:03 */ @Data -public class ResiPortrayalCommonFormDTO { +public class ResiPortrayalCommonFormDTO extends PageFormDTO { /** * /gov/org/customeragency/agencygridtree返回的agencyId */ @@ -17,5 +18,16 @@ public class ResiPortrayalCommonFormDTO { * /gov/org/customeragency/agencygridtree返回level=grid时,orgType:grid;其他情况orgType:agency */ private String orgType; + + /** + * 查询居民列表 + * 年龄饼图/学历饼图返回的code + */ + private String code; + /** + * 学历:education + * 年龄:age + */ + private String codeType; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java new file mode 100644 index 0000000000..ea9ceb1135 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java @@ -0,0 +1,123 @@ +package com.epmet.dto.result.resi; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +/** + * @Description 烟台居民画像,居民列表 + * @Author yzm + * @Date 2023/4/12 10:10 + */ +@Data +public class ResiPortrayalDetailDTO { + /** + * 居民id + */ + @ExcelIgnore + private String icResiUserId; + + @ExcelIgnore + private String gridId; + + @ExcelIgnore + // @ExcelProperty(value = "所属网格") + // @ColumnWidth(30) + private String gridName; + + /** + * 所属小区ID + */ + @ExcelIgnore + private String villageId; + @ExcelIgnore + private String villageName; + /** + * 所属楼宇Id + */ + @ExcelIgnore + private String buildId; + @ExcelIgnore + private String buildName; + /** + * 单元id + */ + @ExcelIgnore + private String unitId; + @ExcelIgnore + private String unitName; + + /** + * 所属家庭Id + */ + @ExcelIgnore + private String homeId; + + @ExcelIgnore + // @ExcelProperty(value = "所属房屋") + // @ColumnWidth(30) + private String homeName; + + /** + * 所属家庭号 + * 101 + */ + @ExcelIgnore + private String doorName; + + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + @ColumnWidth(25) + private String name; + /** + * 手机号 + */ + @ExcelProperty(value = "手机号") + @ColumnWidth(25) + private String mobile; + /** + * 性别:1男;2女;0未知 + */ + @ExcelIgnore + private String gender; + /** + * 性别名称 + */ + @ExcelProperty(value = "性别") + @ColumnWidth(10) + private String genderName; + /** + * 身份证 + */ + @ExcelProperty(value = "身份证号") + @ColumnWidth(25) + private String idCard; + + @ExcelProperty(value = "出生日期") + @ColumnWidth(25) + private String birthday; + + /** + * 年龄 + */ + @ExcelProperty(value = "年龄") + @ColumnWidth(10) + private Integer age; + /** + * 学历key + */ + @ExcelIgnore + private String educationCode; + /** + * 学历 + */ + @ExcelProperty(value = "学历") + @ColumnWidth(10) + private String educationName; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResult.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResult.java new file mode 100644 index 0000000000..f545e23bae --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResult.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result.resi; + +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2023/4/19 17:26 + */ +@Data +public class ResiPortrayalResult { + private Integer total; + private List list; +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index e0e653a016..03284d5fe7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -63,7 +63,8 @@ import com.epmet.dto.form.resi.ResiPortrayalCommonFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; -import com.epmet.dto.result.resi.ResiPortrayalResultDTO; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResult; import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.PartyMemberAgeExportExcel; import com.epmet.excel.PartyMemberEducationExportExcel; @@ -465,7 +466,6 @@ public class IcResiUserController implements ResultDataResolver { /** * desc: 导出居民信息 * - * @param customerId * @param tokenDto * @param pageFormDTO * @param response @@ -620,7 +620,6 @@ public class IcResiUserController implements ResultDataResolver { * * @param tokenDto * @param pageFormDTO - * @param response * @return void * @author LiuJanJun * @date 2021/11/19 4:24 下午 @@ -1451,7 +1450,6 @@ public class IcResiUserController implements ResultDataResolver { /** * Desc: 居民首次进入小程序,可以根据输入身份证信息查询在数字社区居民信息中的网格,匹配不成功提示 - * @param tokenDto * @param formDTO * @author zxc * @date 2022/8/5 11:17 @@ -1538,8 +1536,8 @@ public class IcResiUserController implements ResultDataResolver { * @return */ @PostMapping("age-distribute") - public Result> queryAgeDistribute(@RequestBody ResiPortrayalCommonFormDTO formDTO) { - return new Result>().ok(icResiUserService.queryAgeDistribute(formDTO.getOrgId(), formDTO.getOrgType())); + public Result queryAgeDistribute(@LoginUser TokenDto tokenDto, @RequestBody ResiPortrayalCommonFormDTO formDTO) { + return new Result().ok(icResiUserService.queryAgeDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType())); } /** @@ -1551,9 +1549,73 @@ public class IcResiUserController implements ResultDataResolver { * @return */ @PostMapping("education-distribute") - public Result> queryEducationDistribute(@LoginUser TokenDto tokenDto,@RequestBody ResiPortrayalCommonFormDTO formDTO) { - return new Result>().ok(icResiUserService.queryEducationDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType())); + public Result queryEducationDistribute(@LoginUser TokenDto tokenDto,@RequestBody ResiPortrayalCommonFormDTO formDTO) { + return new Result().ok(icResiUserService.queryEducationDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType())); } + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 居民画像,居民列表 + * + * @param tokenDto + * @param formDTO + * @return + */ + @MaskResponse(fieldNames = {"mobile", "idCard"},fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) + @PostMapping("portrayal-list") + public Result> queryPortrayalResiList(@LoginUser TokenDto tokenDto, @RequestBody ResiPortrayalCommonFormDTO formDTO) { + return new Result>().ok(icResiUserService.queryPortrayalResiList(tokenDto.getCustomerId(), tokenDto.getUserId(), + formDTO.getPageNo(), formDTO.getPageSize(), + formDTO.getOrgId(), formDTO.getOrgType(), + formDTO.getCodeType(), + formDTO.getCode())); + } + + /** + * 11、导出列表数据 + * + * @param response + * @param formDTO + * @throws Exception + */ + @PostMapping("portrayal-listexport") + public void exportMonitoringEquipment(HttpServletResponse response, + @RequestBody ResiPortrayalCommonFormDTO formDTO) throws Exception { + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "居民画像-居民列表" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), ResiPortrayalDetailDTO.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + // 默认查询本组织及下级 + data = icResiUserService.queryPortrayalResiListForExport(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId(), + formDTO.getPageNo(),formDTO.getPageSize(), + formDTO.getOrgId(),formDTO.getOrgType(), + formDTO.getCodeType(),formDTO.getCode()); + list = data.getList(); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("居民画像-居民列表export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index c6693389d6..a3a2f9d40d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -24,6 +24,7 @@ import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.entity.IcResiUserEntity; import org.apache.ibatis.annotations.MapKey; @@ -463,5 +464,26 @@ public interface IcResiUserDao extends BaseDao { */ List queryEducationDistribute(@Param("customerId") String customerId, @Param("orgId") String orgId, - @Param("orgType") String orgType); + @Param("orgType") String orgType, + @Param("orgIdPath")String orgIdPath); + + List selectAgeAgeDistribute(@Param("customerId") String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType, + @Param("orgIdPath")String orgIdPath); + + /** + * @param customerId + * @param orgId + * @param orgType + * @param codeType 学历:education 年龄:age + * @param code + * @return 居民画像,居民列表 + */ + List selectPortrayalResiList(@Param("customerId") String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType, + @Param("orgIdPath") String orgIdPath, + @Param("codeType")String codeType, + @Param("code") String code); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index ef2a04d8d9..090c56560f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -28,7 +28,8 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; -import com.epmet.dto.result.resi.ResiPortrayalResultDTO; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResult; import com.epmet.entity.IcResiUserEntity; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; @@ -555,11 +556,13 @@ public interface IcResiUserService extends BaseService { * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 * 居民年龄分布饼图 * + * @param customerId + * @param staffId * @param orgId * @param orgType * @return */ - List queryAgeDistribute(String orgId, String orgType); + ResiPortrayalResult queryAgeDistribute(String customerId, String staffId, String orgId, String orgType); /** * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 @@ -570,5 +573,33 @@ public interface IcResiUserService extends BaseService { * @param orgType agency/grid * @return */ - List queryEducationDistribute(String customerId,String staffId,String orgId, String orgType); + ResiPortrayalResult queryEducationDistribute(String customerId, String staffId, String orgId, String orgType); + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 居民画像,居民列表 + * + * @return + */ + PageData queryPortrayalResiList(String customerId, String staffId, + Integer pageNo, Integer pageSize, + String orgId, String orgType, + String codeType,String code); + + /** + * 导出居民画像,居民列表调用此方法。只导出列表信息 + * @param customerId + * @param staffId + * @param pageNo + * @param pageSize + * @param orgId + * @param orgType + * @param codeType + * @param code + * @return + */ + PageData queryPortrayalResiListForExport(String customerId, String staffId, + Integer pageNo, Integer pageSize, + String orgId, String orgType, + String codeType,String code); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 3c56aa244d..d87b068e73 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -62,6 +62,8 @@ import com.epmet.dto.result.*; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResult; import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.entity.*; import com.epmet.enums.RenHuConditionEnum; @@ -3906,18 +3908,74 @@ public class IcResiUserServiceImpl extends BaseServiceImpl queryAgeDistribute(String orgId, String orgType) { - // todo - + public ResiPortrayalResult queryAgeDistribute(String customerId, String staffId, String orgId, String orgType) { + ResiPortrayalResult result=new ResiPortrayalResult(); + if (StringUtils.isBlank(orgId)) { + orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); + orgType = OrgTypeEnum.AGENCY.getCode(); + } + String orgIdPath=StrConstant.EPMETY_STR; + if(OrgTypeEnum.AGENCY.getCode().equals(orgType)){ + orgIdPath=CustomerOrgRedis.getOrgIdPath(orgId,orgType); + } + List resultList=getDefaultAgeDistribute(); + List list=baseDao.selectAgeAgeDistribute(customerId,orgId,orgType,orgIdPath); + if(CollectionUtils.isEmpty(list)){ + result.setTotal(NumConstant.ZERO); + result.setList(resultList); + return result; + } + Map resultMap = list.stream().collect(Collectors.toMap(ResiPortrayalResultDTO::getCode,ResiPortrayalResultDTO::getTotalResi)); + int total=NumConstant.ZERO; + for(ResiPortrayalResultDTO resultDto:resultList){ + if (MapUtils.isNotEmpty(resultMap) && resultMap.containsKey(resultDto.getCode())) { + resultDto.setTotalResi(resultMap.get(resultDto.getCode())); + } + total+=resultDto.getTotalResi(); + } + result.setTotal(total); + result.setList(resultList); + return result; + } - return null; + private List getDefaultAgeDistribute() { + List list = new ArrayList<>(); + for (int code = 0; code <= 4; code++) { + ResiPortrayalResultDTO resultDTO = new ResiPortrayalResultDTO(); + resultDTO.setTotalResi(NumConstant.ZERO); + resultDTO.setCode(String.valueOf(code)); + switch (code) { + case 0: + resultDTO.setCodeName("50岁以下"); + break; + case 1: + resultDTO.setCodeName("50-59岁"); + break; + case 2: + resultDTO.setCodeName("60-69岁"); + break; + case 3: + resultDTO.setCodeName("70-79岁"); + break; + case 4: + resultDTO.setCodeName("80岁以上"); + break; + default: + resultDTO.setCodeName(StrConstant.EPMETY_STR); + } + list.add(resultDTO); + } + return list; } + /** * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 @@ -3928,7 +3986,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl queryEducationDistribute(String customerId, String staffId, String orgId, String orgType) { + public ResiPortrayalResult queryEducationDistribute(String customerId, String staffId, String orgId, String orgType) { + ResiPortrayalResult result=new ResiPortrayalResult(); if (StringUtils.isBlank(orgId)) { orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); orgType = OrgTypeEnum.AGENCY.getCode(); @@ -3940,23 +3999,138 @@ public class IcResiUserServiceImpl extends BaseServiceImpl totalList = baseDao.queryEducationDistribute(customerId, orgId, orgType); + List totalList = baseDao.queryEducationDistribute(customerId, orgId, orgType,orgIdPath); Map map = totalList.stream().collect(Collectors.toMap(ResiPortrayalResultDTO::getCode,ResiPortrayalResultDTO::getTotalResi)); List resultDTOList = new ArrayList<>(); - dictResult.getData().forEach(dict -> { + int total=NumConstant.ZERO; + for (DictListResultDTO dict : dictResult.getData()) { ResiPortrayalResultDTO resultDTO = new ResiPortrayalResultDTO(); resultDTO.setCode(dict.getValue()); resultDTO.setCodeName(dict.getLabel()); resultDTO.setTotalResi(NumConstant.ZERO); - if(MapUtils.isNotEmpty(map)&&map.containsKey(dict.getValue())){ + if (MapUtils.isNotEmpty(map) && map.containsKey(dict.getValue())) { resultDTO.setTotalResi(map.get(dict.getValue())); } resultDTOList.add(resultDTO); - }); - return resultDTOList; + total += resultDTO.getTotalResi(); + } + result.setTotal(total); + result.setList(resultDTOList); + return result; } + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 居民画像,居民列表 + * + * @param customerId + * @param staffId + * @param pageNo + * @param pageSize + * @param orgId + * @param orgType + * @param codeType 学历:education 年龄:age + * @param code:年龄饼图/学历饼图返回的code + * @return + */ + @Override + public PageData queryPortrayalResiList(String customerId, String staffId, + Integer pageNo, Integer pageSize, + String orgId, String orgType, + String codeType, + String code) { + // 获取文化程度字典 + DictListFormDTO dictFormDTO = new DictListFormDTO(); + dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode()); + Result> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); + if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败"); + } + Map educationMap = dictResult.getData().stream().collect(Collectors.toMap(DictListResultDTO::getValue, DictListResultDTO::getLabel)); + if (StringUtils.isBlank(orgId)) { + orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); + orgType = OrgTypeEnum.AGENCY.getCode(); + } + String orgIdPath=StrConstant.EPMETY_STR; + if(OrgTypeEnum.AGENCY.getCode().equals(orgType)){ + orgIdPath=CustomerOrgRedis.getOrgIdPath(orgId,orgType); + } + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.selectPortrayalResiList(customerId, orgId, orgType,orgIdPath,codeType, code); + if(CollectionUtils.isNotEmpty(list)){ + Set houseIds=list.stream().map(m -> m.getHomeId()).collect(Collectors.toSet()); + //查询房子名称 + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); + List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); + Map houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); + + list.forEach(resi -> { + // 学历名称 + resi.setEducationName(educationMap.get(resi.getEducationCode())); + GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(resi.getGridId()); + if (null != gridInfoCache) { + resi.setGridName(gridInfoCache.getGridNamePath()); + } + if (houseInfoMap.containsKey(resi.getHomeId()) && null != houseInfoMap.get(resi.getHomeId())) { + HouseInfoDTO houseInfoDTO = houseInfoMap.get(resi.getHomeId()); + String buildName = StringUtils.isNotBlank(houseInfoDTO.getBuildingName()) ? houseInfoDTO.getBuildingName() : StrConstant.EPMETY_STR; + resi.setBuildName(buildName); + + String neighBorName = StringUtils.isNotBlank(houseInfoDTO.getNeighborHoodName()) ? houseInfoDTO.getNeighborHoodName() : StrConstant.EPMETY_STR; + resi.setVillageName(neighBorName); + + String unitName = StringUtils.isNotBlank(houseInfoDTO.getUnitName()) ? houseInfoDTO.getUnitName() : StrConstant.EPMETY_STR; + resi.setUnitName(unitName); + + String doorName = StringUtils.isNotBlank(houseInfoDTO.getDoorName()) ? houseInfoDTO.getDoorName() : StrConstant.EPMETY_STR; + resi.setDoorName(doorName); + resi.setHomeName(neighBorName.concat(buildName).concat(unitName).concat(doorName)); + } + }); + } + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(), pageSize); + } + + @Override + public PageData queryPortrayalResiListForExport(String customerId, String staffId, + Integer pageNo, Integer pageSize, + String orgId, String orgType, + String codeType, + String code) { + // 获取文化程度字典 + DictListFormDTO dictFormDTO = new DictListFormDTO(); + dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode()); + Result> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); + if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败"); + } + Map educationMap = dictResult.getData().stream().collect(Collectors.toMap(DictListResultDTO::getValue, DictListResultDTO::getLabel)); + + if (StringUtils.isBlank(orgId)) { + orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); + orgType = OrgTypeEnum.AGENCY.getCode(); + } + String orgIdPath=StrConstant.EPMETY_STR; + if(OrgTypeEnum.AGENCY.getCode().equals(orgType)){ + orgIdPath=CustomerOrgRedis.getOrgIdPath(orgId,orgType); + } + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.selectPortrayalResiList(customerId, orgId, orgType,orgIdPath,codeType, code); + if(CollectionUtils.isNotEmpty(list)){ + list.forEach(resi -> { + // 学历名称 + resi.setEducationName(educationMap.get(resi.getEducationCode())); + }); + } + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(), pageSize); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 52930c1242..4cfde975f4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -365,7 +365,17 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl selecUserBaseInfoByUserId(String userId) { - return new Result().ok(baseDao.selecUserBaseInfoByUserId(userId)); + ResiUserBaseInfoResultDTO resultDTO=baseDao.selecUserBaseInfoByUserId(userId); + // start + // 2023.04.18烟台需求增加 + // 用于完善信息界面展示 + if (null != resultDTO) { + RegisterRelationEntity registerRelation = registerRelationDao.selectRegisteredGridIdByUserId(userId); + if (null != registerRelation) { + resultDTO.setGridId(registerRelation.getGridId()); + } + }// end + return new Result().ok(resultDTO); } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 07278b80aa..5db97e1f5e 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -125,7 +125,47 @@ - and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} <= #{subCondition.columnValue[1]} + + + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) <= #{subCondition.columnValue[1]} + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + @@ -180,7 +220,47 @@ - and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} <= #{subCondition.columnValue[1]} + + + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) <= #{subCondition.columnValue[1]} + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + @@ -1526,7 +1606,7 @@ r.DEL_FLAG = '0' AND r.CUSTOMER_ID = #{customerId} - AND ( r.AGENCY_ID = #{orgId} OR r.PIDS LIKE concat('%',#{orgId},'%') ) + and r.PIDS LIKE concat(#{orgIdPath},'%') and r.GRID_ID = #{orgId} @@ -1538,5 +1618,98 @@ r.CULTURE + + + +