Commit 8a49f4e4 authored by fangxinjiang's avatar fangxinjiang

户禁用时存在户的基数配置,不可禁用

parent ab1323d9
......@@ -107,7 +107,7 @@ public class SysHouseHoldInfoController {
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_syshouseholdinfo_edit')" )
public R<Boolean> updateById(@RequestBody SysHouseHoldInfo sysHouseHoldInfo) {
return R.ok(sysHouseHoldInfoService.updateById(sysHouseHoldInfo));
return sysHouseHoldInfoService.updateByIdAsso(sysHouseHoldInfo);
}
/**
......
......@@ -44,4 +44,6 @@ public interface SysHouseHoldInfoService extends IService<SysHouseHoldInfo> {
* @return R
*/
R<Boolean> saveInfo (SysHouseHoldInfo sysHouseHoldInfo);
R<Boolean> updateByIdAsso(SysHouseHoldInfo sysHouseHoldInfo);
}
......@@ -21,8 +21,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysHouseHoldInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysHouseHoldInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.SysHouseHoldInfoService;
import lombok.RequiredArgsConstructor;
......@@ -37,6 +41,8 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMapper, SysHouseHoldInfo> implements SysHouseHoldInfoService {
private final SysBaseSetInfoMapper baseSetInfoMapper;
/**
* 社保户公积金户数据简单分页查询
* @param sysHouseHoldInfo 社保户公积金户数据
......@@ -65,5 +71,37 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
baseMapper.insert(sysHouseHoldInfo);
return R.ok();
}
/**
* @Author fxj
* @Description 修改社保户公积金户数据
* @Date 16:08 2022/11/14
**/
@Override
public R<Boolean> updateByIdAsso(SysHouseHoldInfo hold) {
if (Common.isEmpty(hold.getId())){
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
SysHouseHoldInfo holdInfo = baseMapper.selectById(hold.getId());
if (Common.isEmpty(holdInfo)){
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
if (CommonConstants.ONE_STRING.equals(hold.getDelFlag())
&& baseSetInfoMapper.selectCount(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, hold.getType())
.le(SysBaseSetInfo::getApplyStartDate, DateUtil.getCurrentDateTime())
.in(SysBaseSetInfo::getDepartId,hold.getId())
.eq(SysBaseSetInfo::getStatus,CommonConstants.ZERO_STRING)
.eq(SysBaseSetInfo::getDeleteFlag, CommonConstants.ZERO_STRING)
.and(obj-> obj.isNull(SysBaseSetInfo::getApplyEndDate).or()
.ge(SysBaseSetInfo::getApplyEndDate,DateUtil.getCurrentDateTime()))) > CommonConstants.ZERO_INT){
return R.failed("户下存在可用基数配置,请禁用可用基数配置后禁用户配置!");
}
int res = baseMapper.updateById(hold);
if (res >= 0){
return R.ok();
}else {
return R.failed(CommonConstants.SAVE_FAILED);
}
}
}
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