Commit 19232c29 authored by hongguangwu's avatar hongguangwu

MVP1.7.5-薪资提交校验

parent 761d0a9f
......@@ -7,6 +7,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TInsuranceUnpurchasePersonSalar
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 含风险项目不购买申请明细表-薪资关联表
*
......@@ -24,9 +26,13 @@ public interface TInsuranceUnpurchasePersonSalaryMapper extends BaseMapper<TInsu
IPage<TInsuranceUnpurchasePersonSalary> getTInsuranceUnpurchasePersonSalaryPage(Page<TInsuranceUnpurchasePersonSalary> page
, @Param("tInsuranceUnpurchasePersonSalary") TInsuranceUnpurchasePersonSalary tInsuranceUnpurchasePersonSalary);
// 查找薪资对用的人员表
List<String> getParentIdBySalaryId(@Param("salaryId") String salaryId);
// 删除关联项
void deletePersonSalaryBySalaryId(@Param("salaryId") String salaryId);
// 更新次数-1
void updatePersonSalaryNumBySalaryId(@Param("salaryId") String salaryId);
// 刷新次数
void updatePersonSalaryNumByPersonIdList(@Param("idList") List<String> idList);
}
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TInsuranceUnpurchasePersonSalary;
import java.util.List;
/**
* 含风险项目不购买申请明细表-薪资关联
*
......@@ -20,6 +22,22 @@ public interface TInsuranceUnpurchasePersonSalaryService extends IService<TInsur
*/
IPage<TInsuranceUnpurchasePersonSalary> getTInsuranceUnpurchasePersonSalaryPage(Page<TInsuranceUnpurchasePersonSalary> page, TInsuranceUnpurchasePersonSalary tInsuranceUnpurchasePerson);
/**
* @param salaryId 工资id
* @Description: 删除并刷新次数
* @Author: hgw
* @Date: 2025/1/16 17:47
* @return: void
**/
void deletePersonSalaryBySalaryId(String salaryId);
/**
* @param parentIds 明细主表ids
* @Description: 刷新次数
* @Author: hgw
* @Date: 2025/1/16 17:47
* @return: void
**/
void updatePersonSalaryNumByParentIds(List<String> parentIds);
}
......@@ -9,6 +9,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchasePersonSala
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 含风险项目不购买申请明细表
*
......@@ -39,8 +41,19 @@ public class TInsuranceUnpurchasePersonSalaryServiceImpl extends ServiceImpl<TIn
**/
@Override
public void deletePersonSalaryBySalaryId(String salaryId) {
baseMapper.updatePersonSalaryNumBySalaryId(salaryId);
baseMapper.deletePersonSalaryBySalaryId(salaryId);
List<String> parentIds = baseMapper.getParentIdBySalaryId(salaryId);
// 后刷新次数
if (parentIds != null && !parentIds.isEmpty()) {
// 先删除
baseMapper.deletePersonSalaryBySalaryId(salaryId);
baseMapper.updatePersonSalaryNumByPersonIdList(parentIds);
}
}
@Override
public void updatePersonSalaryNumByParentIds(List<String> parentIds) {
// 刷新次数
baseMapper.updatePersonSalaryNumByPersonIdList(parentIds);
}
}
......@@ -1144,8 +1144,8 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
boolean isTrue;
List<SalaryRiskVo> returnList = new ArrayList<>();
List<TInsuranceUnpurchasePersonSalary> updatePerSonSalaryList = new ArrayList<>();
List<TInsuranceUnpurchasePerson> updatePerSonList = new ArrayList<>();
List<TInsuranceUnpurchasePersonSalary> savePerSonSalaryList = new ArrayList<>();
List<String> updatePerSonList = new ArrayList<>();
for (SalaryRiskVo a : noRisklist) {
isTrue = false;
buyPerson = buyMap.get(a.getEmpIdCard());
......@@ -1153,11 +1153,11 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
if (buyPerson.getReasonType() != null) {
if (CommonConstants.TWO_STRING.equals(buyPerson.getReasonType())) {
isTrue = true;
setUpdateRiskInfo(s, buyPerson, updatePerSonSalaryList, updatePerSonList);
setUpdateRiskInfo(s, buyPerson, savePerSonSalaryList, updatePerSonList);
} else if (CommonConstants.ONE_STRING.equals(buyPerson.getReasonType())) {
if (CommonConstants.ZERO_STRING.equals(buyPerson.getSocialStatus())) {
isTrue = true;
setUpdateRiskInfo(s, buyPerson, updatePerSonSalaryList, updatePerSonList);
setUpdateRiskInfo(s, buyPerson, savePerSonSalaryList, updatePerSonList);
} else {
a.setMsg("“不购买申请”原因为“社保已购买”,但社保不在保");
}
......@@ -1174,11 +1174,11 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
// 无错误信息返回
if (returnList.isEmpty()) {
if (!updatePerSonList.isEmpty()) {
tInsuranceUnpurchasePersonService.updateBatchById(updatePerSonList);
}
if (!updatePerSonSalaryList.isEmpty()) {
tInsuranceUnpurchasePersonSalaryService.saveBatch(updatePerSonSalaryList);
if (!savePerSonSalaryList.isEmpty()) {
tInsuranceUnpurchasePersonSalaryService.saveBatch(savePerSonSalaryList);
if (!updatePerSonList.isEmpty()) {
tInsuranceUnpurchasePersonSalaryService.updatePersonSalaryNumByParentIds(updatePerSonList);
}
}
return getTrueR(s, "校验【商险不购买】通过");
} else {
......@@ -1219,23 +1219,16 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
* @return: void
**/
private void setUpdateRiskInfo(TSalaryStandard s, TInsuranceUnpurchasePerson buyPerson
, List<TInsuranceUnpurchasePersonSalary> updatePerSonSalaryList
, List<TInsuranceUnpurchasePerson> updatePerSonList) {
TInsuranceUnpurchasePerson updatePerSon = new TInsuranceUnpurchasePerson();
updatePerSon.setId(buyPerson.getId());
if (Common.isEmpty(buyPerson.getSalaryNum())) {
updatePerSon.setSalaryNum(CommonConstants.ONE_INT);
} else {
updatePerSon.setSalaryNum(buyPerson.getSalaryNum() + CommonConstants.ONE_INT);
}
updatePerSonList.add(updatePerSon);
, List<TInsuranceUnpurchasePersonSalary> savePerSonSalaryList
, List<String> updatePerSonList) {
updatePerSonList.add(buyPerson.getId());
TInsuranceUnpurchasePersonSalary updatePerSonSalary = new TInsuranceUnpurchasePersonSalary();
updatePerSonSalary.setSalaryId(s.getId());
updatePerSonSalary.setApplyNo(s.getApplyNo());
updatePerSonSalary.setParentId(buyPerson.getId());
updatePerSonSalary.setSalaryMonth(s.getSalaryMonth());
updatePerSonSalaryList.add(updatePerSonSalary);
savePerSonSalaryList.add(updatePerSonSalary);
}
}
......@@ -58,6 +58,15 @@
<include refid="tInsuranceUnpurchasePerson_where"/>
</select>
<!-- 获取parentId -->
<select id="getParentIdBySalaryId" resultType="java.lang.String">
SELECT
a.id
FROM t_insurance_unpurchase_person a
join t_insurance_unpurchase_person_salary s on s.PARENT_ID=a.ID
where s.SALARY_ID = #{salaryId}
</select>
<!--删除关联项-->
<update id="deletePersonSalaryBySalaryId">
update t_insurance_unpurchase_person_salary a
......@@ -65,12 +74,21 @@
where a.SALARY_ID = #{salaryId}
</update>
<!--更新次数-1-->
<update id="updatePersonSalaryNumBySalaryId">
<!-- 更新次数 -->
<update id="updatePersonSalaryNumByPersonIdList">
update t_insurance_unpurchase_person a
left join t_insurance_unpurchase_person_salary b on a.id=b.PARENT_ID
set a.SALARY_NUM = (if(a.SALARY_NUM is null or a.SALARY_NUM = 0,1,a.SALARY_NUM) - 1)
where b.DELETE_FLAG = 0 and b.SALARY_ID = #{salaryId}
JOIN (
select sum(if(c.DELETE_FLAG = 0,1,0)) num,c.PARENT_ID from t_insurance_unpurchase_person_salary c where c.PARENT_ID in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
GROUP BY c.PARENT_ID
) d on d.PARENT_ID=a.id
set a.SALARY_NUM = d.num
where a.id in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</update>
</mapper>
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