15143018065 1 tydzień temu
rodzic
commit
b7d2654029

+ 22 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/DateUtils.java

@@ -400,6 +400,21 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return String.valueOf(nextYear) + (nextMon >= 10 ? nextMon : "0" + nextMon);
     }
 
+    public static String getLastMonth(String month) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
+        try {
+            Date date = sdf.parse(month);
+            Calendar lastMonth = Calendar.getInstance();
+            lastMonth.setTime(date);
+            lastMonth.add(Calendar.MONTH, -1);
+            lastMonth.set(Calendar.DAY_OF_MONTH, lastMonth.getActualMinimum(Calendar.DAY_OF_MONTH));
+            int nextYear = lastMonth.get(Calendar.YEAR); //年份
+            int nextMon = lastMonth.get(Calendar.MONTH) + 1; //月份
+            return String.valueOf(nextYear) + (nextMon >= 10 ? nextMon : "0" + nextMon);
+        } catch (Exception ignored) {}
+        return null;
+    }
+
     public static int checkFor80(String csrq) {
         int res = 0;
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
@@ -475,6 +490,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return res;
     }
 
+    public static String getMonthAfter(String startMonth, int after) {
+        YearMonth initialMonth = YearMonth.of(Integer.parseInt(startMonth.substring(0, 4)), Integer.parseInt(startMonth.substring(4, 6)));
+        YearMonth monthsLater = initialMonth.plusMonths(after);
+        return monthsLater.format(DateTimeFormatter.ofPattern("yyyyMM"));
+    }
+
     public static String getCsyfByPc(String month, String pc) {
         String res = null;
         int pc2 = 90 * 12 - 1;
@@ -518,6 +539,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
     }
 
     public static void main(String[] args) {
-        System.out.println(getCsyfByPc("202501", "0"));
+        System.out.println(getMonthAfter("202512", 1));
     }
 }

+ 33 - 35
ruoyi-modules/mz-gljt/src/main/java/com/ruoyi/gljt/service/impl/GljtJfxxServiceImpl.java

