diff --git a/src/com/engine/salary/biz/SISchemeBiz.java b/src/com/engine/salary/biz/SISchemeBiz.java index 5b6ab3796..3bda51c50 100644 --- a/src/com/engine/salary/biz/SISchemeBiz.java +++ b/src/com/engine/salary/biz/SISchemeBiz.java @@ -12,11 +12,8 @@ import com.engine.salary.entity.sischeme.param.InsuranceSchemeReqParam; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemePO; import com.engine.salary.entity.sischeme.vo.InsuranceSchemeFormVO; - import com.engine.salary.enums.sicategory.*; - import com.engine.salary.exception.SalaryRunTimeException; -import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; import com.engine.salary.mapper.siaccount.SIAccountUtilMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; @@ -455,8 +452,8 @@ public class SISchemeBiz { public int checkBeforeDeleteOtherscheme(Map params){ return getSIAccountUtilMapper().checkBeforeDeleteOtherscheme((Collection)params.get("ids")).get(0).getNum(); } - public int checkBeforeDeleteBill(Map params){ - return getSIAccountUtilMapper().checkBeforeDeleteBill((Collection)params.get("ids")).get(0).getNum(); + public int checkBeforeDeleteBill(Map params,Integer welfareTypeId){ + return getSIAccountUtilMapper().checkBeforeDeleteBill((Collection)params.get("ids"),welfareTypeId).get(0).getNum(); } public void deleteSocialscheme(Map params){ @@ -465,6 +462,7 @@ public class SISchemeBiz { InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class); InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class); + insuranceSchemeMapper.deleteByIds((Collection)params.get("ids")); insuranceSchemeDetailMapper.deleteByIds((Collection)params.get("ids")); sqlSession.commit(); diff --git a/src/com/engine/salary/cmd/sischeme/SISchemeDeleteCmd.java b/src/com/engine/salary/cmd/sischeme/SISchemeDeleteCmd.java index 8ff507559..f2fc0dec4 100644 --- a/src/com/engine/salary/cmd/sischeme/SISchemeDeleteCmd.java +++ b/src/com/engine/salary/cmd/sischeme/SISchemeDeleteCmd.java @@ -4,6 +4,7 @@ import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; import com.engine.salary.biz.SISchemeBiz; +import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import org.apache.commons.collections4.CollectionUtils; import weaver.hrm.User; @@ -41,22 +42,30 @@ public class SISchemeDeleteCmd extends AbstractCommonCommand } SISchemeBiz siSchemeBiz = new SISchemeBiz(); //fixme 校验带上类型 -// int num = siSchemeBiz.checkBeforeDeleteSocialscheme(params); -// if (num > 0){ -// throw new SalaryRunTimeException("该社保方案已被使用"); -// } -// int accumulationfundNum = siSchemeBiz.checkBeforeDeleteAccumulationfund(params); -// if (accumulationfundNum > 0){ -// throw new SalaryRunTimeException("该公积金方案已被使用"); -// } -// int otherschemeNum = siSchemeBiz.checkBeforeDeleteOtherscheme(params); -// if (otherschemeNum > 0){ -// throw new SalaryRunTimeException("该其他福利方案已被使用"); -// } -// int billNum = siSchemeBiz.checkBeforeDeleteBill(params); -// if (billNum > 0){ -// throw new SalaryRunTimeException("该其他福利方案已被核算"); -// } + int welfareTypeId = (Integer) params.get("welfareTypeId"); + if(WelfareTypeEnum.SOCIAL_SECURITY.getValue() == welfareTypeId){ + int num = siSchemeBiz.checkBeforeDeleteSocialscheme(params); + if (num > 0){ + throw new SalaryRunTimeException("该社保方案已被使用"); + } + } + if(WelfareTypeEnum.ACCUMULATION_FUND.getValue() == welfareTypeId){ + int accumulationfundNum = siSchemeBiz.checkBeforeDeleteAccumulationfund(params); + if (accumulationfundNum > 0){ + throw new SalaryRunTimeException("该公积金方案已被使用"); + } + } + if(WelfareTypeEnum.OTHER.getValue() == welfareTypeId){ + int otherschemeNum = siSchemeBiz.checkBeforeDeleteOtherscheme(params); + if (otherschemeNum > 0){ + throw new SalaryRunTimeException("该其他福利方案已被使用"); + } + } + + int billNum = siSchemeBiz.checkBeforeDeleteBill(params,welfareTypeId); + if (billNum > 0){ + throw new SalaryRunTimeException("该福利方案已被核算"); + } siSchemeBiz.deleteSocialscheme(params); return apidatas; diff --git a/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeReqParam.java b/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeReqParam.java index b4df38ac3..ff8e9398c 100644 --- a/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeReqParam.java +++ b/src/com/engine/salary/entity/sischeme/param/InsuranceSchemeReqParam.java @@ -2,7 +2,7 @@ package com.engine.salary.entity.sischeme.param; import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDTO; import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDetailDTO; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -35,5 +35,10 @@ public class InsuranceSchemeReqParam { */ private List insuranceSchemeDetailList; + /** + * 福利类型 + */ + private WelfareTypeEnum welfareTypeEnum; + private List ids; } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.java b/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.java index f906dda74..6431ed141 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.java +++ b/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.java @@ -33,5 +33,5 @@ public interface SIAccountUtilMapper { * @param id * @return */ - List checkBeforeDeleteBill(@Param("ids") Collection id); + List checkBeforeDeleteBill(@Param("ids") Collection id,@Param("welfareTypeId") Integer welfareTypeId); } diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.xml b/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.xml index 0fba343a3..4b559aff3 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/SIAccountUtilMapper.xml @@ -67,17 +67,24 @@ hrsa_bill_detail WHERE delete_type = 0 - AND (social_scheme_id IN - - #{id} - - OR fund_scheme_id IN - - #{id} - - OR other_scheme_id IN - - #{id} - ) + + AND social_scheme_id IN + + #{id} + + + + AND fund_scheme_id IN + + #{id} + + + + AND other_scheme_id IN + + #{id} + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index 06b8f0e21..3f8428572 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -736,7 +736,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { @Override public List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) { List taxAgentEmployeeList = Lists.newArrayList(); - + List taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId); taxAgentManageRangeEmployeeList.forEach(m -> { List employeeList = m.getEmployeeList(); diff --git a/src/com/engine/salary/web/SISchemeController.java b/src/com/engine/salary/web/SISchemeController.java index 49aea2b19..b0d9cef18 100644 --- a/src/com/engine/salary/web/SISchemeController.java +++ b/src/com/engine/salary/web/SISchemeController.java @@ -4,26 +4,21 @@ import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam; -import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO; import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam; import com.engine.salary.entity.sischeme.param.InsuranceSchemeReqParam; import com.engine.salary.entity.sischeme.param.SISchemaImportParam; import com.engine.salary.enums.sicategory.WelfareTypeEnum; -import com.engine.salary.mapper.siarchives.SocialSchemeMapper; import com.engine.salary.service.SIAccountService; import com.engine.salary.service.SISchemeService; import com.engine.salary.service.impl.SIAccountServiceImpl; import com.engine.salary.service.impl.SISchemeServiceImpl; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.wrapper.SISchemeWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.session.SqlSession; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import weaver.conn.mybatis.MyBatisFactory; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -36,7 +31,9 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -155,6 +152,7 @@ public class SISchemeController { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); map.put("ids",insuranceSchemeReqParam.getIds()); + map.put("welfareTypeId", insuranceSchemeReqParam.getWelfareTypeEnum().getValue()); return new ResponseResult< Map, Map>(user).run(getService(user)::delete,map); }