Commit ecd1888c authored by hongguangwu's avatar hongguangwu

MVP1.5.1-收入证明等

parent 6da783cd
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
...@@ -14,6 +15,7 @@ import javax.validation.constraints.NotBlank; ...@@ -14,6 +15,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date;
/** /**
...@@ -53,7 +55,8 @@ public class TProveApply extends Model<TProveApply> { ...@@ -53,7 +55,8 @@ public class TProveApply extends Model<TProveApply> {
*/ */
@ExcelAttribute(name = "申请日期", isNotEmpty = true, errorInfo = "申请日期不能为空") @ExcelAttribute(name = "申请日期", isNotEmpty = true, errorInfo = "申请日期不能为空")
@Schema(description = "申请日期", name = "creatDate") @Schema(description = "申请日期", name = "creatDate")
private LocalDate creatDate; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date creatDate;
/** /**
* 开始月 * 开始月
*/ */
......
...@@ -51,9 +51,9 @@ public class TProveRecord extends Model<TProveRecord> { ...@@ -51,9 +51,9 @@ public class TProveRecord extends Model<TProveRecord> {
* @return * @return
**/ **/
@Schema(description = "员工姓名") @Schema(description = "员工姓名")
@ExcelAttribute(name = "姓名") @ExcelAttribute(name = "员工姓名")
@NotBlank(message = "员工姓名不能为空") @NotBlank(message = "员工姓名不能为空")
@ExcelProperty("姓名") @ExcelProperty("员工姓名")
private String employeeName; private String employeeName;
/** /**
* 员工身份证号 * 员工身份证号
...@@ -62,10 +62,10 @@ public class TProveRecord extends Model<TProveRecord> { ...@@ -62,10 +62,10 @@ public class TProveRecord extends Model<TProveRecord> {
* @Date 2019-11-07 10:27 * @Date 2019-11-07 10:27
* @return * @return
**/ **/
@Schema(description = "员工身份证号") @Schema(description = "身份证号")
@NotBlank(message = "员工身份证号不能为空") @NotBlank(message = "身份证号不能为空")
@ExcelAttribute(name = "身份证") @ExcelAttribute(name = "身份证")
@ExcelProperty("身份证") @ExcelProperty("身份证")
private String employeeIdCard; private String employeeIdCard;
/** /**
* 结算主体(部门)名称 * 结算主体(部门)名称
...@@ -74,23 +74,23 @@ public class TProveRecord extends Model<TProveRecord> { ...@@ -74,23 +74,23 @@ public class TProveRecord extends Model<TProveRecord> {
* @Date 2019-11-07 10:27 * @Date 2019-11-07 10:27
* @return * @return
**/ **/
@Schema(description = "结算主体(部门)名称") @Schema(description = "项目名称")
@NotBlank(message = "结算主体名称不能为空") @NotBlank(message = "项目名称不能为空")
@ExcelAttribute(name = "结算主体") @ExcelAttribute(name = "项目名称")
@ExcelProperty("结算主体") @ExcelProperty("项目名称")
private String employeeSettleDepartName; private String employeeSettleDepartName;
/** /**
* *
*/ */
private String creatUser; private String creatUser;
@Schema(description = "申请人名称") @Schema(description = "开具人")
@ExcelAttribute(name = "开具人") @ExcelAttribute(name = "开具人")
@ExcelProperty("开具人") @ExcelProperty("开具人")
private String creatUserName; private String creatUserName;
/** /**
* 创建日期 * 创建日期
*/ */
@Schema(description = "创建日期", name = "creatDate") @Schema(description = "开具日期", name = "creatDate")
@ExcelAttribute(name = "开具日期") @ExcelAttribute(name = "开具日期")
@ExcelProperty("开具日期") @ExcelProperty("开具日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
......
...@@ -17,8 +17,8 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; ...@@ -17,8 +17,8 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -58,7 +58,7 @@ public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProv ...@@ -58,7 +58,7 @@ public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProv
proveApply.setId(null); proveApply.setId(null);
//初始化数据填充 //初始化数据填充
proveApply.setAuditStatus(CommonConstants.ZERO_STRING);//待审核 proveApply.setAuditStatus(CommonConstants.ZERO_STRING);//待审核
proveApply.setCreatDate(LocalDate.now()); proveApply.setCreatDate(new Date());
proveApply.setCreatUser(user.getId()); proveApply.setCreatUser(user.getId());
proveApply.setCreatUserName(user.getNickname()); proveApply.setCreatUserName(user.getNickname());
//保存数据 //保存数据
......
...@@ -31,9 +31,11 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; ...@@ -31,9 +31,11 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils; import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -50,6 +52,8 @@ import static java.lang.Thread.sleep; ...@@ -50,6 +52,8 @@ import static java.lang.Thread.sleep;
@Service @Service
public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCheckBankNo> implements TCheckBankNoService { public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCheckBankNo> implements TCheckBankNoService {
private final RedisUtil redisUtil;
private final TCanCheckService canCheckService; private final TCanCheckService canCheckService;
@Override @Override
...@@ -101,6 +105,9 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -101,6 +105,9 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
@Override @Override
public CheckBatchVo checkBankNoBatch(List<TCheckBankNo> list) { public CheckBatchVo checkBankNoBatch(List<TCheckBankNo> list) {
Date dateS = new Date();
final String startS = String.valueOf(dateS.getTime());
CheckBatchVo vo = new CheckBatchVo(); CheckBatchVo vo = new CheckBatchVo();
List<String> noList = new ArrayList<>(); List<String> noList = new ArrayList<>();
for (TCheckBankNo no : list) { for (TCheckBankNo no : list) {
...@@ -119,7 +126,7 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -119,7 +126,7 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
} }
List<TCheckBankNo> noCurlist = new ArrayList<>(); List<TCheckBankNo> noCurlist = new ArrayList<>();
TCheckBankNo cur; TCheckBankNo cur;
Map<String, Boolean> bankMap = new HashMap<>(); final Map<String, Boolean> bankMap = new HashMap<>();
for (TCheckBankNo check : list) { for (TCheckBankNo check : list) {
cur = noMap.get(check.getBankNo()); cur = noMap.get(check.getBankNo());
if (cur != null) { if (cur != null) {
...@@ -136,64 +143,78 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -136,64 +143,78 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
noCurlist.add(check); noCurlist.add(check);
} }
} }
List<TCheckBankNo> saveList = new ArrayList<>(); final List<TCheckBankNo> saveList = new ArrayList<>();
if (!noCurlist.isEmpty()) { if (!noCurlist.isEmpty()) {
synchronized (this) { boolean canCheck = canCheckService.getCanCheck();
boolean canCheck = canCheckService.getCanCheck(); if (noCurlist.size()>=50) {
if (noCurlist.size()>=50) { int l = 4;
int l = 4; for (int k=0;k<l;k++) {
for (int k=0;k<l;k++) { if ((k+1)==l) {
if ((k+1)==l) { final List<TCheckBankNo> finalList = noCurlist.subList(k * (noCurlist.size() / l), noCurlist.size());
final List<TCheckBankNo> finalList = noCurlist.subList(k * (noCurlist.size() / l), noCurlist.size()); if (canCheck) {
if (canCheck) { doThread(bankMap, startS, finalList);
doThread(bankMap, saveList, finalList);
} else {
doNomal(bankMap, saveList, finalList);
}
} else { } else {
final List<TCheckBankNo> finalList = noCurlist.subList(k * (noCurlist.size() / l), (k + 1) * (noCurlist.size() / l)); doNomal(bankMap, saveList, finalList);
if (canCheck) {
doThread(bankMap, saveList, finalList);
} else {
doNomal(bankMap, saveList, finalList);
}
} }
}
} else {
if (canCheck) {
doThread(bankMap, saveList, noCurlist);
} else { } else {
doNomal(bankMap, saveList, noCurlist); final List<TCheckBankNo> finalList = noCurlist.subList(k * (noCurlist.size() / l), (k + 1) * (noCurlist.size() / l));
if (canCheck) {
doThread(bankMap, startS, finalList);
} else {
doNomal(bankMap, saveList, finalList);
}
} }
} }
while (Thread.activeCount() > 4) { } else {
Thread.yield(); if (canCheck) {
doThread(bankMap, startS, noCurlist);
} else {
doNomal(bankMap, saveList, noCurlist);
} }
//fo (TCheckBankNo no : noCurlist) }
// 原代码 if (canCheck) {
/*resR = ChecksUtil.checkBankNoTwo(no.getName(), no.getBankNo(), canCheck) Date date = new Date();
f (Common.isNotNull(resR) && resR.getCode() == CommonConstants.SUCCESS long start = date.getTime();
&& Common.isNotNull(resR.getData())) int maxTime = (noCurlist.size()*200);
newNo = resR.getData() long start2 = date.getTime();
bankMap.put(no.getBankNo(), CommonConstants.ZERO_ONE.equals(newNo.getResult())) while (Thread.activeCount() > 2 && (start2-start) < maxTime) {
saveList.add(newNo) Thread.yield();
else date = new Date();
bankMap.put(no.getBankNo(), false) start2 = date.getTime();
*/
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
} }
} }
//fo (TCheckBankNo no : noCurlist)
// 原代码
/*resR = ChecksUtil.checkBankNoTwo(no.getName(), no.getBankNo(), canCheck)
f (Common.isNotNull(resR) && resR.getCode() == CommonConstants.SUCCESS
&& Common.isNotNull(resR.getData()))
newNo = resR.getData()
bankMap.put(no.getBankNo(), CommonConstants.ZERO_ONE.equals(newNo.getResult()))
saveList.add(newNo)
else
bankMap.put(no.getBankNo(), false)
*/
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
}
}
Map<String, Boolean> bankMapS = (Map<String, Boolean>) redisUtil.get(startS);
if (bankMapS != null && !bankMapS.isEmpty()) {
bankMap.putAll(bankMapS);
} }
vo.setCheckMap(bankMap); vo.setCheckMap(bankMap);
return vo; return vo;
} }
private void doThread(Map<String, Boolean> bankMap, List<TCheckBankNo> saveList, List<TCheckBankNo> finalList) { private void doThread(Map<String, Boolean> bankMap, String startS,List<TCheckBankNo> finalList) {
new Thread(() -> { new Thread(() -> {
List<TCheckBankNo> saveList = new ArrayList<>();
for (int i = 0; i< finalList.size(); i++) { for (int i = 0; i< finalList.size(); i++) {
final TCheckBankNo no = finalList.get(i); final TCheckBankNo no = finalList.get(i);
setBankMap(bankMap, no, saveList); setBankMap(bankMap, startS, no, saveList);
}
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
} }
}).start(); }).start();
} }
...@@ -214,7 +235,7 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -214,7 +235,7 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
} }
} }
public void setBankMap(Map<String, Boolean> bankMap, TCheckBankNo no, List<TCheckBankNo> saveList) { public void setBankMap(Map<String, Boolean> bankMap, String startS, TCheckBankNo no, List<TCheckBankNo> saveList) {
// 1.调用银行卡信息校验api // 1.调用银行卡信息校验api
R<TCheckBankNo> resR = ChecksUtil.checkBankNoTwoMethod(no.getName(), no.getBankNo()); R<TCheckBankNo> resR = ChecksUtil.checkBankNoTwoMethod(no.getName(), no.getBankNo());
if (Common.isNotNull(resR) && resR.getCode() == CommonConstants.SUCCESS if (Common.isNotNull(resR) && resR.getCode() == CommonConstants.SUCCESS
...@@ -225,46 +246,52 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -225,46 +246,52 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
} else { } else {
bankMap.put(no.getBankNo(), false); bankMap.put(no.getBankNo(), false);
} }
Map<String, Boolean> bankMapS = (Map<String, Boolean>) redisUtil.get(startS);
if (bankMapS== null) {
bankMapS = new HashMap<>(bankMap);
}
redisUtil.set(startS, bankMapS, 600L);
} }
/*public static void setBankMapByi(Map<Integer, Boolean> bankMap,int i){
bankMap.put(i,true);
}
/*public static void mai(String[] args) { public static void main(String[] args) {
Map<Integer, Boolean> bankMap = new HashMap<>(); Map<Integer, Boolean> bankMap = new HashMap<>();
int j=100; int j=100;
List<Integer> aList = new ArrayList<>(); List<Integer> aList = new ArrayList<>();
for (int k=0;k<229;k++) { for (int k=0;k<50;k++) {
aList.add(k); aList.add(k);
} }
if (j>=100) { int l = 4;
int l = 4; for (int k=0;k<l;k++) {
for (int k=0;k<l;k++) { if ((k+1)==l) {
if ((k+1)==l) { final List<Integer> finalList = aList.subList(k * (aList.size() / l), aList.size());
final List<Integer> finalList = aList.subList(k * (aList.size() / l), aList.size()); new Thread(() -> {
new Thread(() -> { for (int i=0;i<finalList.size();i++) {
for (int i=0;i<finalList.size();i++) { final Integer finalI = finalList.get(i);
final Integer finalI = finalList.get(i); setBankMapByi(bankMap, finalI);
setBankMapByi(bankMap, finalI); }
} }).start();
}).start(); } else {
} else { final List<Integer> finalList = aList.subList(k * (aList.size() / l), (k + 1) * (aList.size() / l));
final List<Integer> finalList = aList.subList(k * (aList.size() / l), (k + 1) * (aList.size() / l)); new Thread(() -> {
new Thread(() -> { for (int i=0;i<finalList.size();i++) {
for (int i=0;i<finalList.size();i++) { final Integer finalI = finalList.get(i);
final Integer finalI = finalList.get(i); setBankMapByi(bankMap, finalI);
setBankMapByi(bankMap, finalI); }
} }).start();
}).start();
}
}
} else {
for (int i=0;i<aList.size();i++) {
setBankMapByi(bankMap, aList.get(i));
} }
} }
while (Thread.activeCount() > 4) {
while (Thread.activeCount() > 2) {
Thread.yield(); Thread.yield();
} }
for (int i : bankMap.keySet()) {
System.out.println(i);
}
}*/ }*/
} }
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