forked from luyan/epmet-cloud-lingshan
				
			
			
			
				Browse Source
			
			
			
			
				
		# Conflicts: # epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java # epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java # epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java # epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java # epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java # epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java # epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xmlmaster
				 82 changed files with 2497 additions and 66 deletions
			
			
		| @ -0,0 +1,37 @@ | |||
| package com.epmet.commons.tools.utils; | |||
| 
 | |||
| import org.apache.commons.lang3.StringUtils; | |||
| 
 | |||
| /** | |||
|  * desc:utf8mb4转为utf8 | |||
|  * | |||
|  * @author: LiuJanJun | |||
|  * @date: 2022/7/22 9:45 下午 | |||
|  * @version: 1.0 | |||
|  */ | |||
| public class StrUtil { | |||
| 
 | |||
|     private static final int LAST_BMP = 0xFFFF; | |||
| 
 | |||
|     public static String filterEmoji(String source) { | |||
|         if (StringUtils.isBlank(source)) { | |||
|             return source; | |||
|         } | |||
|         StringBuilder sb = new StringBuilder(source.length()); | |||
|         for (int i = 0; i < source.length(); i++) { | |||
|             int codePoint = source.codePointAt(i); | |||
|             if (codePoint < LAST_BMP) { | |||
|                 sb.appendCodePoint(codePoint); | |||
|             } else { | |||
|                 i++; | |||
|             } | |||
|         } | |||
|         return sb.toString(); | |||
|     } | |||
| 
 | |||
| 
 | |||
|     public static void main(String[] args) { | |||
|         String x = StrUtil.filterEmoji("😀😁😆😅🥹🥹😇😗😀😂666"); | |||
|         System.out.println(x); | |||
|     } | |||
| } | |||
| @ -0,0 +1,16 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| 
 | |||
| 
 | |||
| @Data | |||
| public class CustomerGridStaffListFormDTO implements Serializable { | |||
| 
 | |||
|     /** | |||
|      * 客户Id | |||
|      */ | |||
|     private String customerId; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,34 @@ | |||
| package com.epmet.dto.result; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * @Author sun | |||
|  * @DESC | |||
|  */ | |||
| @Data | |||
| public class CustomerGridStaffListResultDTO implements Serializable { | |||
| 
 | |||
|     /** | |||
|      * 网格Id | |||
|      */ | |||
|     private String gridId; | |||
| 
 | |||
|     /** | |||
|      * 网格编码 | |||
|      */ | |||
|     private String gridCode; | |||
| 
 | |||
|     /** | |||
|      * 网格名 | |||
|      */ | |||
|     private String gridName; | |||
| 
 | |||
|     /** | |||
|      * 区县系统中的网格员唯一编码 | |||
|      */ | |||
|     private String gridUserId; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,8 @@ | |||
| package com.epmet.opendata.dto.constant; | |||
| 
 | |||
| public interface DataWorkerConstant { | |||
|     String ALL = "all"; | |||
|     String CREATE = "create"; | |||
|     String CHANGE = "change"; | |||
|     String DELETE = "delete"; | |||
| } | |||
| @ -0,0 +1,40 @@ | |||
| package com.epmet.opendata.dto.form; | |||
| 
 | |||
| import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * @Description | |||
|  * @Author yzm | |||
|  * @Date 2022/7/22 14:02 | |||
|  */ | |||
| @Data | |||
| public class ExractGridInfoPingYinFormDTO implements Serializable { | |||
| 
 | |||
|     public interface GridInfo extends CustomerClientShowGroup { | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 客户Id | |||
|      */ | |||
|     @NotBlank(message = "客户Id不能为空", groups = {GridInfo.class}) | |||
|     private String customerId = ""; | |||
| 
 | |||
|     /** | |||
|      * 网格Id或者组织id | |||
|      */ | |||
|     private List<String> orgIdList; | |||
| 
 | |||
|     /** | |||
|      * 废弃:这个不对。操作类型【新增:add 修改删除:edit  初始化所有数据:all】 | |||
|      * 操作类型【组织新增:agency_create 组织变更:agency_change  网格新增:grid_create 网格变更:grid_change  人员新增:staff_create 人员变更:staff_change】 | |||
|      * 删除网格grid_delete,删除组织agency_delete | |||
|      */ | |||
|     @NotBlank(message = "操作类型【新增:add 修改删除:edit  初始化所有数据:all】不能为空", groups = {GridInfo.class}) | |||
|     private String type; | |||
| } | |||
| 
 | |||
| @ -0,0 +1,17 @@ | |||
| package com.epmet.opendata.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| 
 | |||
| @Data | |||
| public class GridStaffInfoFormDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = -5277855973512833181L; | |||
| 
 | |||
|     /** | |||
|      * 客户Id | |||
|      */ | |||
|     private String customerId; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,18 @@ | |||
| package com.epmet.opendata.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * @Author zxc | |||
|  * @DateTime 2022/7/22 13:23 | |||
|  * @DESC | |||
|  */ | |||
| @Data | |||
| public class HistoryDataSyncFormDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = -58891187838165930L; | |||
| 
 | |||
|     private String customerId; | |||
| } | |||
| @ -0,0 +1,39 @@ | |||
| package com.epmet.opendata.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.dto.basereport.form.EventInfoFormDTO; | |||
| import com.epmet.opendata.service.EventreportPingyinService; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| 
 | |||
| import javax.annotation.Resource; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 平阴区事件上报中间表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("eventreportPingyin") | |||
| public class EventreportPingyinController { | |||
|     @Resource | |||
|     private EventreportPingyinService eventreportPingyinService; | |||
| 
 | |||
|     /** | |||
|      * 获取上报事件 | |||
|      * @Param formDTO | |||
|      * @Return {@link Result} | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2021/10/15 16:59 | |||
|      */ | |||
|     @PostMapping("eventinfo") | |||
|     public Result getEventinfo(@RequestBody(required = false) EventInfoFormDTO formDTO) { | |||
|         eventreportPingyinService.getEventInfo(formDTO); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,48 @@ | |||
| package com.epmet.opendata.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO; | |||
| import com.epmet.opendata.service.GridInfoPingyinService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 平阴区网格表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("gridInfoPingyin") | |||
| public class GridInfoPingyinController { | |||
| 
 | |||
|     @Autowired | |||
|     private GridInfoPingyinService gridInfoPingyinService; | |||
| 
 | |||
|     /** | |||
|      * @Author yzm | |||
|      * @Description 组织基础信息中间库同步 | |||
|      **/ | |||
|     @PostMapping("extract-agency") | |||
|     public Result getAgencyBaseInfo(@RequestBody ExractGridInfoPingYinFormDTO formDTO) { | |||
|         ValidatorUtils.validateEntity(formDTO, ExractGridInfoPingYinFormDTO.GridInfo.class); | |||
|         gridInfoPingyinService.exractAgency(formDTO); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author yzm | |||
|      * @Description 网格基础信息中间库同步 | |||
|      **/ | |||
|     @PostMapping("extract-grid") | |||
|     public Result getGridBaseInfo(@RequestBody ExractGridInfoPingYinFormDTO formDTO) { | |||
|         ValidatorUtils.validateEntity(formDTO, ExractGridInfoPingYinFormDTO.GridInfo.class); | |||
|         gridInfoPingyinService.exractGrid(formDTO); | |||
|         return new Result(); | |||
|     } | |||
| } | |||
| @ -0,0 +1,47 @@ | |||
| package com.epmet.opendata.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.aop.NoRepeatSubmit; | |||
| import com.epmet.commons.tools.utils.ExcelUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.AssertUtils; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.commons.tools.validator.group.AddGroup; | |||
| import com.epmet.commons.tools.validator.group.UpdateGroup; | |||
| import com.epmet.commons.tools.validator.group.DefaultGroup; | |||
| import com.epmet.dto.form.CustomerGridStaffListFormDTO; | |||
| import com.epmet.dto.result.CustomerGridStaffListResultDTO; | |||
| import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; | |||
| import com.epmet.opendata.service.GridstaffInfoPingyinService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 
 | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员基础信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("gridstaffInfoPingyin") | |||
| public class GridstaffInfoPingyinController { | |||
| 
 | |||
|     @Autowired | |||
|     private GridstaffInfoPingyinService gridstaffInfoPingyinService; | |||
| 
 | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description  网格员基本信息同步 | |||
|      **/ | |||
|     @PostMapping(value = "gridstaffinfo") | |||
|     public Result gridStaffInfo(@RequestBody GridStaffInfoFormDTO formDTO) { | |||
|         gridstaffInfoPingyinService.gridStaffInfo(formDTO); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,32 @@ | |||
| package com.epmet.opendata.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.aop.NoRepeatSubmit; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.utils.ExcelUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.AssertUtils; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.commons.tools.validator.group.AddGroup; | |||
| import com.epmet.commons.tools.validator.group.UpdateGroup; | |||
| import com.epmet.commons.tools.validator.group.DefaultGroup; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 
 | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员例行工作信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("gridstaffWorkInfoPingyin") | |||
| public class GridstaffWorkInfoPingyinController { | |||
| 
 | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,16 @@ | |||
| package com.epmet.opendata.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.opendata.entity.EventreportPingyinEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| 
 | |||
| /** | |||
|  * 平阴区事件上报中间表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Mapper | |||
| public interface EventreportPingyinDao extends BaseDao<EventreportPingyinEntity> { | |||
| 	void deleteAllData(); | |||
| } | |||
| @ -0,0 +1,33 @@ | |||
| package com.epmet.opendata.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.opendata.entity.GridInfoPingyinEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Mapper | |||
| public interface GridInfoPingyinDao extends BaseDao<GridInfoPingyinEntity> { | |||
| 
 | |||
|     int deleteAllAgencyData(); | |||
| 
 | |||
|     int deleteAllGridData(); | |||
| 
 | |||
|     List<GridInfoPingyinEntity> selectByGridCode(String gridCode); | |||
| 
 | |||
|     int updateSomeCol(@Param("gridCode") String gridCode, | |||
|                        @Param("gridName")String gridName, | |||
|                        @Param("gridLevel")String gridLevel, | |||
|                        @Param("lng")BigDecimal lng, | |||
|                        @Param("lat")BigDecimal lat); | |||
| 
 | |||
|     int deleteByCode(String gridCode); | |||
| } | |||
| @ -0,0 +1,22 @@ | |||
| package com.epmet.opendata.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员基础信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Mapper | |||
| public interface GridstaffInfoPingyinDao extends BaseDao<GridstaffInfoPingyinEntity> { | |||
| 
 | |||
|     void del(); | |||
| 
 | |||
|     void edit(GridstaffInfoPingyinEntity entity); | |||
| 
 | |||
|     GridstaffInfoPingyinEntity selectByCodeAndStaffId(@Param("code") String code, @Param("staffId") String staffId); | |||
| } | |||
| @ -0,0 +1,18 @@ | |||
| package com.epmet.opendata.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员例行工作信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Mapper | |||
| public interface GridstaffWorkInfoPingyinDao extends BaseDao<GridstaffWorkInfoPingyinEntity> { | |||
| 
 | |||
|     Integer delAllGridStaffWorkInfoPY(); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,178 @@ | |||
| package com.epmet.opendata.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 平阴区事件上报中间表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("eventreport_pingyin") | |||
| public class EventreportPingyinEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 上报区县代码,参照6位行政区划代码 | |||
|      */ | |||
| 	private String qxBm; | |||
| 
 | |||
|     /** | |||
|      * 上报区县名称 | |||
|      */ | |||
| 	private String qxMc; | |||
| 
 | |||
|     /** | |||
|      * 网格编码,参照《山东省社会治理网格化智能工作平台数据标准》 | |||
|      */ | |||
| 	private String gridCode; | |||
| 
 | |||
|     /** | |||
|      * 网格名称 | |||
|      */ | |||
| 	private String gridName; | |||
| 
 | |||
|     /** | |||
|      * 事件编号,可以使用区县系统中的事件唯一识别码 | |||
|      */ | |||
| 	private String eventCode; | |||
| 
 | |||
|     /** | |||
|      * 事件名称 | |||
|      */ | |||
| 	private String eventName; | |||
| 
 | |||
|     /** | |||
|      * 事件类别,参照《山东省社会治理网格化智能工作平台数据标准》10.19 | |||
|      */ | |||
| 	private String eventCategory; | |||
| 
 | |||
|     /** | |||
|      * 上报网格员姓名 | |||
|      */ | |||
| 	private String gridUserName; | |||
| 
 | |||
|     /** | |||
|      * 上报网格员的身份证号码 | |||
|      */ | |||
| 	private String gridUserCardid; | |||
| 
 | |||
|     /** | |||
|      * 事件上报时间 | |||
|      */ | |||
| 	private Date reportTime; | |||
| 
 | |||
|     /** | |||
|      * 事件发生时间 | |||
|      */ | |||
| 	private Date happenTime; | |||
| 
 | |||
|     /** | |||
|      * 事件发生地点描述 | |||
|      */ | |||
| 	private String happenPlace; | |||
| 
 | |||
|     /** | |||
|      * 事件简述,详细一些,文字数量不少于10字 | |||
|      */ | |||
| 	private String eventDescription; | |||
| 
 | |||
|     /** | |||
|      * 事件办结方式,符合《标准》10.20 | |||
|      */ | |||
| 	private String waysOfResolving; | |||
| 
 | |||
|     /** | |||
|      * 是否办结,填写Y、N(Y 是  N 否) | |||
|      */ | |||
| 	private String successfulOrNo; | |||
| 
 | |||
|     /** | |||
|      * 办结层级,符合《标准》10.21 | |||
|      */ | |||
| 	private String completeLevel; | |||
| 
 | |||
|     /** | |||
|      * 办结时间,办结后填写 | |||
|      */ | |||
| 	private Date completeTime; | |||
| 
 | |||
|     /** | |||
|      * 事件发生位置经度,wgs84坐标系,请勿用火星坐标系,不得跑出辖区 | |||
|      */ | |||
| 	private BigDecimal lng; | |||
| 
 | |||
|     /** | |||
|      * 事件发生位置纬度,wgs84坐标系,请勿用火星坐标系,不得跑出辖区 | |||
|      */ | |||
| 	private BigDecimal lat; | |||
| 
 | |||
|     /** | |||
|      * 事件主要当事人姓名 | |||
|      */ | |||
| 	private String name; | |||
| 
 | |||
|     /** | |||
|      * 事件涉及人数 | |||
|      */ | |||
| 	private Integer numberInvolved; | |||
| 
 | |||
|     /** | |||
|      * 事件涉及单位名称 | |||
|      */ | |||
| 	private String relatedUnites; | |||
| 
 | |||
|     /** | |||
|      * 重点场所类别,符合《标准》10.25 | |||
|      */ | |||
| 	private String keyAreaType; | |||
| 
 | |||
|     /** | |||
|      * 宗教活动规模,符合《标准》10.26 | |||
|      */ | |||
| 	private String religionScale; | |||
| 
 | |||
|     /** | |||
|      * 宗教类别,符合《标准》10.27 | |||
|      */ | |||
| 	private String religionType; | |||
| 
 | |||
|     /** | |||
|      * 重点场所是否变动,填写Y、N(Y 是  N 否) | |||
|      */ | |||
| 	private String isKeyareaState; | |||
| 
 | |||
|     /** | |||
|      * 重点人员是否在当地,填写Y、N(Y 是  N 否) | |||
|      */ | |||
| 	private String isKeypeopleLocate; | |||
| 
 | |||
|     /** | |||
|      * 重点人员现状描述 | |||
|      */ | |||
| 	private String keypeopleStatus; | |||
| 
 | |||
|     /** | |||
|      * 例行工作编辑插入、更新时间,县市区填写 | |||
|      */ | |||
| 	private Date updateTime; | |||
| 
 | |||
|     /** | |||
|      * 事件是否删除,Y:是、N:否 | |||
|      */ | |||
| 	private String isDel; | |||
| 
 | |||
|     /** | |||
|      * 入库时间,自动生成,请勿设置 | |||
|      */ | |||
| 	private Date recoredInsertTime; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,98 @@ | |||
| package com.epmet.opendata.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("grid_info_pingyin") | |||
| public class GridInfoPingyinEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 上报区县代码,参照6位行政区划代码 | |||
|      */ | |||
| 	private String qxBm; | |||
| 
 | |||
|     /** | |||
|      * 上报区县名称 | |||
|      */ | |||
| 	private String qxMc; | |||
| 
 | |||
|     /** | |||
|      * 网格编码,参照《标准》 | |||
|      */ | |||
| 	private String gridCode; | |||
| 
 | |||
|     /** | |||
|      * 网格名称 | |||
|      */ | |||
| 	private String gridName; | |||
| 
 | |||
|     /** | |||
|      * 网格层级,应符合10.1组织层级,所有层级上报 | |||
|      */ | |||
| 	private String gridLevel; | |||
| 
 | |||
|     /** | |||
|      * 专属网格类型,应符合10.28专属网格类型 | |||
|      */ | |||
| 	private String gridType; | |||
| 
 | |||
|     /** | |||
|      * 网格内人口规模,如果为农村和城市网格,字段必填,应符合10.29.网格内人口规模 | |||
|      */ | |||
| 	private String populationSize; | |||
| 
 | |||
|     /** | |||
|      * 是否成立网格党支部或网格党小组,Y:是、N:否 | |||
|      */ | |||
| 	private String isPartyBranch; | |||
| 
 | |||
|     /** | |||
|      * 网格党组织类型,是否成立党支部或党小组为是,此项必填。应符合10.37网格党组织类型。 | |||
|      */ | |||
| 	private String partyBranchType; | |||
| 
 | |||
|     /** | |||
|      * 网格中心点的经度 | |||
|      */ | |||
| 	private BigDecimal lng; | |||
| 
 | |||
|     /** | |||
|      * 网格中心点纬度 | |||
|      */ | |||
| 	private BigDecimal lat; | |||
| 
 | |||
|     /** | |||
|      * 网格颜色,如 #000000 | |||
|      */ | |||
| 	private String gridColor; | |||
| 
 | |||
|     /** | |||
|      * 网格信息编辑插入、更新时间,,县市区填写 | |||
|      */ | |||
| 	private Date updateTime; | |||
| 
 | |||
|     /** | |||
|      * 此网格是否删除,Y:是、N:否 | |||
|      */ | |||
| 	private String isDel; | |||
| 
 | |||
|     /** | |||
|      * 入库时间,自动生成,请勿设置 | |||
|      */ | |||
| 	private Date recoredInsertTime; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,152 @@ | |||
| package com.epmet.opendata.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员基础信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("gridstaff_info_pingyin") | |||
| public class GridstaffInfoPingyinEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 上报区县代码,参照6位行政区划代码 | |||
|      */ | |||
| 	private String qxBm; | |||
| 
 | |||
|     /** | |||
|      * 上报区县名称 | |||
|      */ | |||
| 	private String qxMc; | |||
| 
 | |||
|     /** | |||
|      * 区县系统中的网格员唯一编码 | |||
|      */ | |||
| 	private String gridUserId; | |||
| 
 | |||
|     /** | |||
|      * 网格编码 | |||
|      */ | |||
| 	private String gridCode; | |||
| 
 | |||
|     /** | |||
|      * 网格名称 | |||
|      */ | |||
| 	private String gridName; | |||
| 
 | |||
|     /** | |||
|      * 网格员姓名 | |||
|      */ | |||
| 	private String nickName; | |||
| 
 | |||
|     /** | |||
|      * 网格员身份证号码 | |||
|      */ | |||
| 	private String cardNum; | |||
| 
 | |||
|     /** | |||
|      * 网格员类型,符合《标准》10.3 | |||
|      */ | |||
| 	private String userType; | |||
| 
 | |||
|     /** | |||
|      * 网格员手机号 | |||
|      */ | |||
| 	private String phonenumber; | |||
| 
 | |||
|     /** | |||
|      * 网格员性别,应符合10.31中性别,不要有 其他 | |||
|      */ | |||
| 	private String sex; | |||
| 
 | |||
|     /** | |||
|      * 网格员民族,应符合10.32中民族 | |||
|      */ | |||
| 	private String nation; | |||
| 
 | |||
|     /** | |||
|      * 网格员政治面貌,符合GB/T 4762 | |||
|      */ | |||
| 	private String paerty; | |||
| 
 | |||
|     /** | |||
|      * 网格员出生日期 | |||
|      */ | |||
| 	private Date birthday; | |||
| 
 | |||
|     /** | |||
|      * 网格员学历,符合GB/T4658,博士、研究生会进行预警 | |||
|      */ | |||
| 	private String education; | |||
| 
 | |||
|     /** | |||
|      * 入职时间,格式为“YYYY-MM-DD” | |||
|      */ | |||
| 	private Date entryDate; | |||
| 
 | |||
|     /** | |||
|      * 是否离职,格式为Y:是、N:否 | |||
|      */ | |||
| 	private String isLeave; | |||
| 
 | |||
|     /** | |||
|      * 离职时间,格式为“YYYY-MM-DD” | |||
|      */ | |||
| 	private Date leaveDate; | |||
| 
 | |||
|     /** | |||
|      * 网格员年收入,含福利、补贴和保险等,应符合10.30中的网格员年收入,专职低于1w5、兼职大于3w会预警 | |||
|      */ | |||
| 	private String income; | |||
| 
 | |||
|     /** | |||
|      * 是否社区(村)两委委员,Y:是、N:否 | |||
|      */ | |||
| 	private String isCommittee; | |||
| 
 | |||
|     /** | |||
|      * 是否社区工作者,Y:是、N:否 | |||
|      */ | |||
| 	private String isCommunityWorkers; | |||
| 
 | |||
|     /** | |||
|      * 是否社会工作者,Y:是、N:否 | |||
|      */ | |||
| 	private String isSocialWorker; | |||
| 
 | |||
|     /** | |||
|      * 是否村(居)民小组长,Y:是、N:否 | |||
|      */ | |||
| 	private String isVillageLeader; | |||
| 
 | |||
|     /** | |||
|      * 是否警务助理,Y:是、N:否 | |||
|      */ | |||
| 	private String isPoliceAssistant; | |||
| 
 | |||
|     /** | |||
|      * 是否人民调解员,Y:是、N:否 | |||
|      */ | |||
| 	private String isMediator; | |||
| 
 | |||
|     /** | |||
|      * 网格员信息编辑插入、更新时间,,县市区填写 | |||
|      */ | |||
| 	private Date updateTime; | |||
| 
 | |||
|     /** | |||
|      * 入库时间,自动生成,请勿设置 | |||
|      */ | |||
| 	private Date recoredInsertTime; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,94 @@ | |||
| package com.epmet.opendata.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员例行工作信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("gridstaff_work_info_pingyin") | |||
| public class GridstaffWorkInfoPingyinEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 主键 | |||
|      */ | |||
| 	private String id; | |||
| 
 | |||
|     /** | |||
|      * 上报区县代码,参照6位行政区划代码 | |||
|      */ | |||
| 	private String qxBm; | |||
| 
 | |||
|     /** | |||
|      * 上报区县名称 | |||
|      */ | |||
| 	private String qxMc; | |||
| 
 | |||
|     /** | |||
|      * 网格编码 | |||
|      */ | |||
| 	private String gridCode; | |||
| 
 | |||
|     /** | |||
|      * 网格名称 | |||
|      */ | |||
| 	private String gridName; | |||
| 
 | |||
| 	@TableField(exist = false) | |||
| 	private String gridId; | |||
| 
 | |||
|     /** | |||
|      * 例行工作类型,应符合10.27中的例行工作类型 | |||
|      */ | |||
| 	private String workType; | |||
| 
 | |||
|     /** | |||
|      * 发生日期,格式为“YYYY-MM-DD” | |||
|      */ | |||
| 	private Date happenTime; | |||
| 
 | |||
|     /** | |||
|      * 基础信息主键,出租房巡查、重点场所巡查、刑满释放人员、社区矫正、吸毒人员、信访人员重点青少年和精神障碍者必填 | |||
|      */ | |||
| 	private Integer baseInfoId; | |||
| 
 | |||
|     /** | |||
|      * 有无变动(异常),Y:是、N:否 | |||
|      */ | |||
| 	private String workResult; | |||
| 
 | |||
|     /** | |||
|      * 说明 | |||
|      */ | |||
| 	private String workContent; | |||
| 
 | |||
|     /** | |||
|      * 例行工作编辑插入、更新时间,,县市区填写 | |||
|      */ | |||
| 	private Date updateTime; | |||
| 
 | |||
|     /** | |||
|      * 例行工作是否删除,Y:是、N:否 | |||
|      */ | |||
| 	private String isDel; | |||
| 
 | |||
|     /** | |||
|      * 入库时间,自动生成,请勿设置 | |||
|      */ | |||
| 	private Date recoredInsertTime; | |||
| 
 | |||
| 	@TableField(exist = false) | |||
| 	private String happenTimeString; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| package com.epmet.opendata.service; | |||
| 
 | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.dto.basereport.form.EventInfoFormDTO; | |||
| import com.epmet.opendata.entity.EventreportPingyinEntity; | |||
| 
 | |||
| /** | |||
|  * 平阴区事件上报中间表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| public interface EventreportPingyinService extends BaseService<EventreportPingyinEntity> { | |||
|     /** | |||
|      * 获取上报事件 | |||
|      * @Param formDTO | |||
|      * @Return | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2021/10/15 16:59 | |||
|      */ | |||
|     void getEventInfo(EventInfoFormDTO formDTO); | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package com.epmet.opendata.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO; | |||
| import com.epmet.opendata.entity.GridInfoPingyinEntity; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| public interface GridInfoPingyinService extends BaseService<GridInfoPingyinEntity> { | |||
|     /** | |||
|      * 抽取customer_agency到grid_info_pingyin表 | |||
|      * | |||
|      * @param formDTO | |||
|      */ | |||
|     void exractAgency(ExractGridInfoPingYinFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * 抽取customer_grid到grid_info_pingyin表 | |||
|      * | |||
|      * @param formDTO | |||
|      */ | |||
|     void exractGrid(ExractGridInfoPingYinFormDTO formDTO); | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| package com.epmet.opendata.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; | |||
| import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; | |||
| import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; | |||
| 
 | |||
| import java.util.Map; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员基础信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| public interface GridstaffInfoPingyinService extends BaseService<GridstaffInfoPingyinEntity> { | |||
| 
 | |||
|     void gridStaffInfo(GridStaffInfoFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 网格员信息中间库同步 | |||
|      **/ | |||
|     void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO); | |||
| } | |||
| @ -0,0 +1,22 @@ | |||
| package com.epmet.opendata.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; | |||
| import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员例行工作信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| public interface GridstaffWorkInfoPingyinService extends BaseService<GridstaffWorkInfoPingyinEntity> { | |||
|     /** | |||
|      * Desc: 2022-07-22 新表 例行工作同步 | |||
|      * @param formDTO | |||
|      * @author zxc | |||
|      * @date 2022/7/22 11:16 | |||
|      */ | |||
|     Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm formDTO); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,178 @@ | |||
| package com.epmet.opendata.service.impl; | |||
| 
 | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.constant.NumConstant; | |||
| import com.epmet.commons.tools.exception.RenException; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.utils.StrUtil; | |||
| import com.epmet.dto.basereport.form.EventInfoFormDTO; | |||
| import com.epmet.dto.basereport.result.EventInfoResultDTO; | |||
| import com.epmet.feign.DataStatisticalOpenFeignClient; | |||
| import com.epmet.opendata.dao.EventreportPingyinDao; | |||
| import com.epmet.opendata.dao.GridstaffInfoPingyinDao; | |||
| import com.epmet.opendata.entity.EventreportPingyinEntity; | |||
| import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; | |||
| import com.epmet.opendata.service.EventreportPingyinService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections4.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| 
 | |||
| import javax.annotation.Resource; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.stream.Collectors; | |||
| 
 | |||
| /** | |||
|  * 平阴区事件上报中间表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Slf4j | |||
| @Service | |||
| public class EventreportPingyinServiceImpl extends BaseServiceImpl<EventreportPingyinDao, EventreportPingyinEntity> implements EventreportPingyinService { | |||
|     @Resource | |||
|     private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; | |||
|     @Resource | |||
|     private GridstaffInfoPingyinDao gridstaffInfoPingyinDao; | |||
| 
 | |||
|     /** | |||
|      * 获取上报事件 | |||
|      * | |||
|      * @param formDTO | |||
|      * @Param formDTO | |||
|      * @Return | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2021/10/15 16:59 | |||
|      */ | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void getEventInfo(EventInfoFormDTO formDTO) { | |||
|         formDTO.setPageSize(1000); | |||
|         long start = System.currentTimeMillis(); | |||
|         if (NumConstant.ONE_STR.equals(formDTO.getInitFlag())) { | |||
|             //清空表里数据
 | |||
|             baseDao.deleteAllData(); | |||
|         } | |||
|         Result<List<EventInfoResultDTO>> result = dataStatisticalOpenFeignClient.getEventInfoV2(formDTO); | |||
|         if (!result.success()) { | |||
|             log.error("getEventinfo cost:{}ms",System.currentTimeMillis()-start); | |||
|             throw new RenException(result.getInternalMsg()); | |||
|         } | |||
|         List<EventInfoResultDTO> list = result.getData(); | |||
|         saveEvent(list, formDTO.getInitFlag()); | |||
|         //分批次循环
 | |||
|         while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()) { | |||
|             formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); | |||
|             result = dataStatisticalOpenFeignClient.getEventInfo(formDTO); | |||
|             list = result.getData(); | |||
|             saveEvent(list, formDTO.getInitFlag()); | |||
|         } | |||
|     } | |||
| 
 | |||
|     private void saveEvent(List<EventInfoResultDTO> list, String initFlag) { | |||
|         if (CollectionUtils.isEmpty(list)) { | |||
|             log.warn("no event data to save table base_conflicts_resolve"); | |||
|             return; | |||
|         } | |||
|         List<EventreportPingyinEntity> entityList = list.stream().map(item -> { | |||
|             EventreportPingyinEntity entity = new EventreportPingyinEntity(); | |||
|             entity.setQxBm("370124"); | |||
|             entity.setQxMc("平阴县"); | |||
|             entity.setGridCode(item.getOrgCode()); | |||
|             entity.setGridName(item.getOrgName()); | |||
|             entity.setEventCode(("py_").concat(item.getId())); | |||
| 
 | |||
|             String eventName = StrUtil.filterEmoji(item.getEventName()); | |||
|             entity.setEventName(eventName); | |||
|             entity.setEventCategory(item.getEventCategory()); | |||
|             entity.setGridUserCardid(""); | |||
|             entity.setGridUserName(""); | |||
|             LambdaQueryWrapper<GridstaffInfoPingyinEntity> staffWrapper = new LambdaQueryWrapper<>(); | |||
|             staffWrapper.eq(GridstaffInfoPingyinEntity::getGridUserId, item.getReporterId()); | |||
|             List<GridstaffInfoPingyinEntity> staffList = gridstaffInfoPingyinDao.selectList(staffWrapper); | |||
|             if (CollectionUtils.isNotEmpty(staffList)) { | |||
|                 entity.setGridUserCardid(staffList.get(NumConstant.ZERO).getCardNum()); | |||
|                 entity.setGridUserName(staffList.get(NumConstant.ZERO).getNickName()); | |||
|             } else { | |||
|                 staffWrapper = new LambdaQueryWrapper<>(); | |||
|                 staffWrapper.eq(GridstaffInfoPingyinEntity::getGridCode, item.getOrgCode()); | |||
|                 staffList = gridstaffInfoPingyinDao.selectList(staffWrapper); | |||
|                 if (CollectionUtils.isNotEmpty(staffList)) { | |||
|                     for (GridstaffInfoPingyinEntity staff : staffList) { | |||
|                         entity.setGridUserCardid(staff.getCardNum()); | |||
|                         entity.setGridUserName(staff.getNickName()); | |||
|                         if (StringUtils.isNotBlank(staff.getCardNum())) { | |||
|                             break; | |||
|                         } | |||
|                     } | |||
|                 } | |||
|             } | |||
|             entity.setReportTime(item.getReportTime()); | |||
|             entity.setHappenTime(item.getHappenDate()); | |||
|             entity.setHappenPlace(item.getHappenPlace()); | |||
|             String eventDescription = item.getEventDescription(); | |||
|             //如果不为空 长度控制3000以内
 | |||
|             if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.THREE_THOUSAND) { | |||
|                 eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.THREE_THOUSAND); | |||
|             } | |||
|             eventDescription = StrUtil.filterEmoji(eventDescription); | |||
|             entity.setEventDescription(eventDescription); | |||
|             entity.setWaysOfResolving(item.getWaysOfResolving()); | |||
|             //业务不确定
 | |||
|             if (("03").equals(item.getStatus())) { | |||
|                 entity.setSuccessfulOrNo("Y"); | |||
|             } else { | |||
|                 entity.setSuccessfulOrNo("N"); | |||
|             } | |||
|             entity.setCompleteLevel(item.getCompleteLevel()); | |||
|             entity.setCompleteTime(item.getCompleteTime()); | |||
|             entity.setLng(item.getLng()); | |||
|             entity.setLat(item.getLat()); | |||
|             entity.setIsDel("N"); | |||
|             entity.setUpdateTime(new Date()); | |||
| 
 | |||
|             //业务不包含 一级分类里 如果是03 矛盾纠纷 则涉及人数写2(目前业务不支持 所以应产品需求 填2)
 | |||
|             if ("03".equals(item.getParentEventCategory())) { | |||
|                 entity.setNumberInvolved(NumConstant.TWO); | |||
|             } | |||
|             return entity; | |||
|         }).collect(Collectors.toList()); | |||
|         log.info("数据拼装结果" + entityList); | |||
|         //过滤掉必填字段为空的数据
 | |||
|         entityList = entityList.stream().filter(item -> | |||
|                 StringUtils.isNotBlank(item.getGridCode()) && StringUtils.isNotBlank(item.getGridName()) && | |||
|                 StringUtils.isNotBlank(item.getEventCategory()) && StringUtils.isNotBlank(item.getGridUserName()) && | |||
|                 StringUtils.isNotBlank(item.getGridUserCardid()) && null != item.getReportTime() && | |||
|                 null != item.getHappenTime() && StringUtils.isNotBlank(item.getHappenPlace()) && | |||
|                 StringUtils.isNotBlank(item.getGridUserCardid()) && StringUtils.isNotBlank(item.getEventDescription()) && | |||
|                 StringUtils.isNotBlank(item.getWaysOfResolving()) && null != item.getLng() && null != item.getLat() | |||
|         ).collect(Collectors.toList()); | |||
|         log.info("数据过滤结果" + entityList.size()); | |||
|         if (NumConstant.ZERO_STR.equals(initFlag)) { | |||
|             entityList.forEach(entity -> { | |||
|                 LambdaQueryWrapper<EventreportPingyinEntity> wrapper = new LambdaQueryWrapper<>(); | |||
|                 wrapper.eq(EventreportPingyinEntity::getEventCode, entity.getEventCode()); | |||
|                 EventreportPingyinEntity event = baseDao.selectOne(wrapper); | |||
|                 if (null == event) { | |||
|                     baseDao.insert(entity); | |||
|                 } else { | |||
|                     baseDao.update(entity, wrapper); | |||
|                 } | |||
|             }); | |||
|         } else { | |||
|             for (EventreportPingyinEntity entity : entityList) { | |||
|                 try { | |||
|                     baseDao.insert(entity); | |||
|                 } catch (Exception e) { | |||
|                     log.error(e.toString()); | |||
|                 } | |||
|             } | |||
|         } | |||
| 
 | |||
| 
 | |||
|     } | |||
| } | |||
| @ -0,0 +1,228 @@ | |||
| package com.epmet.opendata.service.impl; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.constant.Constant; | |||
| import com.epmet.commons.tools.constant.NumConstant; | |||
| import com.epmet.commons.tools.exception.RenException; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.constant.IndexCalConstant; | |||
| import com.epmet.dto.org.result.CustomerAgencyDTO; | |||
| import com.epmet.dto.org.result.CustomerGridDTO; | |||
| import com.epmet.feign.DataStatisticalOpenFeignClient; | |||
| import com.epmet.opendata.dao.GridInfoPingyinDao; | |||
| import com.epmet.opendata.dto.constant.DataWorkerConstant; | |||
| import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO; | |||
| import com.epmet.opendata.entity.GridInfoPingyinEntity; | |||
| import com.epmet.opendata.service.GridInfoPingyinService; | |||
| import org.apache.commons.collections4.CollectionUtils; | |||
| import org.apache.commons.collections4.ListUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| 
 | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 平阴区网格表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Service | |||
| public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinDao, GridInfoPingyinEntity> implements GridInfoPingyinService { | |||
|     @Autowired | |||
|     private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; | |||
| 
 | |||
| 
 | |||
|     /** | |||
|      * 抽取customer_agency到grid_info_pingyin表 | |||
|      * | |||
|      * @param formDTO | |||
|      */ | |||
|     @Override | |||
|     public void exractAgency(ExractGridInfoPingYinFormDTO formDTO) { | |||
|         // 1.查询组织基础信息,customer_agency.code为空的不抽取
 | |||
|         com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); | |||
|         if (DataWorkerConstant.ALL.equals(formDTO.getType())) { | |||
|             formDTO1.setDelFlag("0"); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { | |||
|             formDTO1.setDelFlag(NumConstant.ZERO_STR); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { | |||
|             formDTO1.setDelFlag(NumConstant.ZERO_STR); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.DELETE)) { | |||
|             formDTO1.setDelFlag(NumConstant.ONE_STR); | |||
|         } | |||
|         Result<List<CustomerAgencyDTO>> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1); | |||
|         if (!result.success()) { | |||
|             throw new RenException(result.getInternalMsg()); | |||
|         } | |||
|         if (null == result.getData() || result.getData().size() < NumConstant.ONE) { | |||
|             return; | |||
|         } | |||
|         // 2.封装数据
 | |||
|         List<GridInfoPingyinEntity> gridInfoList = new ArrayList<>(); | |||
|         result.getData().forEach(ag -> { | |||
|             GridInfoPingyinEntity entity = new GridInfoPingyinEntity(); | |||
|             entity.setQxBm("370124"); | |||
|             entity.setQxMc("平阴县"); | |||
|             entity.setGridCode(ag.getCode()); | |||
|             entity.setGridName(ag.getOrganizationName()); | |||
|             entity.setIsDel("N"); | |||
|             if (Constant.DISTRICT.equals(ag.getLevel())) { | |||
|                 entity.setGridLevel("03"); | |||
|             } else if (Constant.STREET.equals(ag.getLevel())) { | |||
|                 entity.setGridLevel("04"); | |||
|             } else if (Constant.COMMUNITY.equals(ag.getLevel())) { | |||
|                 entity.setGridLevel("06"); | |||
|             } | |||
|             entity.setLat(new BigDecimal(ag.getLatitude())); | |||
|             entity.setLng(new BigDecimal(ag.getLongitude())); | |||
|             gridInfoList.add(entity); | |||
|         }); | |||
|         // 3、初始化传all;新增或者编辑
 | |||
|         if (DataWorkerConstant.ALL.equals(formDTO.getType())) { | |||
|             // 全删,全增
 | |||
|             baseDao.deleteAllAgencyData(); | |||
|             // 一次100
 | |||
|             List<List<GridInfoPingyinEntity>> partition = ListUtils.partition(gridInfoList, IndexCalConstant.INSERT_SIZE); | |||
|             partition.forEach(list -> { | |||
|                 this.insertBatch(list); | |||
|             }); | |||
| 
 | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { | |||
|             // 单独新增组织
 | |||
|             this.insertBatch(gridInfoList); | |||
| 
 | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { | |||
|             // 修改组织时,先根据code查询,如果有数据,更新
 | |||
|             for (GridInfoPingyinEntity entity : gridInfoList) { | |||
| 
 | |||
|                 List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode()); | |||
| 
 | |||
|                 if (CollectionUtils.isNotEmpty(orginList)) { | |||
| 
 | |||
|                     // 更新网格名称、网格层级、网格中心点的经度,网格中心点纬度
 | |||
|                     for (GridInfoPingyinEntity oigin : orginList) { | |||
|                         baseDao.updateSomeCol(oigin.getGridCode(), entity.getGridName(), entity.getGridLevel(), entity.getLng(), entity.getLat()); | |||
|                     } | |||
| 
 | |||
|                 } else { | |||
|                     // 插入
 | |||
|                     baseDao.insert(entity); | |||
|                 } | |||
|             } | |||
|         }else if(formDTO.getType().contains(DataWorkerConstant.DELETE)){ | |||
|             // 要删除的组织id
 | |||
|             for (GridInfoPingyinEntity entity : gridInfoList) { | |||
|                 List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode()); | |||
|                 if (CollectionUtils.isNotEmpty(orginList)) { | |||
|                     for (GridInfoPingyinEntity oigin : orginList) { | |||
|                         baseDao.deleteByCode(oigin.getGridCode()); | |||
|                     } | |||
|                 } | |||
|             } | |||
|         } | |||
| 
 | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 抽取customer_grid到grid_info_pingyin表 | |||
|      * | |||
|      * @param formDTO | |||
|      */ | |||
|     @Override | |||
|     public void exractGrid(ExractGridInfoPingYinFormDTO formDTO) { | |||
|         // 1.查询网格基础信息
 | |||
|         com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); | |||
|         if (StringUtils.isBlank(formDTO.getType())||DataWorkerConstant.ALL.equals(formDTO.getType())) { | |||
|             formDTO1.setDelFlag("0"); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { | |||
|             formDTO1.setDelFlag(NumConstant.ZERO_STR); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { | |||
|             formDTO1.setDelFlag(NumConstant.ZERO_STR); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.DELETE)) { | |||
|             formDTO1.setDelFlag(NumConstant.ONE_STR); | |||
|         } | |||
|         Result<List<CustomerGridDTO>> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1); | |||
|         if (!result.success()) { | |||
|             throw new RenException(result.getInternalMsg()); | |||
|         } | |||
|         if (null == result.getData() || result.getData().size() < NumConstant.ONE) { | |||
|             return; | |||
|         } | |||
| 
 | |||
|         // 2.封装数据
 | |||
|         List<GridInfoPingyinEntity> gridInfoList = new ArrayList<>(); | |||
|         result.getData().forEach(ag -> { | |||
|             GridInfoPingyinEntity entity = new GridInfoPingyinEntity(); | |||
|             entity.setQxBm("370124"); | |||
|             entity.setQxMc("平阴县"); | |||
|             entity.setGridCode(ag.getCode()); | |||
|             entity.setGridName(ag.getGridName()); | |||
|             entity.setGridLevel("07"); | |||
|             entity.setIsDel("N"); | |||
|             entity.setUpdateTime(new Date()); | |||
|             if (ag.getLatitude().length() > 10) { | |||
|                 entity.setLat(new BigDecimal(ag.getLatitude().substring(0, 10))); | |||
|             } else { | |||
|                 entity.setLat(new BigDecimal(ag.getLatitude())); | |||
|             } | |||
|             if (ag.getLongitude().length() > 10) { | |||
|                 entity.setLng(new BigDecimal(ag.getLongitude().substring(0, 10))); | |||
|             } else { | |||
|                 entity.setLng(new BigDecimal(ag.getLongitude())); | |||
|             } | |||
|             gridInfoList.add(entity); | |||
|         }); | |||
|         // 3、初始化传all;新增或者编辑
 | |||
|         if (DataWorkerConstant.ALL.equals(formDTO.getType())) { | |||
|             // 全删,全增
 | |||
|             baseDao.deleteAllGridData(); | |||
|             // 一次100
 | |||
|             List<List<GridInfoPingyinEntity>> partition = ListUtils.partition(gridInfoList, IndexCalConstant.INSERT_SIZE); | |||
|             partition.forEach(list -> { | |||
|                 this.insertBatch(list); | |||
|             }); | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { | |||
|             // 单独新增组织
 | |||
|             this.insertBatch(gridInfoList); | |||
| 
 | |||
|         } else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { | |||
|             // 修改组织时,先根据code查询,如果有数据,更新
 | |||
|             for (GridInfoPingyinEntity entity : gridInfoList) { | |||
| 
 | |||
|                 List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode()); | |||
| 
 | |||
|                 if (CollectionUtils.isNotEmpty(orginList)) { | |||
| 
 | |||
|                     // 更新网格名称、网格层级、网格中心点的经度,网格中心点纬度
 | |||
|                     for (GridInfoPingyinEntity oigin : orginList) { | |||
|                         baseDao.updateSomeCol(oigin.getGridCode(), entity.getGridName(), entity.getGridLevel(), entity.getLng(), entity.getLat()); | |||
|                     } | |||
| 
 | |||
|                 } else { | |||
|                     // 插入
 | |||
|                     baseDao.insert(entity); | |||
|                 } | |||
|             } | |||
|         }else if(formDTO.getType().contains(DataWorkerConstant.DELETE)){ | |||
|             // 要删除的网格id
 | |||
|             for (GridInfoPingyinEntity entity : gridInfoList) { | |||
|                 List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode()); | |||
|                 if (CollectionUtils.isNotEmpty(orginList)) { | |||
|                     for (GridInfoPingyinEntity oigin : orginList) { | |||
|                         baseDao.deleteByCode(oigin.getGridCode()); | |||
|                     } | |||
|                 } | |||
|             } | |||
|         } | |||
| 
 | |||
|     } | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,147 @@ | |||
| package com.epmet.opendata.service.impl; | |||
| 
 | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.exception.RenException; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.utils.DateUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.dto.form.CustomerGridStaffListFormDTO; | |||
| import com.epmet.dto.form.GridStaffUploadtFormDTO; | |||
| import com.epmet.dto.result.CustomerGridStaffListResultDTO; | |||
| import com.epmet.dto.result.GridStaffUploadResultDTO; | |||
| import com.epmet.dto.user.result.GridUserInfoDTO; | |||
| import com.epmet.feign.DataStatisticalOpenFeignClient; | |||
| import com.epmet.feign.EpmetUserOpenFeignClient; | |||
| import com.epmet.feign.GovOrgOpenFeignClient; | |||
| import com.epmet.opendata.dao.GridstaffInfoPingyinDao; | |||
| import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; | |||
| import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; | |||
| import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; | |||
| import com.epmet.opendata.service.GridstaffInfoPingyinService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections4.CollectionUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| 
 | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员基础信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Service | |||
| @Slf4j | |||
| public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffInfoPingyinDao, GridstaffInfoPingyinEntity> implements GridstaffInfoPingyinService { | |||
| 
 | |||
|     @Autowired | |||
|     private GovOrgOpenFeignClient govOrgOpenFeignClient; | |||
|     @Autowired | |||
|     private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | |||
|     @Autowired | |||
|     private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; | |||
| 
 | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void gridStaffInfo(GridStaffInfoFormDTO formDTO) { | |||
|         //1.查询客户网格下工作人员【存在网格code的网格下的工作人员】
 | |||
|         CustomerGridStaffListFormDTO org = new CustomerGridStaffListFormDTO(); | |||
|         org.setCustomerId(formDTO.getCustomerId()); | |||
|         Result<List<CustomerGridStaffListResultDTO>> orgList = govOrgOpenFeignClient.gridStaff(org); | |||
|         if (!orgList.success()) { | |||
|             throw new RenException("查询客户网格下工作人员列表信息失败:".concat(orgList.toString())); | |||
|         } | |||
|         log.info(String.format("网格员数据同步,查询到网格下工作人员记录共%s条", orgList.getData().size())); | |||
| 
 | |||
|         //2.查询客户工作人员基础信息【客户下未被禁用的有效工作人员信息】
 | |||
|         GridStaffUploadtFormDTO user = new GridStaffUploadtFormDTO(); | |||
|         user.setCustomerId(formDTO.getCustomerId()); | |||
|         Result<List<GridStaffUploadResultDTO>> userList = epmetUserOpenFeignClient.customerStaff(user); | |||
|         if (!userList.success()) { | |||
|             throw new RenException("查询客户下工作人员基础信息失败:".concat(userList.toString())); | |||
|         } | |||
|         log.info(String.format("网格员数据同步,查询到客户下工作人员基础信息记录共%s条", userList.getData().size())); | |||
|         Map<String, GridStaffUploadResultDTO> map = userList.getData().stream().collect(Collectors.toMap(GridStaffUploadResultDTO::getGridUserId, m -> m, (k1, k2) -> k1)); | |||
| 
 | |||
|         //3.拼装数据
 | |||
|         List<GridstaffInfoPingyinEntity> entityList = new ArrayList(); | |||
|         if (!CollectionUtils.isEmpty(orgList.getData()) && !CollectionUtils.isEmpty(userList.getData())) { | |||
|             for (CustomerGridStaffListResultDTO gs : orgList.getData()) { | |||
|                 if (map.containsKey(gs.getGridUserId())) { | |||
|                     GridStaffUploadResultDTO us = map.get(gs.getGridUserId()); | |||
|                     GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(us, GridstaffInfoPingyinEntity.class); | |||
|                     entity.setQxBm("370124"); | |||
|                     entity.setQxMc("平阴县"); | |||
|                     entity.setGridCode(gs.getGridCode()); | |||
|                     entity.setGridName(gs.getGridName()); | |||
|                     entity.setSex("0".equals(us.getSex()) ? "9" : us.getSex()); | |||
|                     if ("Y".equals(entity.getIsLeave())) { | |||
|                         entity.setLeaveDate(us.getDate()); | |||
|                     } | |||
|                     entityList.add(entity); | |||
|                 } | |||
|             } | |||
|         } | |||
| 
 | |||
|         //4.删除表中历史数据
 | |||
|         baseDao.del(); | |||
| 
 | |||
|         //5.批量新增数据
 | |||
|         log.info(String.format("网格员数据同步,本次共同步%s条记录", entityList.size())); | |||
|         insertBatch(entityList); | |||
| 
 | |||
|     } | |||
| 
 | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 网格员信息中间库同步 | |||
|      **/ | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) { | |||
|         log.info("网格工作人员信息同步,入参对象值:  " + JSON.toJSONString(formDTO, true)); | |||
|         //1.查询工作人员网格信息和基础信息
 | |||
|         com.epmet.dto.user.form.StaffBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.user.form.StaffBaseInfoFormDTO.class); | |||
|         Result<List<GridUserInfoDTO>> result = dataStatisticalOpenFeignClient.getStaffBaseInfo(formDTO1); | |||
|         if (!result.success()) { | |||
|             throw new RenException(result.getInternalMsg()); | |||
|         } | |||
|         if (CollectionUtils.isEmpty(result.getData())) { | |||
|             return; | |||
|         } | |||
| 
 | |||
|         //2.中间库新增/修改数据【基本一个人一条数据,程序按批量处理】
 | |||
|         result.getData().forEach(r -> { | |||
|             GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(r, GridstaffInfoPingyinEntity.class); | |||
|             entity.setQxBm("370124"); | |||
|             entity.setQxMc("平阴县"); | |||
|             entity.setGridCode(r.getCode()); | |||
|             entity.setGridName(r.getGridName()); | |||
|             entity.setIsLeave(r.getIsLeave()); | |||
|             entity.setLeaveDate(r.getLeaveDate()); | |||
|             entity.setGridUserId(r.getStaffId()); | |||
|             entity.setCardNum(r.getIdCard()); | |||
|             //按网格查询人员是否存在,存在更新否则新增
 | |||
|             GridstaffInfoPingyinEntity gs = baseDao.selectByCodeAndStaffId(r.getCode(), r.getStaffId()); | |||
|             log.info(String.format("网格工作人员信息同步,当前操作人员信息,姓名:%s   staffId:%s", entity.getNickName(), entity.getGridUserId())); | |||
|             if (null != gs) { | |||
|                 entity.setUpdateTime(new Date()); | |||
|                 baseDao.edit(entity); | |||
|             } else { | |||
|                 insert(entity); | |||
|             } | |||
|         }); | |||
| 
 | |||
|     } | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,150 @@ | |||
| package com.epmet.opendata.service.impl; | |||
| 
 | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.constant.NumConstant; | |||
| import com.epmet.commons.tools.exception.EpmetErrorCode; | |||
| import com.epmet.commons.tools.exception.EpmetException; | |||
| import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | |||
| import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.utils.DateUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.utils.StrUtil; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.commons.tools.validator.group.AddGroup; | |||
| import com.epmet.dto.form.patrol.PatrolQueryFormDTO; | |||
| import com.epmet.dto.result.PatrolRoutineWorkResult; | |||
| import com.epmet.feign.EpmetUserOpenFeignClient; | |||
| import com.epmet.opendata.dao.GridstaffWorkInfoPingyinDao; | |||
| import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; | |||
| import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity; | |||
| import com.epmet.opendata.service.GridstaffWorkInfoPingyinService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections4.ListUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.jetbrains.annotations.NotNull; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.util.CollectionUtils; | |||
| 
 | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 平阴区网格员例行工作信息 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-07-22 | |||
|  */ | |||
| @Slf4j | |||
| @Service | |||
| public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffWorkInfoPingyinDao, GridstaffWorkInfoPingyinEntity> implements GridstaffWorkInfoPingyinService { | |||
| 
 | |||
|     @Autowired | |||
|     private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | |||
| 
 | |||
|     @Override | |||
|     public Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm patrolRecordForm) { | |||
|         log.info("insertBaseGridWorkRecordV2 param:{}", JSON.toJSONString(patrolRecordForm)); | |||
|         ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class); | |||
|         // 构建传参
 | |||
|         PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); | |||
|         if (StringUtils.isBlank(patrolRecordForm.getId())) { | |||
|             Integer row; | |||
|             do { | |||
|                 row = baseDao.delAllGridStaffWorkInfoPY(); | |||
|             } while (row == NumConstant.ONE_THOUSAND); | |||
|         } | |||
|         List<PatrolRoutineWorkResult> data; | |||
|         do { | |||
|             Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO); | |||
|             if (record == null || !record.success()) { | |||
|                 log.error("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); | |||
|                 throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); | |||
|             } | |||
|             data = record.getData(); | |||
|             if (CollectionUtils.isEmpty(data)) { | |||
|                 //数据已被删除了
 | |||
|                 //暂时设置error 用于排错
 | |||
|                 log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); | |||
|                 int effectRow = baseDao.deleteById(patrolRecordForm.getId()); | |||
|                 log.warn("del effectRow:{}", effectRow); | |||
|                 throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); | |||
|             } | |||
|             data.forEach(d -> { | |||
|                 GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(d.getGridId()); | |||
|                 if (null == gridInfo) { | |||
|                     log.warn("未查询到网格信息:" + d.getGridId()); | |||
|                     return; | |||
|                 } | |||
|                 String s = StrUtil.filterEmoji(d.getWorkContent()); | |||
|                 d.setWorkContent(s); | |||
|                 d.setGridCode(gridInfo.getCode()); | |||
|                 d.setGridName(gridInfo.getGridName()); | |||
|             }); | |||
|             insertNewRecordBatch(data); | |||
|             midPatrolFormDTO.setPageNo(midPatrolFormDTO.getPageNo() + 1); | |||
|         } while (data.size() == NumConstant.ONE_THOUSAND); | |||
|         return true; | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * Desc: 数据存入 | |||
|      * | |||
|      * @param newEntities | |||
|      * @author zxc | |||
|      * @date 2022/7/22 14:17 | |||
|      */ | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void insertGridStaffWorkInfoPY(List<GridstaffWorkInfoPingyinEntity> newEntities) { | |||
|         if (!CollectionUtils.isEmpty(newEntities)) { | |||
|             List<List<GridstaffWorkInfoPingyinEntity>> partition = ListUtils.partition(newEntities, NumConstant.ONE_HUNDRED); | |||
|             partition.forEach(p -> { | |||
|                 this.insertBatch(p); | |||
|             }); | |||
|         } | |||
|     } | |||
| 
 | |||
|     private Boolean insertNewRecordBatch(List<PatrolRoutineWorkResult> list) { | |||
|         List<GridstaffWorkInfoPingyinEntity> insertList = new ArrayList<>(); | |||
|         list.forEach(o -> { | |||
|             if (StringUtils.isBlank(o.getGridCode())) { | |||
|                 return; | |||
|             } | |||
|             insertList.add(buildNewEntity(o)); | |||
|         }); | |||
|         //insert
 | |||
|         if (CollectionUtils.isEmpty(insertList)) { | |||
|             log.error("新构建要插入的数据为空,param:{}", JSON.toJSONString(list)); | |||
|             return false; | |||
|         } | |||
|         insertGridStaffWorkInfoPY(insertList); | |||
|         return true; | |||
|     } | |||
| 
 | |||
|     private GridstaffWorkInfoPingyinEntity buildNewEntity(PatrolRoutineWorkResult record) { | |||
|         GridstaffWorkInfoPingyinEntity entity = ConvertUtils.sourceToTarget(record, GridstaffWorkInfoPingyinEntity.class); | |||
|         entity.setQxBm("370124"); | |||
|         entity.setQxMc("平阴县"); | |||
|         entity.setHappenTime(DateUtils.parseDate(record.getHappenTime().concat(" 00:00:00"), DateUtils.DATE_PATTERN)); | |||
|         entity.setWorkResult(NumConstant.ONE == record.getIsNormal() ? "Y" : "N"); | |||
|         entity.setWorkType(record.getWorkTypeSecondCode()); | |||
|         entity.setRecoredInsertTime(record.getCreatedTime()); | |||
|         entity.setUpdateTime(record.getUpdatedTime()); | |||
|         entity.setId(null); | |||
|         entity.setIsDel("N"); | |||
|         return entity; | |||
|     } | |||
| 
 | |||
|     @NotNull | |||
|     private PatrolQueryFormDTO buildParam(UpsertPatrolRecordForm patrolRecordForm) { | |||
|         PatrolQueryFormDTO midPatrolFormDTO = new PatrolQueryFormDTO(); | |||
|         midPatrolFormDTO.setCustomerId(patrolRecordForm.getCustomerId()); | |||
|         midPatrolFormDTO.setId(StringUtils.isBlank(patrolRecordForm.getId()) ? "" : patrolRecordForm.getId()); | |||
|         midPatrolFormDTO.setPageNo(patrolRecordForm.getPageNo()); | |||
|         midPatrolFormDTO.setPageSize(NumConstant.ONE_THOUSAND); | |||
|         return midPatrolFormDTO; | |||
|     } | |||
| } | |||
| @ -0,0 +1,47 @@ | |||
| <?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.opendata.dao.EventreportPingyinDao"> | |||
| 
 | |||
|     <resultMap type="com.epmet.opendata.entity.EventreportPingyinEntity" id="eventreportPingyinMap"> | |||
|         <result property="id" column="id"/> | |||
|         <result property="qxBm" column="qx_bm"/> | |||
|         <result property="qxMc" column="qx_mc"/> | |||
|         <result property="gridCode" column="grid_code"/> | |||
|         <result property="gridName" column="grid_name"/> | |||
|         <result property="eventCode" column="event_code"/> | |||
|         <result property="eventName" column="event_name"/> | |||
|         <result property="eventCategory" column="event_category"/> | |||
|         <result property="gridUserName" column="grid_user_name"/> | |||
|         <result property="gridUserCardid" column="grid_user_cardid"/> | |||
|         <result property="reportTime" column="report_time"/> | |||
|         <result property="happenTime" column="happen_time"/> | |||
|         <result property="happenPlace" column="happen_place"/> | |||
|         <result property="eventDescription" column="event_description"/> | |||
|         <result property="waysOfResolving" column="ways_of_resolving"/> | |||
|         <result property="successfulOrNo" column="successful_or_no"/> | |||
|         <result property="completeLevel" column="complete_level"/> | |||
|         <result property="completeTime" column="complete_time"/> | |||
|         <result property="lng" column="lng"/> | |||
|         <result property="lat" column="lat"/> | |||
|         <result property="name" column="name"/> | |||
|         <result property="numberInvolved" column="number_involved"/> | |||
|         <result property="relatedUnites" column="related_unites"/> | |||
|         <result property="lessorName" column="lessor_name"/> | |||
|         <result property="rentingResult" column="renting_result"/> | |||
|         <result property="keyAreaType" column="key_area_type"/> | |||
|         <result property="religionScale" column="religion_scale"/> | |||
|         <result property="religionType" column="religion_type"/> | |||
|         <result property="isKeyareaState" column="is_keyarea_state"/> | |||
|         <result property="isKeypeopleLocate" column="is_keypeople_locate"/> | |||
|         <result property="keypeopleStatus" column="keypeople_status"/> | |||
|         <result property="updateTime" column="update_time"/> | |||
|         <result property="isDel" column="is_del"/> | |||
|         <result property="recoredInsertTime" column="recored_insert_time"/> | |||
|     </resultMap> | |||
|     <delete id="deleteAllData"> | |||
|         DELETE FROM eventreport_pingyin | |||
|     </delete> | |||
| 
 | |||
| 
 | |||
| </mapper> | |||
| @ -0,0 +1,34 @@ | |||
| <?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.opendata.dao.GridInfoPingyinDao"> | |||
| 
 | |||
|     <delete id="deleteAllAgencyData"> | |||
|         delete from grid_info_pingyin where grid_level !='07' | |||
|     </delete> | |||
| 
 | |||
| 
 | |||
|     <delete id="deleteAllGridData"> | |||
|         delete from grid_info_pingyin where grid_level ='07' | |||
|     </delete> | |||
| 
 | |||
|     <select id="selectByGridCode" parameterType="java.lang.String" resultType="com.epmet.opendata.entity.GridInfoPingyinEntity"> | |||
|         select g.* from grid_info_pingyin g | |||
|         where g.grid_code = #{gridCode} and is_del = 'N' | |||
|     </select> | |||
| 
 | |||
|     <update id="updateSomeCol" parameterType="map"> | |||
|        update  grid_info_pingyin | |||
|        set grid_name = #{gridName}, | |||
|            grid_level = #{gridLevel}, | |||
|            lng = #{lng}, | |||
|            lat = #{lat}, | |||
|            update_time = now() | |||
|         where grid_code = #{gridCode} and is_del = 'N' | |||
|     </update> | |||
| 
 | |||
|     <update id="deleteByCode"> | |||
|         update grid_info_pingyin set is_del = 'Y',update_time = now() | |||
|         where grid_code = #{gridCode} | |||
|     </update> | |||
| </mapper> | |||
| @ -0,0 +1,38 @@ | |||
| <?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.opendata.dao.GridstaffInfoPingyinDao"> | |||
| 
 | |||
|     <update id="edit"> | |||
|         UPDATE gridstaff_info_pingyin | |||
|         SET grid_name = #{gridName}, | |||
|          nick_name = #{nickName}, | |||
|          card_num = #{cardNum}, | |||
|          phonenumber = #{phonenumber}, | |||
|          sex = #{sex} | |||
|         WHERE | |||
|             grid_user_id = #{gridUserId} | |||
|         AND grid_code = #{gridCode} | |||
|     </update> | |||
| 
 | |||
|     <delete id="del"> | |||
|         delete from gridstaff_info_pingyin | |||
|     </delete> | |||
| 
 | |||
|     <select id="selectByCodeAndStaffId" resultType="com.epmet.opendata.entity.GridstaffInfoPingyinEntity"> | |||
|         SELECT | |||
|             grid_user_id, | |||
|             grid_code, | |||
|             grid_name, | |||
|             nick_name, | |||
|             card_num, | |||
|             phonenumber | |||
|         FROM | |||
|             gridstaff_info_pingyin | |||
|         WHERE | |||
|             grid_user_id = #{staffId} | |||
|         AND grid_code = #{code} | |||
|         LIMIT 1 | |||
|     </select> | |||
| 
 | |||
| </mapper> | |||
| @ -0,0 +1,26 @@ | |||
| <?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.opendata.dao.GridstaffWorkInfoPingyinDao"> | |||
| 
 | |||
|     <resultMap type="com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity" id="gridstaffWorkInfoPingyinMap"> | |||
|         <result property="id" column="id"/> | |||
|         <result property="qxBm" column="qx_bm"/> | |||
|         <result property="qxMc" column="qx_mc"/> | |||
|         <result property="gridCode" column="GRID_CODE"/> | |||
|         <result property="gridName" column="GRID_NAME"/> | |||
|         <result property="workType" column="WORK_TYPE"/> | |||
|         <result property="happenTime" column="HAPPEN_TIME"/> | |||
|         <result property="baseInfoId" column="BASE_INFO_ID"/> | |||
|         <result property="workResult" column="WORK_RESULT"/> | |||
|         <result property="workContent" column="WORK_CONTENT"/> | |||
|         <result property="updateTime" column="update_time"/> | |||
|         <result property="isDel" column="is_del"/> | |||
|         <result property="recoredInsertTime" column="recored_insert_time"/> | |||
|     </resultMap> | |||
|     <delete id="delAllGridStaffWorkInfoPY"> | |||
|         delete from gridstaff_work_info_pingyin LIMIT 1000 | |||
|     </delete> | |||
| 
 | |||
| 
 | |||
| </mapper> | |||
| @ -0,0 +1,22 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * @description: 网格工作人员数据上报-查询客户网格下有效工作人员信息数据 | |||
|  * @author: sun | |||
|  */ | |||
| @NoArgsConstructor | |||
| @Data | |||
| public class GridStaffUploadtFormDTO { | |||
| 
 | |||
|     /** | |||
|      * 客户Id | |||
|      */ | |||
|     private String customerId; | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,58 @@ | |||
| package com.epmet.dto.result; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * @description: 网格工作人员数据上报-查询客户网格下有效工作人员信息数据 | |||
|  * @author: sun | |||
|  */ | |||
| @Data | |||
| public class GridStaffUploadResultDTO { | |||
|     /** | |||
|      * 区县系统中的网格员唯一编码 | |||
|      */ | |||
|     private String gridUserId; | |||
| 
 | |||
|     /** | |||
|      * 网格员姓名 | |||
|      */ | |||
|     private String nickName; | |||
| 
 | |||
|     /** | |||
|      * 网格员身份证号码 | |||
|      */ | |||
|     private String cardNum; | |||
| 
 | |||
|     /** | |||
|      * 网格员手机号 | |||
|      */ | |||
|     private String phonenumber; | |||
| 
 | |||
|     /** | |||
|      * 网格员性别,应符合10.31中性别,不要有 其他 | |||
|      */ | |||
|     private String sex; | |||
| 
 | |||
|     /** | |||
|      * 网格员类型,符合《标准》10.3 | |||
|      */ | |||
|     private String userType; | |||
| 
 | |||
|     /** | |||
|      * 网格员信息编辑插入、更新时间,,县市区填写 | |||
|      */ | |||
|     private Date updateTime; | |||
| 
 | |||
|     /** | |||
|      * 是否离职,格式为Y:是、N:否 | |||
|      */ | |||
|     private String isLeave; | |||
| 
 | |||
|     /** | |||
|      * 离职时间,格式为“YYYY-MM-DD” | |||
|      */ | |||
|     private Date date; | |||
| 
 | |||
| } | |||
					Loading…
					
					
				
		Reference in new issue