forked from rongchao/epmet-cloud-rizhao
119 changed files with 3893 additions and 89 deletions
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.commons.tools.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class HasOperPermissionFormDTO { |
||||
|
|
||||
|
/** |
||||
|
* uri |
||||
|
*/ |
||||
|
@NotBlank(message = "uri不能为空") |
||||
|
private String uri; |
||||
|
|
||||
|
/** |
||||
|
* http方法 |
||||
|
*/ |
||||
|
@NotBlank(message = "请求http方法不能为空") |
||||
|
private String method; |
||||
|
|
||||
|
@NotBlank(message = "操作者ID不能为空") |
||||
|
private String operId; |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.epmet.commons.tools.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class OperResouce { |
||||
|
|
||||
|
private String userId; |
||||
|
private String resourceUrl; |
||||
|
private String ResourceMethod; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.commons.tools.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/26 17:04 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class YtHsjcResDTO { |
||||
|
private int code = 200; |
||||
|
private String msg = "请求成功"; |
||||
|
/** |
||||
|
* 响应数据 |
||||
|
*/ |
||||
|
private List<YtHsjcResDetailDTO> data; |
||||
|
private int total; |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.epmet.commons.tools.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/26 17:10 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class YtHsjcResDetailDTO { |
||||
|
private String id; |
||||
|
private String name; |
||||
|
private String card_no; |
||||
|
private String telephone; |
||||
|
private String address; |
||||
|
private String test_time; |
||||
|
private String depart_name; |
||||
|
private String county; |
||||
|
private String upload_time; |
||||
|
private String sample_result_pcr; |
||||
|
private String sample_time; |
||||
|
private String sampling_org_pcr; |
||||
|
|
||||
|
/* { |
||||
|
"code":"200", |
||||
|
"msg":"请求成功", |
||||
|
"data":[ |
||||
|
{ |
||||
|
"id":"6a31eb2d38c011eda054fa163ebc7ff4", |
||||
|
"name":"杨冠中",// 姓名
|
||||
|
"card_no":"372527198404130813",// 证件号码
|
||||
|
"telephone":"13697890860",// 电话
|
||||
|
"address":"保利香榭里公馆18-1-302",// 联系地址
|
||||
|
"test_time":"2022-09-20 12:52:28",// 检测时间
|
||||
|
"depart_name":"天仁医学检验实验室有限公司",// varchar
|
||||
|
"county":"莱山区",// 所属区县
|
||||
|
"upload_time":"2022-09-20 21:23:10",// 时间戳
|
||||
|
"sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性
|
||||
|
"sample_time":"2022-09-20 06:48:28",// 采样时间
|
||||
|
"sampling_org_pcr":"采样点327"// 核酸采样机构
|
||||
|
}, |
||||
|
] |
||||
|
"total":1 |
||||
|
} |
||||
|
*/ |
||||
|
} |
||||
|
|
@ -0,0 +1,46 @@ |
|||||
|
package com.epmet.commons.tools.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; |
||||
|
import com.epmet.commons.tools.dto.result.OperResouce; |
||||
|
import com.epmet.commons.tools.feign.fallback.CommonOperAccessOpenFeignClientFallbackFactory; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 运营端权限模块 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/5/21 15:17 本服务对外开放的API,其他服务通过引用此client调用该服务 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class) |
||||
|
//@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class, url = "http://localhost:8093")
|
||||
|
public interface CommonOperAccessOpenFeignClient { |
||||
|
/** |
||||
|
* @param |
||||
|
* @return com.epmet.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 清空运营人员权限信息、菜单信息 |
||||
|
* @Date 2020/5/21 17:08 |
||||
|
**/ |
||||
|
@GetMapping("/oper/access/menu/clearoperuseraccess") |
||||
|
Result clearOperUserAccess(); |
||||
|
|
||||
|
/** |
||||
|
* 是否有该接口的权限 |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/oper/access/menu/hasPermission") |
||||
|
Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form); |
||||
|
|
||||
|
/** |
||||
|
* 需要验证的菜单资源 |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/oper/access/menu/getExamineResourceUrls") |
||||
|
Result<List<OperResouce>> getExamineResourceUrls(); |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package com.epmet.commons.tools.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; |
||||
|
import com.epmet.commons.tools.dto.result.OperResouce; |
||||
|
import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 运营端权限模块 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/5/21 15:47 |
||||
|
*/ |
||||
|
//@Component
|
||||
|
public class CommonOperAccessOpenFeignClientFallback implements CommonOperAccessOpenFeignClient { |
||||
|
@Override |
||||
|
public Result clearOperUserAccess() { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "clearOperUserAccess"); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result hasOperPermission(HasOperPermissionFormDTO form) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "hasOperPermission"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<OperResouce>> getExamineResourceUrls() { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getExamineResourceUrls"); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,19 @@ |
|||||
|
package com.epmet.commons.tools.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; |
||||
|
import feign.hystrix.FallbackFactory; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
@Component |
||||
|
@Slf4j |
||||
|
public class CommonOperAccessOpenFeignClientFallbackFactory implements FallbackFactory<CommonOperAccessOpenFeignClient> { |
||||
|
private CommonOperAccessOpenFeignClientFallback fallback = new CommonOperAccessOpenFeignClientFallback(); |
||||
|
|
||||
|
@Override |
||||
|
public CommonOperAccessOpenFeignClient create(Throwable cause) { |
||||
|
log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); |
||||
|
return fallback; |
||||
|
} |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.commons.tools.utils; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.commons.tools.dto.result.YtHsjcResDTO; |
||||
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
||||
|
import com.epmet.commons.tools.exception.EpmetException; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/26 16:56 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
public class YtHsResUtils { |
||||
|
static String url = "https://10.2.2.60:8191/sjzt/server/hsjcxx?appkey=DR4jF5Be7sCsqDmCamq2tmYCl"; |
||||
|
|
||||
|
/** |
||||
|
* desc:图片同步扫描 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public static YtHsjcResDTO hsjc(String cardNo, Integer rowNum, Integer pageSize) { |
||||
|
try { |
||||
|
String param = String.format("&card_no=%s&ROWNUM=%s&PAGESIZE=%s", cardNo, rowNum, pageSize); |
||||
|
String apiUrl = url.concat(param); |
||||
|
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(apiUrl, null); |
||||
|
if (result.success()) { |
||||
|
return JSON.parseObject(result.getData(), YtHsjcResDTO.class); |
||||
|
} |
||||
|
YtHsjcResDTO resultResult = new YtHsjcResDTO(); |
||||
|
resultResult.setData(new ArrayList<>()); |
||||
|
return resultResult; |
||||
|
} catch (Exception e) { |
||||
|
log.error(String.format("烟台核算检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage())); |
||||
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取核算检测结果api异常"+e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
epmet: |
||||
|
oper-examine-resource-urls: |
||||
|
# 角色编辑 |
||||
|
- resourceUrl: /oper/access/operrole |
||||
|
resourceMethod: PUT |
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.task; |
||||
|
|
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.NatInfoScanTaskFormDTO; |
||||
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @author zxc |
||||
|
* @dscription |
||||
|
* 大数据局部门配置on |
||||
|
* 根据范围搜索居民,调接口查询最近一次核酸检测记录 |
||||
|
* 检测时间 + 身份证 不存在就插入 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component("natInfoScanTask") |
||||
|
public class NatInfoScanTask implements ITask { |
||||
|
|
||||
|
@Autowired |
||||
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
||||
|
|
||||
|
@Override |
||||
|
public void run(String params) { |
||||
|
NatInfoScanTaskFormDTO formDTO = new NatInfoScanTaskFormDTO(); |
||||
|
if (StringUtils.isNotBlank(params)) { |
||||
|
formDTO = JSON.parseObject(params, NatInfoScanTaskFormDTO.class); |
||||
|
} |
||||
|
Result result = userOpenFeignClient.natInfoScanTask(formDTO); |
||||
|
if (result.success()) { |
||||
|
log.info("NatInfoScanTask定时任务执行成功"); |
||||
|
} else { |
||||
|
log.error("NatInfoScanTask定时任务执行失败:" + result.getMsg()); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
ALTER TABLE `epmet_gov_access`.`gov_menu` |
||||
|
ADD COLUMN `color` varchar(16) DEFAULT '' COMMENT '菜单颜色' AFTER `icon`; |
@ -0,0 +1,26 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/21 15:13 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class TopArticleFormDTO { |
||||
|
/** |
||||
|
* 文章id |
||||
|
*/ |
||||
|
@NotBlank(message = "文章id不能为空") |
||||
|
private String articleId; |
||||
|
/** |
||||
|
* top |
||||
|
* cancel_top |
||||
|
*/ |
||||
|
@NotBlank(message = "type不能为空,置顶:top,取消置顶:cancel_top") |
||||
|
private String type; |
||||
|
} |
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class HasOperPermissionFormDTO { |
||||
|
|
||||
|
/** |
||||
|
* uri |
||||
|
*/ |
||||
|
@NotBlank(message = "uri不能为空") |
||||
|
private String uri; |
||||
|
|
||||
|
/** |
||||
|
* http方法 |
||||
|
*/ |
||||
|
@NotBlank(message = "请求http方法不能为空") |
||||
|
private String method; |
||||
|
|
||||
|
@NotBlank(message = "操作者ID不能为空") |
||||
|
private String operId; |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class OperResouce { |
||||
|
|
||||
|
private String userId; |
||||
|
private String resourceUrl; |
||||
|
private String ResourceMethod; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DataSyncConfigDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 部门编码 |
||||
|
*/ |
||||
|
private String deptCode; |
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String deptName; |
||||
|
|
||||
|
/** |
||||
|
* 数据名称 |
||||
|
*/ |
||||
|
private String dataName; |
||||
|
|
||||
|
/** |
||||
|
* 开启:open;关闭:closed |
||||
|
*/ |
||||
|
private String switchStatus; |
||||
|
|
||||
|
private String dataCode; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
private List<DataSyncScopeDTO> scopeList; |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import com.epmet.dto.form.ScopeSaveFormDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 数据更新范围表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DataSyncScopeDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表主键 |
||||
|
*/ |
||||
|
private String dataSyncConfigId; |
||||
|
|
||||
|
/** |
||||
|
* 网格:grid, |
||||
|
社区级:community, |
||||
|
乡(镇、街道)级:street, |
||||
|
区县级: district, |
||||
|
市级: city |
||||
|
省级:province |
||||
|
*/ |
||||
|
@NotBlank(message = "orgType不能为空",groups = ScopeSaveFormDTO.ScopeSaveForm.class) |
||||
|
private String orgType; |
||||
|
|
||||
|
/** |
||||
|
* 组织或者网格id |
||||
|
*/ |
||||
|
@NotBlank(message = "orgId不能为空",groups = ScopeSaveFormDTO.ScopeSaveForm.class) |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* org_id的上级 |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* org_id的全路径,包含自身 |
||||
|
*/ |
||||
|
private String orgIdPath; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,121 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelIgnore; |
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 核酸比对记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcNatCompareRecordDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ExcelIgnore |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
@ExcelIgnore |
||||
|
private String relationId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
@ColumnWidth(15) |
||||
|
@ExcelProperty("姓名") |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 真实身份证号 |
||||
|
*/ |
||||
|
@ColumnWidth(20) |
||||
|
@ExcelProperty("身份证号") |
||||
|
private String realIdCard; |
||||
|
|
||||
|
/** |
||||
|
* 身份证 |
||||
|
*/ |
||||
|
@ExcelIgnore |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
@ExcelIgnore |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 真实手机号 |
||||
|
*/ |
||||
|
@ColumnWidth(20) |
||||
|
@ExcelProperty("手机号") |
||||
|
private String realMobile; |
||||
|
|
||||
|
/** |
||||
|
* 是否客户下居民(0:否 1:是) |
||||
|
*/ |
||||
|
@ExcelIgnore |
||||
|
private String isAgencyUser; |
||||
|
|
||||
|
@ColumnWidth(10) |
||||
|
@ExcelProperty("本辖区居民") |
||||
|
private String isAgencyUserDesc; |
||||
|
|
||||
|
/** |
||||
|
* 是本辖区的居民时候,ic_resi_user.id |
||||
|
*/ |
||||
|
@ExcelIgnore |
||||
|
private String icResiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 最近一次核酸时间:接口填入 |
||||
|
*/ |
||||
|
@ColumnWidth(30) |
||||
|
@ExcelProperty("最近一次核酸时间") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date latestNatTime; |
||||
|
|
||||
|
/** |
||||
|
* 检测结果(0:阴性 1:阳性):接口填入 |
||||
|
*/ |
||||
|
@ExcelIgnore |
||||
|
private String natResult; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 检测地点:接口填入 |
||||
|
*/ |
||||
|
@ColumnWidth(50) |
||||
|
@ExcelProperty("检测地点") |
||||
|
private String natAddress; |
||||
|
|
||||
|
|
||||
|
@ColumnWidth(15) |
||||
|
@ExcelProperty("检测结果") |
||||
|
private String natResultDesc; |
||||
|
|
||||
|
@ExcelIgnore |
||||
|
private String importDate; |
||||
|
|
||||
|
|
||||
|
@ColumnWidth(30) |
||||
|
@ExcelProperty("导入时间") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date importTime; |
||||
|
|
||||
|
@ColumnWidth(30) |
||||
|
@ExcelProperty("导入组织") |
||||
|
private String agencyName; |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2022/9/26 14:34 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ConfigSwitchFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 7510856043372376415L; |
||||
|
|
||||
|
public interface ConfigSwitchForm{} |
||||
|
|
||||
|
@NotBlank(message = "deptCode不能为空",groups = ConfigSwitchForm.class) |
||||
|
private String deptCode; |
||||
|
|
||||
|
@NotBlank(message = "dataSyncConfigId不能为空",groups = ConfigSwitchForm.class) |
||||
|
private String dataSyncConfigId; |
||||
|
private String updatedBy; |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2022/9/26 17:04 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class NatInfoScanTaskFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 3053943501957102943L; |
||||
|
|
||||
|
private String customerId; |
||||
|
|
||||
|
private List<String> idCards; |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import com.epmet.dto.DataSyncScopeDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2022/9/26 15:35 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScopeSaveFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -489844541905303736L; |
||||
|
|
||||
|
public interface ScopeSaveForm{} |
||||
|
|
||||
|
@NotBlank(message = "dataSyncConfigId不能为空",groups = ScopeSaveForm.class) |
||||
|
private String dataSyncConfigId; |
||||
|
private String customerId; |
||||
|
|
||||
|
@Valid |
||||
|
private List<DataSyncScopeDTO> scopeList; |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotEmpty; |
||||
|
import javax.validation.constraints.Size; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/21 17:06 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SendNoticeV2FormDTO { |
||||
|
// token获取
|
||||
|
private String customerId; |
||||
|
private String staffId; |
||||
|
// 前端传入
|
||||
|
/** |
||||
|
* 用户列表 |
||||
|
*/ |
||||
|
@NotEmpty(message = "业务数据id不能为空", groups = CustomerClientShowGroup.class) |
||||
|
private List<String> bdIds; |
||||
|
/** |
||||
|
* 通知渠道通知渠道 0小程序通知,1短信通知 |
||||
|
*/ |
||||
|
@NotEmpty(message = "请选择通知渠道", groups = CustomerClientShowGroup.class) |
||||
|
private List<String> channel; |
||||
|
/** |
||||
|
* v1:通知来源 0 行程上报,1 疫苗接种,2 核酸检测 |
||||
|
* v2:0行程上报,1疫苗接种关注名单,2重点人群关注名单-隔离防疫(原核酸检测关注名单) |
||||
|
*/ |
||||
|
@NotEmpty(message = "通知来源不能为空", groups = CustomerClientShowGroup.class) |
||||
|
private String origin; |
||||
|
/** |
||||
|
* 通知内容 |
||||
|
*/ |
||||
|
@Size(min = 1, max = 500, message = "通知内容不超过500字", groups = CustomerClientShowGroup.class) |
||||
|
private String content; |
||||
|
|
||||
|
// 接口内赋值
|
||||
|
/** |
||||
|
* 组织名 |
||||
|
*/ |
||||
|
private String orgName; |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.dto.form.yqfk; |
||||
|
|
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/26 15:55 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcNatCompareRecordPageFormDTO extends PageFormDTO { |
||||
|
/** |
||||
|
* 是否客户下居民(0:否 1:是) |
||||
|
*/ |
||||
|
private String isResiUser; |
||||
|
/** |
||||
|
* 导入时间 yyyyMMdd |
||||
|
*/ |
||||
|
private String importDate; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 身份证 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
|
||||
|
private String customerId; |
||||
|
private String userId; |
||||
|
private String agencyId; |
||||
|
} |
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2022/9/27 10:23 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class NatUserInfoResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8904940082452398136L; |
||||
|
|
||||
|
private String idCard; |
||||
|
|
||||
|
private String userId; |
||||
|
|
||||
|
private String agencyId; |
||||
|
|
||||
|
private String pids; |
||||
|
} |
@ -0,0 +1,115 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
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.DataSyncConfigDTO; |
||||
|
import com.epmet.dto.form.ConfigSwitchFormDTO; |
||||
|
import com.epmet.dto.form.NatInfoScanTaskFormDTO; |
||||
|
import com.epmet.dto.form.ScopeSaveFormDTO; |
||||
|
import com.epmet.service.DataSyncConfigService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("dataSyncConfig") |
||||
|
public class DataSyncConfigController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DataSyncConfigService dataSyncConfigService; |
||||
|
|
||||
|
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
||||
|
public Result<DataSyncConfigDTO> get(@PathVariable("id") String id){ |
||||
|
DataSyncConfigDTO data = dataSyncConfigService.get(id); |
||||
|
return new Result<DataSyncConfigDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody DataSyncConfigDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
dataSyncConfigService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody DataSyncConfigDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
dataSyncConfigService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
dataSyncConfigService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】配置开关 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 14:36 |
||||
|
*/ |
||||
|
@PostMapping("configSwitch") |
||||
|
public Result configSwitch(@RequestBody ConfigSwitchFormDTO formDTO, @LoginUser TokenDto tokenDto){ |
||||
|
ValidatorUtils.validateEntity(formDTO, ConfigSwitchFormDTO.ConfigSwitchForm.class); |
||||
|
formDTO.setUpdatedBy(tokenDto.getUserId()); |
||||
|
dataSyncConfigService.configSwitch(formDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】列表 |
||||
|
* @param tokenDto |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:04 |
||||
|
*/ |
||||
|
@PostMapping("list") |
||||
|
public Result<PageData> list(@LoginUser TokenDto tokenDto, @RequestBody PageFormDTO formDTO){ |
||||
|
ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class); |
||||
|
return new Result<PageData>().ok(dataSyncConfigService.list(tokenDto,formDTO)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】范围保存 |
||||
|
* @param tokenDto |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:40 |
||||
|
*/ |
||||
|
@PostMapping("scopeSave") |
||||
|
public Result scopeSave(@LoginUser TokenDto tokenDto,@RequestBody ScopeSaveFormDTO formDTO){ |
||||
|
ValidatorUtils.validateEntity(formDTO,ScopeSaveFormDTO.ScopeSaveForm.class); |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
dataSyncConfigService.scopeSave(formDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("natInfoScanTask") |
||||
|
public Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO){ |
||||
|
dataSyncConfigService.natInfoScanTask(formDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.DataSyncScopeDTO; |
||||
|
import com.epmet.service.DataSyncScopeService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 数据更新范围表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("dataSyncScope") |
||||
|
public class DataSyncScopeController { |
||||
|
|
||||
|
@Autowired |
||||
|
private DataSyncScopeService dataSyncScopeService; |
||||
|
|
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<DataSyncScopeDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<DataSyncScopeDTO> page = dataSyncScopeService.page(params); |
||||
|
return new Result<PageData<DataSyncScopeDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
||||
|
public Result<DataSyncScopeDTO> get(@PathVariable("id") String id){ |
||||
|
DataSyncScopeDTO data = dataSyncScopeService.get(id); |
||||
|
return new Result<DataSyncScopeDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@RequestBody DataSyncScopeDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
dataSyncScopeService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody DataSyncScopeDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
dataSyncScopeService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
dataSyncScopeService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,194 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.ExcelWriter; |
||||
|
import com.alibaba.excel.write.metadata.WriteSheet; |
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.annotation.MaskResponse; |
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.constant.AppClientConstant; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
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.feign.ResultDataResolver; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.*; |
||||
|
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
||||
|
import com.epmet.constants.ImportTaskConstants; |
||||
|
import com.epmet.dto.IcNatCompareRecordDTO; |
||||
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
||||
|
import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; |
||||
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
||||
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
||||
|
import com.epmet.service.IcNatCompareRecordService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.io.IOUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpHeaders; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.FileOutputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.net.URLEncoder; |
||||
|
import java.nio.file.Path; |
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 核算比对记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@RequestMapping("icNatCompareRecord") |
||||
|
public class IcNatCompareRecordController implements ResultDataResolver { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcNatCompareRecordService icNatCompareRecordService; |
||||
|
@Autowired |
||||
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
||||
|
|
||||
|
/** |
||||
|
* 未做核酸比对-分页查询 |
||||
|
* @param tokenDto |
||||
|
* @param formDTO |
||||
|
* @return |
||||
|
*/ |
||||
|
@RequestMapping("page") |
||||
|
@MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) |
||||
|
public Result<PageData<IcNatCompareRecordDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO){ |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
formDTO.setUserId(tokenDto.getUserId()); |
||||
|
PageData<IcNatCompareRecordDTO> page = icNatCompareRecordService.page(formDTO); |
||||
|
return new Result<PageData<IcNatCompareRecordDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* pc:未做核酸比对-导出 |
||||
|
* @param tokenDto |
||||
|
* @param formDTO |
||||
|
* @param response |
||||
|
*/ |
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("export") |
||||
|
public void export(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO, HttpServletResponse response) { |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
formDTO.setUserId(tokenDto.getUserId()); |
||||
|
// formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
|
||||
|
// formDTO.setUserId("35005df15fb0f7c791344f0b424870b7");
|
||||
|
formDTO.setIsPage(false); |
||||
|
ExcelWriter excelWriter = null; |
||||
|
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
||||
|
int pageNo = formDTO.getPageNo(); |
||||
|
try { |
||||
|
// 这里 需要指定写用哪个class去写
|
||||
|
String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); |
||||
|
String fileName = "核酸比对".concat(today); |
||||
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcNatCompareRecordDTO.class).build(); |
||||
|
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
||||
|
PageData<IcNatCompareRecordDTO> data = null; |
||||
|
do { |
||||
|
data = icNatCompareRecordService.page(formDTO); |
||||
|
formDTO.setPageNo(++pageNo); |
||||
|
excelWriter.write(data.getList(), writeSheet); |
||||
|
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
log.error("export exception", e); |
||||
|
} finally { |
||||
|
// 千万别忘记finish 会帮忙关闭流
|
||||
|
if (excelWriter != null) { |
||||
|
excelWriter.finish(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 导入excel |
||||
|
* @return |
||||
|
*/ |
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("import") |
||||
|
public Result importExcel(@LoginUser TokenDto tokenDto, @RequestPart("file") MultipartFile file) { |
||||
|
String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); |
||||
|
|
||||
|
// 1.暂存文件
|
||||
|
String originalFilename = file.getOriginalFilename(); |
||||
|
String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); |
||||
|
|
||||
|
Path fileSavePath; |
||||
|
try { |
||||
|
Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat_compare_record", "import"); |
||||
|
fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName)); |
||||
|
} catch (IOException e) { |
||||
|
String errorMsg = ExceptionUtils.getErrorStackTrace(e); |
||||
|
log.error("【未做核酸比对】创建临时存储文件失败:{}", errorMsg); |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); |
||||
|
} |
||||
|
|
||||
|
InputStream is = null; |
||||
|
FileOutputStream os = null; |
||||
|
|
||||
|
try { |
||||
|
is = file.getInputStream(); |
||||
|
os = new FileOutputStream(fileSavePath.toString()); |
||||
|
IOUtils.copy(is, os); |
||||
|
} catch (Exception e) { |
||||
|
log.error("method exception", e); |
||||
|
} finally { |
||||
|
org.apache.poi.util.IOUtils.closeQuietly(is); |
||||
|
org.apache.poi.util.IOUtils.closeQuietly(os); |
||||
|
} |
||||
|
|
||||
|
// 2.生成导入任务记录
|
||||
|
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); |
||||
|
importTaskForm.setOperatorId(userId); |
||||
|
importTaskForm.setBizType(ImportTaskConstants.IC_NAT_COMPARE_RECORD); |
||||
|
importTaskForm.setOriginFileName(originalFilename); |
||||
|
|
||||
|
ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), |
||||
|
ServiceConstant.EPMET_COMMON_SERVICE, |
||||
|
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), |
||||
|
"excel未做核酸比对导入文件错误", |
||||
|
"未做核酸比对导入文件失败"); |
||||
|
|
||||
|
// 3.执行导入
|
||||
|
icNatCompareRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId()); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param response |
||||
|
* @throws IOException |
||||
|
*/ |
||||
|
@RequestMapping(value = "template-download", method = {RequestMethod.GET, RequestMethod.POST}) |
||||
|
public void downloadTemplate(HttpServletResponse response) throws IOException { |
||||
|
response.setCharacterEncoding("UTF-8"); |
||||
|
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); |
||||
|
//response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
|
||||
|
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
||||
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("未做核酸比对", "UTF-8") + ".xlsx"); |
||||
|
|
||||
|
InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_nat_compare_record_template.xlsx"); |
||||
|
try { |
||||
|
ServletOutputStream os = response.getOutputStream(); |
||||
|
IOUtils.copy(is, os); |
||||
|
} finally { |
||||
|
if (is != null) { |
||||
|
is.close(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.DataSyncConfigDTO; |
||||
|
import com.epmet.dto.DataSyncScopeDTO; |
||||
|
import com.epmet.dto.form.ConfigSwitchFormDTO; |
||||
|
import com.epmet.dto.result.NatUserInfoResultDTO; |
||||
|
import com.epmet.entity.DataSyncConfigEntity; |
||||
|
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 2022-09-26 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface DataSyncConfigDao extends BaseDao<DataSyncConfigEntity> { |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】配置开关 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 14:36 |
||||
|
*/ |
||||
|
void configSwitch(ConfigSwitchFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】列表 |
||||
|
* @param customerId |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:04 |
||||
|
*/ |
||||
|
List<DataSyncConfigDTO> list(@Param("customerId")String customerId); |
||||
|
|
||||
|
List<DataSyncScopeDTO> scopeList(@Param("id")String id); |
||||
|
|
||||
|
/** |
||||
|
* Desc: 删除范围 |
||||
|
* @param dataSyncConfigId |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:46 |
||||
|
*/ |
||||
|
void delScope(@Param("dataSyncConfigId")String dataSyncConfigId); |
||||
|
|
||||
|
/** |
||||
|
* Desc: 根据范围查询居民证件号 |
||||
|
* @param list |
||||
|
* @author zxc |
||||
|
* @date 2022/9/27 09:23 |
||||
|
*/ |
||||
|
List<NatUserInfoResultDTO> getIdCardsByScope(@Param("list") List<DataSyncScopeDTO> list); |
||||
|
|
||||
|
List<NatUserInfoResultDTO> getUserIdByIdCard(@Param("list") List<String> list); |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.DataSyncScopeEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新范围表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface DataSyncScopeDao extends BaseDao<DataSyncScopeEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.IcNatCompareRecRelationEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* 核酸比对组织关系表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-27 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IcNatCompareRecRelationDao extends BaseDao<IcNatCompareRecRelationEntity> { |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param customerId |
||||
|
* @param compareRecId |
||||
|
* @param agencyId |
||||
|
* @param importDate yyyyMMdd |
||||
|
* @return |
||||
|
*/ |
||||
|
IcNatCompareRecRelationEntity selectExist(@Param("customerId") String customerId, |
||||
|
@Param("compareRecId") String compareRecId, |
||||
|
@Param("agencyId") String agencyId, |
||||
|
@Param("importDate") String importDate); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.IcNatCompareRecordDTO; |
||||
|
import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; |
||||
|
import com.epmet.entity.IcNatCompareRecordEntity; |
||||
|
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 2022-09-26 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IcNatCompareRecordDao extends BaseDao<IcNatCompareRecordEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 分页查询 |
||||
|
* @param formDTO |
||||
|
* @return |
||||
|
*/ |
||||
|
List<IcNatCompareRecordDTO> pageList(IcNatCompareRecordPageFormDTO formDTO); |
||||
|
|
||||
|
|
||||
|
IcNatCompareRecordEntity selectByIdCard(@Param("customerId") String customerId, @Param("idCard")String idCard); |
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("data_sync_config") |
||||
|
public class DataSyncConfigEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 部门编码 |
||||
|
*/ |
||||
|
private String deptCode; |
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String deptName; |
||||
|
|
||||
|
/** |
||||
|
* 数据名称 |
||||
|
*/ |
||||
|
private String dataName; |
||||
|
|
||||
|
/** |
||||
|
* 开启:open;关闭:closed |
||||
|
*/ |
||||
|
private String switchStatus; |
||||
|
|
||||
|
private String dataCode; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新范围表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("data_sync_scope") |
||||
|
public class DataSyncScopeEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表主键 |
||||
|
*/ |
||||
|
private String dataSyncConfigId; |
||||
|
|
||||
|
/** |
||||
|
* 网格:grid, |
||||
|
* 组织:agency |
||||
|
*/ |
||||
|
private String orgType; |
||||
|
|
||||
|
/** |
||||
|
* 组织或者网格id |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* org_id的上级 |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* org_id的全路径,包含自身 |
||||
|
*/ |
||||
|
private String orgIdPath; |
||||
|
|
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
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 2022-09-27 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ic_nat_compare_rec_relation") |
||||
|
public class IcNatCompareRecRelationEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* ic_nat_compare_record.id |
||||
|
*/ |
||||
|
private String compareRecId; |
||||
|
|
||||
|
/** |
||||
|
* 导入日期:yyyyMMdd |
||||
|
*/ |
||||
|
private String importDate; |
||||
|
|
||||
|
/** |
||||
|
* 导入时间,同一天内导入多次需要更新此列值 |
||||
|
*/ |
||||
|
private Date importTime; |
||||
|
|
||||
|
/** |
||||
|
* 操作人员所属组织id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
/** |
||||
|
* 组织名称 |
||||
|
*/ |
||||
|
private String agencyName; |
||||
|
/** |
||||
|
* agency_id的上级 |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* agency_id组织的所有上级 |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 最近一次操作人 |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 最近一次操作人姓名 |
||||
|
*/ |
||||
|
private String staffName; |
||||
|
|
||||
|
/** |
||||
|
* 是否本社区(agency_id)下居民(0:否 1:是) |
||||
|
*/ |
||||
|
private String isAgencyUser; |
||||
|
|
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
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 2022-09-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ic_nat_compare_record") |
||||
|
public class IcNatCompareRecordEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
private String customerId; |
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 身份证 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 是否客户下居民(0:否 1:是) |
||||
|
*/ |
||||
|
private String isResiUser; |
||||
|
|
||||
|
/** |
||||
|
* 是否客户下居民,ic_resi_user.id |
||||
|
*/ |
||||
|
private String icResiUserId; |
||||
|
|
||||
|
/** |
||||
|
* 最近一次核酸时间:接口填入 |
||||
|
*/ |
||||
|
private Date latestNatTime; |
||||
|
|
||||
|
/** |
||||
|
* 检测结果(0:阴性 1:阳性):接口填入 |
||||
|
*/ |
||||
|
private String natResult; |
||||
|
|
||||
|
/** |
||||
|
* 检测地点:接口填入 |
||||
|
*/ |
||||
|
private String natAddress; |
||||
|
/** |
||||
|
* 联系地址:接口填入 |
||||
|
*/ |
||||
|
private String contactAddress; |
||||
|
/** |
||||
|
* 最新一次导入时间,对应ic_nat_compare_rec_relation.IMPORT_TIME |
||||
|
*/ |
||||
|
private Date latestImportTime; |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.epmet.excel.data; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/27 9:41 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcNatCompareRecordExcelData { |
||||
|
@NotBlank(message = "姓名为必填项") |
||||
|
@ExcelProperty("姓名") |
||||
|
private String name; |
||||
|
|
||||
|
@NotBlank(message = "身份证号为必填项") |
||||
|
@ExcelProperty("身份证号") |
||||
|
private String idCard; |
||||
|
|
||||
|
@NotBlank(message = "手机号为必填项") |
||||
|
@ExcelProperty("手机号") |
||||
|
private String mobile; |
||||
|
|
||||
|
@Data |
||||
|
public static class ErrorRow { |
||||
|
|
||||
|
@ExcelProperty("姓名") |
||||
|
@ColumnWidth(20) |
||||
|
private String name; |
||||
|
|
||||
|
@ColumnWidth(20) |
||||
|
@ExcelProperty("身份证号") |
||||
|
private String idCard; |
||||
|
|
||||
|
@ExcelProperty("手机号") |
||||
|
@ColumnWidth(20) |
||||
|
private String mobile; |
||||
|
|
||||
|
@ColumnWidth(60) |
||||
|
@ExcelProperty("错误信息") |
||||
|
private String errorInfo; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,160 @@ |
|||||
|
package com.epmet.excel.handler; |
||||
|
|
||||
|
import com.alibaba.excel.context.AnalysisContext; |
||||
|
import com.alibaba.excel.read.listener.ReadListener; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.constant.StrConstant; |
||||
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
||||
|
import com.epmet.commons.tools.dto.result.YtHsjcResDTO; |
||||
|
import com.epmet.commons.tools.dto.result.YtHsjcResDetailDTO; |
||||
|
import com.epmet.commons.tools.enums.EnvEnum; |
||||
|
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.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.DateUtils; |
||||
|
import com.epmet.commons.tools.utils.ObjectUtil; |
||||
|
import com.epmet.commons.tools.utils.YtHsResUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.entity.IcNatCompareRecordEntity; |
||||
|
import com.epmet.excel.data.IcNatCompareRecordExcelData; |
||||
|
import com.epmet.service.impl.IcNatCompareRecordServiceImpl; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2022/9/27 9:42 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
public class IcNatCompareRecordExcelImportListener implements ReadListener<IcNatCompareRecordExcelData> { |
||||
|
|
||||
|
/** |
||||
|
* 最大条数阈值 |
||||
|
*/ |
||||
|
public static final int MAX_THRESHOLD = 200; |
||||
|
/** |
||||
|
* 当前操作用户 |
||||
|
*/ |
||||
|
private CustomerStaffInfoCacheResult staffInfo; |
||||
|
private String customerId; |
||||
|
private IcNatCompareRecordServiceImpl icNatCompareRecordService; |
||||
|
/** |
||||
|
* 数据 |
||||
|
*/ |
||||
|
private List<IcNatCompareRecordEntity> datas = new ArrayList<>(); |
||||
|
|
||||
|
/** |
||||
|
* 错误项列表 |
||||
|
*/ |
||||
|
private List<IcNatCompareRecordExcelData.ErrorRow> errorRows = new ArrayList<>(); |
||||
|
private Date importTime; |
||||
|
/** |
||||
|
* 导入日期:yyyyMMdd |
||||
|
*/ |
||||
|
private String importDate; |
||||
|
public IcNatCompareRecordExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordServiceImpl icNatCompareRecordService) { |
||||
|
this.customerId = customerId; |
||||
|
this.staffInfo = staffInfo; |
||||
|
this.icNatCompareRecordService = icNatCompareRecordService; |
||||
|
this.importDate=importDate; |
||||
|
this.importTime=importTime; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void invoke(IcNatCompareRecordExcelData data, AnalysisContext analysisContext) { |
||||
|
try { |
||||
|
// log.warn("有数据吗?"+JSON.toJSONString(data));
|
||||
|
// 不能为空先校验数据
|
||||
|
ValidatorUtils.validateEntity(data); |
||||
|
// 去除空格
|
||||
|
ObjectUtil.objectToTrim(data); |
||||
|
IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); |
||||
|
compareRecordEntity.setCustomerId(customerId); |
||||
|
compareRecordEntity.setLatestNatTime(null); |
||||
|
compareRecordEntity.setNatAddress(StrConstant.EPMETY_STR); |
||||
|
compareRecordEntity.setNatResult(StrConstant.EPMETY_STR); |
||||
|
// 开发和测试没法测试,只能写死只有生产才去调用了 烟台客户id:1535072605621841922
|
||||
|
EnvEnum currentEnv = EnvEnum.getCurrentEnv(); |
||||
|
if (EnvEnum.PROD.getCode().equals(currentEnv.getCode()) && "1535072605621841922".equals(customerId)) { |
||||
|
// 调用烟台api获取核酸检测结果
|
||||
|
YtHsjcResDTO hsjcResDTO = YtHsResUtils.hsjc(data.getIdCard(), 1, 1); |
||||
|
if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) { |
||||
|
YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0); |
||||
|
String testTime = ytHsjcResDetailDTO.getTest_time(); |
||||
|
compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_PATTERN)); |
||||
|
compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSample_result_pcr() : StrConstant.EPMETY_STR); |
||||
|
|
||||
|
// "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性
|
||||
|
String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr(); |
||||
|
if (NumConstant.ONE_STR.equals(sample_result_pcr)) { |
||||
|
compareRecordEntity.setNatResult(NumConstant.ONE_STR); |
||||
|
} else if (NumConstant.TWO_STR.equals(sample_result_pcr)) { |
||||
|
compareRecordEntity.setNatResult(NumConstant.ZERO_STR); |
||||
|
} |
||||
|
compareRecordEntity.setContactAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getAddress()) ? ytHsjcResDetailDTO.getAddress() : StrConstant.EPMETY_STR); |
||||
|
} |
||||
|
} |
||||
|
datas.add(compareRecordEntity); |
||||
|
|
||||
|
if (datas.size() == MAX_THRESHOLD) { |
||||
|
execPersist(); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
String errorMsg = null; |
||||
|
if (e instanceof ValidateException) { |
||||
|
errorMsg = ((ValidateException) e).getMsg(); |
||||
|
} else if (e instanceof EpmetException) { |
||||
|
errorMsg = ((EpmetException) e).getMsg(); |
||||
|
} else { |
||||
|
errorMsg = "未知错误"; |
||||
|
log.error("【未做核酸比对导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); |
||||
|
} |
||||
|
IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow(); |
||||
|
errorRow.setIdCard(data.getIdCard()); |
||||
|
errorRow.setName(data.getName()); |
||||
|
errorRow.setMobile(data.getMobile()); |
||||
|
errorRow.setErrorInfo(errorMsg); |
||||
|
errorRows.add(errorRow); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
||||
|
// 最后几条达不到阈值,这里必须再调用一次
|
||||
|
execPersist(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 执行持久化 |
||||
|
*/ |
||||
|
private void execPersist() { |
||||
|
// ic_nat_compare_record、ic_nat_compare_rec_relation
|
||||
|
try { |
||||
|
if (datas != null && datas.size() > 0) { |
||||
|
icNatCompareRecordService.batchPersist(datas, staffInfo,importDate,importTime, this); |
||||
|
} |
||||
|
} finally { |
||||
|
datas.clear(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取错误行 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public List<IcNatCompareRecordExcelData.ErrorRow> getErrorRows() { |
||||
|
return errorRows; |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,86 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.dto.DataSyncConfigDTO; |
||||
|
import com.epmet.dto.form.ConfigSwitchFormDTO; |
||||
|
import com.epmet.dto.form.NatInfoScanTaskFormDTO; |
||||
|
import com.epmet.dto.form.ScopeSaveFormDTO; |
||||
|
import com.epmet.entity.DataSyncConfigEntity; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
public interface DataSyncConfigService extends BaseService<DataSyncConfigEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return DataSyncConfigDTO |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
DataSyncConfigDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
void save(DataSyncConfigDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
void update(DataSyncConfigDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】配置开关 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 14:36 |
||||
|
*/ |
||||
|
void configSwitch(ConfigSwitchFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】列表 |
||||
|
* @param tokenDto |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:04 |
||||
|
*/ |
||||
|
PageData list(TokenDto tokenDto, PageFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】范围保存 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:41 |
||||
|
*/ |
||||
|
void scopeSave(ScopeSaveFormDTO formDTO); |
||||
|
|
||||
|
void natInfoScanTask(NatInfoScanTaskFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.DataSyncScopeDTO; |
||||
|
import com.epmet.entity.DataSyncScopeEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新范围表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
public interface DataSyncScopeService extends BaseService<DataSyncScopeEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<DataSyncScopeDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
PageData<DataSyncScopeDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<DataSyncScopeDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
List<DataSyncScopeDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return DataSyncScopeDTO |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
DataSyncScopeDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
void save(DataSyncScopeDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
void update(DataSyncScopeDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.IcNatCompareRecordDTO; |
||||
|
import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; |
||||
|
import com.epmet.entity.IcNatCompareRecordEntity; |
||||
|
|
||||
|
import java.nio.file.Path; |
||||
|
|
||||
|
/** |
||||
|
* 核算比对记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
public interface IcNatCompareRecordService extends BaseService<IcNatCompareRecordEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return PageData<IcNatCompareRecordDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-09-26 |
||||
|
*/ |
||||
|
PageData<IcNatCompareRecordDTO> page(IcNatCompareRecordPageFormDTO formDTO); |
||||
|
|
||||
|
void execAsyncExcelImport(Path fileSavePath, String taskId, String customerId, String userId); |
||||
|
} |
@ -0,0 +1,265 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import com.epmet.commons.tools.dto.result.YtHsjcResDTO; |
||||
|
import com.epmet.commons.tools.exception.EpmetException; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
||||
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
||||
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.DateUtils; |
||||
|
import com.epmet.commons.tools.utils.YtHsResUtils; |
||||
|
import com.epmet.dao.DataSyncConfigDao; |
||||
|
import com.epmet.dao.IcNatDao; |
||||
|
import com.epmet.dto.DataSyncConfigDTO; |
||||
|
import com.epmet.dto.form.ConfigSwitchFormDTO; |
||||
|
import com.epmet.dto.form.NatInfoScanTaskFormDTO; |
||||
|
import com.epmet.dto.form.ScopeSaveFormDTO; |
||||
|
import com.epmet.dto.result.NatUserInfoResultDTO; |
||||
|
import com.epmet.entity.DataSyncConfigEntity; |
||||
|
import com.epmet.entity.DataSyncScopeEntity; |
||||
|
import com.epmet.entity.IcNatEntity; |
||||
|
import com.epmet.entity.IcNatRelationEntity; |
||||
|
import com.epmet.service.DataSyncConfigService; |
||||
|
import com.epmet.service.DataSyncScopeService; |
||||
|
import com.epmet.service.IcNatRelationService; |
||||
|
import com.epmet.service.IcNatService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
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.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao, DataSyncConfigEntity> implements DataSyncConfigService { |
||||
|
|
||||
|
@Autowired |
||||
|
private DataSyncScopeService dataSyncScopeService; |
||||
|
@Autowired |
||||
|
private IcNatDao icNatDao; |
||||
|
@Autowired |
||||
|
private IcNatService icNatService; |
||||
|
@Autowired |
||||
|
private IcNatRelationService icNatRelationService; |
||||
|
|
||||
|
private QueryWrapper<DataSyncConfigEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<DataSyncConfigEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DataSyncConfigDTO get(String id) { |
||||
|
DataSyncConfigEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, DataSyncConfigDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(DataSyncConfigDTO dto) { |
||||
|
DataSyncConfigEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncConfigEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(DataSyncConfigDTO dto) { |
||||
|
DataSyncConfigEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncConfigEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】配置开关 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 14:36 |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void configSwitch(ConfigSwitchFormDTO formDTO) { |
||||
|
baseDao.configSwitch(formDTO); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】列表 |
||||
|
* @param tokenDto |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:04 |
||||
|
*/ |
||||
|
@Override |
||||
|
public PageData list(TokenDto tokenDto, PageFormDTO formDTO) { |
||||
|
PageData<DataSyncConfigDTO> result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L); |
||||
|
PageInfo<DataSyncConfigDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId())); |
||||
|
if (CollectionUtils.isNotEmpty(pageInfo.getList())){ |
||||
|
result.setList(pageInfo.getList()); |
||||
|
result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 【数据配置】范围保存 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 15:41 |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void scopeSave(ScopeSaveFormDTO formDTO) { |
||||
|
baseDao.delScope(formDTO.getDataSyncConfigId()); |
||||
|
if (CollectionUtils.isNotEmpty(formDTO.getScopeList())){ |
||||
|
formDTO.getScopeList().forEach(o -> { |
||||
|
o.setCustomerId(formDTO.getCustomerId()); |
||||
|
o.setDataSyncConfigId(formDTO.getDataSyncConfigId()); |
||||
|
if (o.getOrgType().equals("grid")){ |
||||
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(o.getOrgId()); |
||||
|
if (null == gridInfo){ |
||||
|
throw new EpmetException("查询网格信息失败"+o.getOrgId()); |
||||
|
} |
||||
|
o.setPid(gridInfo.getPid()); |
||||
|
o.setOrgIdPath(gridInfo.getPids() + ":" + gridInfo.getId()); |
||||
|
}else { |
||||
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(o.getOrgId()); |
||||
|
if (null == agencyInfo){ |
||||
|
throw new EpmetException("查询组织信息失败"+o.getOrgId()); |
||||
|
} |
||||
|
o.setPid(agencyInfo.getPid()); |
||||
|
o.setOrgIdPath(agencyInfo.getPids().equals(NumConstant.EMPTY_STR) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId()); |
||||
|
} |
||||
|
}); |
||||
|
dataSyncScopeService.insertBatch(ConvertUtils.sourceToTarget(formDTO.getScopeList(), DataSyncScopeEntity.class)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: |
||||
|
* 大数据局部门配置on |
||||
|
* 根据范围搜索居民,调接口查询最近一次核酸检测记录 |
||||
|
* 检测时间 + 身份证 不存在就插入 |
||||
|
* @param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2022/9/26 17:16 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void natInfoScanTask(NatInfoScanTaskFormDTO formDTO) { |
||||
|
if (CollectionUtils.isNotEmpty(formDTO.getIdCards())){ |
||||
|
List<NatUserInfoResultDTO> userIdByIdCard = baseDao.getUserIdByIdCard(formDTO.getIdCards()); |
||||
|
List<NatUserInfoResultDTO> collect = formDTO.getIdCards().stream().map(id -> { |
||||
|
NatUserInfoResultDTO e = new NatUserInfoResultDTO(); |
||||
|
e.setIdCard(id); |
||||
|
e.setUserId(""); |
||||
|
return e; |
||||
|
}).collect(Collectors.toList()); |
||||
|
collect.forEach(c -> userIdByIdCard.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId()))); |
||||
|
hsjc(collect,formDTO.getCustomerId()); |
||||
|
return; |
||||
|
} |
||||
|
List<DataSyncConfigDTO> allConfigList = baseDao.list(StringUtils.isNotBlank(formDTO.getCustomerId()) ? formDTO.getCustomerId() : null); |
||||
|
if (CollectionUtils.isEmpty(allConfigList)){ |
||||
|
return; |
||||
|
} |
||||
|
List<DataSyncConfigDTO> configList = allConfigList.stream().filter(l -> l.getDeptCode().equals("dsjj") && l.getSwitchStatus().equals("open")).collect(Collectors.toList()); |
||||
|
if (CollectionUtils.isNotEmpty(configList)){ |
||||
|
configList.forEach(c -> { |
||||
|
if (CollectionUtils.isNotEmpty(c.getScopeList())){ |
||||
|
Integer no = NumConstant.ONE; |
||||
|
Integer size; |
||||
|
do { |
||||
|
PageInfo<NatUserInfoResultDTO> pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.getIdCardsByScope(c.getScopeList())); |
||||
|
size = pageInfo.getList().size(); |
||||
|
hsjc(pageInfo.getList(),c.getCustomerId()); |
||||
|
no++; |
||||
|
}while (size.compareTo(NumConstant.ONE_THOUSAND) == NumConstant.ZERO); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Desc: 根据证件号 查询nat 存在 ? 不处理 : 新增 |
||||
|
* @param idCards |
||||
|
* @param customerId |
||||
|
* @author zxc |
||||
|
* @date 2022/9/27 11:08 |
||||
|
*/ |
||||
|
private void hsjc(List<NatUserInfoResultDTO> idCards,String customerId){ |
||||
|
if (CollectionUtils.isNotEmpty(idCards)){ |
||||
|
List<IcNatEntity> entities = new ArrayList<>(); |
||||
|
idCards.forEach(idCard -> { |
||||
|
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); |
||||
|
if (CollectionUtils.isNotEmpty(natInfoResult.getData())){ |
||||
|
natInfoResult.getData().forEach(natInfo -> { |
||||
|
IcNatEntity e = new IcNatEntity(); |
||||
|
e.setCustomerId(customerId); |
||||
|
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
||||
|
e.setUserId(idCard.getUserId()); |
||||
|
e.setUserType("sync"); |
||||
|
e.setName(natInfo.getName()); |
||||
|
e.setMobile(natInfo.getTelephone()); |
||||
|
e.setIdCard(natInfo.getCard_no()); |
||||
|
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(),DateUtils.DATE_TIME_PATTERN)); |
||||
|
e.setNatResult(natInfo.getSample_result_pcr()); |
||||
|
e.setNatAddress(natInfo.getSampling_org_pcr()); |
||||
|
e.setAgencyId(idCard.getAgencyId()); |
||||
|
e.setPids(idCard.getPids()); |
||||
|
entities.add(e); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
if (CollectionUtils.isNotEmpty(entities)){ |
||||
|
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities); |
||||
|
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true))); |
||||
|
Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); |
||||
|
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ |
||||
|
icNatService.insertBatch(groupByStatus.get(false)); |
||||
|
} |
||||
|
//组织关系表
|
||||
|
List<IcNatRelationEntity> relationEntities = new ArrayList<>(); |
||||
|
entities.forEach(ne -> { |
||||
|
// 不是居民的先不加关系表吧
|
||||
|
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)){ |
||||
|
IcNatRelationEntity e = new IcNatRelationEntity(); |
||||
|
e.setCustomerId(customerId); |
||||
|
e.setAgencyId(ne.getAgencyId()); |
||||
|
e.setPids(ne.getPids()); |
||||
|
e.setIcNatId(ne.getId()); |
||||
|
e.setUserType("sync"); |
||||
|
relationEntities.add(e); |
||||
|
} |
||||
|
}); |
||||
|
if (CollectionUtils.isNotEmpty(relationEntities)){ |
||||
|
icNatRelationService.insertBatch(relationEntities); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.dao.DataSyncScopeDao; |
||||
|
import com.epmet.dto.DataSyncScopeDTO; |
||||
|
import com.epmet.entity.DataSyncScopeEntity; |
||||
|
import com.epmet.service.DataSyncScopeService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 数据更新范围表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DataSyncScopeServiceImpl extends BaseServiceImpl<DataSyncScopeDao, DataSyncScopeEntity> implements DataSyncScopeService { |
||||
|
|
||||
|
@Override |
||||
|
public PageData<DataSyncScopeDTO> page(Map<String, Object> params) { |
||||
|
IPage<DataSyncScopeEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, DataSyncScopeDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<DataSyncScopeDTO> list(Map<String, Object> params) { |
||||
|
List<DataSyncScopeEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, DataSyncScopeDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<DataSyncScopeEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<DataSyncScopeEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DataSyncScopeDTO get(String id) { |
||||
|
DataSyncScopeEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, DataSyncScopeDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(DataSyncScopeDTO dto) { |
||||
|
DataSyncScopeEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncScopeEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(DataSyncScopeDTO dto) { |
||||
|
DataSyncScopeEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncScopeEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,305 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.constant.StrConstant; |
||||
|
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.ExceptionUtils; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
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.utils.*; |
||||
|
import com.epmet.constants.ImportTaskConstants; |
||||
|
import com.epmet.dao.IcNatCompareRecRelationDao; |
||||
|
import com.epmet.dao.IcNatCompareRecordDao; |
||||
|
import com.epmet.dto.IcNatCompareRecordDTO; |
||||
|
import com.epmet.dto.IcResiUserDTO; |
||||
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
||||
|
import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; |
||||
|
import com.epmet.dto.result.UploadImgResultDTO; |
||||
|
import com.epmet.entity.IcNatCompareRecRelationEntity; |
||||
|
import com.epmet.entity.IcNatCompareRecordEntity; |
||||
|
import com.epmet.excel.data.IcNatCompareRecordExcelData; |
||||
|
import com.epmet.excel.handler.IcNatCompareRecordExcelImportListener; |
||||
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
||||
|
import com.epmet.feign.OssFeignClient; |
||||
|
import com.epmet.service.IcNatCompareRecordService; |
||||
|
import com.epmet.service.IcResiUserService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.fileupload.FileItem; |
||||
|
import org.apache.commons.fileupload.FileItemFactory; |
||||
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.apache.http.entity.ContentType; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.io.OutputStream; |
||||
|
import java.nio.file.Files; |
||||
|
import java.nio.file.Path; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* 核算比对记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-09-26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class IcNatCompareRecordServiceImpl extends BaseServiceImpl<IcNatCompareRecordDao, IcNatCompareRecordEntity> implements IcNatCompareRecordService { |
||||
|
@Autowired |
||||
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
||||
|
@Autowired |
||||
|
private OssFeignClient ossFeignClient; |
||||
|
@Autowired |
||||
|
private IcNatCompareRecRelationDao icNatCompareRecRelationDao; |
||||
|
|
||||
|
private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { |
||||
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
||||
|
if (null == staffInfo) { |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); |
||||
|
} |
||||
|
return staffInfo; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 列表分页查询 |
||||
|
* @param formDTO |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public PageData<IcNatCompareRecordDTO> page(IcNatCompareRecordPageFormDTO formDTO) { |
||||
|
//1.获取工作人员缓存信息
|
||||
|
CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId()); |
||||
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
||||
|
//2.按条件查询业务数据
|
||||
|
PageInfo<IcNatCompareRecordDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) |
||||
|
.doSelectPageInfo(() -> baseDao.pageList(formDTO)); |
||||
|
List<IcNatCompareRecordDTO> list = data.getList(); |
||||
|
return new PageData(list, data.getTotal()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 未做核酸比对导入文件 |
||||
|
* @param filePath |
||||
|
* @param importTaskId |
||||
|
* @param customerId |
||||
|
* @param userId |
||||
|
*/ |
||||
|
@Override |
||||
|
public void execAsyncExcelImport(Path filePath, String importTaskId, String customerId, String userId) { |
||||
|
try { |
||||
|
//获取当前登录用户所属组织id
|
||||
|
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); |
||||
|
Date importTime=new Date(); |
||||
|
String importDate= DateUtils.format(importTime,DateUtils.DATE_PATTERN_YYYYMMDD); |
||||
|
IcNatCompareRecordExcelImportListener listener = new IcNatCompareRecordExcelImportListener(customerId, staffInfo, importDate, importTime, this); |
||||
|
|
||||
|
EasyExcel.read(filePath.toFile(), IcNatCompareRecordExcelData.class, listener).headRowNumber(1).sheet(0).doRead(); |
||||
|
|
||||
|
Path errorDescFile = null; |
||||
|
String errorDesFileUrl = null; |
||||
|
List<IcNatCompareRecordExcelData.ErrorRow> errorRows = listener.getErrorRows(); |
||||
|
|
||||
|
boolean failed = errorRows.size() > 0; |
||||
|
if (failed) { |
||||
|
// 生成并上传错误文件
|
||||
|
try { |
||||
|
// 文件生成
|
||||
|
Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat_compare_record", "import", "error_des"); |
||||
|
String fileName = UUID.randomUUID().toString().concat(".xlsx"); |
||||
|
errorDescFile = errorDescDir.resolve(fileName); |
||||
|
|
||||
|
FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); |
||||
|
FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); |
||||
|
OutputStream os = fileItem.getOutputStream(); |
||||
|
|
||||
|
EasyExcel.write(os, IcNatCompareRecordExcelData.ErrorRow.class).sheet("导入失败列表").doWrite(errorRows); |
||||
|
|
||||
|
// 文件上传oss
|
||||
|
Result<UploadImgResultDTO> errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); |
||||
|
if (errorDesFileUploadResult.success()) { |
||||
|
errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); |
||||
|
} |
||||
|
} finally { |
||||
|
if (Files.exists(errorDescFile)) { |
||||
|
Files.delete(errorDescFile); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); |
||||
|
importFinishTaskForm.setTaskId(importTaskId); |
||||
|
importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
||||
|
importFinishTaskForm.setOperatorId(userId); |
||||
|
importFinishTaskForm.setResultDesc(""); |
||||
|
importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); |
||||
|
|
||||
|
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); |
||||
|
if (!result.success()) { |
||||
|
log.error("【未做核酸比对】finishImportTask失败"); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
String errorMsg = ExceptionUtils.getErrorStackTrace(e); |
||||
|
log.error("【未做核酸比对】出错:{}", errorMsg); |
||||
|
|
||||
|
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); |
||||
|
importFinishTaskForm.setTaskId(importTaskId); |
||||
|
importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
||||
|
importFinishTaskForm.setOperatorId(userId); |
||||
|
importFinishTaskForm.setResultDesc("导入失败"); |
||||
|
|
||||
|
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); |
||||
|
if (!result.success()) { |
||||
|
log.error("【未做核酸比对】导入记录状态修改为'完成'失败"); |
||||
|
} |
||||
|
} finally { |
||||
|
// 删除临时文件
|
||||
|
if (Files.exists(filePath)) { |
||||
|
try { |
||||
|
Files.delete(filePath); |
||||
|
} catch (IOException e) { |
||||
|
log.error("method exception", e); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param datas |
||||
|
* @param staffInfo 当前操作人 |
||||
|
* @param importDate yyyyMMdd |
||||
|
* @param importTime 导入时间yyyy-MM-dd HH:mm:ss |
||||
|
* @param listener |
||||
|
*/ |
||||
|
public void batchPersist(List<IcNatCompareRecordEntity> datas,CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordExcelImportListener listener) { |
||||
|
datas.forEach(entity -> { |
||||
|
try { |
||||
|
persisNat(entity, staffInfo,importDate,importTime); |
||||
|
} catch (Exception exception) { |
||||
|
String errorMsg = ExceptionUtils.getErrorStackTrace(exception); |
||||
|
log.error(errorMsg); |
||||
|
|
||||
|
IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow(); |
||||
|
errorRow.setName(entity.getName()); |
||||
|
errorRow.setMobile(entity.getMobile()); |
||||
|
errorRow.setIdCard(entity.getIdCard()); |
||||
|
errorRow.setErrorInfo("batchPersist未知系统错误"); |
||||
|
listener.getErrorRows().add(errorRow); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param data |
||||
|
* @param staffInfo 当前操作人 |
||||
|
* @param importDate yyyyMMdd |
||||
|
* @param importTime 导入时间yyyy-MM-dd HH:mm:ss |
||||
|
*/ |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void persisNat(IcNatCompareRecordEntity data, CustomerStaffInfoCacheResult staffInfo, String importDate, Date importTime) { |
||||
|
// 查询是否本辖区居民
|
||||
|
IcResiUserDTO icResiUserDTO = SpringContextUtils.getBean(IcResiUserService.class).getByIdCard(data.getCustomerId(), data.getIdCard(), null); |
||||
|
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); |
||||
|
//根据身份证号判断是否存在基础信息
|
||||
|
IcNatCompareRecordEntity existEntity=baseDao.selectByIdCard(data.getCustomerId(),data.getIdCard()); |
||||
|
if (null == existEntity) { |
||||
|
// 1、不存在该身份证的基础记录,直接插入ic_nat_compare_record 、ic_nat_compare_rec_relation 插入记录
|
||||
|
IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); |
||||
|
compareRecordEntity.setIcResiUserId(null == icResiUserDTO ? StrConstant.EPMETY_STR : icResiUserDTO.getId()); |
||||
|
// 是否客户下居民(0:否 1:是)
|
||||
|
compareRecordEntity.setIsResiUser(StringUtils.isNotBlank(compareRecordEntity.getIcResiUserId()) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); |
||||
|
compareRecordEntity.setLatestImportTime(importTime); |
||||
|
//插入基础信息
|
||||
|
insert(compareRecordEntity); |
||||
|
|
||||
|
IcNatCompareRecRelationEntity relationEntity = new IcNatCompareRecRelationEntity(); |
||||
|
relationEntity.setCustomerId(data.getCustomerId()); |
||||
|
relationEntity.setCompareRecId(compareRecordEntity.getId()); |
||||
|
relationEntity.setImportDate(importDate); |
||||
|
relationEntity.setImportTime(importTime); |
||||
|
relationEntity.setAgencyId(staffInfo.getAgencyId()); |
||||
|
relationEntity.setAgencyName(staffInfo.getAgencyName()); |
||||
|
relationEntity.setStaffId(staffInfo.getStaffId()); |
||||
|
relationEntity.setStaffName(staffInfo.getRealName()); |
||||
|
if (null != agencyInfoCache) { |
||||
|
relationEntity.setPid(agencyInfoCache.getPid()); |
||||
|
relationEntity.setPids(agencyInfoCache.getPids()); |
||||
|
} |
||||
|
// 是否本社区(agency_id)下居民(0:否 1:是)
|
||||
|
if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { |
||||
|
relationEntity.setIsAgencyUser(NumConstant.ONE_STR); |
||||
|
} else { |
||||
|
relationEntity.setIsAgencyUser(NumConstant.ZERO_STR); |
||||
|
} |
||||
|
//插入关系表
|
||||
|
icNatCompareRecRelationDao.insert(relationEntity); |
||||
|
} else { |
||||
|
IcNatCompareRecordEntity origin = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); |
||||
|
origin.setId(existEntity.getId()); |
||||
|
origin.setIcResiUserId(null == icResiUserDTO ? StrConstant.EPMETY_STR : icResiUserDTO.getId()); |
||||
|
// 是否客户下居民(0:否 1:是)
|
||||
|
origin.setIsResiUser(StringUtils.isNotBlank(origin.getIcResiUserId()) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); |
||||
|
origin.setLatestImportTime(importTime); |
||||
|
baseDao.updateById(origin); |
||||
|
IcNatCompareRecRelationEntity existRelationEntity=icNatCompareRecRelationDao.selectExist(data.getCustomerId(),origin.getId(),staffInfo.getAgencyId(),importDate); |
||||
|
if(null!=existRelationEntity){ |
||||
|
// 是否本社区(agency_id)下居民(0:否 1:是)
|
||||
|
if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { |
||||
|
existRelationEntity.setIsAgencyUser(NumConstant.ONE_STR); |
||||
|
} else { |
||||
|
existRelationEntity.setIsAgencyUser(NumConstant.ZERO_STR); |
||||
|
} |
||||
|
//记录最后一次导入时间、最近一次操作人id,最近一次操作人姓名
|
||||
|
existRelationEntity.setImportTime(importTime); |
||||
|
existRelationEntity.setStaffId(staffInfo.getStaffId()); |
||||
|
existRelationEntity.setStaffName(staffInfo.getRealName()); |
||||
|
existRelationEntity.setAgencyName(staffInfo.getAgencyName()); |
||||
|
icNatCompareRecRelationDao.updateById(existRelationEntity); |
||||
|
}else{ |
||||
|
IcNatCompareRecRelationEntity relationEntity = new IcNatCompareRecRelationEntity(); |
||||
|
relationEntity.setCustomerId(data.getCustomerId()); |
||||
|
relationEntity.setCompareRecId(origin.getId()); |
||||
|
relationEntity.setImportDate(importDate); |
||||
|
relationEntity.setImportTime(importTime); |
||||
|
relationEntity.setAgencyId(staffInfo.getAgencyId()); |
||||
|
relationEntity.setAgencyName(staffInfo.getAgencyName()); |
||||
|
relationEntity.setStaffId(staffInfo.getStaffId()); |
||||
|
relationEntity.setStaffName(staffInfo.getRealName()); |
||||
|
if (null != agencyInfoCache) { |
||||
|
relationEntity.setPid(agencyInfoCache.getPid()); |
||||
|
relationEntity.setPids(agencyInfoCache.getPids()); |
||||
|
} |
||||
|
// 是否本社区(agency_id)下居民(0:否 1:是)
|
||||
|
if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { |
||||
|
relationEntity.setIsAgencyUser(NumConstant.ONE_STR); |
||||
|
} else { |
||||
|
relationEntity.setIsAgencyUser(NumConstant.ZERO_STR); |
||||
|
} |
||||
|
//插入关系表
|
||||
|
icNatCompareRecRelationDao.insert(relationEntity); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue