Commit 0d8cac20 authored by hongguangwu's avatar hongguangwu

MVP1.4-缴费库删除

parent 437a466e
......@@ -343,27 +343,34 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
LambdaQueryWrapper<TPaymentInfo> wrapper = buildQueryWrapper(empIdCard, socialHouseId, fundHouseId,
socialCreateMonth, socialPayMonth);
List<TPaymentInfo> list = baseMapper.selectList(wrapper);
List<String> idList = new ArrayList<>();
List<TPaymentInfo> list;
boolean delFlag = false;
if (Common.isNotNull(list)) {
for (TPaymentInfo paymentInfo : list) {
if ((!user.getId().equals(paymentInfo.getCreateBy()) &&
!CommonConstants.ONE_STRING.equals(user.getId())) ||
CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus()) ||
CommonConstants.ONE_STRING.equals(paymentInfo.getSalaryFundFlag()) ||
CommonConstants.ONE_STRING.equals(paymentInfo.getSalarySocialFlag())) {
delFlag = true;
if (CommonConstants.ONE_STRING.equals(user.getId())) {
list = baseMapper.selectList(wrapper.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getSalarySocialFlag, CommonConstants.ZERO_STRING)
.eq(TPaymentInfo::getSalaryFundFlag, CommonConstants.ZERO_STRING)
);
} else {
idList.add(paymentInfo.getId());
list = baseMapper.selectList(wrapper.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getSalarySocialFlag, CommonConstants.ZERO_STRING)
.eq(TPaymentInfo::getSalaryFundFlag, CommonConstants.ZERO_STRING)
.eq(TPaymentInfo::getCreateBy, user.getId())
);
long count = baseMapper.selectCount(wrapper.and(obj->obj.eq(TPaymentInfo::getPushStatus,CommonConstants.ZERO_STRING)
.or().eq(TPaymentInfo::getSalarySocialFlag, CommonConstants.ONE_STRING)
.or().eq(TPaymentInfo::getSalaryFundFlag, CommonConstants.ONE_STRING)
.or().ne(TPaymentInfo::getCreateBy, user.getId())
)
);
if (count > 0) {
delFlag = true;
}
}
} else {
if (Common.isNotNull(list)) {
baseMapper.deleteBatchIds(list);
} else if (!delFlag) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
if (Common.isNotNull(idList)) {
baseMapper.deleteBatchIds(idList);
}
if (delFlag) {
return R.ok(null, "存在不符合条件的数据(已推送至结算平台或非本人创建),禁止删除!");
}
......
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