Commit 01b1aebc authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.22' into MVP1.7.22

parents 5fada366 d310f868
...@@ -103,4 +103,7 @@ public class ContractAlertSearchVo extends TEmpContractAlert { ...@@ -103,4 +103,7 @@ public class ContractAlertSearchVo extends TEmpContractAlert {
@TableField(exist = false) @TableField(exist = false)
@Schema(description = "前端客服") @Schema(description = "前端客服")
private String customerUserLoginname; private String customerUserLoginname;
@Schema(description = "列表类型 1 待办 2监控 3入职确认信息")
private String type;
} }
...@@ -68,6 +68,8 @@ public class TEmpContractAlertController { ...@@ -68,6 +68,8 @@ public class TEmpContractAlertController {
@Operation(description = "自动化合同续签待办查询") @Operation(description = "自动化合同续签待办查询")
@GetMapping("/autoPage") @GetMapping("/autoPage")
public R<IPage<ContractAlertAutoVo>> getTEmpContractAlertAutoPage(Page<TEmpContractAlert> page, ContractAlertSearchVo tEmpContractAlert) { public R<IPage<ContractAlertAutoVo>> getTEmpContractAlertAutoPage(Page<TEmpContractAlert> page, ContractAlertSearchVo tEmpContractAlert) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, tEmpContractAlert);
//默认开启自动化的 //默认开启自动化的
tEmpContractAlert.setAutoFlag(CommonConstants.ZERO_STRING); tEmpContractAlert.setAutoFlag(CommonConstants.ZERO_STRING);
return R.ok(tEmpContractAlertService.getTEmpContractAlertAutoPage(page,tEmpContractAlert)); return R.ok(tEmpContractAlertService.getTEmpContractAlertAutoPage(page,tEmpContractAlert));
...@@ -99,10 +101,18 @@ public class TEmpContractAlertController { ...@@ -99,10 +101,18 @@ public class TEmpContractAlertController {
**/ **/
@Operation(description = "自动化合同续签待办数量") @Operation(description = "自动化合同续签待办数量")
@GetMapping("/autoCount") @GetMapping("/autoCount")
public R<Integer> getTEmpContractAlertAutoCount() { public R<Integer> getTEmpContractAlertAutoCount(@RequestParam(required = false) String type, @RequestParam(required = false) String menuInfo) {
ContractAlertSearchVo tEmpContractAlert = new ContractAlertSearchVo(); ContractAlertSearchVo tEmpContractAlert = new ContractAlertSearchVo();
//默认开启自动化的 //默认开启自动化的
tEmpContractAlert.setAutoFlag(CommonConstants.ZERO_STRING); tEmpContractAlert.setAutoFlag(CommonConstants.ZERO_STRING);
if (Common.isNotNull(type)) {
tEmpContractAlert.setType(type);
}
if (Common.isNotNull(menuInfo)) {
tEmpContractAlert.setMenuInfo(menuInfo);
}
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, tEmpContractAlert);
return R.ok(tEmpContractAlertService.getTEmpContractAlertAutoCount(tEmpContractAlert)); return R.ok(tEmpContractAlertService.getTEmpContractAlertAutoCount(tEmpContractAlert));
} }
...@@ -336,6 +346,8 @@ public class TEmpContractAlertController { ...@@ -336,6 +346,8 @@ public class TEmpContractAlertController {
@Operation(description = "导出自动化续签待办") @Operation(description = "导出自动化续签待办")
@PostMapping("/autoExport") @PostMapping("/autoExport")
public void autoExport(HttpServletResponse response, @RequestBody ContractAlertSearchVo searchVo) { public void autoExport(HttpServletResponse response, @RequestBody ContractAlertSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
searchVo.setAutoFlag(CommonConstants.ZERO_STRING); searchVo.setAutoFlag(CommonConstants.ZERO_STRING);
tEmpContractAlertService.listAutoExport(response,searchVo); tEmpContractAlertService.listAutoExport(response,searchVo);
} }
......
...@@ -1110,9 +1110,12 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -1110,9 +1110,12 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
searchVo.setAuthSql(null); searchVo.setAuthSql(null);
return; return;
} }
// 非待办监控,走原逻辑,待办监控,走权限配置
if (!(Common.isNotNull(searchVo.getType()) && CommonConstants.TWO_STRING.equals(searchVo.getType()))) {
//非管理员及SSC 走前端客服查询逻辑 //非管理员及SSC 走前端客服查询逻辑
searchVo.setCsLoginName(user.getUsername()); searchVo.setCsLoginName(user.getUsername());
} }
}
public boolean haveRole(YifuUser user, long roleId) { public boolean haveRole(YifuUser user, long roleId) {
List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP); List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP);
for (Long role : roleList) { for (Long role : roleList) {
......
...@@ -359,6 +359,9 @@ ...@@ -359,6 +359,9 @@
<if test="tEmpContractAlert.autoFlag != null and tEmpContractAlert.autoFlag.trim() != ''"> <if test="tEmpContractAlert.autoFlag != null and tEmpContractAlert.autoFlag.trim() != ''">
AND a.AUTO_FLAG = #{tEmpContractAlert.autoFlag} AND a.AUTO_FLAG = #{tEmpContractAlert.autoFlag}
</if> </if>
<if test="tEmpContractAlert.authSql != null and tEmpContractAlert.authSql.trim() != ''">
${tEmpContractAlert.authSql}
</if>
</if> </if>
</sql> </sql>
<!--tEmpContractAlert简单分页查询--> <!--tEmpContractAlert简单分页查询-->
......
...@@ -178,8 +178,8 @@ public class TCheckIdCardController { ...@@ -178,8 +178,8 @@ public class TCheckIdCardController {
@Operation(description = "校验薪资姓名身份证") @Operation(description = "校验薪资姓名身份证")
@SysLog("校验薪资姓名身份证") @SysLog("校验薪资姓名身份证")
@PostMapping("/checkSalaryIdCard") @PostMapping("/checkSalaryIdCard")
public R<List<TCheckIdCard>> checkSalaryIdCard(@RequestBody List<TCheckIdCard> checkList) { public R<List<TCheckIdCard>> checkSalaryIdCard(@RequestBody List<TCheckIdCard> checkList, @RequestParam(required = false) Integer judgeAgeType) {
return tCheckIdCardService.checkSalaryIdCard(checkList, null); return tCheckIdCardService.checkSalaryIdCard(checkList, null, judgeAgeType);
} }
/** /**
...@@ -210,7 +210,7 @@ public class TCheckIdCardController { ...@@ -210,7 +210,7 @@ public class TCheckIdCardController {
} }
/** /**
* @Description: 批量校验姓名身份证 * @Description: 批量校验姓名身份证(未来如果薪资要用这个方法,需要传参judgeAgeType=1
* @Author: hgw * @Author: hgw
* @Date: 2024-4-16 19:47:20 * @Date: 2024-4-16 19:47:20
* @return: com.yifu.cloud.v1.common.core.util.R * @return: com.yifu.cloud.v1.common.core.util.R
...@@ -221,7 +221,8 @@ public class TCheckIdCardController { ...@@ -221,7 +221,8 @@ public class TCheckIdCardController {
@PostMapping("/inner/checkIdCardList") @PostMapping("/inner/checkIdCardList")
public CheckIdCardListVo checkIdCardList(@RequestBody CheckIdCardListVo vo) { public CheckIdCardListVo checkIdCardList(@RequestBody CheckIdCardListVo vo) {
CheckIdCardListVo returnVo = new CheckIdCardListVo(); CheckIdCardListVo returnVo = new CheckIdCardListVo();
R<List<TCheckIdCard>> checkR = tCheckIdCardService.checkSalaryIdCard(vo.getCheckList(), null); // 注意:未来如果薪资要用这个方法,需要传参judgeAgeType=1
R<List<TCheckIdCard>> checkR = tCheckIdCardService.checkSalaryIdCard(vo.getCheckList(), null, null);
if (checkR != null) { if (checkR != null) {
if (checkR.getCode() == CommonConstants.SUCCESS) { if (checkR.getCode() == CommonConstants.SUCCESS) {
returnVo.setCode(CommonConstants.SUCCESS); returnVo.setCode(CommonConstants.SUCCESS);
......
...@@ -49,7 +49,7 @@ public interface TCheckIdCardService extends IService<TCheckIdCard> { ...@@ -49,7 +49,7 @@ public interface TCheckIdCardService extends IService<TCheckIdCard> {
TCheckIdCard checkIdCardSingle(TCheckIdCard tCheckIdCard); TCheckIdCard checkIdCardSingle(TCheckIdCard tCheckIdCard);
R<List<TCheckIdCard>> checkSalaryIdCard(List<TCheckIdCard> checkList, YifuUser user); R<List<TCheckIdCard>> checkSalaryIdCard(List<TCheckIdCard> checkList, YifuUser user, Integer judgeAgeType);
/** /**
* @param list * @param list
......
...@@ -431,7 +431,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -431,7 +431,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
} }
@Override @Override
public R<List<TCheckIdCard>> checkSalaryIdCard(List<TCheckIdCard> checkList, YifuUser user) { public R<List<TCheckIdCard>> checkSalaryIdCard(List<TCheckIdCard> checkList, YifuUser user, Integer judgeAgeType) {
TCanCheck tCanCheck= canCheckService.getById(1); TCanCheck tCanCheck= canCheckService.getById(1);
boolean canCheck = false; boolean canCheck = false;
if (tCanCheck != null && tCanCheck.getCanCheck() == 1) { if (tCanCheck != null && tCanCheck.getCanCheck() == 1) {
...@@ -491,9 +491,16 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -491,9 +491,16 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
int apiNum = 0; int apiNum = 0;
// 有一个错误,就不传200给前端 // 有一个错误,就不传200给前端
boolean isTrue = true; boolean isTrue = true;
int nowDay = Integer.parseInt(DateUtil.getThisDay());
try { try {
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())) {
// 仅工资导入需要判断16周岁,其他的不需要
if (Common.isNotNull(judgeAgeType) && CommonConstants.ONE_INT == judgeAgeType
&& isNot16Age(c.getIdCard(), nowDay)) {
c.setIsTrue(0);
c.setReason("人员未满16周岁,禁用童工");
} else {
lastCard = idCardMap.get(c.getIdCard()); lastCard = idCardMap.get(c.getIdCard());
if (lastCard != null) { if (lastCard != null) {
c.setIsTrue(lastCard.getIsTrue()); c.setIsTrue(lastCard.getIsTrue());
...@@ -541,6 +548,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -541,6 +548,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
} }
// 将同身份证的结果存储下来备用,防止撞库 // 将同身份证的结果存储下来备用,防止撞库
idCardMap.put(c.getIdCard(), c); idCardMap.put(c.getIdCard(), c);
}
} else { } else {
c.setIsTrue(0); c.setIsTrue(0);
c.setReason("姓名身份证不可为空"); c.setReason("姓名身份证不可为空");
...@@ -577,6 +585,31 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -577,6 +585,31 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
return R.failed("数据为空!"); return R.failed("数据为空!");
} }
// 判断是否未满16周岁(只有一种:身份证格式正确,且+16年大于等于当前日期
// 未满16周岁的,返回true,表示需要返回错误信息
public static boolean isNot16Age(String idCard, int nowDay) {
try {
if (Common.isNotNull(idCard) && (idCard.length() == 15 || idCard.length() == 18)) {
int birthDay;
if (idCard.length() == 18) {
// 18位身份证:第7-14位是出生年月日 (YYYYMMDD)
birthDay = Integer.parseInt(idCard.substring(6, 14));
} else {
// 15位身份证年份需要补全19xx年(15位身份证都是19开头的)
birthDay = Integer.parseInt("19" + idCard.substring(6, 12));
}
birthDay += 160000;
return birthDay >= nowDay;
} else {
// 其他情况不判断16周岁
return false;
}
} catch (Exception e) {
// 特殊或错误身份证,不判断16周岁-2026-04-20同倩倩确认
return false;
}
}
/** /**
* @Description: 预入职导入使用的批量姓名身份证校验 * @Description: 预入职导入使用的批量姓名身份证校验
* @Author: hgw * @Author: hgw
...@@ -599,7 +632,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -599,7 +632,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
null, null, null, null,
null,null); null,null);
// 调用以前的批量校验 // 调用以前的批量校验
R<List<TCheckIdCard>> returnR = this.checkSalaryIdCard(list, user); R<List<TCheckIdCard>> returnR = this.checkSalaryIdCard(list, user, null);
if (returnR != null) { if (returnR != null) {
if (returnR.getCode() == CommonConstants.SUCCESS) { if (returnR.getCode() == CommonConstants.SUCCESS) {
checkMap.put("全部正确", true); checkMap.put("全部正确", true);
......
...@@ -24,8 +24,8 @@ import com.yifu.cloud.plus.v1.csp.service.EmployeeRegistrationLeaveService; ...@@ -24,8 +24,8 @@ import com.yifu.cloud.plus.v1.csp.service.EmployeeRegistrationLeaveService;
import com.yifu.cloud.plus.v1.csp.vo.BatchSureLeaveVo; import com.yifu.cloud.plus.v1.csp.vo.BatchSureLeaveVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo; import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo; import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import com.yifu.cloud.plus.v1.csp.vo.ErrorInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
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.vo.BaseServiceParamListVO; import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
...@@ -161,6 +161,9 @@ public class EmployeeRegistrationLeaveController { ...@@ -161,6 +161,9 @@ public class EmployeeRegistrationLeaveController {
private void setLeaveBaseAuth(EmployeeRegistrationLeaveSearchVo searchVo) { private void setLeaveBaseAuth(EmployeeRegistrationLeaveSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo); menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.dept_id"));
}
} }
/** /**
......
...@@ -372,6 +372,10 @@ ...@@ -372,6 +372,10 @@
AND a.emp_project_id = #{employeeRegistrationLeave.empProjectId} AND a.emp_project_id = #{employeeRegistrationLeave.empProjectId}
</if> </if>
<if test="employeeRegistrationLeave.authSql != null and employeeRegistrationLeave.authSql.trim() != ''">
${employeeRegistrationLeave.authSql}
</if>
</if> </if>
</sql> </sql>
......
...@@ -233,6 +233,12 @@ public class TInsuranceAlert extends BaseEntity { ...@@ -233,6 +233,12 @@ public class TInsuranceAlert extends BaseEntity {
@Schema(description = "商险续签待办ID") @Schema(description = "商险续签待办ID")
private String insurancesPreRenewDetailId; private String insurancesPreRenewDetailId;
/**
* 项目id
*/
@Schema(description = "项目id")
private String deptId;
//@Schema(description = "本表的ID就是商险ID") //@Schema(description = "本表的ID就是商险ID")
@TableField(exist = false) @TableField(exist = false)
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
<result property="policyEffectNew" column="POLICY_EFFECT_NEW" jdbcType="DATE"/> <result property="policyEffectNew" column="POLICY_EFFECT_NEW" jdbcType="DATE"/>
<result property="customerUsername" column="CUSTOMER_USERNAME" jdbcType="VARCHAR"/> <result property="customerUsername" column="CUSTOMER_USERNAME" jdbcType="VARCHAR"/>
<result property="replaceTag" column="REPLACE_TAG" jdbcType="VARCHAR"/> <result property="replaceTag" column="REPLACE_TAG" jdbcType="VARCHAR"/>
<result property="deptId" column="DEPT_ID" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 商险续签待办专用 --> <!-- 商险续签待办专用 -->
...@@ -107,6 +108,7 @@ ...@@ -107,6 +108,7 @@
a.ALERT_ID, a.ALERT_ID,
a.HAVE_WORK_DAY, a.HAVE_WORK_DAY,
a.INSURANCES_PRE_RENEW_DETAIL_ID, a.INSURANCES_PRE_RENEW_DETAIL_ID,
a.DEPT_ID,
b.BUY_TYPE, b.BUY_TYPE,
b.process_status, b.process_status,
b.error_info, b.error_info,
...@@ -255,6 +257,9 @@ ...@@ -255,6 +257,9 @@
<if test="tInsuranceAlert.customerUsername != null and tInsuranceAlert.customerUsername.trim() != ''"> <if test="tInsuranceAlert.customerUsername != null and tInsuranceAlert.customerUsername.trim() != ''">
AND b.CUSTOMER_USERNAME like CONCAT('%',#{tInsuranceAlert.customerUsername},'%') AND b.CUSTOMER_USERNAME like CONCAT('%',#{tInsuranceAlert.customerUsername},'%')
</if> </if>
<if test="tInsuranceAlert.authSql != null and tInsuranceAlert.authSql.trim() != ''">
${tInsuranceAlert.authSql}
</if>
<if test="tInsuranceAlert.deptNoList != null and tInsuranceAlert.deptNoList.size > 0"> <if test="tInsuranceAlert.deptNoList != null and tInsuranceAlert.deptNoList.size > 0">
AND a.DEPT_NO in AND a.DEPT_NO in
<foreach item="idStr" index="index" collection="tInsuranceAlert.deptNoList" open="(" separator="," <foreach item="idStr" index="index" collection="tInsuranceAlert.deptNoList" open="(" separator=","
......
...@@ -1155,14 +1155,17 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -1155,14 +1155,17 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
return R.failed("请登录!"); return R.failed("请登录!");
} }
TCheckIdCard idCardCheck; TCheckIdCard idCardCheck;
int nowDay = Integer.parseInt(DateUtil.getThisDay());
for (TSalaryEmployee emp : excelVOList) { for (TSalaryEmployee emp : excelVOList) {
if (Common.isNotNull(emp.getEmpIdcard())) { if (Common.isNotNull(emp.getEmpIdcard())) {
if (!isNot16Age(emp.getEmpIdcard(), nowDay)) {
idCardCheck = new TCheckIdCard(); idCardCheck = new TCheckIdCard();
idCardCheck.setIdCard(emp.getEmpIdcard()); idCardCheck.setIdCard(emp.getEmpIdcard());
idCardCheck.setName(emp.getEmpName()); idCardCheck.setName(emp.getEmpName());
idCardCheck.setCreateUser(user.getId()); idCardCheck.setCreateUser(user.getId());
idCardCheck.setReason(user.getNickname()); idCardCheck.setReason(user.getNickname());
checkList.add(idCardCheck); checkList.add(idCardCheck);
}
idCardList.add(emp.getEmpIdcard()); idCardList.add(emp.getEmpIdcard());
} }
if (Common.isNotNull(emp.getEmpPhone())) { if (Common.isNotNull(emp.getEmpPhone())) {
...@@ -1391,6 +1394,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -1391,6 +1394,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
errorMessageList.add(new ErrorMessage((i ), "新增员工,除了支行,其他必填")); errorMessageList.add(new ErrorMessage((i ), "新增员工,除了支行,其他必填"));
continue; continue;
} else { } else {
if (isNot16Age(idCard, nowDay)) {
errorMessageList.add(new ErrorMessage((i ), "人员未满16周岁,禁用童工"));
continue;
}
if (excel.getTaxMonth().length() == 6) { if (excel.getTaxMonth().length() == 6) {
try { try {
Integer.parseInt(excel.getTaxMonth()); Integer.parseInt(excel.getTaxMonth());
...@@ -1489,6 +1496,31 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -1489,6 +1496,31 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
} }
} }
// 判断是否未满16周岁(只有一种:身份证格式正确,且+16年大于等于当前日期
// 未满16周岁的,返回true,表示需要返回错误信息
public static boolean isNot16Age(String idCard, int nowDay) {
try {
if (Common.isNotNull(idCard) && (idCard.length() == 15 || idCard.length() == 18)) {
int birthDay;
if (idCard.length() == 18) {
// 18位身份证:第7-14位是出生年月日 (YYYYMMDD)
birthDay = Integer.parseInt(idCard.substring(6, 14));
} else {
// 15位身份证年份需要补全19xx年(15位身份证都是19开头的)
birthDay = Integer.parseInt("19" + idCard.substring(6, 12));
}
birthDay += 160000;
return birthDay >= nowDay;
} else {
// 其他情况不判断16周岁
return false;
}
} catch (Exception e) {
// 特殊或错误身份证,不判断16周岁-2026-04-20同倩倩确认
return false;
}
}
/** /**
* 同步ekp薪酬人员信息 * 同步ekp薪酬人员信息
* *
......
...@@ -47,8 +47,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryZeroSearchVo; ...@@ -47,8 +47,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryZeroSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryZeroVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryZeroVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DeadlockLoserDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
...@@ -58,10 +60,7 @@ import java.io.InputStream; ...@@ -58,10 +60,7 @@ import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -90,9 +89,11 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala ...@@ -90,9 +89,11 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
@Resource @Resource
private CheckDaprUtil checkDaprUtil; private CheckDaprUtil checkDaprUtil;
private static final Random RANDOM = new Random();
// 批量更新状态(deleteFlag0,1,2:0:正常;1:已删除;2存在报账假删除) // 批量更新状态(deleteFlag0,1,2:0:正常;1:已删除;2存在报账假删除)
@Override @Override
public int updateDeleteFlagByIdList(String invoiceTitle, String settleMonth, String year, Integer deleteFlag, Integer oldDeleteFlag, String salaryId) { public synchronized int updateDeleteFlagByIdList(String invoiceTitle, String settleMonth, String year, Integer deleteFlag, Integer oldDeleteFlag, String salaryId) {
List<String> cardList; List<String> cardList;
if (deleteFlag == CommonConstants.ZERO_INT) { if (deleteFlag == CommonConstants.ZERO_INT) {
cardList = salaryAccountService.getCardListBySalaryIdAndNotExists(salaryId, invoiceTitle, settleMonth); cardList = salaryAccountService.getCardListBySalaryIdAndNotExists(salaryId, invoiceTitle, settleMonth);
...@@ -106,7 +107,35 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala ...@@ -106,7 +107,35 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
if (Common.isEmpty(tableName)) { if (Common.isEmpty(tableName)) {
return CommonConstants.ZERO_INT; return CommonConstants.ZERO_INT;
} }
return baseMapper.updateDeleteFlagByIdList(tableName, deleteFlag, oldDeleteFlag, cardList, invoiceTitle, settleMonth); // 1. 排序
Collections.sort(cardList);
// 2. 分批(每批50条)
int batchSize = 50;
int endIndex;
List<String> batchCards;
for (int i = 0; i < cardList.size(); i += batchSize) {
endIndex = Math.min(i + batchSize, cardList.size());
batchCards = cardList.subList(i, endIndex);
// 每批执行一次批量更新
try {
baseMapper.updateDeleteFlagByIdList(
tableName, deleteFlag, oldDeleteFlag,
batchCards, invoiceTitle, settleMonth);
} catch (Exception e) {
// 3. 带重试机制
// 随机退避,避免多个事务同时重试再次冲突
try {
Thread.sleep(RANDOM.nextInt(100) + 50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
baseMapper.updateDeleteFlagByIdList(
tableName, deleteFlag, oldDeleteFlag,
batchCards, invoiceTitle, settleMonth);
}
}
return CommonConstants.ONE_INT;
//return baseMapper.updateDeleteFlagByIdList(tableName, deleteFlag, oldDeleteFlag, cardList, invoiceTitle, settleMonth)
} }
/** /**
......
...@@ -200,7 +200,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -200,7 +200,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
@Override @Override
public long getDispatchInfoFundCount(TDispatchInfoPreSearchVo searchVo) { public long getDispatchInfoFundCount(TDispatchInfoPreSearchVo searchVo) {
if (Common.isEmpty(searchVo.getType())) {
searchVo.setType(CommonConstants.ONE_STRING); searchVo.setType(CommonConstants.ONE_STRING);
}
initSearchVo(searchVo); initSearchVo(searchVo);
return baseMapper.selectFundCount(searchVo); return baseMapper.selectFundCount(searchVo);
} }
......
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