删除社保方案福利功能
This commit is contained in:
parent
9602ed1d87
commit
eb6f0b81ca
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.biz;
|
||||
|
||||
`import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.encrypt.sischeme.InsuranceSchemeDetailPOEncrypt;
|
||||
|
|
@ -15,6 +16,8 @@ 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;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||||
|
|
@ -37,9 +40,11 @@ import java.util.stream.Collectors;
|
|||
* @Date 2022/3/7
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class SISchemeBiz {
|
||||
|
||||
public class SISchemeBiz {
|
||||
|
||||
private SIAccountUtilMapper getSIAccountUtilMapper() {
|
||||
return SqlProxyHandle.getProxy(SIAccountUtilMapper.class);
|
||||
}
|
||||
/**
|
||||
* 获取社保方案
|
||||
* @param id
|
||||
|
|
@ -441,4 +446,24 @@ public class
|
|||
item.setLowerLimit(AESEncryptUtil.decrypt(item.getLowerLimit()));
|
||||
return item;
|
||||
}
|
||||
public int checkBeforeDeleteSocialscheme(Map<String, Object> params){
|
||||
return getSIAccountUtilMapper().checkBeforeDeleteSocialscheme((Collection<Long>)params.get("ids")).get(0).getNum();
|
||||
}
|
||||
|
||||
public void deleteSocialscheme(Map<String, Object> params){
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
|
||||
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
|
||||
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
|
||||
insuranceSchemeMapper.deleteByIds((Collection<Long>)params.get("ids"));
|
||||
insuranceSchemeDetailMapper.deleteByIds((Collection<Long>)params.get("ids"));
|
||||
sqlSession.commit();
|
||||
}finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ public class SISchemeDeleteCmd extends AbstractCommonCommand<Map<String, Object>
|
|||
throw new SalaryRunTimeException("参数错误");
|
||||
}
|
||||
SISchemeBiz siSchemeBiz = new SISchemeBiz();
|
||||
int num = siSchemeBiz.checkBeforeDeleteSocialscheme(params);
|
||||
if (num > 0){
|
||||
throw new SalaryRunTimeException("该社保福利方案已被使用");
|
||||
}
|
||||
siSchemeBiz.deleteSocialscheme(params);
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,4 +34,6 @@ public class InsuranceSchemeReqParam {
|
|||
* 福利方案明细
|
||||
*/
|
||||
private List<InsuranceSchemeDetailDTO> insuranceSchemeDetailList;
|
||||
|
||||
private List<Long> ids;
|
||||
}
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
package com.engine.salary.mapper.siaccount;
|
||||
|
||||
import com.engine.salary.entity.siaccount.dto.SIAccountUtilDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface SIAccountUtilMapper {
|
||||
|
||||
List<SIAccountUtilDTO> checkIfBusinessaccounting(Long id);
|
||||
|
||||
List<SIAccountUtilDTO> checkBeforeDeleteSocialscheme(@Param("ids") Collection<Long> id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,4 +20,16 @@
|
|||
AND c.delete_type = 0
|
||||
AND c.status != 1
|
||||
</select>
|
||||
<select id="checkBeforeDeleteSocialscheme" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
COUNT(0) num
|
||||
FROM
|
||||
hrsa_bill_detail
|
||||
WHERE
|
||||
delete_type = 0
|
||||
AND social_scheme_id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -69,4 +69,6 @@ public interface InsuranceSchemeDetailMapper {
|
|||
|
||||
List<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment);
|
||||
|
||||
void deleteByIds(@Param("ids")Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,5 +226,15 @@
|
|||
AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE
|
||||
hrsa_scheme_detail
|
||||
SET delete_type = 1
|
||||
WHERE primary_id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.mapper.sischeme;
|
|||
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -60,4 +61,6 @@ public interface InsuranceSchemeMapper {
|
|||
|
||||
|
||||
List<InsuranceSchemePO> listByWelfareType(@Param("welfareType")Integer welfareType);
|
||||
|
||||
void deleteByIds(@Param("ids")Collection<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,5 +160,14 @@
|
|||
</if>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE hrsa_social_security_scheme
|
||||
SET delete_type=1
|
||||
WHERE id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -145,16 +145,16 @@ public class SISchemeController {
|
|||
* 删除(接口中暂无)
|
||||
* @param request
|
||||
* @param response
|
||||
* @param ids
|
||||
* @param insuranceSchemeReqParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/delete")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteTaxRate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
||||
public String deleteTaxRate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceSchemeReqParam insuranceSchemeReqParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("ids",ids);
|
||||
map.put("ids",insuranceSchemeReqParam.getIds());
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::delete,map);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue