|
@@ -38,7 +38,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
@@ -304,11 +303,58 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
|
|
|
gljtSqSq.setId(id);
|
|
|
if (CollectionUtils.isNotEmpty(gljtSqSq.getJfxxList())) {
|
|
|
insertSqJfxx(gljtSqSq, gljtSqSq.getJfxxList(), id, lr.getId(), gljtSqSq.getXzqh());
|
|
|
- if (StringUtils.equals(gljtSqSq.getStatus(), GljtAdStatus.MONTH.getCode())) asyncIn(gljtSqSq);
|
|
|
+ if (StringUtils.equals(gljtSqSq.getStatus(), GljtAdStatus.MONTH.getCode())) {
|
|
|
+ asyncIn(gljtSqSq);
|
|
|
+ // 触发插入本月的计发信息,当开始发放时间位于本月
|
|
|
+ generateThisMonth(gljtSqSq, pz);
|
|
|
+ }
|
|
|
}
|
|
|
return gljtSqSqMapper.insert(gljtSqSq);
|
|
|
}
|
|
|
|
|
|
+ private void generateThisMonth(GljtSqSq gljtSqSq, GljtQxpz pz) {
|
|
|
+ if (StringUtils.isNotEmpty(gljtSqSq.getFfyf())) {
|
|
|
+ List<String> monthList = new ArrayList<>();
|
|
|
+ List<GljtJfxx> inList = new ArrayList<>();
|
|
|
+ if (StringUtils.equals(DateUtils.dateTime().substring(0, 6), gljtSqSq.getFfyf())) {
|
|
|
+ monthList.add(gljtSqSq.getFfyf());
|
|
|
+ } else if (Integer.parseInt(gljtSqSq.getFfyf()) < Integer.parseInt(DateUtils.dateTime().substring(0, 6))) {
|
|
|
+ monthList = DateUtils.getMonthsBetween(gljtSqSq.getFfyf(), DateUtils.dateTime().substring(0, 6));
|
|
|
+ }
|
|
|
+ for (String month: monthList) {
|
|
|
+ if (gljtJfxxMapper.selectCount(new LambdaQueryWrapper<GljtJfxx>()
|
|
|
+ .eq(GljtJfxx::getSqrZjhm, SecurityUtils.sm4encrypt_ECB(EncryptionUtils.key, gljtSqSq.getSqrZjhm()))
|
|
|
+ .eq(GljtJfxx::getFfyf, month)) == 0) {
|
|
|
+ GljtJfxx in = new GljtJfxx();
|
|
|
+ BeanUtil.copyProperties(gljtSqSq, in, new CopyOptions().ignoreNullValue());
|
|
|
+ in.setId(IdUtils.simpleUUID());
|
|
|
+ in.setLrId(gljtSqSq.getLrId());
|
|
|
+ in.setFfyf(month);
|
|
|
+ if (StringUtils.isEmpty(pz.getKz1())) {
|
|
|
+ in.setDfyf(DateUtils.dateTime().substring(0, 6));
|
|
|
+ } else {
|
|
|
+ String date = DateUtils.dateTimeNow().substring(6, 8);
|
|
|
+ if (Integer.parseInt(date) > Integer.parseInt(pz.getKz1())) {
|
|
|
+ // 下月
|
|
|
+ in.setDfyf(DateUtils.getNextMonth());
|
|
|
+ } else {
|
|
|
+ // 本月
|
|
|
+ in.setDfyf(DateUtils.dateTime().substring(0, 6));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ in.setJfms("按时发放");
|
|
|
+ GljtSqUtils.checkBtbz(in, gljtSqSq, gljtSqSq.getFfyf(), gljtSqUtils.getXmpz());
|
|
|
+ in.setJkzk("0");
|
|
|
+ in.setLrzt("1");
|
|
|
+ in.setFflx("0");
|
|
|
+ in.setStatus("0");
|
|
|
+ inList.add(in);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gljtJfxxMapper.batchInsert(inList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void insertSqJfxx(GljtSqSq sq, JSONArray jfxxList, String sqId, String lrId, String xzqh) {
|
|
|
List<GljtJfxxBf> list = com.alibaba.fastjson.JSONArray.parseArray(jfxxList.toJSONString(),
|
|
|
GljtJfxxBf.class);
|
|
@@ -367,7 +413,11 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
|
|
|
gljtSqUtils.getAskFlow(gljtSqUtils.getQxpz(), gljtSqSq);
|
|
|
if (CollectionUtils.isNotEmpty(gljtSqSq.getJfxxList())) {
|
|
|
insertSqJfxx(old, gljtSqSq.getJfxxList(), gljtSqSq.getId(), lr.getId(), old.getXzqh());
|
|
|
- if (StringUtils.equals(gljtSqSq.getStatus(), GljtAdStatus.MONTH.getCode())) asyncIn(gljtSqSq);
|
|
|
+ if (StringUtils.equals(gljtSqSq.getStatus(), GljtAdStatus.MONTH.getCode())) {
|
|
|
+ asyncIn(gljtSqSq);
|
|
|
+ // 触发插入本月的计发信息,当开始发放时间位于本月
|
|
|
+ generateThisMonth(old, gljtSqUtils.getQxpz());
|
|
|
+ }
|
|
|
}
|
|
|
return gljtSqSqMapper.updateById(gljtSqSq);
|
|
|
}
|
|
@@ -389,6 +439,8 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
|
|
|
lr.setFfyf(old.getFfyf());
|
|
|
try {
|
|
|
asyncIn(old);
|
|
|
+ // 触发插入本月的计发信息,当开始发放时间位于本月
|
|
|
+ generateThisMonth(old, gljtSqUtils.getQxpz());
|
|
|
BeanUtil.copyProperties(gljtSqSq, gljtSqLr, new CopyOptions().ignoreNullValue());
|
|
|
gljtSqLr.setStatus(GljtLrStatus.FF.getCode());
|
|
|
String lrHiId = gljtSqUtils.insertLrHiSq(gljtSqLr, "0");
|
|
@@ -408,7 +460,7 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
|
|
|
if (StringUtils.isNotEmpty(sq.getSqbfys()) && !StringUtils.equals(sq.getSqbfys(), "0")) {
|
|
|
List<GljtJfxxBf> bfxx = gljtJfxxBfMapper.selectList(new LambdaQueryWrapper<GljtJfxxBf>()
|
|
|
.eq(GljtJfxxBf::getSqId, sq.getId()));
|
|
|
- GljtXmpz pz = gljtSqUtils.getXmpz();
|
|
|
+ GljtQxpz pz = gljtSqUtils.getQxpz();
|
|
|
List<GljtJfxx> jfxx = new ArrayList<>();
|
|
|
bfxx.forEach(b -> {
|
|
|
GljtJfxx in = new GljtJfxx();
|
|
@@ -560,19 +612,34 @@ public class GljtSqSqServiceImpl implements IGljtSqSqService
|
|
|
// 大于80岁
|
|
|
res.put("input", "1");
|
|
|
GljtQxpz pz = gljtSqUtils.getQxpz();
|
|
|
+ String under = null;
|
|
|
+ List<String> maxList = new ArrayList<>();
|
|
|
if (StringUtils.isNotEmpty(pz.getKz3())) {
|
|
|
- if (StringUtils.isNotEmpty(gljtSqSq.getQrsj())) {
|
|
|
- if (Integer.parseInt(gljtSqSq.getQrsj().substring(0, 6)) > Integer.parseInt(pz.getKz3())) {
|
|
|
- res.put("under", gljtSqSq.getQrsj().substring(0, 6));
|
|
|
- } else {
|
|
|
- res.put("under", pz.getKz3());
|
|
|
- }
|
|
|
- } else {
|
|
|
- res.put("under", pz.getKz3());
|
|
|
- }
|
|
|
- } else {
|
|
|
- res.put("under", null);
|
|
|
+ maxList.add(pz.getKz3());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(pz.getBfys())) {
|
|
|
+ maxList.add(DateUtils.getMonthBefore(DateUtils.dateTime().substring(0, 6), Integer.parseInt(pz.getBfys())));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(gljtSqSq.getQrsj())) {
|
|
|
+ maxList.add(gljtSqSq.getQrsj().substring(0, 6));
|
|
|
}
|
|
|
+ int after80 = DateUtils.checkFor80(gljtSqSq.getCsrq()) + 1;
|
|
|
+ maxList.add(DateUtils.getMonthBefore(DateUtils.dateTime().substring(0, 6), after80));
|
|
|
+ int max = maxList.stream().map(Integer::parseInt).max(Comparator.comparingInt(Integer::intValue)).orElse(null);
|
|
|
+ res.put("under", String.valueOf(max));
|
|
|
+ // if (StringUtils.isNotEmpty(pz.getKz3())) {
|
|
|
+// if (StringUtils.isNotEmpty(gljtSqSq.getQrsj())) {
|
|
|
+// if (Integer.parseInt(gljtSqSq.getQrsj().substring(0, 6)) > Integer.parseInt(pz.getKz3())) {
|
|
|
+// res.put("under", gljtSqSq.getQrsj().substring(0, 6));
|
|
|
+// } else {
|
|
|
+// res.put("under", pz.getKz3());
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// res.put("under", pz.getKz3());
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// res.put("under", null);
|
|
|
+// }
|
|
|
}
|
|
|
return res;
|
|
|
}
|