@@ -232,31 +232,29 @@ public class GljtJfxxServiceImpl implements IGljtJfxxService {
     public List<GljtJfxx> generateJfByLr(GljtXmpz pz, String month, GljtSqLr lr) {
         EncryptionUtils.decryptForPlaintext(lr);
         List<GljtJfxx> res = new ArrayList<>();
-        List<String> monthList = new ArrayList<>();
-        if (StringUtils.equals(lr.getFfyf(), month)) {
-            monthList.add(lr.getFfyf());
-        } else if (StringUtils.equals(lr.getSqbfys(), "0")) {
-            monthList.add(month);
-        } else {
-            monthList = DateUtils.getMonthsBetween(lr.getFfyf(), month);
-        }
-        for (String ffyf: monthList) {
-            if (gljtJfxxMapper.selectCount(new LambdaQueryWrapper<GljtJfxx>()
-                    .eq(GljtJfxx::getLrId, lr.getId()).eq(GljtJfxx::getFfyf, ffyf)) == 0) {
-                GljtJfxx in = new GljtJfxx();
-                BeanUtil.copyProperties(lr, in, new CopyOptions().ignoreNullValue());
-                in.setId(IdUtils.simpleUUID());
-                in.setFfyf(ffyf);
-                in.setLrId(lr.getId());
-                GljtSqUtils.checkBtbz(in, lr, ffyf, pz);
-                in.setJkzk(lr.getJkzkDjzt());
-                in.setLrzt(lr.getStatus());
-                in.setFflx(StringUtils.equals(ffyf, month) ? "0" : "1");
-                in.setStatus("0");
-                checkTfBf(in);
-                res.add(in);
+//        List<String> monthList = new ArrayList<>();
+//        if (StringUtils.equals(lr.getFfyf(), month)) {
+//            monthList.add(lr.getFfyf());
+//        } else if (StringUtils.equals(lr.getSqbfys(), "0")) {
+//            monthList.add(month);
+//        } else {
+//            monthList = DateUtils.getMonthsBetween(lr.getFfyf(), month);
+//        }
+        if (gljtJfxxMapper.selectCount(new LambdaQueryWrapper<GljtJfxx>()
+                .eq(GljtJfxx::getLrId, lr.getId()).eq(GljtJfxx::getFfyf, month)) == 0) {
+            GljtJfxx in = new GljtJfxx();
+            BeanUtil.copyProperties(lr, in, new CopyOptions().ignoreNullValue());
+            in.setId(IdUtils.simpleUUID());
+            in.setFfyf(month);
+            in.setLrId(lr.getId());
+            GljtSqUtils.checkBtbz(in, lr, month, pz);
+            in.setJkzk(lr.getJkzkDjzt());
+            in.setLrzt(lr.getStatus());
+            in.setFflx("0");
+            in.setStatus("0");
+            checkTf(in);
+            res.add(in);
 //                gljtJfxxMapper.insert(in);
-            }
         }
         return res;
     }
@@ -367,7 +365,7 @@ public class GljtJfxxServiceImpl implements IGljtJfxxService {
         }
     }
 
-    public void checkTfBf(GljtJfxx in) {
+    public void checkTf(GljtJfxx in) {
         if (StringUtils.equals(in.getLrzt(), GljtLrStatus.ZT.getCode())) {
             // 暂停
             GljtSqTf tf = gljtSqTfMapper.selectOne(new LambdaQueryWrapper<GljtSqTf>()
@@ -379,15 +377,15 @@ public class GljtJfxxServiceImpl implements IGljtJfxxService {
                 in.setTfsqId(tf.getId());
             }
         }
-        if (StringUtils.equals(in.getFflx(), "1")) {
-            // 补发
-            GljtSqSq sq = gljtSqSqMapper.selectOne(new LambdaQueryWrapper<GljtSqSq>()
-                    .eq(GljtSqSq::getLrId, in.getLrId()).ne(GljtSqSq::getSqbfys, "0"));
-            if (ObjectUtils.isNotEmpty(sq)) {
-                in.setBfqrsj(StringUtils.isNotEmpty(sq.getMzShsj()) ? sq.getMzShsj() : StringUtils.isNotEmpty(sq.getJdShsj()) ? sq.getJdShsj() : sq.getSqShsj());
-                in.setBfyy("0");
-                in.setBfsqId(sq.getId());
-            }
-        }
+//        if (StringUtils.equals(in.getFflx(), "1")) {
+//            // 补发
+//            GljtSqSq sq = gljtSqSqMapper.selectOne(new LambdaQueryWrapper<GljtSqSq>()
+//                    .eq(GljtSqSq::getLrId, in.getLrId()).ne(GljtSqSq::getSqbfys, "0"));
+//            if (ObjectUtils.isNotEmpty(sq)) {
+//                in.setBfqrsj(StringUtils.isNotEmpty(sq.getMzShsj()) ? sq.getMzShsj() : StringUtils.isNotEmpty(sq.getJdShsj()) ? sq.getJdShsj() : sq.getSqShsj());
+//                in.setBfyy("0");
+//                in.setBfsqId(sq.getId());
+//            }
+//        }
     }
 }

+ 1 - 1
ruoyi-modules/mz-gljt/src/main/java/com/ruoyi/gljt/service/impl/GljtPcffServiceImpl.java

@@ -187,7 +187,7 @@ public class GljtPcffServiceImpl implements IGljtPcffService {
             lqw.in(GljtJfxx::getFflx, fflxList);
         }
         lqw.set(GljtJfxx::getPcId, gljtPcff.getId());
-        gljtJfxxMapper.update(null, lqw);
+        gljtJfxxMapper.update(null, lqw);   
         List<GljtJfxx> jfxxList = gljtJfxxMapper.selectList(new LambdaQueryWrapper<GljtJfxx>()
                 .eq(GljtJfxx::getPcId, gljtPcff.getId()).select(GljtJfxx::getLrId, GljtJfxx::getFfje));
         List<String> lrIdList = jfxxList.stream().map(GljtJfxx::getLrId).distinct().collect(Collectors.toList());

+ 37 - 3
ruoyi-modules/mz-gljt/src/main/java/com/ruoyi/gljt/service/impl/GljtSqSqServiceImpl.java

@@ -81,6 +81,9 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
     @Autowired
     private RemoteSysConfigService remoteConfigService;
 
+    @Autowired
+    private GljtJfxxMapper gljtJfxxMapper;
+
     /**
      * 查询高龄津贴申请信息
      *
@@ -219,6 +222,7 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
         if (StringUtils.equals(gljtSqSq.getStatus(), GljtAdStatus.MONTH.getCode())) {
             lr.setStatus(GljtLrStatus.FF.getCode());
             try {
+                asyncIn(gljtSqSq);
                 gljtSqUtils.insertLrHi(lr, "0");
             } catch (Exception ignored) {}
         } else {
@@ -241,6 +245,7 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
     public int updateGljtSqSq(GljtSqSq gljtSqSq) {
         GljtSqSq old = gljtSqSqMapper.selectById(gljtSqSq.getId());
         if (ObjectUtils.isEmpty(old)) throw new ServiceException("该申请已被变更,请刷新后再次尝试");
+        EncryptionUtils.decryptForPlaintext(old);
         if (StringUtils.equals(old.getStatus(), GljtAdStatus.CG.getCode())) {
             if (StringUtils.isEmpty(gljtSqSq.getSqShjg())) {
                 // 草稿
@@ -281,6 +286,7 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
             lr.setStatus(GljtLrStatus.FF.getCode());
             lr.setFfyf(old.getFfyf());
             try {
+                asyncIn(old);
                 BeanUtil.copyProperties(gljtSqSq, gljtSqLr, new CopyOptions().ignoreNullValue());
                 gljtSqLr.setStatus(GljtLrStatus.FF.getCode());
                 gljtSqUtils.insertLrHi(gljtSqLr, "0");
@@ -295,6 +301,33 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
         return gljtSqSqMapper.updateById(gljtSqSq);
     }
 
+    private void asyncIn(GljtSqSq sq) {
+        if (StringUtils.isNotEmpty(sq.getSqbfys()) && !StringUtils.equals(sq.getSqbfys(), "0")) {
+            List<GljtJfxx> res = new ArrayList<>();
+            GljtXmpz pz = gljtSqUtils.getXmpz();
+            GljtSqLr lr = gljtSqLrMapper.selectById(sq.getLrId());
+            if (ObjectUtils.isEmpty(lr)) throw new ServiceException("该老人已被变更请刷新后重试");
+            EncryptionUtils.decryptForPlaintext(lr);
+            List<String> monthList = DateUtils.getMonthsBetween(sq.getFfyf(), DateUtils.getMonthAfter(sq.getFfyf(), Integer.parseInt(sq.getSqbfys()) - 1));
+            for (String ffyf: monthList) {
+                if (gljtJfxxMapper.selectCount(new LambdaQueryWrapper<GljtJfxx>()
+                        .eq(GljtJfxx::getLrId, lr.getId()).eq(GljtJfxx::getFfyf, ffyf)) == 0) {
+                    GljtJfxx in = new GljtJfxx();
+                    BeanUtil.copyProperties(lr, in, new CopyOptions().ignoreNullValue());
+                    in.setFfyf(ffyf);
+                    in.setLrId(lr.getId());
+                    GljtSqUtils.checkBtbz(in, lr, ffyf, pz);
+                    in.setJkzk(lr.getJkzkDjzt());
+                    in.setLrzt("1");
+                    in.setFflx("1"); // 0当发1补发2追缴3补追缴
+                    in.setStatus("0");
+                    res.add(in);
+                }
+            }
+            gljtJfxxMapper.batchInsert(res);
+        }
+    }
+
     @Override
     public int editFj(GljtSqSq gljtSqSq) {
         if (StringUtils.isAnyEmpty(gljtSqSq.getId(), gljtSqSq.getSqbfj())) throw new ServiceException("申请及附件不能为空");
@@ -360,9 +393,9 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
         Map<String, String> res = new LinkedHashMap<>();
         if (StringUtils.isNotEmpty(gljtSqSq.getFfyf()) && StringUtils.isNotEmpty(gljtSqSq.getCsrq())) {
             try {
-                Date ffDate = DateUtils.dateTime("yyyyMM", gljtSqSq.getFfyf());
+                 Date ffDate = DateUtils.dateTime("yyyyMM", gljtSqSq.getFfyf());
                 if (ObjectUtils.isNotEmpty(ffDate) && ffDate.before(new Date())) {
-                    int bfys = DateUtils.calculateMonthsBetween(ffDate, new Date());
+                     int bfys = DateUtils.calculateMonthsBetween(ffDate, new Date());
                     int after80 = DateUtils.checkFor80(gljtSqSq.getCsrq());
                     if (after80 < bfys) {
                         bfys = after80;
@@ -377,8 +410,9 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
                         int start90 = 90 * 12;
                         int start100 = 100 * 12;
                         int month = DateUtils.getMonthByBirth(gljtSqSq.getCsrq(), gljtSqSq.getFfyf() + "01");
+                        if (month < 960) month = 960;
                         for (int i = 0; i < bfys; i++) {
-                            int ffyfMonth = month - i;
+                            int ffyfMonth = month + i;
                             if (ffyfMonth >= start80 && ffyfMonth < start90) {
                                 if (StringUtils.equals(gljtSqSq.getIsdb(), "1")) {
                                     sum = sum.add(new BigDecimal(xm.getBtzjEd()));

+ 4 - 1
ruoyi-modules/mz-gljt/src/main/java/com/ruoyi/gljt/service/impl/GljtSqZjServiceImpl.java

@@ -281,8 +281,11 @@ public class GljtSqZjServiceImpl implements IGljtSqZjService
         if (StringUtils.isEmpty(gljtSqZj.getLrId())) {
             throw new ServiceException("请先选择老人");
         }
+        List<String> zjLx = new ArrayList<>();
+        zjLx.add("0");
+        zjLx.add("1");
         List<GljtJfxx> list = gljtJfxxMapper.selectList(new LambdaQueryWrapper<GljtJfxx>()
-                .eq(GljtJfxx::getLrId, gljtSqZj.getLrId()).eq(GljtJfxx::getStatus, "1"));
+                .eq(GljtJfxx::getLrId, gljtSqZj.getLrId()).eq(GljtJfxx::getStatus, "1").in(GljtJfxx::getFflx, zjLx));
         list.forEach(l -> {
             EncryptionUtils.decryptForPlaintext(l);
             l.setPcId(null);