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