|
@@ -6,21 +6,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ruoyi.common.core.exception.ServiceException;
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
+import com.ruoyi.common.core.utils.uuid.IdUtils;
|
|
|
import com.ruoyi.common.security.utils.DictUtils;
|
|
|
import com.ruoyi.common.security.utils.EncryptionUtils;
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.security.utils.SysDeptJlUtils;
|
|
|
import com.ruoyi.gljt.domain.*;
|
|
|
-import com.ruoyi.gljt.mapper.GljtJfxxMapper;
|
|
|
-import com.ruoyi.gljt.mapper.GljtJkzkMapper;
|
|
|
-import com.ruoyi.gljt.mapper.GljtSqLrExportMapper;
|
|
|
-import com.ruoyi.gljt.mapper.GljtSqLrMapper;
|
|
|
+import com.ruoyi.gljt.mapper.*;
|
|
|
import com.ruoyi.gljt.service.IGljtSqLrService;
|
|
|
import com.ruoyi.gljt.utils.ExcelTemplateUtils;
|
|
|
import com.ruoyi.gljt.utils.GljtSqUtils;
|
|
|
import com.ruoyi.system.api.domain.SysDictData;
|
|
|
import com.ruoyi.system.api.enums.GljtLrStatus;
|
|
|
+import com.ruoyi.system.domain.SysDeptJl;
|
|
|
import com.ruoyi.system.mapper.SysDeptJlMapper;
|
|
|
+import com.ruoyi.system.utils.IDCardUtil;
|
|
|
import com.ruoyi.system.utils.SubCodeUtil;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -57,6 +57,12 @@ public class GljtSqLrServiceImpl implements IGljtSqLrService
|
|
|
@Autowired
|
|
|
private GljtSqUtils gljtSqUtils;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private GljtQxpzMapper gljtQxpzMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GljtXmpzMapper gljtXmpzMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SysDeptJlMapper sysDeptJlMapper;
|
|
|
|
|
@@ -460,4 +466,115 @@ public class GljtSqLrServiceImpl implements IGljtSqLrService
|
|
|
return gljtSqLrMapper.deleteBatchIds(Arrays.asList(ids));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String importGljtLr(List<GljtSqLrImport> list, String xzqh) {
|
|
|
+ StringBuilder res = new StringBuilder();
|
|
|
+ res.append("导入成功<br />");
|
|
|
+ if (CollectionUtils.isEmpty(list)) throw new ServiceException("不能导入空数据");
|
|
|
+ GljtQxpz qxpz = gljtQxpzMapper.selectOne(new LambdaQueryWrapper<GljtQxpz>().likeRight(GljtQxpz::getXzqh, xzqh.substring(0, 6)));
|
|
|
+ GljtXmpz xmpz = gljtXmpzMapper.selectOne(new LambdaQueryWrapper<GljtXmpz>().likeRight(GljtXmpz::getXzqh, xzqh.substring(0, 6)));
|
|
|
+ if (ObjectUtils.isEmpty(qxpz) || ObjectUtils.isEmpty(xmpz)) throw new ServiceException("区县配置及项目配置不能为空");
|
|
|
+ List<SysDeptJl> deptList = sysDeptJlMapper.selectList(new LambdaQueryWrapper<SysDeptJl>()
|
|
|
+ .likeRight(SysDeptJl::getCode, xzqh.substring(0, 6)));
|
|
|
+ if (CollectionUtils.isEmpty(deptList)) throw new ServiceException("输入行政区划有误");
|
|
|
+ SysDeptJl top = deptList.stream().filter(d -> StringUtils.equals(d.getLevel(), "3")).findFirst().orElse(null);
|
|
|
+ try {
|
|
|
+ List<SysDictData> mzList = DictUtils.getDictCache("C0009");
|
|
|
+ List<SysDictData> snList = DictUtils.getDictCache("GL021");
|
|
|
+ List<SysDictData> pcList = DictUtils.getDictCache("GL013");
|
|
|
+ List<SysDictData> isList = DictUtils.getDictCache("CZ035");
|
|
|
+ List<SysDictData> gxList = DictUtils.getDictCache("XZ061");
|
|
|
+ List<SysDictData> yhList = DictUtils.getDictCache("C0044");
|
|
|
+ for (GljtSqLrImport lr: list) {
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ lr.setSqrZjhm(lr.getSqrZjhm().trim());
|
|
|
+ if (!IDCardUtil.idCardValidate(lr.getSqrZjhm())) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,证件号码[").append(lr.getSqrZjhm()).append("]未通过检测!<br />");
|
|
|
+ SysDeptJl jd = deptList.stream().filter(d -> StringUtils.equals(d.getName(), lr.getJd())).findFirst().orElse(new SysDeptJl());
|
|
|
+ if (StringUtils.isEmpty(jd.getCode())) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,街道[").append(lr.getJd()).append("]未通过检测!<br />");
|
|
|
+ SysDeptJl sq = deptList.stream().filter(d -> StringUtils.equals(d.getParentId(), jd.getId()) && StringUtils.equals(d.getName(), lr.getSq())).findFirst().orElse(new SysDeptJl());
|
|
|
+ if (StringUtils.isEmpty(sq.getCode())) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,社区[").append(lr.getSq()).append("]未通过检测!<br />");
|
|
|
+ String mz = mzList.stream().filter(m -> m.getDictLabel().contains(lr.getMz())).findFirst().orElse(new SysDictData()).getDictValue();
|
|
|
+ if (StringUtils.isEmpty(mz)) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,民族[").append(lr.getMz()).append("]未通过检测!<br />");
|
|
|
+ String sn = snList.stream().filter(s -> StringUtils.equals(s.getDictLabel(), lr.getSndj())).findFirst().orElse(new SysDictData()).getDictValue();
|
|
|
+ if (StringUtils.isEmpty(sn)) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,健康状况[").append(lr.getSndj()).append("]未通过检测!<br />");
|
|
|
+ String db = isList.stream().filter(s -> StringUtils.equals(s.getDictLabel(), lr.getIsdb())).findFirst().orElse(new SysDictData()).getDictValue();
|
|
|
+ if (StringUtils.isEmpty(db)) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,是否低保[").append(lr.getIsdb()).append("]未通过检测!<br />");
|
|
|
+ String gx = gxList.stream().filter(s -> StringUtils.equals(s.getDictLabel(), lr.getJhrGx())).findFirst().orElse(new SysDictData()).getDictValue();
|
|
|
+ String yh = yhList.stream().filter(s -> StringUtils.equals(s.getDictLabel(), lr.getKhyh())).findFirst().orElse(new SysDictData()).getDictValue();
|
|
|
+ if (!checkDate(lr.getSqrq())) stringBuilder.append("[").append(lr.getSqrXm()).append("]老人,申请日期[").append(lr.getSqrq()).append("]未通过检测!<br />");
|
|
|
+ if (StringUtils.isEmpty(yh)) yh = "9999";
|
|
|
+ if (StringUtils.isEmpty(stringBuilder)) {
|
|
|
+ GljtSqLr in = new GljtSqLr();
|
|
|
+ String csrq = lr.getSqrZjhm().substring(6, 14);
|
|
|
+ String genderCode = lr.getSqrZjhm().substring(16, 17);
|
|
|
+ String xb = Integer.parseInt(genderCode) % 2 == 0 ? "2" : "1";
|
|
|
+ String pc = GljtSqUtils.getBtbzByCsrq(csrq, db, xmpz);
|
|
|
+ BeanUtil.copyProperties(lr, in, new CopyOptions().ignoreNullValue());
|
|
|
+ in.setId(IdUtils.simpleUUID());
|
|
|
+ in.setCsrq(csrq);
|
|
|
+ in.setXb(xb);
|
|
|
+ in.setPc(pc);
|
|
|
+ in.setKhyh(yh);
|
|
|
+ in.setIsdb(db);
|
|
|
+ in.setMz(mz);
|
|
|
+ in.setSndj(sn);
|
|
|
+ in.setJhrGx(gx);
|
|
|
+ in.setXzqh(sq.getCode());
|
|
|
+ in.setFfyf(lr.getSqrq().substring(0, 6));
|
|
|
+ in.setJkzkDjzt("0");
|
|
|
+ in.setStatus("1");
|
|
|
+ in.setCreateTimeStr(lr.getSqrq());
|
|
|
+ in.setSqShjg("01");
|
|
|
+ in.setJdShjg("01");
|
|
|
+ in.setMzShjg("01");
|
|
|
+ in.setSqShyj("通过");
|
|
|
+ in.setJdShyj("通过");
|
|
|
+ in.setMzShyj("通过");
|
|
|
+ in.setSqShsj(lr.getSqrq());
|
|
|
+ in.setJdShsj(lr.getSqrq());
|
|
|
+ in.setMzShsj(lr.getSqrq());
|
|
|
+ in.setSqShrxm("系统");
|
|
|
+ in.setJdShrxm("系统");
|
|
|
+ in.setMzShrxm("系统");
|
|
|
+ in.setSqbfys("0");
|
|
|
+ in.setSqbfje("0");
|
|
|
+ in.setFzjg(top.getName() + "公安局");
|
|
|
+ in.setIsImport("1");
|
|
|
+ in.setIsgs("0");
|
|
|
+ gljtSqLrMapper.delete(new LambdaQueryWrapper<GljtSqLr>().eq(GljtSqLr::getSqrZjhm, SecurityUtils.sm4encrypt_ECB(EncryptionUtils.key, lr.getSqrZjhm())));
|
|
|
+ gljtSqLrMapper.insert(in);
|
|
|
+ } else {
|
|
|
+ res.append(stringBuilder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException(e.getMessage());
|
|
|
+ }
|
|
|
+ return res.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ private String cleanIdCard(String sfzh) {
|
|
|
+ if (StringUtils.isEmpty(sfzh)) {
|
|
|
+ return sfzh;
|
|
|
+ }
|
|
|
+ // 去除所有空格(包括中间、前后的空格)
|
|
|
+ return sfzh.replaceAll("\\s+", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean checkDate(String date) {
|
|
|
+ if (date.length() != 6 && date.length() != 8) return false;
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMM");
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ if (date.length() == 6) {
|
|
|
+ Date date1 = sdf1.parse(date);
|
|
|
+ }
|
|
|
+ if (date.length() == 8) {
|
|
|
+ Date date2 = sdf2.parse(date);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } catch (Exception e) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|