Commit 142af468 authored by hongguangwu's avatar hongguangwu

MVP1.7.0 优化

parent a0f7a3ff
...@@ -404,8 +404,12 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -404,8 +404,12 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
TCheckIdCard c = new TCheckIdCard(); TCheckIdCard c = new TCheckIdCard();
c.setName(name); c.setName(name);
c.setIdCard(idCard); c.setIdCard(idCard);
List<TCheckIdCard> saveList = new ArrayList<>();
// 安全调用: // 安全调用:
this.doSafetyApi(c, canCheck, userId); this.doSafetyApi(c, canCheck, userId, saveList);
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
}
if (CommonConstants.ONE_INT == c.getIsTrue()) { if (CommonConstants.ONE_INT == c.getIsTrue()) {
return R.ok(); return R.ok();
} else { } else {
...@@ -492,6 +496,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -492,6 +496,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
// 有一个错误,就不传200给前端 // 有一个错误,就不传200给前端
boolean isTrue = true; boolean isTrue = true;
try { try {
List<TCheckIdCard> saveList = new ArrayList<>();
for (TCheckIdCard c : checkList) { for (TCheckIdCard c : checkList) {
if (Common.isNotNull(c.getIdCard()) && Common.isNotNull(c.getName())) { if (Common.isNotNull(c.getIdCard()) && Common.isNotNull(c.getName())) {
lastCard = idCardMap.get(c.getIdCard()); lastCard = idCardMap.get(c.getIdCard());
...@@ -528,7 +533,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -528,7 +533,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
nowApiNum++; nowApiNum++;
apiNum++; apiNum++;
// 安全调用: // 安全调用:
this.doSafetyApi(c, canCheck, userId); this.doSafetyApi(c, canCheck, userId, saveList);
returnMap.put(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName(), c); returnMap.put(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName(), c);
} else { } else {
...@@ -549,6 +554,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -549,6 +554,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
isTrue = false; isTrue = false;
} }
} }
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
}
} catch (Exception e) { } catch (Exception e) {
returnMap.clear(); returnMap.clear();
trueMap.clear(); trueMap.clear();
...@@ -622,7 +630,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -622,7 +630,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
* @Date: 2022/6/27 17:09 * @Date: 2022/6/27 17:09
* @return: void * @return: void
**/ **/
private void doSafetyApi(TCheckIdCard c, boolean canCheck, String userId) { private void doSafetyApi(TCheckIdCard c, boolean canCheck, String userId, List<TCheckIdCard> saveList) {
TCheckIdCard check = new TCheckIdCard(); TCheckIdCard check = new TCheckIdCard();
check.setIdCard(c.getIdCard()); check.setIdCard(c.getIdCard());
Map<String, TCheckIdCard> checkMap = this.getAllMap(check); Map<String, TCheckIdCard> checkMap = this.getAllMap(check);
...@@ -640,7 +648,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -640,7 +648,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
} }
} else { } else {
// 调用花钱的 // 调用花钱的
this.moneyCheck(c, canCheck, userId); this.moneyCheck(c, canCheck, userId, saveList);
} }
} else { } else {
check = checkMap.get(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName()); check = checkMap.get(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName());
...@@ -650,19 +658,19 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -650,19 +658,19 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
} else { } else {
// 调用花钱的 // 调用花钱的
this.moneyCheck(c, canCheck, userId); this.moneyCheck(c, canCheck, userId, saveList);
} }
} }
} }
// 调用花钱的 // 调用花钱的
private void moneyCheck(TCheckIdCard c, boolean canCheck, String userId) { private void moneyCheck(TCheckIdCard c, boolean canCheck, String userId, List<TCheckIdCard> saveList) {
// 调用花钱的 // 调用花钱的
ChecksUtil.checkIdCard(c, canCheck); ChecksUtil.checkIdCard(c, canCheck);
c.setCreateUser(userId); c.setCreateUser(userId);
c.setCreateTime(LocalDateTime.now()); c.setCreateTime(LocalDateTime.now());
c.setType(CommonConstants.ONE_INT); c.setType(CommonConstants.ONE_INT);
this.save(c); saveList.add(c);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment