Browse Source

Merge branch 'lingshan_master' into dev

master
wxz 2 years ago
parent
commit
5b54f0b09b
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java
  2. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java
  3. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  4. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java
  5. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  6. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
  7. 28
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  8. 83
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventAddEditFormDTO.java
  9. 86
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventFormsDTO.java
  10. 102
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventResultDTO.java
  11. 88
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java
  12. 19
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/EventEntityDao.java
  13. 43
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventDetailEntity.java
  14. 97
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventEntity.java
  15. 19
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/EventService.java
  16. 136
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java
  17. 13
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/EventEntityDao.xml
  18. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java
  19. 117
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java
  20. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java
  21. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java
  22. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java
  23. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java
  24. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java
  25. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java
  26. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java
  27. 69
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailAzbjEntity.java
  28. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailBaseEntity.java
  29. 69
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJdryEntity.java
  30. 74
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJzhzEntity.java
  31. 79
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailSqjzEntity.java
  32. 70
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailXfryEntity.java
  33. 64
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonEntity.java
  34. 59
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonTypeEntity.java
  35. 34
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdIsOrNotConverter.java
  36. 57
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java
  37. 51
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java
  38. 73
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java
  39. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java
  40. 79
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java
  41. 84
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java
  42. 92
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java
  43. 77
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java
  44. 401
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java
  45. 54
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdAzbjExcelImportListener.java
  46. 50
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJieduExcelImportListener.java
  47. 51
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJingZhangExcelImportListener.java
  48. 50
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdSqjzExcelImportListener.java
  49. 51
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdXinFangExcelImportListener.java
  50. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/exceptions/ReadExcelHeaderOnlyException.java
  51. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java
  52. 281
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java
  53. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_azbj_export.xlsx
  54. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jdry_export.xlsx
  55. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jzhz_export.xlsx
  56. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_sqjz_export.xlsx
  57. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_xfry_export.xlsx
  58. 57
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml
  59. 36
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml
  60. 61
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml
  61. 59
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml
  62. 60
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml
  63. 45
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml
  64. 36
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java

@ -19,6 +19,7 @@ public enum BizTypeEnum {
GRID_PROJECT("grid_project", "网格项目"),
PROJECT("project", "项目"),
ARTICLE("article", "文章(党建声音)"),
SPECIAL_CROWD("special_crowd", "社会维稳(特殊人群)"),
;
public static BizTypeEnum getEnum(String code) {

8
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java

@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class TCCCClientUtils {
private static String SDKAPPID = "1400801042";
private static Long SDKAPPID = 1400801042L;
private static String USERID = "286388969@qq.com";
@ -34,12 +34,12 @@ public class TCCCClientUtils {
CccClient client = new CccClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest();
req.setSdkAppId(1400801042L);
req.setSeatUserId("286388969@qq.com");
req.setSdkAppId(SDKAPPID);
req.setSeatUserId(USERID);
// 返回的resp是一个CreateSDKLoginTokenResponse的实例,与请求对象对应
CreateSDKLoginTokenResponse resp = client.CreateSDKLoginToken(req);
// 输出json格式的字符串回包
System.out.println(CreateSDKLoginTokenResponse.toJsonString(resp));
log.info(CreateSDKLoginTokenResponse.toJsonString(resp));
return CreateSDKLoginTokenResponse.toJsonString(resp);
} catch (TencentCloudSDKException e) {
log.error(e.toString());

2
epmet-gateway/src/main/resources/bootstrap.yml

@ -528,6 +528,8 @@ epmet:
# 员工登记、受众群体登记
- /gov/org/icEmployeeRegister/add
- /gov/org/icGroupPeopleRegister/add
# 组织树,灵山大屏需要无登录调用,放开
- /gov/org/agency/maporg
# 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls:
- /data/report/**

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java

@ -14,7 +14,7 @@ public class TCCCAuthController {
public String getTcccAuth() {
try {
String tcccAuth = TCCCClientUtils.getToken();
System.out.println(tcccAuth);
log.info(tcccAuth);
return tcccAuth;
} catch (Exception e) {
log.error(e.toString());

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

@ -362,14 +362,13 @@ public class AgencyController {
/**
* @param formDTO
* @param tokenDto
* @Description 地图配置组织查询
* @author zxc
* @date 2021/10/25 10:50 上午
*/
@PostMapping("maporg")
public Result<MapOrgResultDTO> mapOrg(@RequestBody MapOrgFormDTO formDTO, @LoginUser TokenDto tokenDto) {
return new Result<MapOrgResultDTO>().ok(agencyService.mapOrg(formDTO, tokenDto));
public Result<MapOrgResultDTO> mapOrg(@RequestBody MapOrgFormDTO formDTO) {
return new Result<MapOrgResultDTO>().ok(agencyService.mapOrg(formDTO));
}
/**

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java

@ -118,12 +118,11 @@ public interface AgencyService {
/**
* @param formDTO
* @param tokenDto
* @Description 地图配置组织查询
* @author zxc
* @date 2021/10/25 10:50 上午
*/
MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO, TokenDto tokenDto);
MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO);
/**
* @param formDTO

28
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.commons.tools.redis.RedisKeys;
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.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.*;
@ -733,7 +734,6 @@ public class AgencyServiceImpl implements AgencyService {
/**
* @param formDTO
* @param tokenDto
* @Description 地图配置组织查询
* 根据level查询去查询不同的表类型组织agency网格grid小区neighborHood
* 组织类型去查 customer_agency看本级是不是 community下级组织就是网格查询customer_grid不是继续查customer_agency
@ -744,19 +744,35 @@ public class AgencyServiceImpl implements AgencyService {
* @date 2021/10/25 10:50 上午
*/
@Override
public MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO, TokenDto tokenDto) {
public MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO) {
MapOrgResultDTO result = new MapOrgResultDTO();
LambdaQueryWrapper<CustomerAgencyEntity> qw = new LambdaQueryWrapper();
qw.eq(CustomerAgencyEntity::getPid, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getDelFlag, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getCustomerId, tokenDto.getCustomerId());
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectOne(qw);
String customerId = null;
if (StringUtils.isBlank(formDTO.getOrgId())) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
// 没有传参,则使用当前用户所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo((customerId = EpmetRequestHolder.getLoginUserCustomerId()), EpmetRequestHolder.getLoginUserId());
if (null == staffInfo) {
return result;
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setLevel(OrgInfoConstant.AGENCY);
} else {
// 前段传递了,那就用前端传递的level和orgId,并且查出来这个组织的客户id,用于后面查询跟组织中心点
if (OrgInfoConstant.AGENCY.equals(formDTO.getLevel())) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId());
customerId = agencyInfo.getCustomerId();
} else if (OrgInfoConstant.GRID.equals(formDTO.getLevel())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getOrgId());
customerId = gridInfo.getCustomerId();
}
}
// 查询客户跟组织中心点
LambdaQueryWrapper<CustomerAgencyEntity> qw = new LambdaQueryWrapper();
qw.eq(CustomerAgencyEntity::getPid, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getDelFlag, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getCustomerId, customerId);
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectOne(qw);
if (StringUtils.isNotBlank(customerAgencyEntity.getLatitude())) {
result.setLatitude(new BigDecimal(customerAgencyEntity.getLatitude()));
}

83
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventAddEditFormDTO.java

@ -0,0 +1,83 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class EventAddEditFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 事件编号
*/
private String code;
/**
* 事件状态
*/
private String status;
/**
* 上报人员
*/
private String reporter;
/**
* 联系电话
*/
private String phone;
/**
* 上报事件
*/
private Date reportDate;
/**
* 紧急程度
*/
private String urgency;
/**
* 所属网格
*/
private String grid;
/**
* 事件类型
*/
private String eventType;
/**
* 即办类型
*/
private String type;
/**
* 办理期限
*/
private Date lastDate;
/**
* 满意度
*/
private String satisficing;
/**
* 页码
*/
private Integer pageNo = 1;
/**
* 每页显示数量
*/
private Integer pageSize = 20;
private Boolean isPage = true;
private String customerId;
private String agencyId;
private String staffId;
private String userId;
private String app;
private String client;
}

86
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventFormsDTO.java

@ -0,0 +1,86 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 灵山项目事件 formDTO
*/
@Data
public class EventFormsDTO implements Serializable {
private static final long serialVersionUID = 1;
public interface Detail extends CustomerClientShowGroup {
}
public interface GovRedDot extends CustomerClientShowGroup {
}
/**
* 事件编号
*/
private String code;
/**
* 事件状态
*/
private String status;
/**
* 上报人员
*/
private String reporter;
/**
* 联系电话
*/
private String phone;
/**
* 上报事件
*/
private Date reportDate;
/**
* 紧急程度
*/
private String urgency;
/**
* 所属网格
*/
private String grid;
/**
* 事件类型
*/
private String eventType;
/**
* 即办类型
*/
private String type;
/**
* 办理期限
*/
private Date lastDate;
/**
* 满意度
*/
private String satisficing;
/**
* 页码
*/
private Integer pageNo = 1;
/**
* 每页显示数量
*/
private Integer pageSize = 20;
private Boolean isPage = true;
private String customerId;
private String agencyId;
private String staffId;
}

102
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventResultDTO.java

@ -0,0 +1,102 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 即墨灵山项目
*/
@Data
public class EventResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
private String id;
/**
* 事件编号
*/
private String code;
/**
* 事件状态
*/
private String status;
/**
* 事件明细ID
*/
private String detailId;
/**
* 上报人员
*/
private String reporter;
/**
* 联系电话
*/
private String phone;
/**
* 上报事件事件
*/
private Date reportDate;
/**
* 紧急程度
*/
private String urgency;
/**
* 所属网格
*/
private String grid;
/**
* 事件类型
*/
private String eventType;
/**
* 即办类型
*/
private String type;
/**
* 办理期限
*/
private Date lastDate;
/**
* 事件地址
*/
private String eventAddr;
/**
* 坐标经度
*/
private String longitude;
/**
* 坐标纬度
*/
private String latitude;
/**
* 音频
*/
private String voice;
/**
* 视频
*/
private String video;
/**
* 满意度
*/
private String satisficing;
/**
* 解决情况
*/
private String remark;
/**
* 事件描述
*/
private String conetnt;
}

88
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java

@ -0,0 +1,88 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
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.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.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.form.EventAddEditFormDTO;
import com.epmet.dto.form.EventFormsDTO;
import com.epmet.dto.result.EventResultDTO;
import com.epmet.service.EventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author yan Lu
* @date 2023-04-14 19:07
* @deprecated 社会治理--事件处理
*/
@Slf4j
@RestController
@RequestMapping("event")
public class EventController {
@Autowired
private EventService eventService;
/**
* 社会治理 事件列表
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("list")
public Result<PageData<EventResultDTO>> getList(@LoginUser TokenDto tokenDto, @RequestBody EventFormsDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
return new Result<PageData<EventResultDTO>>().ok(eventService.getList(formDTO));
}
/**
* @deprecated 根据ID获取事件
* @param id
* @return
*/
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<EventResultDTO> get(@PathVariable("id") String id){
EventResultDTO data = eventService.getById(id);
return new Result<EventResultDTO>().ok(data);
}
@NoRepeatSubmit
@PostMapping("add")
public Result save(@LoginUser TokenDto tokenDto, @RequestBody EventAddEditFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AddGroup.class, DefaultGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setApp(tokenDto.getApp());
formDTO.setClient(tokenDto.getClient());
eventService.save(formDTO);
return new Result();
}
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody EventResultDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
eventService.update(dto);
return new Result();
}
@PostMapping("delete")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
eventService.delete(ids);
return new Result();
}
}

19
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/EventEntityDao.java

@ -0,0 +1,19 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.EventFormsDTO;
import com.epmet.dto.result.EventResultDTO;
import com.epmet.entity.EventEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 灵山项目
*/
@Mapper
public interface EventEntityDao extends BaseDao<EventEntity> {
List<EventResultDTO> getList(EventFormsDTO formDTO);
}

43
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventDetailEntity.java

@ -0,0 +1,43 @@
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;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("event_detail")
public class EventDetailEntity extends BaseEpmetEntity {
/**
* 事件ID
*/
private String eventId;
/**
* 上报人
*/
private String reporter;
/**
* 接收人
*/
private String recipient;
/**
* 上报事件
*/
private Date reportDate;
/**
* 事件附件地址
*/
private String atts;
/**
* 事件处理耗时
*/
private String timeSpent;
/**
* 反馈内容
*/
private String content;
}

97
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventEntity.java

@ -0,0 +1,97 @@
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;
/**
* 灵山项目事件
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("event_entity")
public class EventEntity extends BaseEpmetEntity {
/**
* 事件编号
*/
private String code;
/**
* 事件状态
*/
private String status;
/**
* 事件明细ID
*/
private String detailId;
/**
* 上报人员
*/
private String reporter;
/**
* 联系电话
*/
private String phone;
/**
* 上报事件事件
*/
private Date reportDate;
/**
* 紧急程度
*/
private String urgency;
/**
* 所属网格
*/
private String grid;
/**
* 事件类型
*/
private String eventType;
/**
* 即办类型
*/
private String type;
/**
* 办理期限
*/
private Date lastDate;
/**
* 事件地址
*/
private String eventAddr;
/**
* 坐标经度
*/
private String longitude;
/**
* 坐标纬度
*/
private String latitude;
/**
* 音频
*/
private String voice;
/**
* 视频
*/
private String video;
/**
* 满意度
*/
private String satisficing;
/**
* 解决情况
*/
private String remark;
/**
* 事件描述
*/
private String conetnt;
}

19
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/EventService.java

@ -0,0 +1,19 @@
package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.EventAddEditFormDTO;
import com.epmet.dto.form.EventFormsDTO;
import com.epmet.dto.result.EventResultDTO;
public interface EventService {
PageData<EventResultDTO> getList(EventFormsDTO formDTO);
EventResultDTO getById(String id);
void update(EventResultDTO dto);
void delete(String[] ids);
void save(EventAddEditFormDTO dto);
}

136
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java

@ -0,0 +1,136 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.EventEntityDao;
import com.epmet.dto.form.EventAddEditFormDTO;
import com.epmet.dto.form.EventFormsDTO;
import com.epmet.dto.result.EventResultDTO;
import com.epmet.entity.EventEntity;
import com.epmet.entity.IcEventOperationLogEntity;
import com.epmet.service.EventService;
import com.epmet.service.IcEventOperationLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Service
public class EventServiceImpl extends BaseServiceImpl<EventEntityDao, EventEntity> implements EventService {
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private IcEventOperationLogService icEventOperationLogService;
/**
* @param formDTO
* @return
* @deprecated 查询事件列表
*/
@Override
public PageData<EventResultDTO> getList(EventFormsDTO formDTO) {
if (StringUtils.isBlank(formDTO.getAgencyId())) {
//获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
}
//分页查询当前组织下网格内事件数据
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<EventResultDTO> list = baseDao.getList(formDTO);
PageInfo<EventResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
/**
* @param id
* @return
* @deprecated 获取事件详情
*/
@Override
public EventResultDTO getById(String id) {
EventEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, EventResultDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(EventResultDTO dto) {
EventEntity entity = ConvertUtils.sourceToTarget(dto, EventEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
for (String id : ids) {
EventEntity entity = baseDao.selectById(id);
if (null == entity) {
continue;
}
LambdaUpdateWrapper<EventEntity> wrapper = new LambdaUpdateWrapper();
wrapper.eq(EventEntity::getId, id).set(EventEntity::getUpdatedTime, new Date())
.set(EventEntity::getUpdatedBy, loginUserUtil.getLoginUserId())
.set(EventEntity::getDelFlag, NumConstant.ONE_STR);
baseDao.update(null, wrapper);
// icEventCategoryService.delInsert(id,null);
}
}
@Override
public void save(EventAddEditFormDTO formDTO) {
EventEntity entity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class);
entity.setId(IdWorker.getIdStr());
// List<IcEventOperationLogEntity> logList = new ArrayList<>();
// logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), new Date(), "add", "publish"));
// icEventOperationLogService.insertBatch(logList);
insert(entity);
}
/**
* @param customerId
* @param staffId
* @return
* @deprecated 获取当前登陆人员信息
*/
public CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId);
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", staffId));
}
return staffInfo;
}
/**
* 事件管理操作日志记录
*
* @return
*/
private IcEventOperationLogEntity logEntity(String customerId, String icEventId, String userId, Date operateTime, String actionCode, String actionDesc) {
IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity();
logEntity.setCustomerId(customerId);
logEntity.setIcEventId(icEventId);
logEntity.setUserId(userId);
logEntity.setUserIdentity("staff");
logEntity.setActionCode(actionCode);
logEntity.setActionDesc(actionDesc);
logEntity.setOperateTime(operateTime);
return logEntity;
}
}

13
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/EventEntityDao.xml

@ -0,0 +1,13 @@
<?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.EventEntityDao">
<select id="getList" resultType="com.epmet.dto.result.EventResultDTO">
select * from event_entity
<where>
DEL_FLAG = '0'
</where>
order by REPORT_DATE DESC, CREATED_TIME DESC
</select>
</mapper>

42
epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java

@ -0,0 +1,42 @@
package com.epmet.enums;
/**
* @description: 灵山街道-特殊人群
* @param null:
* @return
* @author: WangXianZhang
* @date: 2023/4/19 10:55 AM
*/
public enum LingShanSpecialCrowdTypeEnums {
AZBJ("anzhibangjiao", "安置帮教", 1),
SQJZ("shequjiaozheng", "社区矫正", 1),
JDRY("xidurenyuan", "戒毒人员", 1),
JZHZ("jingzhanghuanzhe", "精障患者", 1),
XFRY("xinfangrenyuan", "信访人员", 1);
/**
* 类型anzhibangjiao,
*/
private String type;
private String name;
private Integer headerRowNumber;
LingShanSpecialCrowdTypeEnums(String type, String name, Integer headerRowNumber) {
this.type = type;
this.name = name;
this.headerRowNumber = headerRowNumber;
}
public String getType() {
return type;
}
public String getName() {
return name;
}
public Integer getHeaderRowNumber() {
return headerRowNumber;
}
}

117
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java

@ -0,0 +1,117 @@
package com.epmet.controller;
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.FileUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.LingShanSpecialCrowdService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Date;
/**
* @description: 灵山社会维稳特殊人群
* @param null:
* @return
* @author: WangXianZhang
* @date: 2023/4/18 9:08 AM
*/
@Slf4j
@RestController
@RequestMapping("lingShan/specialCrowd")
public class LingShanSpecialCrowdController {
@Autowired
private LingShanSpecialCrowdService lingShanSpecialCrowdService;
/**
* @description: 特殊人群导入
* @param file:
* @param crowdCategory: 人群类别
* anzhibangjiao
* buliangqingshaonian
* shequjiaozheng
* xidurenyuan
* xiejiaorenyuan
* zhaoshizhaohuojingshenbing
* @return
* @author: WangXianZhang
* @date: 2023/4/18 9:12 AM
*/
@PostMapping("import")
public Result importSpecialCowd(MultipartFile file, @RequestParam("crowdCategory") String crowdCategory) {
String originalFilename = file.getOriginalFilename();
String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
// 1.存文件
Path fileSavePath = saveSpecialCrowdTempFile(file, suffix);
// 2.执行业务导入
try {
lingShanSpecialCrowdService.importSpecialCrowd(crowdCategory, fileSavePath.toString(), originalFilename);
} catch (Exception e) {
throw e;
// ...
} finally {
// 3.删除文件
deleteSpecialCrowdTempFile(fileSavePath);
}
return new Result();
}
/**
* @description: 保存特殊人群临时文件
* @param file:
* @return
* @author: WangXianZhang
* @date: 2023/4/18 9:46 AM
*/
public Path saveSpecialCrowdTempFile(@RequestParam("file") MultipartFile file, String suffix) {
Path fileSavePath;
FileOutputStream os = null;
try {
Path fileSaveDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("special_crowd_import");
String fileName = DateUtils.format(new Date(), "yyyyMMdd_HHmmss_" + System.nanoTime()) + suffix;
fileSavePath = fileSaveDir.resolve(fileName);
IOUtils.copy(file.getInputStream(), (os = new FileOutputStream(fileSavePath.toString())));
return fileSavePath;
} catch (IOException e) {
log.error("【灵山街道】导入社会维稳数据,缓存文件失败。");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, null);
} finally {
org.apache.poi.util.IOUtils.closeQuietly(os);
}
}
/**
* @description: 删除特殊人群临时文件
* @param fileSavePath:
* @return
* @author: WangXianZhang
* @date: 2023/4/18 9:47 AM
*/
public void deleteSpecialCrowdTempFile(Path fileSavePath) {
if (fileSavePath != null) {
try {
Files.deleteIfExists(fileSavePath);
} catch (
IOException e) {
log.error("【灵山街道】导入社会维稳数据,删除临时文件失败");
}
}
}
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-安置帮教
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdDetailAzbjDao extends BaseDao<LingshanSpecialCrowdDetailAzbjEntity> {
void saveBatchManually(@Param("asbjList") List<LingshanSpecialCrowdDetailAzbjEntity> l);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdDetailJdryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-戒毒人员
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdDetailJdryDao extends BaseDao<LingshanSpecialCrowdDetailJdryEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailJdryEntity> l);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-精障患者
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdDetailJzhzDao extends BaseDao<LingshanSpecialCrowdDetailJzhzEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailJzhzEntity> l);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdDetailSqjzEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-社区矫正
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdDetailSqjzDao extends BaseDao<LingshanSpecialCrowdDetailSqjzEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailSqjzEntity> l);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdDetailXfryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-信访人员
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdDetailXfryDao extends BaseDao<LingshanSpecialCrowdDetailXfryEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailXfryEntity> l);
}

21
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java

@ -0,0 +1,21 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity;
import com.epmet.entity.LingshanSpecialCrowdPersonEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-人员基础信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdPersonDao extends BaseDao<LingshanSpecialCrowdPersonEntity> {
void saveOrUpdateManually(@Param("list") List<LingshanSpecialCrowdPersonEntity> list);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 灵山-特殊人群-人员具有的特殊人群类型信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
public interface LingshanSpecialCrowdPersonTypeDao extends BaseDao<LingshanSpecialCrowdPersonTypeEntity> {
void saveOrUpdateManually(@Param("types") List<LingshanSpecialCrowdPersonTypeEntity> types);
}

69
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailAzbjEntity.java

@ -0,0 +1,69 @@
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-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_detail_azbj")
public class LingshanSpecialCrowdDetailAzbjEntity extends LingshanSpecialCrowdDetailBaseEntity {
private static final long serialVersionUID = 1L;
/**
* 原罪名
*/
private String originalCharge;
/**
* 释放日期
*/
private Date releaseDate;
/**
* 原判刑期单位
*/
private Date originPrisonTerm;
/**
* 是否累犯0否1是
*/
private Integer recidivismFlag;
/**
* 是否安置0否1是
*/
private Integer emplacementFlag;
/**
* 安置日期
*/
private Date emplacementDate;
/**
* 安置帮教情况
*/
private String emplacementInfo;
/**
* 是否注销
*/
private Integer canceledFlag;
/**
* 注销原因
*/
private String canceledReason;
}

22
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailBaseEntity.java

@ -0,0 +1,22 @@
package com.epmet.entity;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
@Data
public class LingshanSpecialCrowdDetailBaseEntity extends BaseEpmetEntity {
/**
* 客户Id
*/
private String customerId;
/**
* org id路径:分割
*/
private String orgIdPath;
/**
* 证件号
*/
private String idCard;
}

69
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJdryEntity.java

@ -0,0 +1,69 @@
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-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_detail_jdry")
public class LingshanSpecialCrowdDetailJdryEntity extends LingshanSpecialCrowdDetailBaseEntity {
private static final long serialVersionUID = 1L;
/**
* 有无犯罪史
*/
private Integer criminalHistoryFlag;
/**
* 有无复吸史
*/
private Integer drugRepetitionFlag;
/**
* 初次发现日期
*/
private Date firstDiscoveryDate;
/**
* 管控人姓名
*/
private String controllerName;
/**
* 管控人联系方式
*/
private String controllerContact;
/**
* 帮扶人姓名
*/
private String helperName;
/**
* 帮扶人联系方式
*/
private String helperContact;
/**
* 是否脱管
*/
private Integer detachedFlag;
/**
* 脱管原因
*/
private String detachedReason;
}

74
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJzhzEntity.java

@ -0,0 +1,74 @@
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-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_detail_jzhz")
public class LingshanSpecialCrowdDetailJzhzEntity extends LingshanSpecialCrowdDetailBaseEntity {
private static final long serialVersionUID = 1L;
/**
* 有无肇事肇祸史
*/
private Integer causeTroubleHistoryFlag;
/**
* 肇事肇祸次数
*/
private Integer causeTroubleTimes;
/**
* 目前诊断类型1精神分裂症2分裂情感性障碍3持久的妄想性障碍偏执性精神病4双相情感障碍5癫痫所致精神障碍6精神发育迟滞伴发精神障碍7重度抑郁发作8精神活性物质所致精神障碍9其他
*/
private Integer currentDiagnosis;
/**
* 危险性评估等级012345
*/
private Integer dangerousClass;
/**
* 是否具备外出能力
*/
private Integer canGoOutFlag;
/**
* 是否有暴力倾向
*/
private Integer violenceFlag;
/**
* 是否落实监管补助
*/
private Integer allowanceFlag;
/**
* 是否纳入低保
*/
private Integer subsistenceFlag;
/**
* 监护人姓名
*/
private String guardianName;
/**
* 监护人联系方式
*/
private String guardianContact;
}

79
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailSqjzEntity.java

@ -0,0 +1,79 @@
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-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_detail_sqjz")
public class LingshanSpecialCrowdDetailSqjzEntity extends LingshanSpecialCrowdDetailBaseEntity {
private static final long serialVersionUID = 1L;
/**
* 矫正类型1.管制,2缓刑,3假释,4暂予监外执行,5剥夺政治权利
*/
private Integer rectificateType;
/**
* 矫正开始日期
*/
private Date rectificateStartDate;
/**
* 矫正结束日期
*/
private Date rectificateEndDate;
/**
* 原羁押场所
*/
private String originDetainAddress;
/**
* 原罪名
*/
private String originalCharge;
/**
* 接受方式1.自行报到2狱所押送3当庭交接4其他
*/
private Integer receiveWay;
/**
* 矫正情况说明
*/
private String rectificateInfo;
/**
* 是否脱管
*/
private Integer detachedFlag;
/**
* 脱管原因
*/
private String detachedReason;
/**
* 是否注销
*/
private Integer canceledFlag;
/**
* 注销原因
*/
private String canceledReason;
}

70
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailXfryEntity.java

@ -0,0 +1,70 @@
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-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_detail_xfry")
public class LingshanSpecialCrowdDetailXfryEntity extends LingshanSpecialCrowdDetailBaseEntity {
private static final long serialVersionUID = 1L;
/**
* 反映问题
*/
private String problem;
/**
* 稳控措施
*/
private String stableControlMeasurement;
/**
* 是否多次上访
*/
private Integer multipleFlag;
/**
* 是否在当地
*/
private Integer localFlag;
/**
* 分管领导
*/
private String branchLeader;
/**
* 分管领导联系方式
*/
private String branchLeaderContact;
/**
* 负责人
*/
private String principal;
/**
* 负责人联系方式
*/
private String principalContact;
/**
* 稳控人员名单
*/
private String stableControlerList;
}

64
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonEntity.java

@ -0,0 +1,64 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 灵山-特殊人群-人员基础信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_person")
public class LingshanSpecialCrowdPersonEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* org id路径:分割
*/
private String orgIdPath;
/**
* 姓名
*/
private String name;
/**
* 证件号
*/
private String idCard;
public LingshanSpecialCrowdPersonEntity() {
}
public LingshanSpecialCrowdPersonEntity(String id, String customerId, String orgIdPath, String name, String idCard,
String delFlag, Integer revision, Date createdTime, String createdBy, Date updatedTime,
String updatedBy) {
this.customerId = customerId;
this.orgIdPath = orgIdPath;
this.name = name;
this.idCard = idCard;
this.setDelFlag(delFlag);
this.setCreatedBy(createdBy);
this.setCreatedTime(createdTime);
this.setUpdatedBy(updatedBy);
this.setUpdatedTime(updatedTime);
this.setRevision(revision);
this.setId(id);
}
}

59
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonTypeEntity.java

@ -0,0 +1,59 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 灵山-特殊人群-人员具有的特殊人群类型信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_person_type")
public class LingshanSpecialCrowdPersonTypeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* org id路径:分割
*/
private String orgIdPath;
/**
* 证件号
*/
private String idCard;
/**
* 特殊人群类别
*/
private String specialType;
public LingshanSpecialCrowdPersonTypeEntity(String id, String customerId, String orgIdPath, String idCard, String specialType, String delFlag,
Integer revision, Date createdTime, String createdBy, Date updatedTime, String updatedBy) {
this.customerId = customerId;
this.orgIdPath = orgIdPath;
this.idCard = idCard;
this.specialType = specialType;
this.setDelFlag(delFlag);
this.setCreatedBy(createdBy);
this.setCreatedTime(createdTime);
this.setUpdatedBy(updatedBy);
this.setUpdatedTime(updatedTime);
this.setRevision(revision);
this.setId(id);
}
}

34
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdIsOrNotConverter.java

@ -0,0 +1,34 @@
package com.epmet.excel.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
import org.apache.commons.lang3.StringUtils;
/**
* 灵山-是否转换器
*/
public class LingShanSpecialCrowdIsOrNotConverter implements Converter<Integer> {
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Class<?> supportJavaTypeKey() {
return Integer.class;
}
@Override
public Integer convertToJavaData(ReadConverterContext<?> context) throws Exception {
String content = context.getReadCellData().getStringValue();
if (StringUtils.isNotBlank(content)) {
if (content.equals("是") || content.equals("有")) {
return 1;
} else if (content.equals("无") || content.equals("否")) {
return 0;
}
}
return Converter.super.convertToJavaData(context);
}
}

57
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java

@ -0,0 +1,57 @@
package com.epmet.excel.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
/**
* 灵山-诊断类型转换器
*/
public class LingShanSpecialCrowdJzhzConverter implements Converter<Integer> {
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Integer convertToJavaData(ReadConverterContext<?> context) throws Exception {
String content = context.getReadCellData().getStringValue();
if (content instanceof String) {
switch (content) {
// 诊断类型
case "精神分裂症":
return 1;
case "分裂情感性障碍":
return 2;
case "持久的妄想性障碍(偏执性精神病)":
return 3;
case "双相(情感)障碍":
return 4;
case "癫痫所致精神障碍":
return 5;
case "精神发育迟滞伴发精神障碍":
return 6;
case "重度抑郁发作":
return 7;
case "精神活性物质所致精神障碍":
return 8;
case "其他":
return 9;
// 危险性评估等级
case "0级":
return 0;
case "1级":
return 1;
case "2级":
return 2;
case "3级":
return 3;
case "4级":
return 4;
case "5级":
return 5;
}
}
return Converter.super.convertToJavaData(context);
}
}

51
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java

@ -0,0 +1,51 @@
package com.epmet.excel.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
/**
* 灵山-社区矫正转换器
*/
public class LingShanSpecialCrowdSqjzConverter implements Converter<Integer> {
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Class<?> supportJavaTypeKey() {
return Integer.class;
}
@Override
public Integer convertToJavaData(ReadConverterContext<?> context) throws Exception {
Object content = context.getReadCellData().getStringValue();
if (content instanceof String) {
switch ((String) content) {
// 矫正类型
case "管制":
return 1;
case "缓刑":
return 2;
case "假释":
return 3;
case "暂予监外执行":
return 4;
case "剥夺政治权利":
return 5;
// 接受方式
case "自行报到":
return 1;
case "狱所押送":
return 2;
case "当庭交接":
return 3;
case "其他":
return 4;
}
}
return Converter.super.convertToJavaData(context);
}
}

73
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java

@ -0,0 +1,73 @@
package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 安置帮教
*/
@Data
public class LingShanSpecialCrowdDetailAzbjExcelData extends LingShanSpecialCrowdDetailBaseExcelData {
/**
* 原罪名
*/
@ExcelProperty(value = "*原罪名")
@NotBlank(message = "原罪名不能为空")
private String originalCharge;
/**
* 释放日期
*/
@ExcelProperty(value = "*释放日期")
@NotNull(message = "释放日期不能为空")
private Date releaseDate;
/**
* 原判刑期单位
*/
@ExcelProperty(value = "原判刑期(单位:月)")
private Date originPrisonTerm;
/**
* 是否累犯0否1是
*/
@ExcelProperty(value = "是否累犯", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer recidivismFlag;
/**
* 是否安置0否1是
*/
@ExcelProperty(value = "是否安置", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer emplacementFlag;
/**
* 安置日期
*/
@ExcelProperty(value = "安置日期")
private Date emplacementDate;
/**
* 安置帮教情况
*/
@ExcelProperty(value = "安置帮教情况")
private String emplacementInfo;
/**
* 是否注销
*/
@ExcelProperty(value = "是否注销", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer canceledFlag;
/**
* 注销原因
*/
@ExcelProperty(value = "注销原因")
private String canceledReason;
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java

@ -0,0 +1,30 @@
package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
*
*/
@Data
public class LingShanSpecialCrowdDetailBaseExcelData {
/**
* 姓名
*/
@ExcelProperty(value = "*姓名")
@NotBlank(message = "姓名不能为空")
private String name;
/**
* 证件号
*/
@ExcelProperty(value = "*身份证号")
@NotBlank(message = "身份证号不能为空")
private String idCard;
/**
* 错误信息
*/
private String errorInfo;
}

79
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java

@ -0,0 +1,79 @@
package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 灵山-特殊人群-戒毒人员
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
public class LingshanSpecialCrowdDetailJdryExcelData extends LingShanSpecialCrowdDetailBaseExcelData {
/**
* 有无犯罪史
*/
@ExcelProperty(value = "*有无犯罪史", converter = LingShanSpecialCrowdIsOrNotConverter.class)
@NotNull(message = "有无犯罪史不能为空")
private Integer criminalHistoryFlag;
/**
* 有无复吸史
*/
@ExcelProperty(value = "*有无复吸史", converter = LingShanSpecialCrowdIsOrNotConverter.class)
@NotNull(message = "有无复吸史不能为空")
private Integer drugRepetitionFlag;
/**
* 初次发现日期
*/
@ExcelProperty(value = "初次发现日期")
private Date firstDiscoveryDate;
/**
* 管控人姓名
*/
@ExcelProperty(value = "管控人姓名")
private String controllerName;
/**
* 管控人联系方式
*/
@ExcelProperty(value = "管控人联系方式")
private String controllerContact;
/**
* 帮扶人姓名
*/
@ExcelProperty(value = "帮扶人姓名")
private String helperName;
/**
* 帮扶人联系方式
*/
@ExcelProperty(value = "帮扶人联系方式")
private String helperContact;
/**
* 是否脱管
*/
@ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer detachedFlag;
/**
* 脱管原因
*/
@ExcelProperty(value = "脱管原因")
private String detachedReason;
}

84
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java

@ -0,0 +1,84 @@
package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter;
import com.epmet.excel.converter.LingShanSpecialCrowdJzhzConverter;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 灵山-特殊人群-精障患者
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
public class LingshanSpecialCrowdDetailJzhzExcelData extends LingShanSpecialCrowdDetailBaseExcelData {
private static final long serialVersionUID = 1L;
/**
* 有无肇事肇祸史
*/
@ExcelProperty(value = "*有无肇事肇祸史", converter = LingShanSpecialCrowdIsOrNotConverter.class)
@NotNull(message = "有无肇事肇祸史不能为空")
private Integer causeTroubleHistoryFlag;
/**
* 肇事肇祸次数
*/
@ExcelProperty(value = "*肇事肇祸次数")
@NotNull(message = "肇事肇祸次数不能为空")
private Integer causeTroubleTimes;
/**
* 目前诊断类型1精神分裂症2分裂情感性障碍3持久的妄想性障碍偏执性精神病4双相情感障碍5癫痫所致精神障碍6精神发育迟滞伴发精神障碍7重度抑郁发作8精神活性物质所致精神障碍9其他
*/
@ExcelProperty(value = "目前诊断类型", converter = LingShanSpecialCrowdJzhzConverter.class)
private Integer currentDiagnosis;
/**
* 危险性评估等级012345
*/
@ExcelProperty(value = "危险性评估等级", converter = LingShanSpecialCrowdJzhzConverter.class)
private Integer dangerousClass;
/**
* 是否具备外出能力
*/
@ExcelProperty(value = "是否具备外出能力", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer canGoOutFlag;
/**
* 是否有暴力倾向
*/
@ExcelProperty(value = "是否有暴力倾向", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer violenceFlag;
/**
* 是否落实监管补助
*/
@ExcelProperty(value = "是否落实监管补助", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer allowanceFlag;
/**
* 是否纳入低保
*/
@ExcelProperty(value = "是否纳入低保", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer subsistenceFlag;
/**
* 监护人姓名
*/
@ExcelProperty(value = "监护人姓名")
private String guardianName;
/**
* 监护人联系方式
*/
@ExcelProperty(value = "监护人联系方式")
private String guardianContact;
}

92
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java

@ -0,0 +1,92 @@
package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter;
import com.epmet.excel.converter.LingShanSpecialCrowdSqjzConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 灵山-特殊人群-社区矫正
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
public class LingshanSpecialCrowdDetailSqjzExcelData extends LingShanSpecialCrowdDetailBaseExcelData {
/**
* 矫正类型1.管制,2缓刑,3假释,4暂予监外执行,5剥夺政治权利
*/
@ExcelProperty(value = "*矫正类型", converter = LingShanSpecialCrowdSqjzConverter.class)
@NotNull(message = "矫正类型不能为空")
private Integer rectificateType;
/**
* 矫正开始日期
*/
@ExcelProperty(value = "矫正开始日期")
private Date rectificateStartDate;
/**
* 矫正结束日期
*/
@ExcelProperty(value = "矫正结束日期")
private Date rectificateEndDate;
/**
* 原羁押场所
*/
@ExcelProperty(value = "原羁押场所")
private String originDetainAddress;
/**
* 原罪名
*/
@ExcelProperty(value = "原罪名")
private String originalCharge;
/**
* 接受方式1.自行报到2狱所押送3当庭交接4其他
*/
@ExcelProperty(value = "接受方式", converter = LingShanSpecialCrowdSqjzConverter.class)
private Integer receiveWay;
/**
* 矫正情况说明
*/
@ExcelProperty(value = "矫正情况说明")
private String rectificateInfo;
/**
* 是否脱管
*/
@ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer detachedFlag;
/**
* 脱管原因
*/
@ExcelProperty(value = "脱管原因")
private String detachedReason;
/**
* 是否注销
*/
@ExcelProperty(value = "是否注销" , converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer canceledFlag;
/**
* 注销原因
*/
@ExcelProperty(value = "注销原因")
private String canceledReason;
}

77
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java

@ -0,0 +1,77 @@
package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* 灵山-特殊人群-信访人员
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
public class LingshanSpecialCrowdDetailXfryExcelData extends LingShanSpecialCrowdDetailBaseExcelData {
/**
* 反映问题
*/
@ExcelProperty(value = "*反映问题")
@NotBlank(message = "反映问题不能为空")
private String problem;
/**
* 稳控措施
*/
@ExcelProperty(value = "*稳控措施")
@NotBlank(message = "稳控措施不能为空")
private String stableControlMeasurement;
/**
* 是否多次上访
*/
@ExcelProperty(value = "是否多次上访", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer multipleFlag;
/**
* 是否在当地
*/
@ExcelProperty(value = "是否在当地", converter = LingShanSpecialCrowdIsOrNotConverter.class)
private Integer localFlag;
/**
* 分管领导
*/
@ExcelProperty(value = "分管领导")
private String branchLeader;
/**
* 分管领导联系方式
*/
@ExcelProperty(value = "分管领导联系方式")
private String branchLeaderContact;
/**
* 负责人
*/
@ExcelProperty(value = "负责人")
private String principal;
/**
* 负责人联系方式
*/
@ExcelProperty(value = "负责人联系方式")
private String principalContact;
/**
* 稳控人员名单
*/
@ExcelProperty(value = "稳控人员名单")
private String stableControlerList;
}

401
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java

@ -0,0 +1,401 @@
package com.epmet.excel.handler;
import cn.hutool.log.Log;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.listener.ReadListener;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.common.token.util.TokenUtil;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.entity.LingshanSpecialCrowdDetailBaseEntity;
import com.epmet.entity.LingshanSpecialCrowdPersonEntity;
import com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData;
import com.epmet.exceptions.ReadExcelHeaderOnlyException;
import com.epmet.service.LingShanSpecialCrowdService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import java.util.*;
import java.util.stream.Collectors;
/**
* 灵山大屏-抽象的导入excel监听器
*/
@Data
@Slf4j
public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends LingShanSpecialCrowdDetailBaseExcelData, E extends LingshanSpecialCrowdDetailBaseEntity>
extends AnalysisEventListener<T> {
/**
* @description: 分布式锁
* @param null:
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:43 PM
*/
private DistributedLock distributedLock;
/**
* 按批次保存单次最大数据量
*/
private static final Integer MAX_BATCH_SIZE = 500;
private String templateFileName;
/**
* 表头应有行数
*/
private Integer maxHeadRowNum;
/**
* 文件的表头中应当有哪些列
*/
private List<String> headerZhList;
/**
* @description: 是否只校验表头
* @param null:
* @return
* @author: WangXianZhang
* @date: 2023/4/19 5:16 PM
*/
private Boolean validateHeaderOnly = false;
/**
* 当前表头读到了第几行
*/
private Integer currentHeadRowNum = 0;
/**
* 原始数据列表
*/
private List<T> originDatas = new ArrayList<>();
/**
* 错误数据列表
*/
private List<T> errorDatas = new ArrayList<>();
/**
* 正确数据
*/
private List<E> correctDatas = new ArrayList<>();
private List<LingshanSpecialCrowdPersonEntity> persons = new ArrayList<>();
private List<LingshanSpecialCrowdPersonTypeEntity> personTypes = new ArrayList<>();
protected LingShanSpecialCrowdService lingShanSpecialCrowdService;
private Class<E> entityClass;
private CustomerStaffInfoCacheResult currentStaffInfo;
private LingShanSpecialCrowdTypeEnums specialCrowdType;
public AbstractLingShanSpecialCrowdExcelImportListener() {
lingShanSpecialCrowdService = SpringContextUtils.getBean(LingShanSpecialCrowdService.class);
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
currentStaffInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
maxHeadRowNum = setMaxHeadRowNum();
headerZhList = setHeaderZhList();
specialCrowdType = getSpecialCrowdType();
entityClass = getEntityClass();
}
/**
* @param headMap:
* @param context:
* @return
* @description: 表头回调函数此处做统一表头校验确认文件内容与当前要导入的数据的字段一致防止导错类型.
* @author: WangXianZhang
* @date: 2023/4/18 10:42 AM
*/
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
// super.invokeHeadMap(headMap, context);
if (maxHeadRowNum == null || CollectionUtils.isEmpty(headerZhList)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【灵山街道】社会维稳数据导入-子类未设置header行数以及header字段列表。");
}
if ((++currentHeadRowNum).equals(maxHeadRowNum)) {
// 如果是表头最后一行,则校验表头
List<String> redundentHeaders = new ArrayList<>();
List<String> lackHeaders = new ArrayList<>();
Collection<String> headersFromFile = headMap.values();
// 2次循环,双向校验
for (String headerZh : headersFromFile) {
if (StringUtils.isNotBlank(headerZh) && !headerZhList.contains(headerZh)) {
redundentHeaders.add(headerZh);
}
}
for (String headerZh : headerZhList) {
if (StringUtils.isNotBlank(headerZh) && !headersFromFile.contains(headerZh)) {
lackHeaders.add(headerZh);
}
}
// 汇总错误字段,成一句话
String preValidTipStr = "";
if (CollectionUtils.isNotEmpty(redundentHeaders)) {
preValidTipStr += "多余【" + String.join(",", redundentHeaders) + "】字段。";
}
if (CollectionUtils.isNotEmpty(lackHeaders)) {
preValidTipStr += "缺少【" + String.join(",", lackHeaders) + "】必填字段。";
}
if (StringUtils.isNotBlank(preValidTipStr)) {
log.error("【灵山街道-社会维稳导入】表格表头不对应," + preValidTipStr);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "上传文件有误!" + preValidTipStr + "请确认表格格式正确");
}
}
}
/**
* @description: 行读取回调函数
* @param row:
* @param context:
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:44 PM
*/
@Override
public void invoke(T row, AnalysisContext context) {
if (validateHeaderOnly) {
// 如果仅解析表头,那么抛出异常,外层接住
throw new ReadExcelHeaderOnlyException();
}
try {
ValidatorUtils.validateEntity(row);
} catch (ValidateException e) {
// 加入到错误记录中去
errorDatas.add(row);
return;
}
originDatas.add(row);
if (originDatas.size() >= MAX_BATCH_SIZE) {
// 满足了一批次的数量,执行保存
saveBatchWithLock();
clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (validateHeaderOnly) {
throw new ReadExcelHeaderOnlyException();
}
if (originDatas.size() > 0) {
saveBatchWithLock();
clear();
}
}
/**
* @param :
* @return
* @description: 批量保存带锁的因为要在Listener中过滤出哪些数据不能导入返回给前端
* 所以需要再lisener中做批量检查然后批量保存过程需要一点时间为了防止并发问题加分布式锁以agencyId为粒度
* @author: WangXianZhang
* @date: 2023/4/18 4:33 PM
*/
private void saveBatchWithLock() {
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, EpmetRequestHolder.getLoginUserId());
RLock lock = distributedLock.getLock(String.format("{}:{}:{}", "lock:specialcrowd", customerId, staffInfo.getAgencyId()));
try {
this.saveBatch();
} catch (Exception e) {
throw e;
} finally {
if (lock != null && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
/**
* @param :
* @return
* @description: 批量保存
* @author: WangXianZhang
* @date: 2023/4/18 3:42 PM
*/
protected void saveBatch() {
String orgIdPath = PidUtils.convertPid2OrgIdPath(currentStaffInfo.getFromOrgId(), currentStaffInfo.getAgencyPIds());
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
Date now = new Date();
Iterator<T> it = getOriginDatas().iterator();
for (; it.hasNext(); ) {
T row = it.next();
String errorInfo = lingShanSpecialCrowdService.validate(row);
if (StringUtils.isNotBlank(errorInfo)) {
row.setErrorInfo(errorInfo);
errorDatas.add(row);
it.remove();
} else {
persons.add(new LingshanSpecialCrowdPersonEntity(IdWorker.getIdStr(), customerId, orgIdPath, row.getName(), row.getIdCard(),
"0", 0, now, currentStaffInfo.getStaffId(), now, currentStaffInfo.getStaffId()));
personTypes.add(new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, row.getIdCard(), specialCrowdType.getType(),
"0", 0, now, currentStaffInfo.getStaffId(), now, currentStaffInfo.getStaffId()));
E e = ConvertUtils.sourceToTarget(row, entityClass);
e.setCustomerId(customerId);
e.setOrgIdPath(orgIdPath);
e.setId(IdWorker.getIdStr());
e.setRevision(0);
e.setCreatedTime(now);
e.setUpdatedTime(now);
e.setCreatedBy(currentStaffInfo.getStaffId());
e.setUpdatedBy(currentStaffInfo.getStaffId());
e.setDelFlag("0");
correctDatas.add(e);
}
}
// 执行保存
if(!CollectionUtils.isEmpty(persons) && !CollectionUtils.isEmpty(personTypes)) {
savePersonAndTypes(persons, personTypes);
}
// 将错误的数据处理 todo
// 保存人群详情数据
saveBatchCallback(correctDatas);
}
/**
* @description: 保存人员信息人员类型
* @param persons:
* @param personTypes:
* @return
* @author: WangXianZhang
* @date: 2023/4/19 11:06 AM
*/
private void savePersonAndTypes(List<LingshanSpecialCrowdPersonEntity> persons, List<LingshanSpecialCrowdPersonTypeEntity> personTypes) {
lingShanSpecialCrowdService.savePersonAndTypes(persons, personTypes);
}
/**
* @param :
* @return
* @description: 清理数据
* @author: WangXianZhang
* @date: 2023/4/18 4:41 PM
*/
protected void clear() {
originDatas.clear();
errorDatas.clear();
}
/**
* @description: 获取读取到的原始数据
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:21 PM
*/
protected List<T> getOriginDatas() {
return originDatas;
}
/**
* @description: 获取错误数据行
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:22 PM
*/
public List<T> getErrorDatas() {
return errorDatas;
}
/**
* @description: 获取正确数据行
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:22 PM
*/
protected List<E> getCorrectDatas() {
return correctDatas;
}
/**
* @param :
* @return
* @description: 批量保存子类实现
* @author: WangXianZhang
* @date: 2023/4/18 4:32 PM
*/
abstract void saveBatchCallback(List<E> entities);
/**
* @description: 设置表头行数
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:22 PM
*/
abstract Integer setMaxHeadRowNum();
/**
* @description: 设置header字段列表子类应当调用该方法设置该值
* @return
* @author: WangXianZhang
* @date: 2023/4/18 11:21 PM
*/
abstract List<String> setHeaderZhList();
/**
* @description: 设置模板名称
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/20 9:07 AM
*/
abstract String setTemplateFileName();
/**
* @description: 获取entity的class用于数据拷贝
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/19 9:47 AM
*/
abstract Class<E> getEntityClass();
/**
* @description: 指定特殊人群类型
* @param :
* @return
* @author: WangXianZhang
* @date: 2023/4/19 11:00 AM
*/
abstract LingShanSpecialCrowdTypeEnums getSpecialCrowdType();
}

54
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdAzbjExcelImportListener.java

@ -0,0 +1,54 @@
package com.epmet.excel.handler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import java.io.File;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* 灵山-安置帮教导入
*/
public class LingShanSpecialCrowdAzbjExcelImportListener
extends AbstractLingShanSpecialCrowdExcelImportListener<LingShanSpecialCrowdDetailAzbjExcelData, LingshanSpecialCrowdDetailAzbjEntity> {
@Override
Integer setMaxHeadRowNum() {
return 1;
}
@Override
List<String> setHeaderZhList() {
return Arrays.asList("*姓名", "*身份证号", "*原罪名", "*释放日期", "原判刑期(单位:月)", "是否累犯", "是否安置", "安置日期", "安置帮教情况", "是否注销", "注销原因");
}
@Override
Class<LingshanSpecialCrowdDetailAzbjEntity> getEntityClass() {
return LingshanSpecialCrowdDetailAzbjEntity.class;
}
@Override
void saveBatchCallback(List<LingshanSpecialCrowdDetailAzbjEntity> entities) {
lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailAzbjEntity());
}
@Override
LingShanSpecialCrowdTypeEnums getSpecialCrowdType() {
return LingShanSpecialCrowdTypeEnums.AZBJ;
}
@Override
String setTemplateFileName() {
return "lingshan/lingshan_special_crowd_azbj_export.xlsx";
}
}

50
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJieduExcelImportListener.java

@ -0,0 +1,50 @@
package com.epmet.excel.handler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity;
import com.epmet.entity.LingshanSpecialCrowdDetailJdryEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingshanSpecialCrowdDetailJdryExcelData;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 灵山-戒毒导入
*/
public class LingShanSpecialCrowdJieduExcelImportListener
extends AbstractLingShanSpecialCrowdExcelImportListener<LingshanSpecialCrowdDetailJdryExcelData, LingshanSpecialCrowdDetailJdryEntity> {
@Override
Integer setMaxHeadRowNum() {
return 1;
}
@Override
List<String> setHeaderZhList() {
return Arrays.asList("*姓名", "*身份证号", "*有无犯罪史", "*有无复吸史", "初次发现日期", "管控人姓名", "管控人联系方式", "帮扶人姓名", "帮扶人联系方式", "是否脱管", "脱管原因");
}
@Override
Class<LingshanSpecialCrowdDetailJdryEntity> getEntityClass() {
return LingshanSpecialCrowdDetailJdryEntity.class;
}
@Override
void saveBatchCallback(List<LingshanSpecialCrowdDetailJdryEntity> entities) {
lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailJdryEntity());
}
@Override
LingShanSpecialCrowdTypeEnums getSpecialCrowdType() {
return LingShanSpecialCrowdTypeEnums.JDRY;
}
@Override
String setTemplateFileName() {
return "lingshan/lingshan_special_crowd_jdry_export.xlsx";
}
}

51
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJingZhangExcelImportListener.java

@ -0,0 +1,51 @@
package com.epmet.excel.handler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.epmet.entity.LingshanSpecialCrowdDetailJdryEntity;
import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingshanSpecialCrowdDetailJzhzExcelData;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 灵山-精神障碍患者导入
*/
public class LingShanSpecialCrowdJingZhangExcelImportListener
extends AbstractLingShanSpecialCrowdExcelImportListener<LingshanSpecialCrowdDetailJzhzExcelData, LingshanSpecialCrowdDetailJzhzEntity> {
@Override
void saveBatchCallback(List<LingshanSpecialCrowdDetailJzhzEntity> entities) {
lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailJzhzEntity());
}
@Override
Integer setMaxHeadRowNum() {
return 1;
}
@Override
List<String> setHeaderZhList() {
return Arrays.asList("*姓名", "*身份证号", "*有无肇事肇祸史", "*肇事肇祸次数", "目前诊断类型", "危险性评估等级", "是否具备外出能力", "是否有暴力倾向", "是否落实监管补助", "是否纳入低保", "监护人姓名", "监护人联系方式");
}
@Override
Class<LingshanSpecialCrowdDetailJzhzEntity> getEntityClass() {
return LingshanSpecialCrowdDetailJzhzEntity.class;
}
@Override
LingShanSpecialCrowdTypeEnums getSpecialCrowdType() {
return LingShanSpecialCrowdTypeEnums.JZHZ;
}
@Override
String setTemplateFileName() {
return "lingshan/lingshan_special_crowd_jzhz_export.xlsx";
}
}

50
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdSqjzExcelImportListener.java

@ -0,0 +1,50 @@
package com.epmet.excel.handler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.epmet.dao.LingshanSpecialCrowdDetailSqjzDao;
import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity;
import com.epmet.entity.LingshanSpecialCrowdDetailSqjzEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingshanSpecialCrowdDetailSqjzExcelData;
import java.io.File;
import java.util.Arrays;
import java.util.List;
/**
* 灵山-矫正人员导入
*/
public class LingShanSpecialCrowdSqjzExcelImportListener
extends AbstractLingShanSpecialCrowdExcelImportListener<LingshanSpecialCrowdDetailSqjzExcelData, LingshanSpecialCrowdDetailSqjzEntity> {
@Override
void saveBatchCallback(List<LingshanSpecialCrowdDetailSqjzEntity> entities) {
lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailSqjzEntity());
}
@Override
Integer setMaxHeadRowNum() {
return 1;
}
@Override
List<String> setHeaderZhList() {
return Arrays.asList("*姓名", "*身份证号", "*矫正类型", "矫正开始日期", "矫正结束日期", "原羁押场所", "原罪名", "接受方式", "矫正情况说明", "是否脱管", "脱管原因", "是否注销", "注销原因");
}
@Override
Class<LingshanSpecialCrowdDetailSqjzEntity> getEntityClass() {
return LingshanSpecialCrowdDetailSqjzEntity.class;
}
@Override
LingShanSpecialCrowdTypeEnums getSpecialCrowdType() {
return LingShanSpecialCrowdTypeEnums.SQJZ;
}
@Override
String setTemplateFileName() {
return "lingshan/lingshan_special_crowd_sqjz_export.xlsx";
}
}

51
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdXinFangExcelImportListener.java

@ -0,0 +1,51 @@
package com.epmet.excel.handler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity;
import com.epmet.entity.LingshanSpecialCrowdDetailXfryEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingshanSpecialCrowdDetailXfryExcelData;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 灵山-信访人员导入
*/
public class LingShanSpecialCrowdXinFangExcelImportListener
extends AbstractLingShanSpecialCrowdExcelImportListener<LingshanSpecialCrowdDetailXfryExcelData, LingshanSpecialCrowdDetailXfryEntity> {
@Override
void saveBatchCallback(List<LingshanSpecialCrowdDetailXfryEntity> entities) {
lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailXfryEntity());
}
@Override
Integer setMaxHeadRowNum() {
return 1;
}
@Override
List<String> setHeaderZhList() {
return Arrays.asList("*姓名", "*身份证号", "*反映问题", "*稳控措施", "是否多次上访", "是否在当地", "分管领导", "分管领导联系方式", "负责人", "负责人联系方式", "稳控人员名单");
}
@Override
Class<LingshanSpecialCrowdDetailXfryEntity> getEntityClass() {
return LingshanSpecialCrowdDetailXfryEntity.class;
}
@Override
LingShanSpecialCrowdTypeEnums getSpecialCrowdType() {
return LingShanSpecialCrowdTypeEnums.XFRY;
}
@Override
String setTemplateFileName() {
return "lingshan/lingshan_special_crowd_xfry_export.xlsx";
}
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/exceptions/ReadExcelHeaderOnlyException.java

@ -0,0 +1,7 @@
package com.epmet.exceptions;
/**
* 只解析表头的异常(用于停止excel导入)
*/
public class ReadExcelHeaderOnlyException extends RuntimeException {
}

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

@ -0,0 +1,47 @@
package com.epmet.service;
import com.epmet.entity.*;
import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData;
import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
/**
* 灵山特殊人群service
*/
public interface LingShanSpecialCrowdService {
/**
* @description: 导入特殊人群
* @param crowdCategory:
* @param fileSavePath:
* @return
* @author: WangXianZhang
* @date: 2023/4/18 5:42 PM
*/
void importSpecialCrowd(String crowdCategory, String fileSavePath, String originFilename);
/**
* @description: 数据校验
* @param row:
* @returns
* @author: WangXianZhang
* @date: 2023/4/18 4:49 PM
*/
String validate(LingShanSpecialCrowdDetailBaseExcelData row);
void savePersonAndTypes(List<LingshanSpecialCrowdPersonEntity> persons, List<LingshanSpecialCrowdPersonTypeEntity> personTypes);
/**
* @description: 安置帮教-导入
* @return
* @author: WangXianZhang
* @date: 2023/4/18 4:11 PM
*/
void saveBatch(List<LingshanSpecialCrowdDetailAzbjEntity> entities, LingshanSpecialCrowdDetailAzbjEntity e);
void saveBatch(List<LingshanSpecialCrowdDetailJdryEntity> entities, LingshanSpecialCrowdDetailJdryEntity e);
void saveBatch(List<LingshanSpecialCrowdDetailJzhzEntity> entities, LingshanSpecialCrowdDetailJzhzEntity e);
void saveBatch(List<LingshanSpecialCrowdDetailSqjzEntity> entities, LingshanSpecialCrowdDetailSqjzEntity e);
void saveBatch(List<LingshanSpecialCrowdDetailXfryEntity> entities, LingshanSpecialCrowdDetailXfryEntity e);
}

281
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java

@ -0,0 +1,281 @@
package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.enums.BizTypeEnum;
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.exception.ValidateException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.*;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.*;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.*;
import com.epmet.excel.handler.*;
import com.epmet.exceptions.ReadExcelHeaderOnlyException;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.LingShanSpecialCrowdService;
import com.epmet.utils.ImportTaskUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
/**
* 灵山特殊人群service
*/
@Slf4j
@Service
public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdService, ResultDataResolver {
@Autowired
private LingshanSpecialCrowdPersonDao specialCrowdPersonDao;
@Autowired
private LingshanSpecialCrowdPersonTypeDao specialCrowdPersonTypeDao;
@Autowired
private LingshanSpecialCrowdDetailAzbjDao specialCrowdDetailAzbjDao;
@Autowired
private LingshanSpecialCrowdDetailSqjzDao specialCrowdDetailSqjzDao;
@Autowired
private LingshanSpecialCrowdDetailJdryDao specialCrowdDetailJdryDao;
@Autowired
private LingshanSpecialCrowdDetailJzhzDao specialCrowdDetailJzhzDao;
@Autowired
private LingshanSpecialCrowdDetailXfryDao specialCrowdDetailXfryDao;
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private ExecutorService executorService;
@Autowired
private OssFeignClient ossFeignClient;
@Override
public void importSpecialCrowd(String crowdCategory, String fileSavePath, String originFilename) {
Class<? extends LingShanSpecialCrowdDetailBaseExcelData> excelDataClass;
AbstractLingShanSpecialCrowdExcelImportListener listener;
LingShanSpecialCrowdTypeEnums specialCrowdTypeEnum;
if (LingShanSpecialCrowdTypeEnums.AZBJ.getType().equals(crowdCategory)) {
listener = new LingShanSpecialCrowdAzbjExcelImportListener();
excelDataClass = LingShanSpecialCrowdDetailAzbjExcelData.class;
specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.AZBJ;
} else if (LingShanSpecialCrowdTypeEnums.SQJZ.getType().equals(crowdCategory)) {
listener = new LingShanSpecialCrowdSqjzExcelImportListener();
excelDataClass = LingshanSpecialCrowdDetailSqjzExcelData.class;
specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.SQJZ;
} else if (LingShanSpecialCrowdTypeEnums.JDRY.getType().equals(crowdCategory)) {
listener = new LingShanSpecialCrowdJieduExcelImportListener();
excelDataClass = LingshanSpecialCrowdDetailJdryExcelData.class;
specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.JDRY;
} else if (LingShanSpecialCrowdTypeEnums.JZHZ.getType().equals(crowdCategory)) {
listener = new LingShanSpecialCrowdJingZhangExcelImportListener();
excelDataClass = LingshanSpecialCrowdDetailJzhzExcelData.class;
specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.JZHZ;
} else if (LingShanSpecialCrowdTypeEnums.XFRY.getType().equals(crowdCategory)) {
listener = new LingShanSpecialCrowdXinFangExcelImportListener();
excelDataClass = LingshanSpecialCrowdDetailXfryExcelData.class;
specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.XFRY;
} else {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【灵山街道-维稳】导入。不支持的人群类别:" + crowdCategory);
}
// Execute reading
// ReadSheet sheet = EasyExcel.readSheet(0).registerReadListener(listener).build();
// EasyExcel.read(fileSavePath).build().read(sheet);
// 解析表头,判断表头是否合格
try {
listener.setValidateHeaderOnly(true);
EasyExcel.read(fileSavePath, excelDataClass, listener)
.headRowNumber(specialCrowdTypeEnum.getHeaderRowNumber())
.sheet(0)
.doRead();
} catch (ReadExcelHeaderOnlyException e) {
log.info("【灵山街道-导入社会维稳】验证通过,可以继续导入");
}
// 正式开始导入。异步导入
listener.setValidateHeaderOnly(false);
CompletableFuture.runAsync(() -> {
// 创建导入任务
ImportTaskCommonResultDTO importTaskRst = getResultDataOrThrowsException(ImportTaskUtils.createImportTask(originFilename,
BizTypeEnum.SPECIAL_CROWD.getType()),
ServiceConstant.EPMET_COMMON_SERVICE,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
null, "【灵山街道-导入特殊人群】创建导入任务失败");
try {
EasyExcel.read(fileSavePath, excelDataClass, listener)
.headRowNumber(specialCrowdTypeEnum.getHeaderRowNumber())
.sheet(0)
.doRead();
List<LingShanSpecialCrowdDetailBaseExcelData> errorDatas = listener.getErrorDatas();
if (CollectionUtils.isNotEmpty(errorDatas)) {
// 有错误数据需要提示
String resultDescFilePath = uploadResultDescFilePath(errorDatas, listener.getTemplateFileName());
ImportTaskUtils.finishImportTask(importTaskRst.getTaskId(),
ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, resultDescFilePath, "失败,请导出文件查看详细信息");
} else {
// 全部成功
ImportTaskUtils.finishImportTask(importTaskRst.getTaskId(),
ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS, null, "成功");
}
} catch (Exception e) {
log.error("【灵山街道-导入特殊人群】失败,错误信息:" + ExceptionUtils.getErrorStackTrace(e));
ImportTaskUtils.finishImportTask(importTaskRst.getTaskId(),
ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, null, "未知错误");
}
}, executorService);
}
/**
* @description: 上传错误描述文件
* @param errorDatas:
* @return
* @author: WangXianZhang
* @date: 2023/4/19 10:19 PM
*/
private String uploadResultDescFilePath(List<LingShanSpecialCrowdDetailBaseExcelData> errorDatas, String templateFileName) {
FileItem fileItem = null;
try {
String fileName =
DateUtils.format(new Date(), "yyyyMMdd_HHmmss_") + System.nanoTime() + "社会维稳导入失败数据.xlsx";
// 创建临时文件
fileItem = new DiskFileItemFactory(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD, FileUtils.getAndCreateDirUnderEpmetFilesDir("temp").toFile())
.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName);
// 写入临时文件
try (OutputStream os = fileItem.getOutputStream()) {
ExcelWriter excelWriter = EasyExcel.write(os).withTemplate(templateFileName).build();
excelWriter.finish();
} catch (IOException e) {
throw new RuntimeException(e);
}
// 上传文件
UploadImgResultDTO uploadRst = getResultDataOrThrowsException(ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)), ServiceConstant.EPMET_COMMON_SERVICE,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
null, "【灵山街道-导入特殊人群】上传错误描述文件失败。");
return uploadRst.getUrl();
} catch (IOException e) {
throw new RuntimeException("【灵山街道-导入特殊人群】生成错误描述文件-创建临时目录失败");
} finally {
try {
fileItem.delete();
} catch (Exception e) {
log.error("【灵山街道-导入特殊人群】删除fileItem临时文件失败");
}
}
}
@Override
public String validate(LingShanSpecialCrowdDetailBaseExcelData row) {
String idCard = row.getIdCard();
String name = row.getName();
IcResiUserEntity resiEntity = icResiUserDao.selectResiUserEntityByIdCard(idCard, EpmetRequestHolder.getLoginUserCustomerId());
if (resiEntity == null) {
// 居民不存在,报错
return "居民信息不存在,请先维护居民基础信息。";
}
if (!resiEntity.getName().equals(name)) {
return String.format("姓名信息与居民基础信息不一致。(在居民哭华总根据身份证号找到的居民姓名为:{})", name);
}
return null;
}
@Override
public void savePersonAndTypes(List<LingshanSpecialCrowdPersonEntity> persons, List<LingshanSpecialCrowdPersonTypeEntity> personTypes) {
List<List<LingshanSpecialCrowdPersonEntity>> personParts = ListUtils.partition(persons, 50);
List<List<LingshanSpecialCrowdPersonTypeEntity>> personTypeParts = ListUtils.partition(personTypes, 50);
for (List<LingshanSpecialCrowdPersonEntity> p : personParts) {
specialCrowdPersonDao.saveOrUpdateManually(p);
}
for (List<LingshanSpecialCrowdPersonTypeEntity> p : personTypeParts) {
specialCrowdPersonTypeDao.saveOrUpdateManually(p);
}
}
@Override
public void saveBatch(List<LingshanSpecialCrowdDetailAzbjEntity> entities, LingshanSpecialCrowdDetailAzbjEntity e) {
List<List<LingshanSpecialCrowdDetailAzbjEntity>> partition = ListUtils.partition(entities, 50);
for (List<LingshanSpecialCrowdDetailAzbjEntity> l : partition) {
specialCrowdDetailAzbjDao.saveBatchManually(l);
}
}
@Override
public void saveBatch(List<LingshanSpecialCrowdDetailJdryEntity> entities, LingshanSpecialCrowdDetailJdryEntity e) {
List<List<LingshanSpecialCrowdDetailJdryEntity>> partition = ListUtils.partition(entities, 50);
for (List<LingshanSpecialCrowdDetailJdryEntity> l : partition) {
specialCrowdDetailJdryDao.saveBatchManually(l);
}
}
@Override
public void saveBatch(List<LingshanSpecialCrowdDetailJzhzEntity> entities, LingshanSpecialCrowdDetailJzhzEntity e) {
List<List<LingshanSpecialCrowdDetailJzhzEntity>> partition = ListUtils.partition(entities, 50);
for (List<LingshanSpecialCrowdDetailJzhzEntity> l : partition) {
specialCrowdDetailJzhzDao.saveBatchManually(l);
}
}
@Override
public void saveBatch(List<LingshanSpecialCrowdDetailSqjzEntity> entities, LingshanSpecialCrowdDetailSqjzEntity e) {
List<List<LingshanSpecialCrowdDetailSqjzEntity>> partition = ListUtils.partition(entities, 50);
for (List<LingshanSpecialCrowdDetailSqjzEntity> l : partition) {
specialCrowdDetailSqjzDao.saveBatchManually(l);
}
}
@Override
public void saveBatch(List<LingshanSpecialCrowdDetailXfryEntity> entities, LingshanSpecialCrowdDetailXfryEntity e) {
List<List<LingshanSpecialCrowdDetailXfryEntity>> partition = ListUtils.partition(entities, 50);
for (List<LingshanSpecialCrowdDetailXfryEntity> l : partition) {
specialCrowdDetailXfryDao.saveBatchManually(l);
}
}
}

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_azbj_export.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jdry_export.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jzhz_export.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_sqjz_export.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_xfry_export.xlsx

Binary file not shown.

57
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml

@ -0,0 +1,57 @@
<?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.LingshanSpecialCrowdDetailAzbjDao">
<resultMap type="com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity" id="lingshanSpecialCrowdDetailAzbjMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="idCard" column="ID_CARD"/>
<result property="originalCharge" column="ORIGINAL_CHARGE"/>
<result property="releaseDate" column="RELEASE_DATE"/>
<result property="originPrisonTerm" column="ORIGIN_PRISON_TERM"/>
<result property="recidivismFlag" column="RECIDIVISM_FLAG"/>
<result property="emplacementFlag" column="EMPLACEMENT_FLAG"/>
<result property="emplacementDate" column="EMPLACEMENT_DATE"/>
<result property="emplacementInfo" column="EMPLACEMENT_INFO"/>
<result property="canceledFlag" column="CANCELED_FLAG"/>
<result property="canceledReason" column="CANCELED_REASON"/>
<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>
<update id="saveBatchManually">
insert into lingshan_special_crowd_detail_azbj ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, ORIGINAL_CHARGE, RELEASE_DATE
, ORIGIN_PRISON_TERM, RECIDIVISM_FLAG, EMPLACEMENT_FLAG, EMPLACEMENT_DATE
, EMPLACEMENT_INFO, CANCELED_FLAG, CANCELED_REASON, DEL_FLAG, REVISION
, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="asbjList" item="item" separator=",">
( #{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.originalCharge},
#{item.releaseDate},#{item.originPrisonTerm},#{item.recidivismFlag},#{item.emplacementFlag},
#{item.emplacementDate}, #{item.emplacementInfo}, #{item.canceledFlag}, #{item.canceledReason}, #{item.delFlag},
#{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}
)
</foreach>
on duplicate key update ORG_ID_PATH = values(ORG_ID_PATH)
, ID_CARD = values(ID_CARD)
, ORIGINAL_CHARGE = values(ORIGINAL_CHARGE)
, RELEASE_DATE = values(RELEASE_DATE)
, ORIGIN_PRISON_TERM = values(ORIGIN_PRISON_TERM)
, RECIDIVISM_FLAG = values(RECIDIVISM_FLAG)
, EMPLACEMENT_FLAG = values(EMPLACEMENT_FLAG)
, EMPLACEMENT_DATE = values(EMPLACEMENT_DATE)
, EMPLACEMENT_INFO = values(EMPLACEMENT_INFO)
, CANCELED_FLAG = values(CANCELED_FLAG)
, CANCELED_REASON = values(CANCELED_REASON)
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</update>
</mapper>

36
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml

@ -0,0 +1,36 @@
<?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.LingshanSpecialCrowdDetailJdryDao">
<insert id="saveBatchManually">
insert into lingshan_special_crowd_detail_jdry ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, CRIMINAL_HISTORY_FLAG
, DRUG_REPETITION_FLAG, FIRST_DISCOVERY_DATE, CONTROLLER_NAME
, CONTROLLER_CONTACT, HELPER_NAME, HELPER_CONTACT, DETACHED_FLAG
, DETACHED_REASON, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME
, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.criminalHistoryFlag},
#{item.drugRepetitionFlag}, #{item.firstDiscoveryDate}, #{item.controllerName}, #{item.controllerContact}, #{item.helperName},
#{item.helperContact}, #{item.detachedFlag}, #{item.detachedReason}, #{item.delFlag}, #{item.revision},
#{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime})
</foreach>
on duplicate key update
ORG_ID_PATH = values(ORG_ID_PATH),
CRIMINAL_HISTORY_FLAG = values(CRIMINAL_HISTORY_FLAG),
DRUG_REPETITION_FLAG = values(DRUG_REPETITION_FLAG),
FIRST_DISCOVERY_DATE = values(FIRST_DISCOVERY_DATE),
CONTROLLER_NAME = values(CONTROLLER_NAME),
CONTROLLER_CONTACT = values(CONTROLLER_CONTACT),
HELPER_NAME = values(HELPER_NAME),
HELPER_CONTACT = values(HELPER_CONTACT),
DETACHED_FLAG = values(DETACHED_FLAG),
DETACHED_REASON = values(DETACHED_REASON),
DEL_FLAG = values(DEL_FLAG),
REVISION = values(REVISION),
UPDATED_BY = values(UPDATED_BY),
UPDATED_TIME = values(UPDATED_TIME)
</insert>
</mapper>

61
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml

@ -0,0 +1,61 @@
<?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.LingshanSpecialCrowdDetailJzhzDao">
<resultMap type="com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity" id="lingshanSpecialCrowdDetailJzhzMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="idCard" column="ID_CARD"/>
<result property="causeTroubleHistoryFlag" column="CAUSE_TROUBLE_HISTORY_FLAG"/>
<result property="causeTroubleTimes" column="CAUSE_TROUBLE_TIMES"/>
<result property="currentDiagnosis" column="CURRENT_DIAGNOSIS"/>
<result property="dangerousClass" column="DANGEROUS_CLASS"/>
<result property="canGoOutFlag" column="CAN_GO_OUT_FLAG"/>
<result property="violenceFlag" column="VIOLENCE_FLAG"/>
<result property="allowanceFlag" column="ALLOWANCE_FLAG"/>
<result property="subsistenceFlag" column="SUBSISTENCE_FLAG"/>
<result property="guardianName" column="GUARDIAN_NAME"/>
<result property="guardianContact" column="GUARDIAN_CONTACT"/>
<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>
<insert id="saveBatchManually">
insert into lingshan_special_crowd_detail_jzhz ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, CAUSE_TROUBLE_HISTORY_FLAG
, CAUSE_TROUBLE_TIMES, CURRENT_DIAGNOSIS, DANGEROUS_CLASS
, CAN_GO_OUT_FLAG, VIOLENCE_FLAG, ALLOWANCE_FLAG, SUBSISTENCE_FLAG
, GUARDIAN_NAME, GUARDIAN_CONTACT, DEL_FLAG, REVISION, CREATED_BY
, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.causeTroubleHistoryFlag},
#{item.causeTroubleTimes}, #{item.currentDiagnosis}, #{item.dangerousClass}, #{item.canGoOutFlag}, #{item.violenceFlag},
#{item.allowanceFlag}, #{item.subsistenceFlag}, #{item.guardianName}, #{item.guardianContact}, #{item.delFlag},
#{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}
)
</foreach>
on duplicate key update ORG_ID_PATH = values(ORG_ID_PATH)
, ID_CARD = values(ID_CARD)
, CAUSE_TROUBLE_HISTORY_FLAG = values(CAUSE_TROUBLE_HISTORY_FLAG)
, CAUSE_TROUBLE_TIMES = values(CAUSE_TROUBLE_TIMES)
, CURRENT_DIAGNOSIS = values(CURRENT_DIAGNOSIS)
, DANGEROUS_CLASS = values(DANGEROUS_CLASS)
, CAN_GO_OUT_FLAG = values(CAN_GO_OUT_FLAG)
, VIOLENCE_FLAG = values(VIOLENCE_FLAG)
, ALLOWANCE_FLAG = values(ALLOWANCE_FLAG)
, SUBSISTENCE_FLAG = values(SUBSISTENCE_FLAG)
, GUARDIAN_NAME = values(GUARDIAN_NAME)
, GUARDIAN_CONTACT = values(GUARDIAN_CONTACT)
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
</mapper>

59
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml

@ -0,0 +1,59 @@
<?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.LingshanSpecialCrowdDetailSqjzDao">
<resultMap type="com.epmet.entity.LingshanSpecialCrowdDetailSqjzEntity" id="lingshanSpecialCrowdDetailSqjzMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="idCard" column="ID_CARD"/>
<result property="rectificateType" column="RECTIFICATE_TYPE"/>
<result property="rectificateStartDate" column="RECTIFICATE_START_DATE"/>
<result property="rectificateEndDate" column="RECTIFICATE_END_DATE"/>
<result property="originDetainAddress" column="ORIGIN_DETAIN_ADDRESS"/>
<result property="originalCharge" column="ORIGINAL_CHARGE"/>
<result property="receiveWay" column="RECEIVE_WAY"/>
<result property="rectificateInfo" column="RECTIFICATE_INFO"/>
<result property="detachedFlag" column="DETACHED_FLAG"/>
<result property="detachedReason" column="DETACHED_REASON"/>
<result property="canceledFlag" column="CANCELED_FLAG"/>
<result property="canceledReason" column="CANCELED_REASON"/>
<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>
<insert id="saveBatchManually">
insert into lingshan_special_crowd_detail_sqjz ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, RECTIFICATE_TYPE
, RECTIFICATE_START_DATE, RECTIFICATE_END_DATE, ORIGIN_DETAIN_ADDRESS
, ORIGINAL_CHARGE, RECEIVE_WAY, RECTIFICATE_INFO, DETACHED_FLAG
, DETACHED_REASON, CANCELED_FLAG, CANCELED_REASON, DEL_FLAG, REVISION
, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.rectificateType},
#{item.rectificateStartDate}, #{item.rectificateEndDate}, #{item.originDetainAddress}, #{item.originalCharge}, #{item.receiveWay},
#{item.rectificateInfo}, #{item.detachedFlag}, #{item.detachedReason}, #{item.canceledFlag}, #{item.canceledReason},
#{item.delFlag}, #{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy},
#{item.updatedTime})
</foreach>
on duplicate key update
ORG_ID_PATH = values(ORG_ID_PATH)
, RECTIFICATE_TYPE = values(RECTIFICATE_TYPE)
, RECTIFICATE_START_DATE = values(RECTIFICATE_START_DATE)
, RECTIFICATE_END_DATE = values(RECTIFICATE_END_DATE)
, ORIGIN_DETAIN_ADDRESS = values(ORIGIN_DETAIN_ADDRESS)
, ORIGINAL_CHARGE = values(ORIGINAL_CHARGE), RECEIVE_WAY = values(RECEIVE_WAY)
, RECTIFICATE_INFO = values(RECTIFICATE_INFO), DETACHED_FLAG = values(DETACHED_FLAG)
, DETACHED_REASON = values(DETACHED_REASON), CANCELED_FLAG = values(CANCELED_FLAG)
, CANCELED_REASON = values(CANCELED_REASON)
, UPDATED_BY = values(UPDATED_BY),
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
</mapper>

60
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml

@ -0,0 +1,60 @@
<?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.LingshanSpecialCrowdDetailXfryDao">
<resultMap type="com.epmet.entity.LingshanSpecialCrowdDetailXfryEntity" id="lingshanSpecialCrowdDetailXfryMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="idCard" column="ID_CARD"/>
<result property="problem" column="PROBLEM"/>
<result property="stableControlMeasurement" column="STABLE_CONTROL_MEASUREMENT"/>
<result property="multipleFlag" column="MULTIPLE_FLAG"/>
<result property="localFlag" column="LOCAL_FLAG"/>
<result property="branchLeader" column="BRANCH_LEADER"/>
<result property="branchLeaderContact" column="BRANCH_LEADER_CONTACT"/>
<result property="principal" column="PRINCIPAL"/>
<result property="principalContact" column="PRINCIPAL_CONTACT"/>
<result property="stableControlerList" column="STABLE_CONTROLER_LIST"/>
<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>
<insert id="saveBatchManually">
insert into lingshan_special_crowd_detail_xfry ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, PROBLEM
, STABLE_CONTROL_MEASUREMENT, MULTIPLE_FLAG, LOCAL_FLAG, BRANCH_LEADER
, BRANCH_LEADER_CONTACT, PRINCIPAL, PRINCIPAL_CONTACT
, STABLE_CONTROLER_LIST, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME
, UPDATED_BY, UPDATED_TIME)
values
<foreach
collection="list" item="item" separator=",">
(#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.problem},
#{item.stableControlMeasurement}, #{item.multipleFlag}, #{item.localFlag}, #{item.branchLeader}, #{item.branchLeaderContact},
#{item.principal}, #{item.principalContact}, #{item.stableControlerList}, #{item.delFlag}, #{item.revision},
#{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime})
</foreach>
on duplicate key update
ORG_ID_PATH = values (ORG_ID_PATH)
, PROBLEM = values(PROBLEM)
, STABLE_CONTROL_MEASUREMENT = values(STABLE_CONTROL_MEASUREMENT)
, MULTIPLE_FLAG = values(MULTIPLE_FLAG)
, LOCAL_FLAG = values(LOCAL_FLAG)
, BRANCH_LEADER = values(BRANCH_LEADER)
, BRANCH_LEADER_CONTACT = values(BRANCH_LEADER_CONTACT)
, PRINCIPAL = values(PRINCIPAL)
, PRINCIPAL_CONTACT = values(PRINCIPAL_CONTACT)
, STABLE_CONTROLER_LIST = values(STABLE_CONTROLER_LIST)
, DEL_FLAG = values(DEL_FLAG)
, REVISION = values(REVISION)
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
</mapper>

45
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml

@ -0,0 +1,45 @@
<?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.LingshanSpecialCrowdPersonDao">
<!--<resultMap type="com.epmet.entity.LingshanSpecialCrowdPersonEntity" id="lingshanSpecialCrowdPersonMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="name" column="NAME"/>
<result property="idCard" column="ID_CARD"/>
<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>-->
<!--保存或更新-->
<insert id="saveOrUpdateManually" parameterType="map">
insert into lingshan_special_crowd_person ( ID, CUSTOMER_ID, ORG_ID_PATH, `NAME`, ID_CARD,
DEL_FLAG, REVISION, CREATED_BY , CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="list" item="item" separator="," index="idx" open="" close="">
( #{item.id},
#{item.customerId},
#{item.orgIdPath},
#{item.name},
#{item.idCard},
#{item.delFlag},
#{item.revision},
#{item.createdBy},
#{item.createdTime},
#{item.updatedBy},
#{item.updatedTime}
)
</foreach>
on duplicate key update NAME=values(name)
, UPDATED_BY=values(UPDATED_BY)
, UPDATED_TIME=values(UPDATED_TIME)
</insert>
</mapper>

36
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

@ -0,0 +1,36 @@
<?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.LingshanSpecialCrowdPersonTypeDao">
<resultMap type="com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity" id="lingshanSpecialCrowdPersonTypeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="idCard" column="ID_CARD"/>
<result property="specialType" column="SPECIAL_TYPE"/>
<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>
<insert id="saveOrUpdateManually">
insert into lingshan_special_crowd_person_type ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, SPECIAL_TYPE,
DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="types" item="type" separator=",">
(#{type.id}, #{type.customerId}, #{type.orgIdPath}, #{type.idCard}, #{type.specialType},
#{type.delFlag}, #{type.revision}, #{type.createdBy}, #{type.createdTime}, #{type.updatedBy}, #{type.updatedTime})
</foreach>
on duplicate key update
ORG_ID_PATH=values(ORG_ID_PATH)
, SPECIAL_TYPE =values(SPECIAL_TYPE)
, UPDATED_BY =values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
</mapper>
Loading…
Cancel
Save