Browse Source

Merge remote-tracking branch 'origin/dev' into dev

master
wxz 3 years ago
parent
commit
35e59a0641
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 5
      epmet-commons/epmet-commons-tools/pom.xml
  3. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyOrgTypeEnum.java
  4. 49
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java
  5. 24
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java
  6. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java
  7. 33
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/ChooseGridFormDTO.java
  8. 13
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java
  9. 13
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java
  10. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  11. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java
  12. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  13. 75
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java
  14. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  15. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  16. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  17. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java
  18. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  19. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  20. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java
  21. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  22. 33
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  23. 110
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  24. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  25. 57
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java
  26. 218
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  27. 65
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  28. 24
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml
  29. 94
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  30. 77
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml
  31. 74
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/CategoryDictDTO.java
  32. 3
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java
  33. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java
  34. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java
  35. 3
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java
  36. 4
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java
  37. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java
  38. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java
  39. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/OfflineListResultDTO.java
  40. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java
  41. 72
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java
  42. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java
  43. 16
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/CategoryDictDao.java
  44. 9
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java
  45. 44
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/CategoryDictEntity.java
  46. 9
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java
  47. 88
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java
  48. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  49. 149
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java
  50. 4
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml
  51. 21
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/CategoryDictDao.xml
  52. 2
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml
  53. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  54. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  55. 12
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  56. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java
  57. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  58. 20
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  59. 11
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java
  60. 13
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java
  61. 10
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/IcPartyMemberDTO.java
  62. 33
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyActQtyStatsResultDTO.java
  63. 15
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyActTypeAndQtyResultDTO.java
  64. 17
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyOrgCategoryResultDTO.java
  65. 60
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyOrgTreeResultDTO.java
  66. 27
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActDao.java
  67. 22
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java
  68. 120
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/LingShanScreenController.java
  69. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java
  70. 3
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/IcPartyMemberEntity.java
  71. 68
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/LingShanScreenService.java
  72. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java
  73. 323
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/LingShanScreenServiceImpl.java
  74. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberBaseInfoServiceImpl.java
  75. 27
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActDao.xml
  76. 44
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml
  77. 3
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml
  78. 14
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java
  79. 123
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java
  80. 17
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResult.java
  81. 78
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  82. 24
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  83. 37
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  84. 194
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  85. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  86. 179
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

2
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配置

5
epmet-commons/epmet-commons-tools/pom.xml

@ -197,6 +197,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>3.1.322</version>
</dependency>
</dependencies>
<build>

15
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;
}
}

49
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();
}
}
}

24
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();
}
}
}

4
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;

33
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;
}

13
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;
}

13
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;
}

8
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<java.util.List < com.epmet.dto.result.AgencyCountCensusResultDTO>>
* @Author: lichao
* @Date: 2023/4/7 14:48
*/
@GetMapping("getAgencyCountList")
public Result<List<AgencyCountCensusResultDTO>> getAgencyCountList(@RequestParam String agencyId){
return new Result<List<AgencyCountCensusResultDTO>>().ok(customerAgencyService.getAgencyCountList(agencyId));
@PostMapping("getAgencyCountList")
public Result<List<AgencyCountCensusResultDTO>> getAgencyCountList(@RequestBody CommunityCountCensusFormDTO dto){
return new Result<List<AgencyCountCensusResultDTO>>().ok(customerAgencyService.getAgencyCountList(dto));
}
/**

2
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();
// 背景设置为红色

7
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<List<BuildingResultDTO>> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody IcNeighborHoodDTO dto) {
return new Result<List<BuildingResultDTO>>().ok(icNeighborHoodService.getNeighborhoodList(tokenDto, dto));
public Result<List<BuildingResultDTO>> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody ChooseGridFormDTO dto) {
ValidatorUtils.validateEntity(dto, ChooseGridFormDTO.AddUserInternalGroup.class);
dto.setCustomerId(tokenDto.getCustomerId());
return new Result<List<BuildingResultDTO>>().ok(icNeighborHoodService.getNeighborhoodList(dto));
}
/**

75
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<PageData<CommunityLoginResultDTO>>().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<CommunityLoginResultDTO> data = null;
List<CommunityLoginResultDTO> 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<Object> 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<PageData<CommunityLoginResultDTO>> streetTotal(@RequestBody CommunityLoginFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,CommunityLoginFormDTO.StreetTotalShowGroup.class);
return new Result<PageData<CommunityLoginResultDTO>>().ok(staffLoginLogService.streetTotal(formDTO.getOrgId(),
formDTO.getStartDate(),
formDTO.getEndDate(),
formDTO.getPageNo(), formDTO.getPageSize()));
}
/***
* 获取当前agencyid下 下级组织活跃情况
* @param formDTO
@ -141,11 +210,9 @@ public class StaffLoginLogController {
PageData<AccountActivityInfo> res = staffLoginLogService.getAccountActivityInfo(formDTO);
if (!CollectionUtils.isEmpty(res.getList())) {
if("1".equals(formDTO.getIsActivity())){
// List<AccountActivityExcel> accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountActivityExcel.class);
ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountActivityExcel.class);
ExcelUtils.exportExcelToTarget(response, "社区活跃数据", res.getList(), AccountActivityExcel.class);
}else {
// List<AccountInactivityExcel> accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountInactivityExcel.class);
ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountInactivityExcel.class);
ExcelUtils.exportExcelToTarget(response, "社区不活跃数据", res.getList(), AccountInactivityExcel.class);
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -434,11 +434,13 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
*/
List<AgencyResultDTO> getAllCommunity(String customerId);
List<AgencyCountCensusResultDTO> agencyCount(@Param("pids") String pids);
List<AgencyCountCensusResultDTO> 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);

7
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<IcBuildingEntity> {
/**
* 展示所有楼栋和小区信息
*
* @param dto
* @return java.util.List<com.epmet.dto.result.BuildingResultDTO>
* @author zhy
* @date 2022/8/19 17:32
*/
List<BuildingResultDTO> listBuildingInfo(IcNeighborHoodDTO dto);
List<BuildingResultDTO> listBuildingInfo(@Param("customerId")String customerId,
@Param("agencyId")String agencyId,
@Param("gridId") String gridId,
@Param("buildingName")String buildingName);
/**

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java

@ -220,9 +220,9 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
*/
List<GroupRentHouseResultDTO> selectGroupRentHouseList(GroupRentHouseFormDTO formDTO);
List<HouseCountPictureListResultDTO> getHousePurposeCount(@Param("orgId") String orgId, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
List<HouseCountPictureListResultDTO> getHousePurposeCount(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
List<HouseCountPictureListResultDTO> getHouseStatusCount(@Param("orgId") String orgId, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
List<HouseCountPictureListResultDTO> getHouseStatusCount(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
List<HousePictureListResultDTO> getHousePictureList(@Param("orgId") String orgId, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd,@Param("purpose") String purpose,@Param("rentFlag") Integer rentFlag);
List<HousePictureListResultDTO> 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);
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java

@ -27,12 +27,17 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
* @param orgId
* @param startDate
* @param endDate
* @param dataRange exclude_zero:不展示登录次数为0的社区 all全部展示
* @return
*/
List<CommunityLoginResultDTO> pageCommunityCount(@Param("orgId") String orgId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
@Param("endDate") Date endDate,
@Param("dataRange")String dataRange);
List<CommunityLoginResultDTO> selectCommunityCount(@Param("orgId") String orgId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
/**
* 柱状图下级组织账号登录次数汇总
*
@ -72,4 +77,10 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
ActivityTatalInfo selectOneActivityTotal(CountActivityFormDTO formDTO);
Integer selectLoginTotalByPath(@Param("orgIdPath") String orgIdPath,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
List<CommunityLoginResultDTO> selectStreetTotal(@Param("orgId") String orgId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -368,10 +368,10 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
/**
* 返回下级数量
* @param agencyId
* @param dto
* @return
*/
List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId);
List<AgencyCountCensusResultDTO> getAgencyCountList(CommunityCountCensusFormDTO dto);
/**
* @Description: 获取下级组织的社区数量

5
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<IcNeighborHoodEntity>
/**
* 获取用户组织下小区列表
*
* @param tokenDto
* @param dto
* @return java.util.List<com.epmet.dto.BuildingResultDTO>
* @author zhy
* @date 2022/8/19 15:57
*/
List<BuildingResultDTO> getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto);
List<BuildingResultDTO> getNeighborhoodList(ChooseGridFormDTO dto);
/**
* @Description 通过ID查询小区信息

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java

@ -84,6 +84,12 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
*/
PageData<CommunityLoginResultDTO> streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize);
/**
* 柱状图点击区县查看街道调用此接口
* 计算的是街道的工作人员+街道下所有社区的人 的总次数
* @return
*/
PageData<CommunityLoginResultDTO> streetTotal(String orgId, Date startDate, Date endDate, Integer pageNo, Integer pageSize);
/***
* 获取登陆情况
* @param formDTO

9
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<String> currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null);
List<String> currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null);*/
// List<String> 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);

33
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<CustomerAgencyDao
/**
* @Description:
* @param agencyId:
* @param dto:
* @Return java.util.List<com.epmet.dto.result.AgencyCountCensusResultDTO>
* @Author: lichao
* @Date: 2023/4/7 14:17
*/
@Override
public List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId) {
public List<AgencyCountCensusResultDTO> getAgencyCountList(CommunityCountCensusFormDTO dto) {
List<AgencyCountCensusResultDTO> agencyCountCensusResultDTOS = new ArrayList<>();
CustomerAgencyEntity customerAgency = baseDao.selectById(agencyId);
CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId());
if (customerAgency != null){
Map<String,String> 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;
}

110
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<IcHouseDao, IcHouseEntit
HouseCountPictureResultDTO resultDTO = new HouseCountPictureResultDTO();
Map<String,String> 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<HouseCountPictureListResultDTO> 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<IcHouseDao, IcHouseEntit
HouseCountPictureResultDTO resultDTO = new HouseCountPictureResultDTO();
Map<String,String> 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<HouseCountPictureListResultDTO> 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<IcHouseDao, IcHouseEntit
public PageData<HousePictureListResultDTO> getHousePictureList(HouseCountPictureFormDTO dto) {
// 列表/导出查询
PageHelper.startPage(dto.getPageNo(), dto.getPageSize());
List<HousePictureListResultDTO> 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<HousePictureListResultDTO> list = baseDao.getHousePictureList(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd(),dto.getPurpose(),dto.getRentFlag());
list.forEach(entity->{
String[] agencyIds = entity.getOrgIdPath().split(":");

9
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<IcNeighborHoodDao
}).collect(Collectors.toList());
}
public List<BuildingResultDTO> getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto) {
dto.setCustomerId(tokenDto.getCustomerId());
public List<BuildingResultDTO> 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<IcNeighborHoodDao
// }
// dto.setAgencyId(result.getAgencyId());
// }
return icBuildingDao.listBuildingInfo(dto);
PageHelper.startPage(dto.getPageNo(), dto.getPageSize());
List<BuildingResultDTO> list = icBuildingDao.listBuildingInfo(dto.getCustomerId(), dto.getAgencyId(), dto.getGridId(), dto.getBuildingName());
return list;
}
/**

57
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<StaffLoginLogDao, StaffLoginLogEntity> implements StaffLoginLogService {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private CustomerAgencyDao customerAgencyDao;
/**
@ -189,8 +195,8 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
if (formDTO.getIsPage()) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<AccountActivityInfo> accountActivityInfos = baseDao.selectListActivityInfo(formDTO);
int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size();
return new PageData<>(accountActivityInfos, total);
PageInfo<AccountActivityInfo> pageInfo = new PageInfo<>(accountActivityInfos);
return new PageData<>(accountActivityInfos, pageInfo.getTotal(),formDTO.getPageSize());
}
List<AccountActivityInfo> accountActivityInfos = baseDao.selectListActivityInfo(formDTO);
int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size();
@ -217,12 +223,12 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
}
if (formDTO.getIsPage()) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate());
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate(),formDTO.getDataRange());
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(), formDTO.getPageSize());
}
// 不分页
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate());
List<CommunityLoginResultDTO> 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<StaffLoginLogDao,
if (StringUtils.isBlank(orgId)) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
orgId = staffInfoCacheResult.getAgencyId();
level=staffInfoCacheResult.getLevel();
}
if(Constant.COMMUNITY.equals(level)){
//如果是社区,返回自己
List<CommunityLoginResultDTO> list = baseDao.selectCommunityCount(orgId, startDate, endDate);
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size();
return new PageData<CommunityLoginResultDTO>(list, total, total);
}
List<CommunityLoginResultDTO> list = baseDao.querySubCount(orgId, startDate, endDate);
//先查询出下级组织
LambdaQueryWrapper<CustomerAgencyEntity> agencyWrapper=new LambdaQueryWrapper<>();
agencyWrapper.eq(CustomerAgencyEntity::getPid,orgId).orderByAsc(CustomerAgencyEntity::getCreatedTime);
List<CustomerAgencyEntity> subAgencyList=customerAgencyDao.selectList(agencyWrapper);
List<CommunityLoginResultDTO> 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<CommunityLoginResultDTO> list = baseDao.querySubCount(orgId, startDate, endDate);
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size();
return new PageData<CommunityLoginResultDTO>(list, total, total);
}
@ -307,4 +336,20 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size();
return new PageData<>(list, total, total);
}
/**
* 柱状图点击区县查看街道调用此接口
* 计算的是街道的工作人员+街道下所有社区的人 的总次数
* @return
*/
@Override
public PageData<CommunityLoginResultDTO> streetTotal(String orgId, Date startDate, Date endDate,Integer pageNo, Integer pageSize){
PageHelper.startPage(pageNo, pageSize);
// todo
List<CommunityLoginResultDTO> list = baseDao.selectStreetTotal(orgId, startDate, endDate);
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(), pageSize);
}
}

218
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},'%')
<if test="timeStart != null">
and UPDATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and UPDATED_TIME &lt;= #{timeEnd}
</if>
group by level
</select>
<select id="communityCount" resultType="java.lang.Integer">
select count(1)
from customer_agency agency
where agency.DEL_FLAG = 0
and agency.LEVEL = 'community'
and agency.PIDS like concat(#{pids},'%')
</select>
<select id="agencyGridCount" resultType="java.lang.Integer">
select count(*)
from customer_grid
where DEL_FLAG = 0
and PIDS like concat(#{pids},'%')
<if test="timeStart != null">
and UPDATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and UPDATED_TIME &lt;= #{timeEnd}
</if>
</select>
@ -911,6 +933,12 @@
and
staff.DEL_FLAG = 0
and agency.PIDS like concat(#{pids},'%')
<if test="timeStart != null">
and agency.UPDATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and agency.UPDATED_TIME &lt;= #{timeEnd}
</if>
</select>
@ -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'
<if test="endDate != null">
and csa.CREATED_TIME <![CDATA[<]]> #{endDate}
</if>
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>
<select id="getCurrentUserCommunityInfo"
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName
from customer_agency
where DEL_FLAG = 0
and LEVEL = 'community'
AND CUSTOMER_ID = #{customerId}
<if test="staffAgencyId != null and staffAgencyId != ''">
AND (PIDS like concat('%',#{staffAgencyId},'%') or ID = #{staffAgencyId})
, count(ca.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'
<if test="endDate != null">
and ca.CREATED_TIME <![CDATA[<]]> #{endDate}
</if>
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>
<select id="getCurrentUserCommunityInfo"
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName
from customer_agency
where DEL_FLAG = 0
and LEVEL = 'community'
AND CUSTOMER_ID = #{customerId}
<if test="staffAgencyId != null and staffAgencyId != ''">
AND (PIDS like concat('%',#{staffAgencyId},'%') or ID = #{staffAgencyId})
</if>
</select>
<select id="selectAgencyTree" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
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'
</select>
</select>
<select id="selectAgencyTree" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
SELECT
ca.ID as id,
<select id="selectNextOrg" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
(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'
</select>
<select id="selectNextOrg" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
(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.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>
<select id="selectTotalNext" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
sum( t.total )
FROM
(
SELECT
count( a.id ) AS total
FROM
customer_agency a
WHERE
a.PID = #{agencyId}
AND a.DEL_FLAG = '0'
UNION all
SELECT
count( g.id ) AS total
FROM
customer_grid g
WHERE
g.PID = #{agencyId}
AND g.DEL_FLAG = '0'
) t
</select>
<!-- 获取当前客户下所有的社区组织,只返回id,orgIdPath,agencyName -->
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>
<select id="selectTotalNext" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
sum( t.total )
FROM
(
SELECT
count( a.id ) AS total
FROM
customer_agency a
WHERE
a.PID = #{agencyId}
AND a.DEL_FLAG = '0'
UNION all
SELECT
count( g.id ) AS total
FROM
customer_grid g
WHERE
g.PID = #{agencyId}
AND g.DEL_FLAG = '0'
) t
</select>
<!-- 获取当前客户下所有的社区组织,只返回id,orgIdPath,agencyName -->
<select id="getAllCommunity" parameterType="java.lang.String" resultType="com.epmet.dto.result.AgencyResultDTO">
SELECT
ca.id agencyId,
@ -1212,10 +1240,10 @@
and agency.LEVEL = 'community'
and agency.PIDS like concat(#{pids},'%')
<if test="timeStart != null">
and agency.CREATED_TIME &gt;= #{timeStart}
and agency.UPDATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and agency.CREATED_TIME &lt;= #{timeEnd}
and agency.UPDATED_TIME &lt;= #{timeEnd}
</if>
</select>
<select id="getCommunityByPidList" resultType="com.epmet.dto.result.CommunityListByAgencyIdResultDTO">

65
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -507,38 +507,41 @@
<select id="listBuildingInfo" resultType="com.epmet.dto.result.BuildingResultDTO">
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}
<if test="gridId != null and gridId != ''">
AND n.GRID_ID = #{gridId}
</if>
<if test="buildingName != null and buildingName != ''">
AND (n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%') OR b.BUILDING_NAME LIKE CONCAT('%', #{buildingName}, '%'))
</if>
<if test="agencyId != null and agencyId != ''">
AND (
n.AGENCY_ID = #{agencyId}
OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%'))
</if>
n.DEL_FLAG = '0'
AND b.DEL_FLAG = '0'
AND g.DEL_FLAG = '0'
AND a.DEL_FLAG = '0'
AND n.CUSTOMER_ID = #{customerId}
<if test="gridId != null and gridId != ''">
AND n.GRID_ID = #{gridId}
</if>
<if test="buildingName != null and buildingName != ''">
AND n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%')
</if>
<if test="agencyId != null and agencyId != ''">
AND (
n.AGENCY_ID = #{agencyId}
OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%'))
</if>
order by n.CREATED_TIME asc,n.id asc
</select>
<select id="getBuildingInfoByName" resultType="com.epmet.entity.IcBuildingEntity"

24
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml

@ -67,16 +67,28 @@
WHERE
ie.DEL_FLAG = '0'
<if test='"grid" == orgType'>
AND ie.GRID_ID = #{orgId}
<if test='null != orgId and "" != orgId'>
AND ie.GRID_ID = #{orgId}
</if>
</if>
<if test='"agency" == orgType'>
AND (ie.AGENCY_ID = #{orgId} or ie.AGENCY_PIDS like concat('%',#{orgId},'%'))
<if test='null != orgId and "" != orgId'>
AND (ie.AGENCY_ID = #{orgId} or ie.AGENCY_PIDS like concat('%',#{orgId},'%'))
</if>
<if test='null == orgId or "" == orgId'>
AND (
ie.AGENCY_ID = #{staffAgencyId}
OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' )
)
</if>
</if>
<if test='null==orgType or "" == orgType'>
AND (
ie.AGENCY_ID = #{staffAgencyId}
OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' )
)
<if test='null != staffAgencyId and "" != staffAgencyId'>
AND (
ie.AGENCY_ID = #{staffAgencyId}
OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' )
)
</if>
</if>
<if test='null != gridId and "" != gridId'>
AND ie.GRID_ID = #{gridId}

94
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -781,8 +781,32 @@
select count(*) as count,PURPOSE as type
from ic_house
where DEL_FLAG = 0
and
ORG_ID_PATH like concat(#{orgId},'%')
<choose>
<when test='orgType == "agency"'>
AND neighbor_hood_id IN (
select a.id from ic_neighbor_hood a
<!-- 排除掉无效组织、网格数据 -->
inner join customer_agency b on a.agency_id = b.id and b.del_flag = '0'
inner join customer_grid c on a.grid_id = c.id and c.del_flag = '0'
where a.del_flag = '0'
and (a.agency_id = #{orgId} OR a.agency_pids LIKE CONCAT('%', #{orgId}, '%'))
)
</when>
<when test='orgType == "grid"'>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and grid_id = #{orgId}
)
</when>
<otherwise>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and id = #{orgId}
)
</otherwise>
</choose>
<if test="timeStart != null">
and CREATED_TIME &gt;= #{timeStart}
</if>
@ -796,8 +820,32 @@
select count(*) as count,RENT_FLAG as type
from ic_house
where DEL_FLAG = 0
and
ORG_ID_PATH like concat(#{orgId},'%')
<choose>
<when test='orgType == "agency"'>
AND neighbor_hood_id IN (
select a.id from ic_neighbor_hood a
<!-- 排除掉无效组织、网格数据 -->
inner join customer_agency b on a.agency_id = b.id and b.del_flag = '0'
inner join customer_grid c on a.grid_id = c.id and c.del_flag = '0'
where a.del_flag = '0'
and (a.agency_id = #{orgId} OR a.agency_pids LIKE CONCAT('%', #{orgId}, '%'))
)
</when>
<when test='orgType == "grid"'>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and grid_id = #{orgId}
)
</when>
<otherwise>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and id = #{orgId}
)
</otherwise>
</choose>
<if test="timeStart != null">
and CREATED_TIME &gt;= #{timeStart}
</if>
@ -816,19 +864,43 @@
left join customer_grid grid on grid.id = hood.GRID_ID
where house.DEL_FLAG = '0'
and
ORG_ID_PATH like concat(#{orgId},'%')
<choose>
<when test='orgType == "agency"'>
AND neighbor_hood_id IN (
select a.id from ic_neighbor_hood a
<!-- 排除掉无效组织、网格数据 -->
inner join customer_agency b on a.agency_id = b.id and b.del_flag = '0'
inner join customer_grid c on a.grid_id = c.id and c.del_flag = '0'
where a.del_flag = '0'
and (a.agency_id = #{orgId} OR a.agency_pids LIKE CONCAT('%', #{orgId}, '%'))
)
</when>
<when test='orgType == "grid"'>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and grid_id = #{orgId}
)
</when>
<otherwise>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and id = #{orgId}
)
</otherwise>
</choose>
<if test="timeStart != null">
and CREATED_TIME &gt;= #{timeStart}
and house.CREATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and CREATED_TIME &lt;= #{timeEnd}
and house.CREATED_TIME &lt;= #{timeEnd}
</if>
<if test="purpose != null and purpose != ''">
and PURPOSE = #{purpose}
and house.PURPOSE = #{purpose}
</if>
<if test="rentFlag != null and rentFlag != ''">
and RENT_FLAG = #{rentFlag}
<if test="rentFlag != null">
and house.RENT_FLAG = #{rentFlag}
</if>

77
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

@ -48,9 +48,43 @@
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
GROUP BY ca.id
<choose>
<when test="null !=dataRange and 'exclude_zero' == dataRange">
GROUP BY ca.id having count( l.id )>0
</when>
<otherwise>
GROUP BY ca.id
</otherwise>
</choose>
order by count(l.id) desc,ca.CREATED_TIME desc
</select>
<!-- 查询某一个社区的登录次数 -->
<select id="selectCommunityCount" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO">
SELECT
ca.id AS agencyId,
d.ORGANIZATION_NAME AS districtName,
s.ORGANIZATION_NAME AS streetName,
ca.ORGANIZATION_NAME AS agencyName,
ca.`LEVEL` AS agencyLevel,
count( l.id ) AS count
FROM customer_agency ca
left JOIN staff_login_log l
ON ( ca.ID =l.AGENCY_ID and l.DEL_FLAG = '0')
LEFT JOIN customer_agency s
ON ( ca.PID = s.ID )
LEFT JOIN customer_agency d
ON ( s.PID = d.ID )
WHERE ca.DEL_FLAG = '0'
AND ca.id = #{orgId}
<if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
</select>
<!--社区活跃列表-->
<select id="selectListActivityInfo" resultType="com.epmet.dto.result.yt.AccountActivityInfo">
SELECT
@ -186,4 +220,45 @@
) t;
</select>
<select id="selectLoginTotalByPath" parameterType="map" resultType="java.lang.Integer">
select
count(l.id)
from staff_login_log l
where l.ORG_ID_PATH like concat(#{orgIdPath},'%')
<if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
</select>
<select id="selectStreetTotal" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO">
SELECT
ca.id AS agencyId,
ca.ORGANIZATION_NAME AS agencyName,
ca.LEVEL AS agencyLevel,
pa.ORGANIZATION_NAME as districtName,
count(l.id) AS count
FROM customer_agency ca
left join staff_login_log l
ON (
(ca.ID =l.AGENCY_ID or ca.id=l.pid)
and l.del_flag='0'
)
left join customer_agency pa
on(ca.pid=pa.id)
WHERE
ca.DEL_FLAG = '0'
and ca.pid=#{orgId}
<if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
GROUP BY ca.id
order by count(l.id) desc
</select>
</mapper>

74
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;
}

3
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
*/

5
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;
/**
* 封面图片地址
*/

5
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;
/**
* 文章标题
*/

3
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;

4
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;
/**
* 文章标题
*/

5
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
*/

5
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;
/**
* 标题
*/

5
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;
/**
* 文章标题
*/

5
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
*/

72
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<CategoryDictDTO>> list(@RequestParam Integer pageNo, @RequestParam Integer pageSize){
List<CategoryDictDTO> list = categoryDictService.list(pageNo, pageSize);
return new Result<List<CategoryDictDTO>>().ok(list);
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<CategoryDictDTO> get(@PathVariable("id") String id){
CategoryDictDTO data = categoryDictService.get(id);
return new Result<CategoryDictDTO>().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();
}
}

2
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<List<DraftListResultDTO>> draftList(@LoginUser TokenDto tokenDto, @RequestBody DraftListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<DraftListResultDTO>>().ok(draftService.draftList(tokenDto, formDTO).getList());

16
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<CategoryDictEntity> {
}

9
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
*/

44
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;
}

9
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;
/**
* 标题审核状态
*/

88
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<CategoryDictEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CategoryDictDTO>
* @author generator
* @date 2023-04-11
*/
PageData<CategoryDictDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CategoryDictDTO>
* @author generator
* @date 2023-04-11
*/
List<CategoryDictDTO> list(Map<String, Object> 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<com.epmet.dto.CategoryDictDTO>
* @author: WangXianZhang
* @date: 2023/4/11 7:06 PM
*/
List<CategoryDictDTO> list(Integer pageNo, Integer pageSize);
}

10
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<ArticleDao, ArticleEntit
List<DraftContentEntity> 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<ArticleDao, ArticleEntit
draftEntity.setGridId("");
draftEntity.setDepartmentId(loginUserDetails.getData().getCustomerId());
draftEntity.setDelFlag(NumConstant.ZERO_STR);
draftEntity.setCategory(fromDTO.getCategory());
buildPreviewContent(fromDTO, draftEntity);
draftDao.insert(draftEntity);
}
@ -306,8 +308,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
DraftCoverEntity coverEntity = buildCoverEntity(tokenDto, fromDTO);
//发布范围
List<DraftPublishRangeEntity> publishRangeEntityList = buildDraftPublishRange(draftEntity, tokenDto, fromDTO);
// 栏目
draftEntity.setCategory(fromDTO.getCategory());
executeSaveDraftAttr(draftEntity, coverEntity, publishRangeEntityList);
return true;
}
@ -933,6 +935,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
article.setId(null);
article.setDraftId(draftId);
article.setStatusFlag(DraftConstant.PUBLISHED);
article.setCategory(draft.getCategory());
if (StringUtils.isNotBlank(publishWay)) {
article.setPublishWay(publishWay);
}
@ -1538,6 +1541,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
if (formDTO.getPublisherType().equals(DraftConstant.GRID)){
article.setGridId(formDTO.getPublisher());
}
article.setCategory(formDTO.getCategory());
article.setPreviewContent(getPreviewContent(formDTO.getContent()).length() > 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<ArticleDao, ArticleEntit
// 1.草稿
DraftEntity draft = ConvertUtils.sourceToTarget(formDTO, DraftEntity.class);
draft.setDepartmentId(customerId);
draft.setCategory(formDTO.getCategory());
draft.setPreviewContent(StringUtils.isBlank(formDTO.getContent()) ? "" : getPreviewContent(formDTO.getContent()).length() > 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<ArticleDao, ArticleEntit
if (formDTO.getPublisherType().equals(DraftConstant.GRID)){
articleEntity.setGridId(formDTO.getPublisher());
}
articleEntity.setCategory(formDTO.getCategory());
articleEntity.setPreviewContent(getPreviewContent(formDTO.getContent()).length() > 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());

149
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<CategoryDictDao, CategoryDictEntity> implements CategoryDictService {
@Autowired
private DistributedLock distributedLock;
@Override
public PageData<CategoryDictDTO> page(Map<String, Object> params) {
IPage<CategoryDictEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CategoryDictDTO.class);
}
@Override
public List<CategoryDictDTO> list(Map<String, Object> params) {
List<CategoryDictEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CategoryDictDTO.class);
}
private QueryWrapper<CategoryDictEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CategoryDictEntity> 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<CategoryDictEntity> 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<CategoryDictEntity> 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<CategoryDictDTO> list(Integer pageNo, Integer pageSize) {
List<CategoryDictEntity> list = baseDao.selectList(null);
return ConvertUtils.sourceToTarget(list, CategoryDictDTO.class);
}
}

4
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 id="selectArticleListForAgency" resultType="com.epmet.dto.result.PublishedListResultDTO">
SELECT
a.ID AS "articleId",
a.CATEGORY AS "category",
a.TITLE AS "title",
IFNULL(a.PREVIEW_CONTENT, "") AS "previewContent",
a.PUBLISHER_NAME AS "publisherName",
@ -135,6 +137,7 @@
SELECT DISTINCT
a.ID AS "articleId",
a.TITLE AS "title",
a.CATEGORY AS "category",
IFNULL(a.PREVIEW_CONTENT, "") AS "previewContent",
a.PUBLISHER_NAME AS "publisherName",
a.OFF_LINE_TIME AS "publishDate"
@ -433,6 +436,7 @@
a.id AS "articleId",
a.org_id AS "agencyId",
a.title AS "title",
a.category AS "category",
IFNULL(a.preview_content, "") AS "previewContent",
a.publish_range_desc AS "publishRangeDesc",
a.publisher_id AS "publisher",

21
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/CategoryDictDao.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.CategoryDictDao">
<resultMap type="com.epmet.entity.CategoryDictEntity" id="categoryDictMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="categoryName" column="CATEGORY_NAME"/>
<result property="pid" column="PID"/>
<result property="sort" column="SORT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

2
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml

@ -135,6 +135,7 @@
SELECT
ID AS "draftId",
TITLE AS "title",
CATEGORY AS "category",
IFNULL(PREVIEW_CONTENT, "") AS "content",
UNIX_TIMESTAMP(CREATED_TIME) AS "createdTime",
STATUS_FLAG AS auditStatus
@ -183,6 +184,7 @@
a.id AS "draftId",
a.org_id AS "agencyId",
a.title AS "title",
a.CATEGORY AS "category",
IFNULL(a.preview_content, "") AS "previewContent",
a.publish_range_desc AS "publishRangeDesc",
a.publisher_id AS "publisher",

10
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java

@ -348,4 +348,14 @@ public interface ResiGroupOpenFeignClient {
**/
@PostMapping("/resi/group/group/partygrouplist/{partyOrgId}")
Result<List<ResiGroupDTO>> partyGroupList(@PathVariable String partyOrgId);
/**
* @description: 使用行政组织查询党小组数量
* @param agencyId: 行政组织单位id
* @return
* @author: WangXianZhang
* @date: 2023/4/14 12:33 PM
*/
@GetMapping("/resi/group/group/partyGroupQuantity/byAgencyId/{agencyId}")
Result<Integer> getPartyGroupQuantityByAgencyId(@PathVariable("agencyId") String agencyId);
}

4
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

@ -253,4 +253,8 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "partyGroupList", partyOrgId);
}
@Override
public Result<Integer> getPartyGroupQuantityByAgencyId(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getPartyGroupQuantityByAgencyId", agencyId);
}
}

12
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -674,5 +674,17 @@ public class ResiGroupController {
return new Result<List<ResiGroupDTO>>().ok(resiGroupService.partyGroupList(partyOrgId));
}
/**
* @description: 使用行政组织查询党小组数量
* @param agencyId: 行政组织单位id
* @return
* @author: WangXianZhang
* @date: 2023/4/14 12:33 PM
*/
@GetMapping("partyGroupQuantity/byAgencyId/{agencyId}")
Result<Integer> getPartyGroupQuantityByAgencyId(@PathVariable("agencyId") String agencyId) {
return new Result<Integer>().ok(resiGroupService.getPartyGroupQuantityByAgencyId(agencyId));
}
}

3
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java

@ -98,4 +98,7 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
* 小组等级
*/
private Integer level;
private String agencyId;
private String pids;
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -483,4 +483,13 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
Map<String, List<IcPartyOrgTreeDTO>> getBranchGroupList(String customerId);
List<ResiGroupDTO> partyGroupList(String partyOrgId);
/**
* @description: 使用行政组织查询党小组列表
* @param agencyId:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 12:34 PM
*/
Integer getPartyGroupQuantityByAgencyId(String agencyId);
}

20
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -30,6 +30,8 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
@ -37,10 +39,7 @@ import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.utils.*;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dto.form.*;
@ -1994,4 +1993,17 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
return ConvertUtils.sourceToTarget(entityList, ResiGroupDTO.class);
}
@Override
public Integer getPartyGroupQuantityByAgencyId(String agencyId) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
"【查询党小组数量】查询组织信息失败:" + agencyId, "【查询党小组数量】查询组织信息失败");
}
LambdaQueryWrapper<ResiGroupEntity> query = new LambdaQueryWrapper<>();
query.eq(ResiGroupEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId());
query.eq(ResiGroupEntity::getPids, PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids()));
return baseDao.selectCount(query);
}
}

11
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java

@ -53,4 +53,15 @@ public class InitInfoResultDTO implements Serializable {
* 手机号
*/
private String mobile;
/**
* 2023.04.18烟台需求增加
* 用于完善信息界面展示
*/
private String gridId;
/**
* 2023.04.18烟台需求增加
* 用于完善信息界面展示
*/
private String gridName;
}

13
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java

@ -1,6 +1,8 @@
package com.epmet.modules.mine.service.impl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.EditInfoFormDTO;
@ -11,6 +13,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.mine.service.PersonalCenterService;
import com.epmet.resi.mine.dto.result.InitInfoResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -46,6 +49,16 @@ public class PersonalCenterServiceImpl implements PersonalCenterService {
resultDTO.setIdNum(baseInfoResult.getData().getIdNum());
resultDTO.setMobile(baseInfoResult.getData().getMobile());
resultDTO.setRealName(baseInfoResult.getData().getRealName());
// start
// 2023.04.18烟台需求增加
// 用于完善信息界面展示
resultDTO.setGridId(baseInfoResult.getData().getGridId());
if (StringUtils.isNotBlank(resultDTO.getGridId())) {
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(resultDTO.getGridId());
if (null != gridInfoCache) {
resultDTO.setGridName(gridInfoCache.getGridNamePath());
}
}// end
return resultDTO;
}

10
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/IcPartyMemberDTO.java

@ -201,4 +201,14 @@ public class IcPartyMemberDTO implements Serializable {
*/
private Date updatedTime;
/**
* 头像
*/
private String headPhoto;
/**
* 性别
*/
private Integer gender;
}

33
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyActQtyStatsResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.resi.partymember.dto.partymember.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* @description: agencyId下的党组织活动数统计
* @param null:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 7:09 PM
*/
@Data
public class LingShanScreenPartyActQtyStatsResultDTO {
private String type;
private Collection<StatsData> data;
@Data
public static class StatsData {
@JsonIgnore
private String orgId;
private String name;
@JsonIgnore
private String actType;
private Integer value;
}
}

15
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyActTypeAndQtyResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.resi.partymember.dto.partymember.result;
import lombok.Data;
/**
* 灵山大屏党建活动和数量
*/
@Data
public class LingShanScreenPartyActTypeAndQtyResultDTO {
private String actTypeKey;
private String name;
private Integer value;
}

17
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyOrgCategoryResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.resi.partymember.dto.partymember.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 灵山大屏党组织和数量dto
*/
@Data
public class LingShanScreenPartyOrgCategoryResultDTO {
private String partyOrgType;
private String name;
private Integer value;
}

60
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/LingShanScreenPartyOrgTreeResultDTO.java

@ -0,0 +1,60 @@
package com.epmet.resi.partymember.dto.partymember.result;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 灵山大屏-党组织树
*/
@Data
public class LingShanScreenPartyOrgTreeResultDTO {
// 中共青岛市即墨区委灵山街道工作委员会
private String title;
private List<PartyOrg> list;
private Integer num;
@Data
public static class PartyOrg {
private String id;
private String pid;
private String name;
private Integer num;
private Integer orgType;
/**
* 子级组织列表
*/
private List<PartyOrg> children = new ArrayList<>();
/**
* 党员列表
*/
private List<Partymember> list = new ArrayList<>();;
}
/**
* @description: 党员信息
*/
@Data
public static class Partymember {
private String name;
private String gender;
private String age;
private String phone;
private String orgname;
private String photo;
private String remarks;
private Integer workStatus;
private Integer isDby;
private Integer isLhdy;
private Integer worknumber;
private Integer workEvent;
}
}

27
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActDao.java

@ -2,6 +2,7 @@ package com.epmet.modules.partyOrg.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.partyOrg.entity.IcPartyActEntity;
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity;
import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO;
import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO;
import com.epmet.resi.partymember.dto.partyOrg.IcPartyActTypeDictDTO;
@ -11,9 +12,12 @@ import com.epmet.resi.partymember.dto.partyOrg.form.PartyActStatisFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyActListResultDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.PartyActStatisResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActQtyStatsResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActTypeAndQtyResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
@ -52,4 +56,27 @@ public interface IcPartyActDao extends BaseDao<IcPartyActEntity> {
List<IcPartyActEntity> selectNoPublishList(String dateId);
List<PartyActStatisResultDTO> getPartActStatis(PartyActStatisFormDTO formDTO);
/**
* @description: 党建活动类型和数量
* @return
* @author: WangXianZhang
* @date: 2023/4/14 12:12 PM
*/
List<LingShanScreenPartyActTypeAndQtyResultDTO> getPartyActTypeAndQuantity(@Param("customerId") String customerId,
@Param("orgIdPath") String orgIdPath);
/**
* @description: 找出当前党组织的下级党组织及其对应的活动数量
* @param currentPartyOrg:
* @param holdTimeStart:
* @param holdTimeEnd:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 8:36 PM
*/
List<LingShanScreenPartyActQtyStatsResultDTO.StatsData> actQtyOfPartyOrgStats(@Param("currentPartyOrgId") String currentPartyOrgId,
@Param("holdTimeStart") Date holdTimeStart,
@Param("holdTimeEnd") Date holdTimeEnd);
}

22
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java

@ -9,6 +9,8 @@ import com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDT
import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeSubDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.PartyOrgListResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -126,4 +128,24 @@ public interface IcPartyOrgDao extends BaseDao<IcPartyOrgEntity> {
* @date 2022/9/7 15:04
*/
void editPrincipal(EditPrincipalFormDTO formDTO);
/**
* @description: 灵山大屏,党建引领党组织和数量
* @param agencyId:
* @param agencyOrgIdPath:
* @return java.util.List<com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO>
* @author: WangXianZhang
* @date: 2023/4/14 11:15 AM
*/
List<LingShanScreenPartyOrgCategoryResultDTO> listPartyOrgCategoryAndQuantity(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("agencyOrgIdPath") String agencyOrgIdPath);
List<LingShanScreenPartyOrgTreeResultDTO.PartyOrg> getPartyOrgsLteDangwei(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("orgIdpath") String orgIdpath);
List<LingShanScreenPartyOrgTreeResultDTO.PartyOrg> getPartyOrgsOfBranch(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("orgIdpath") String orgIdpath);
}

120
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/LingShanScreenController.java

@ -0,0 +1,120 @@
package com.epmet.modules.partymember.controller;
import com.epmet.commons.tools.enums.PartyOrgTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.partymember.service.LingShanScreenService;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActQtyStatsResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActTypeAndQtyResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("lingshanScreen")
@Slf4j
public class LingShanScreenController {
@Autowired
private LingShanScreenService lingShanScreenService;
/**
* @description: 党建引领党组织和数量
* @param agencyId: 当前组织id
* @return com.epmet.commons.tools.utils.Result
* @author: WangXianZhang
* @date: 2023/4/14 10:57 AM
*/
@GetMapping("partyOrgCategoryAndQuantity")
public Result<List<LingShanScreenPartyOrgCategoryResultDTO>> listPartyOrgCategoryAndQuantity(@RequestParam("agencyId") String agencyId) {
List<LingShanScreenPartyOrgCategoryResultDTO> l = lingShanScreenService.listPartyOrgCategoryAndQuantity(agencyId);
return new Result().ok(l);
}
/**
* @description: 党建活动类型和数量
* @param agencyId: 组织id
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO>>
* @author: WangXianZhang
* @date: 2023/4/14 12:03 PM
*/
@GetMapping("partyActTypeAndQuantity")
public Result<List<LingShanScreenPartyActTypeAndQtyResultDTO>> partyActTypeAndQuantity(@RequestParam("agencyId") String agencyId) {
List<LingShanScreenPartyActTypeAndQtyResultDTO> l = lingShanScreenService.partyActTypeAndQuantity(agencyId);
return new Result().ok(l);
}
/**
* @description: 党组织数(只到党支部没有小组)
* @param agencyId:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 1:00 PM
*/
@GetMapping("partyOrgTree")
public Result<LingShanScreenPartyOrgTreeResultDTO> getPartyOrgTree(@RequestParam("agencyId") String agencyId) {
LingShanScreenPartyOrgTreeResultDTO l = lingShanScreenService.getPartyOrgTree(agencyId);
return new Result().ok(l);
}
/**
* @description: 党员列表
* @param partyOrgId: 党组织id
* @return
* @author: WangXianZhang
* @date: 2023/4/14 3:20 PM
*/
@GetMapping("partymemberList")
public Result<List<LingShanScreenPartyOrgTreeResultDTO.Partymember>> partymemberList(@RequestParam("partyOrgId") String partyOrgId) {
List<LingShanScreenPartyOrgTreeResultDTO.Partymember> l = lingShanScreenService.partymemberListByPartyOrgId(partyOrgId);
return new Result().ok(l);
}
/**
* @description: agencyId下的党组织活动数统计
* @param agencyId: 行政组织id
* @return
* @author: WangXianZhang
* @date: 2023/4/14 7:07 PM
*/
@GetMapping("partyActStats/actQtyOfPartyOrg")
public Result<List<LingShanScreenPartyActQtyStatsResultDTO>> actQtyOfPartyOrgStats(@RequestParam("agencyId") String agencyId,
@RequestParam("holdTimeStart") String holdTimeStartStr,
@RequestParam("holdTimeEnd") String holdTimeEndStr) {
Date holdTimeStart;
Date holdTimeEnd;
try {
holdTimeStart = DateUtils.parse(holdTimeStartStr, DateUtils.DATE_TIME_PATTERN);
holdTimeEnd = DateUtils.parse(holdTimeEndStr, DateUtils.DATE_TIME_PATTERN);
} catch (Exception e) {
log.error("日期解析失败,请按指定格式传输:yyyy-MM-dd HH:mm:ss");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "日期解析失败");
}
List<LingShanScreenPartyActQtyStatsResultDTO> l = lingShanScreenService.actQtyOfPartyOrgStats(agencyId, holdTimeStart, holdTimeEnd);
return new Result<List<LingShanScreenPartyActQtyStatsResultDTO>>().ok(l);
}
/**
* @description: 大屏地图-党员数
* @param agencyId:
* @return
* @author: WangXianZhang
* @date: 2023/4/17 1:54 PM
*/
@GetMapping("partymemberQty")
public Result<Integer> getPartymemberQtyOfOrg(@RequestParam("agencyId") String agencyId) {
return new Result<Integer>().ok(lingShanScreenService.getPartymemberQtyOfOrg(agencyId));
}
}

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java

@ -29,7 +29,7 @@ public interface IcPartyMemberDao extends BaseDao<IcPartyMemberEntity> {
* @Author zhaoqifeng
* @Date 2022/5/18 17:01
*/
List<IcPartyMemberResultDTO> selectList(IcPartyMemberFromDTO formDTO);
List<IcPartyMemberResultDTO> selectListZqf(IcPartyMemberFromDTO formDTO);
/**
* @describe: 查询该组织下的党员信息

3
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/IcPartyMemberEntity.java

@ -158,4 +158,7 @@ public class IcPartyMemberEntity extends BaseEpmetEntity {
*/
private String field5;
private String headPhoto;
private Integer gender;
}

68
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/LingShanScreenService.java

@ -0,0 +1,68 @@
package com.epmet.modules.partymember.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActQtyStatsResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActTypeAndQtyResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO;
import java.util.Date;
import java.util.List;
public interface LingShanScreenService {
/**
* @description: 党建引领党组织和数量
* @param agencyId: 组织id
* @return java.util.List<com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO>
* @author: WangXianZhang
* @date: 2023/4/14 11:02 AM
*/
List<LingShanScreenPartyOrgCategoryResultDTO> listPartyOrgCategoryAndQuantity(String agencyId);
/**
* @description: 党建活动类型和数量
* @param agencyId: 组织id
* @return
* @author: WangXianZhang
* @date: 2023/4/14 12:05 PM
*/
List<LingShanScreenPartyActTypeAndQtyResultDTO> partyActTypeAndQuantity(String agencyId);
/**
* @description:
* @param agencyId:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 1:09 PM
*/
LingShanScreenPartyOrgTreeResultDTO getPartyOrgTree(String agencyId);
/**
* @description: 党员列表
* @param partyOrgId:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 3:22 PM
*/
List<LingShanScreenPartyOrgTreeResultDTO.Partymember> partymemberListByPartyOrgId(String partyOrgId);
/**
* @description: agencyId下的党组织活动数统计
* @param agencyId:
* @param holdTimeStart:
* @param holdTimeEnd:
* @return
* @author: WangXianZhang
* @date: 2023/4/14 7:27 PM
*/
List<LingShanScreenPartyActQtyStatsResultDTO> actQtyOfPartyOrgStats(String agencyId, Date holdTimeStart, Date holdTimeEnd);
/**
* @description: 大屏地图-党员数
* @param agencyId:
* @return
* @author: WangXianZhang
* @date: 2023/4/17 1:55 PM
*/
Integer getPartymemberQtyOfOrg(String agencyId);
}

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java

@ -127,7 +127,7 @@ public class IcPartyMemberServiceImpl extends BaseServiceImpl<IcPartyMemberDao,
formDTO.setYear(date.substring(0, 4));
formDTO.setMonth(date.substring(4, 6));
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<IcPartyMemberResultDTO> list = baseDao.selectList(formDTO);
List<IcPartyMemberResultDTO> list = baseDao.selectListZqf(formDTO);
PageInfo<IcPartyMemberResultDTO> pageInfo = new PageInfo<>(list);
//获取文化程度字典

323
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/LingShanScreenServiceImpl.java

@ -0,0 +1,323 @@
package com.epmet.modules.partymember.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.enums.PartyOrgTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.partyOrg.dao.IcPartyActDao;
import com.epmet.modules.partyOrg.dao.IcPartyActTypeDictDao;
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao;
import com.epmet.modules.partyOrg.entity.IcPartyActTypeDictEntity;
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity;
import com.epmet.modules.partymember.dao.IcPartyMemberDao;
import com.epmet.modules.partymember.entity.IcPartyMemberEntity;
import com.epmet.modules.partymember.service.LingShanScreenService;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActQtyStatsResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActTypeAndQtyResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO;
import com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class LingShanScreenServiceImpl implements LingShanScreenService, ResultDataResolver {
@Autowired
private IcPartyOrgDao icPartyOrgDao;
@Autowired
private IcPartyActDao partyActDao;
@Autowired
private IcPartyMemberDao icPartyMemberDao;
@Autowired
private IcPartyActTypeDictDao partyActTypeDictDao;
@Autowired
private ResiGroupOpenFeignClient groupOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public List<LingShanScreenPartyOrgCategoryResultDTO> listPartyOrgCategoryAndQuantity(String agencyId) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询当前组织信息失败,agencyId:" + agencyId, "查询当前组织信息失败");
}
// 1.查询党组织
List<LingShanScreenPartyOrgCategoryResultDTO> l = icPartyOrgDao
.listPartyOrgCategoryAndQuantity(EpmetRequestHolder.getLoginUserCustomerId(), agencyId, PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids()));
// 给组织类型名字赋值
l.forEach(i -> {
PartyOrgTypeEnum partyOrgTypeEnum = PartyOrgTypeEnum.getEnumByCode(i.getPartyOrgType());
if (partyOrgTypeEnum != null) {
i.setName(partyOrgTypeEnum.getName());
}
});
// 2.查询党小组
Integer groupQty = getResultDataOrReturnNull(groupOpenFeignClient.getPartyGroupQuantityByAgencyId(agencyId), ServiceConstant.RESI_GROUP_SERVER);
if (groupQty == null) {
logger.error("【灵山大屏】党建引领-查询党小组信息失败,agencyId:" + agencyId);
groupQty = 0;
}
LingShanScreenPartyOrgCategoryResultDTO gq = new LingShanScreenPartyOrgCategoryResultDTO();
gq.setName("党小组");
gq.setPartyOrgType(null);
gq.setValue(groupQty);
l.add(gq);
return l;
}
@Override
public List<LingShanScreenPartyActTypeAndQtyResultDTO> partyActTypeAndQuantity(String agencyId) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询当前组织信息失败,agencyId:" + agencyId, "查询当前组织信息失败");
}
return partyActDao.getPartyActTypeAndQuantity(EpmetRequestHolder.getLoginUserCustomerId(), PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids()));
}
@Override
public LingShanScreenPartyOrgTreeResultDTO getPartyOrgTree(String agencyId) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询当前组织信息失败,agencyId:" + agencyId, "查询当前组织信息失败");
}
String orgIdpath = PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids());
// 1。查询组织
// 先查党委以上级别的,含党委
List<LingShanScreenPartyOrgTreeResultDTO.PartyOrg> l = icPartyOrgDao.getPartyOrgsLteDangwei(EpmetRequestHolder.getLoginUserCustomerId(), agencyId, orgIdpath);
// 再查党支部的。因为党委查询的时候使用pids和党支部的时候使用起来不一样,所以要分开
List<LingShanScreenPartyOrgTreeResultDTO.PartyOrg> s = icPartyOrgDao.getPartyOrgsOfBranch(EpmetRequestHolder.getLoginUserCustomerId(), agencyId, orgIdpath);
l.addAll(s);
// 2.组装树了开始
Map<String, LingShanScreenPartyOrgTreeResultDTO.PartyOrg> lMap = l.stream().collect(Collectors.toMap(e -> e.getId(), Function.identity()));
// 树根组织的id
String parentPartyOrgId = null;
// 最高的组织级别,用于找到树根。初始值给个100,大一点,不影响
Integer maxLevel = 100;
// 将组织放入到父组织的children列表中
for (Iterator<LingShanScreenPartyOrgTreeResultDTO.PartyOrg> it = l.iterator(); it.hasNext();) {
LingShanScreenPartyOrgTreeResultDTO.PartyOrg e = it.next();
LingShanScreenPartyOrgTreeResultDTO.PartyOrg pOrg = lMap.get(e.getPid());
if (maxLevel > e.getOrgType()) {
maxLevel = e.getOrgType();
parentPartyOrgId = e.getId();
}
if (pOrg != null) {
pOrg.getChildren().add(e);
// 修剪枝叶
it.remove();
}
}
LingShanScreenPartyOrgTreeResultDTO.PartyOrg parentOrg = lMap.get(parentPartyOrgId);
LingShanScreenPartyOrgTreeResultDTO r = new LingShanScreenPartyOrgTreeResultDTO();
r.setTitle(parentOrg.getName());
r.setNum(parentOrg.getNum());
r.setList(parentOrg.getChildren());
return r;
}
@Override
public List<LingShanScreenPartyOrgTreeResultDTO.Partymember> partymemberListByPartyOrgId(String partyOrgId) {
IcPartyOrgEntity partyOrg = icPartyOrgDao.selectById(partyOrgId);
LambdaQueryWrapper<IcPartyMemberEntity> query = null;
if (partyOrg == null) {
String baseErrorMsg = "【灵山大屏】党组织下的党员列表-未找到党组织信息。";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format(baseErrorMsg + "partyOrgId:" + partyOrg), baseErrorMsg);
} else if (Integer.valueOf(partyOrg.getPartyOrgType()) >= 4) {
// 0省委,1市委,2区委,3党工委,4党委,5支部。党委以上,除了支部
query = new LambdaQueryWrapper<>();
query.eq(IcPartyMemberEntity::getOrgPids, PidUtils.convertPid2OrgIdPath(partyOrgId, partyOrg.getOrgPids()));
query.eq(IcPartyMemberEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId());
} else {
// 5支部
query = new LambdaQueryWrapper<>();
query.eq(IcPartyMemberEntity::getOrgPids, partyOrg.getOrgPids());
query.eq(IcPartyMemberEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId());
}
List<IcPartyMemberEntity> l = icPartyMemberDao.selectList(query);
// 党员列表转化为需要的dto返回
return l.stream().map(e -> {
// 查询支部
IcPartyOrgEntity branch = icPartyOrgDao.selectById(e.getSszb());
// 查询居民信息,用于显示年龄
IcResiUserInfoCache resiInfo = CustomerResiUserRedis.getIcResiUserInfo(e.getIcResiUser());
LingShanScreenPartyOrgTreeResultDTO.Partymember t = new LingShanScreenPartyOrgTreeResultDTO.Partymember();
String birthDay;
if (resiInfo != null
&& StringUtils.isNotBlank(birthDay = resiInfo.getBirthday())) {
Date birthday = DateUtils.parse(birthDay, DateUtils.DATE_PATTERN);
Calendar ci = Calendar.getInstance();
ci.setTime(birthday);
int birthYear = ci.get(Calendar.YEAR);
t.setAge((LocalDate.now().getYear() - birthYear) + "");
}
t.setName(e.getName());
Integer gender = e.getGender();
t.setGender(gender != null ? GenderEnum.getName(gender.toString()) : "未知");
t.setOrgname(branch != null ? branch.getPartyOrgName() : null);
t.setPhone(e.getMobile());
t.setRemarks(e.getRemark());
t.setPhoto(e.getHeadPhoto());
// t.setIsDby();
// t.setIsLhdy();
// t.setWorkStatus();
// t.setWorknumber();
// t.setWorkEvent();
return t;
}).collect(Collectors.toList());
}
/**
* @description: 这个方法其实有更容易实现更容易阅读和理解的方式循环活动类型每个活动类型都查询一次统计数据即可
* 但是前期追求更少次数的数据库调用以提升效率越写越复杂既然已经这样了也懒得改了就这样吧
* 如果后面有人感觉维护不了了直接按照上述方式重写就行了不要犹豫不要徘徊很容易改没有暗雷
* @param agencyId: 行政组织id
* @return
* @author: WangXianZhang
* @date: 2023/4/14 11:33 PM
*/
@Override
public List<LingShanScreenPartyActQtyStatsResultDTO> actQtyOfPartyOrgStats(String agencyId, Date holdTimeStart, Date holdTimeEnd) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询当前组织信息失败,agencyId:" + agencyId, "查询当前组织信息失败");
}
// String orgIdpath = PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids());
// 先查当前党组织信息
LambdaQueryWrapper<IcPartyOrgEntity> currentPartyOrgQuery = new LambdaQueryWrapper<>();
currentPartyOrgQuery.eq(IcPartyOrgEntity::getAgencyId, agencyId);
currentPartyOrgQuery.orderByAsc(IcPartyOrgEntity::getPartyOrgType);
currentPartyOrgQuery.last(" limit 1 ");
IcPartyOrgEntity currentPartyOrg = icPartyOrgDao.selectOne(currentPartyOrgQuery);
if (currentPartyOrg == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到党组织信息");
}
// ----------------------------要重写的话,上面建议保留噢,只重写下面就可以了,淦---------------------------------
// 找出当前党组织的下级党组织(全部),及其对应的活动数量
List<LingShanScreenPartyActQtyStatsResultDTO.StatsData> l = partyActDao.actQtyOfPartyOrgStats(currentPartyOrg.getId(), holdTimeStart, holdTimeEnd);
// 将结果遍历,分成2个纬度,分别建立地址引用
// Map<actType, Map<orgId, LingShanScreenPartyActQtyStatsResultDTO.StatsData>>
Map<String, Map<String, LingShanScreenPartyActQtyStatsResultDTO.StatsData>> orgDimMap = new HashMap<>();
HashMap<String, String> orgIdAndName = new HashMap<>();
l.forEach(e -> {
orgIdAndName.put(e.getOrgId(), e.getName());
String actType = e.getActType();
if (StringUtils.isNotBlank(actType)) {
// 不为空,说明该类型有活动数据
Map<String, LingShanScreenPartyActQtyStatsResultDTO.StatsData> m = orgDimMap.get(actType);
if (m == null) {
m = new HashMap<>();
orgDimMap.put(actType, m);
}
m.put(e.getOrgId(), e);
}
});
// 所有的活动类型,并且建立字典,供后续使用
LambdaQueryWrapper<IcPartyActTypeDictEntity> actTypeQuery = new LambdaQueryWrapper<>();
actTypeQuery.eq(IcPartyActTypeDictEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId());
List<IcPartyActTypeDictEntity> actTypes = partyActTypeDictDao.selectList(actTypeQuery);
Map<String, String> actTypeKeyAndName = actTypes.stream().collect(Collectors.toMap(IcPartyActTypeDictEntity::getTypeKey, IcPartyActTypeDictEntity::getTypeName));
// 二维遍历,外层活动类型,内层组织id。确保两个维度的坐标都是全的(哪怕value=0)
for (IcPartyActTypeDictEntity actType : actTypes) {
// 补全外层活动类型
Map<String, LingShanScreenPartyActQtyStatsResultDTO.StatsData> orgIdAndStats = orgDimMap.get(actType.getTypeKey());
if (orgIdAndStats == null) {
orgIdAndStats = new HashMap<>();
orgDimMap.put(actType.getTypeKey(), orgIdAndStats);
}
// 为活动类型补全组织列表(没有活动的组织赋值0)
for (Map.Entry<String, String> entry : orgIdAndName.entrySet()) {
String orgId = entry.getKey();
LingShanScreenPartyActQtyStatsResultDTO.StatsData statsData = orgIdAndStats.get(orgId);
if (statsData == null) {
LingShanScreenPartyActQtyStatsResultDTO.StatsData e = new LingShanScreenPartyActQtyStatsResultDTO.StatsData();
e.setOrgId(orgId);
e.setName(entry.getValue());
e.setValue(0);
e.setActType(actType.getTypeKey());
orgIdAndStats.put(orgId, e);
}
}
}
// 将结果map转化为list,返回
ArrayList<LingShanScreenPartyActQtyStatsResultDTO> rl = new ArrayList<>();
orgDimMap.forEach((actType, orgStatsMap) -> {
LingShanScreenPartyActQtyStatsResultDTO re = new LingShanScreenPartyActQtyStatsResultDTO();
re.setType(actTypeKeyAndName.get(actType));
re.setData(orgStatsMap.values());
rl.add(re);
});
return rl;
}
@Override
public Integer getPartymemberQtyOfOrg(String agencyId) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
logger.error("getPartymemberQtyOfOrg查询组织信息失败agencyId:{}", agencyId);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询当前组织信息失败,agencyId:" + agencyId, "查询当前组织信息失败");
}
LambdaQueryWrapper<IcPartyMemberEntity> query = new LambdaQueryWrapper<>();
query.likeRight(IcPartyMemberEntity::getAgencyPids, PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids()))
.or()
.eq(IcPartyMemberEntity::getAgencyId, agencyId);
return icPartyMemberDao.selectCount(query);
}
}

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberBaseInfoServiceImpl.java

@ -58,7 +58,6 @@ import com.epmet.resi.partymember.dto.partymember.result.ReviewedParyMemberResul
import com.epmet.resi.partymember.dto.partymember.result.UnderReviewParyMemberResultDTO;
import info.debatty.java.stringsimilarity.Levenshtein;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -534,7 +533,6 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB
}
@NotNull
private String getString(String result, double comparisonResult, double most, double small) {
if (comparisonResult == PartyMemberConstant.EQUALS) {
result = result + "11";

27
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActDao.xml

@ -99,6 +99,7 @@
SELECT
a.ID AS icPartyActId,
a.TOPIC,
a.ORG_ID as orgId,
a.PUBLISH_PARTY_ORG_NAME AS publishPartyOrgName,
a.PUBLISH_STAFF_NAME AS publishStaffName,
d.TYPE_NAME AS actTypeName,
@ -268,4 +269,30 @@
ipao.join_org_id
</select>
<!--党建活动类型和数量-->
<select id="getPartyActTypeAndQuantity"
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActTypeAndQtyResultDTO">
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
</select>
<!--找出当前党组织的下级党组织,及其对应的活动数量-->
<select id="actQtyOfPartyOrgStats"
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyActQtyStatsResultDTO$StatsData">
select
o.ID org_id , o.PARTY_ORG_NAME name, a.ACT_TYPE act_type, count(a.ID) as value
from ic_party_org o
left join ic_party_act a on (a.PUBLISH_ORG_PATH like concat(o.ORG_PIDS, ':', o.ID, '%') and a.DEL_FLAG = 0
and a.HOLD_TIME >= #{holdTimeStart} and a.HOLD_TIME &lt;= #{holdTimeEnd})
where o.ORG_PID = #{currentPartyOrgId}
group by o.ID, o.PARTY_ORG_NAME, o.PARTY_ORG_TYPE, a.ACT_TYPE
</select>
</mapper>

44
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml

@ -249,4 +249,48 @@
ORDER BY org_pids ASC
</select>
<!--党建引领,党组织和数量。AGENCY_PIDS和AGENCY_ID双条件组合。agencyId的所有下级+agencyId的本级-->
<select id="listPartyOrgCategoryAndQuantity"
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO">
select PARTY_ORG_TYPE partyOrgType, count(*) as 'value'
from ic_party_org
where CUSTOMER_ID=#{customerId}
and (AGENCY_PIDS like CONCAT(#{agencyOrgIdPath}, '%') or AGENCY_ID = #{agencyId})
and DEL_FLAG = 0
group by PARTY_ORG_TYPE
order by PARTY_ORG_TYPE asc
</select>
<!--获取党委以上组织列表-->
<select id="getPartyOrgsLteDangwei"
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO$PartyOrg">
select org.ID id
, org.ORG_PID pid
, org.PARTY_ORG_TYPE org_type
, org.PARTY_ORG_NAME name
, count(mem.ID) num
from ic_party_org org
left join ic_party_member mem on (mem.DEL_FLAG = 0 and mem.ORG_PIDS like concat(org.ORG_PIDS, ':', org.ID, '%'))
where org.DEL_FLAG = 0
and org.PARTY_ORG_TYPE &lt;= '4'
and (org.AGENCY_ID = #{agencyId} or org.AGENCY_PIDS like CONCAT(#{orgIdpath}, '%'))
group by org.ID, org.PARTY_ORG_NAME
</select>
<!--获取支部列表-->
<select id="getPartyOrgsOfBranch"
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO$PartyOrg">
select org.ID id
, org.ORG_PID pid
, org.PARTY_ORG_TYPE org_type
, org.PARTY_ORG_NAME name
, count(mem.ID) num
from ic_party_org org
left join ic_party_member mem on (mem.DEL_FLAG = 0 and mem.SSZB = org.ID)
where org.DEL_FLAG = 0
and org.PARTY_ORG_TYPE = '5'
and (org.AGENCY_ID = #{agencyId} or org.AGENCY_PIDS like CONCAT(#{orgIdpath}, '%'))
group by org.ID, org.PARTY_ORG_NAME
</select>
</mapper>

3
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml

@ -35,8 +35,9 @@
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="headPhoto" column="HEAD_PHOTO"/>
</resultMap>
<select id="selectList" resultType="com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO">
<select id="selectListZqf" resultType="com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO">
SELECT
*
FROM (

14
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其他情况orgTypeagency
*/
private String orgType;
/**
* 查询居民列表
* 年龄饼图/学历饼图返回的code
*/
private String code;
/**
* 学历education
* 年龄age
*/
private String codeType;
}

123
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;
}

17
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<ResiPortrayalResultDTO> list;
}

78
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<List<ResiPortrayalResultDTO>> queryAgeDistribute(@RequestBody ResiPortrayalCommonFormDTO formDTO) {
return new Result<List<ResiPortrayalResultDTO>>().ok(icResiUserService.queryAgeDistribute(formDTO.getOrgId(), formDTO.getOrgType()));
public Result<ResiPortrayalResult> queryAgeDistribute(@LoginUser TokenDto tokenDto, @RequestBody ResiPortrayalCommonFormDTO formDTO) {
return new Result<ResiPortrayalResult>().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<List<ResiPortrayalResultDTO>> queryEducationDistribute(@LoginUser TokenDto tokenDto,@RequestBody ResiPortrayalCommonFormDTO formDTO) {
return new Result<List<ResiPortrayalResultDTO>>().ok(icResiUserService.queryEducationDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType()));
public Result<ResiPortrayalResult> queryEducationDistribute(@LoginUser TokenDto tokenDto,@RequestBody ResiPortrayalCommonFormDTO formDTO) {
return new Result<ResiPortrayalResult>().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<PageData<ResiPortrayalDetailDTO>> queryPortrayalResiList(@LoginUser TokenDto tokenDto, @RequestBody ResiPortrayalCommonFormDTO formDTO) {
return new Result<PageData<ResiPortrayalDetailDTO>>().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<ResiPortrayalDetailDTO> data = null;
List<ResiPortrayalDetailDTO> 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<Object> 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();
}
}
}
}

24
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<IcResiUserEntity> {
*/
List<ResiPortrayalResultDTO> queryEducationDistribute(@Param("customerId") String customerId,
@Param("orgId") String orgId,
@Param("orgType") String orgType);
@Param("orgType") String orgType,
@Param("orgIdPath")String orgIdPath);
List<ResiPortrayalResultDTO> 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<ResiPortrayalDetailDTO> 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);
}

37
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<IcResiUserEntity> {
* 接口地址http://yapi.elinkservice.cn/project/356/interface/api/cat_1370
* 居民年龄分布饼图
*
* @param customerId
* @param staffId
* @param orgId
* @param orgType
* @return
*/
List<ResiPortrayalResultDTO> 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<IcResiUserEntity> {
* @param orgType agency/grid
* @return
*/
List<ResiPortrayalResultDTO> 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<ResiPortrayalDetailDTO> 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<ResiPortrayalDetailDTO> queryPortrayalResiListForExport(String customerId, String staffId,
Integer pageNo, Integer pageSize,
String orgId, String orgType,
String codeType,String code);
}

194
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<IcResiUserDao, IcResi
* 接口地址http://yapi.elinkservice.cn/project/356/interface/api/cat_1370
* 居民年龄分布饼图
*
* @param customerId
* @param staffId
* @param orgId
* @param orgType
* @return
*/
@Override
public List<ResiPortrayalResultDTO> 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<ResiPortrayalResultDTO> resultList=getDefaultAgeDistribute();
List<ResiPortrayalResultDTO> list=baseDao.selectAgeAgeDistribute(customerId,orgId,orgType,orgIdPath);
if(CollectionUtils.isEmpty(list)){
result.setTotal(NumConstant.ZERO);
result.setList(resultList);
return result;
}
Map<String,Integer> 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<ResiPortrayalResultDTO> getDefaultAgeDistribute() {
List<ResiPortrayalResultDTO> 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<IcResiUserDao, IcResi
* @return
*/
@Override
public List<ResiPortrayalResultDTO> 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<IcResiUserDao, IcResi
if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败");
}
String orgIdPath=StrConstant.EPMETY_STR;
if(OrgTypeEnum.AGENCY.getCode().equals(orgType)){
orgIdPath=CustomerOrgRedis.getOrgIdPath(orgId,orgType);
}
//按照学历分组,查询居民数量
List<ResiPortrayalResultDTO> totalList = baseDao.queryEducationDistribute(customerId, orgId, orgType);
List<ResiPortrayalResultDTO> totalList = baseDao.queryEducationDistribute(customerId, orgId, orgType,orgIdPath);
Map<String,Integer> map = totalList.stream().collect(Collectors.toMap(ResiPortrayalResultDTO::getCode,ResiPortrayalResultDTO::getTotalResi));
List<ResiPortrayalResultDTO> 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<ResiPortrayalDetailDTO> 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<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO);
if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败");
}
Map<String, String> 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<ResiPortrayalDetailDTO> list = baseDao.selectPortrayalResiList(customerId, orgId, orgType,orgIdPath,codeType, code);
if(CollectionUtils.isNotEmpty(list)){
Set<String> houseIds=list.stream().map(m -> m.getHomeId()).collect(Collectors.toSet());
//查询房子名称
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId);
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>();
Map<String, HouseInfoDTO> 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<ResiPortrayalDetailDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(), pageSize);
}
@Override
public PageData<ResiPortrayalDetailDTO> 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<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO);
if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败");
}
Map<String, String> 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<ResiPortrayalDetailDTO> list = baseDao.selectPortrayalResiList(customerId, orgId, orgType,orgIdPath,codeType, code);
if(CollectionUtils.isNotEmpty(list)){
list.forEach(resi -> {
// 学历名称
resi.setEducationName(educationMap.get(resi.getEducationCode()));
});
}
PageInfo<ResiPortrayalDetailDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(), pageSize);
}
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -365,7 +365,17 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
@Override
public Result<ResiUserBaseInfoResultDTO> selecUserBaseInfoByUserId(String userId) {
return new Result<ResiUserBaseInfoResultDTO>().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<ResiUserBaseInfoResultDTO>().ok(resultDTO);
}

179
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -125,7 +125,47 @@
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 2">
<if test='null != subCondition.columnValue[0] and subCondition.columnValue[0] != "" '>
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} &gt;= #{subCondition.columnValue[0]}
</if>
<if test='null != subCondition.columnValue[1] and subCondition.columnValue[1] != "" '>
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} &lt;= #{subCondition.columnValue[1]}
</if>
</if>
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 1">
<if test='null != subCondition.columnValue[0] and subCondition.columnValue[0] != "" '>
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} &gt;= #{subCondition.columnValue[0]}
</if>
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'agerange' ">
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 2">
<if test='null != subCondition.columnValue[0] and 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) &gt;= #{subCondition.columnValue[0]}
</if>
<if test='null != subCondition.columnValue[1] and 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) &lt;= #{subCondition.columnValue[1]}
</if>
</if>
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 1">
<if test='null != subCondition.columnValue[0] and 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) &gt;= #{subCondition.columnValue[0]}
</if>
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'notnull' ">
@ -180,7 +220,47 @@
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 2">
<if test='null != subCondition.columnValue[0] and subCondition.columnValue[0] != "" '>
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} &gt;= #{subCondition.columnValue[0]}
</if>
<if test='null != subCondition.columnValue[1] and subCondition.columnValue[1] != "" '>
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} &lt;= #{subCondition.columnValue[1]}
</if>
</if>
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 1">
<if test='null != subCondition.columnValue[0] and subCondition.columnValue[0] != "" '>
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} &gt;= #{subCondition.columnValue[0]}
</if>
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'agerange' ">
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 2">
<if test='null != subCondition.columnValue[0] and 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) &gt;= #{subCondition.columnValue[0]}
</if>
<if test='null != subCondition.columnValue[1] and 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) &lt;= #{subCondition.columnValue[1]}
</if>
</if>
<if test="subCondition.columnValue != null and subCondition.columnValue.size() == 1">
<if test='null != subCondition.columnValue[0] and 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) &gt;= #{subCondition.columnValue[0]}
</if>
</if>
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'notnull' ">
@ -1526,7 +1606,7 @@
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
<if test='orgType == "agency" '>
AND ( r.AGENCY_ID = #{orgId} OR r.PIDS LIKE concat('%',#{orgId},'%') )
and r.PIDS LIKE concat(#{orgIdPath},'%')
</if>
<if test='orgType == "grid" '>
and r.GRID_ID = #{orgId}
@ -1538,5 +1618,98 @@
r.CULTURE
</select>
<!-- 烟台居民画像:年龄分布 -->
<select id="selectAgeAgeDistribute" parameterType="map" resultType="com.epmet.dto.result.resi.ResiPortrayalResultDTO">
select
temp.CODE,
count(temp.ID) as totalResi
from (
select
temp1.id,
(
case when temp1.age &lt; 50 then '0'
when temp1.age &gt;= 50 and temp1.age &lt;= 59 then '1'
when temp1.age &gt;= 60 and temp1.age &lt;= 69 then '2'
when temp1.age &gt;= 70 and temp1.age &lt;= 79 then '3'
when temp1.age &gt;= 80 then '4'
end
) as `code`
from (
SELECT
u.ID,
YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) as age
FROM
ic_resi_user u
WHERE
u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId}
and u.`STATUS`='0'
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
<if test='orgType == "agency" '>
and u.PIDS LIKE concat(#{orgIdPath},'%')
</if>
<if test='orgType == "grid" '>
and u.GRID_ID = #{orgId}
</if>
)temp1
)temp
group by temp.`code`
</select>
<!-- 居民画像,居民列表 codeType 学历:education 年龄:age -->
<select id="selectPortrayalResiList" parameterType="map" resultType="com.epmet.dto.result.resi.ResiPortrayalDetailDTO">
SELECT
u.ID AS icResiUserId,
u.grid_id as gridId,
u.VILLAGE_ID as villageId,
u.BUILD_ID as buildId,
u.UNIT_ID as unitId,
u.HOME_ID as homeId,
u.`NAME` AS `name`,
u.MOBILE AS mobile,
u.ID_CARD AS idCard,
u.GENDER AS gender,
( CASE WHEN u.GENDER = '1' THEN '男' WHEN u.GENDER = '2' THEN '女' ELSE '未知' END ) AS genderName,
YEAR (NOW())- SUBSTR( u.BIRTHDAY, 1, 4 ) AS age,
u.CULTURE AS educationCode,
'' AS educationName,
IFNULL(u.CULTURE,'')AS educationCode,
u.BIRTHDAY AS birthday
FROM
ic_resi_user u
WHERE
u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId}
AND u.`STATUS` = '0'
<if test='orgType == "agency" '>
and u.PIDS LIKE concat(#{orgIdPath},'%')
</if>
<if test='orgType == "grid" '>
and u.GRID_ID = #{orgId}
</if>
<if test='codeType == "education" '>
<if test="code != null and code != ''">
and u.CULTURE = #{code}
</if>
</if>
<if test='codeType == "age" '>
<if test=" 0 == code">
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt; 50
</if>
<if test=" 1 == code">
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=50 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=59
</if>
<if test=" 2 == code">
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;= 60 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;= 69
</if>
<if test=" 3 == code">
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=70 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=79
</if>
<if test=" 4 == code">
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=80
</if>
</if>
order by u.ID asc
</select>
</mapper>

Loading…
Cancel
Save