修改写法

This commit is contained in:
qjq
2024-11-27 13:56:29 +08:00
parent 1c235b8a99
commit cd26a7688a

View File

@ -38,6 +38,7 @@ import cn.iocoder.yudao.module.member.enums.*;
import cn.iocoder.yudao.module.member.service.orderdetail.OrderDetailService; import cn.iocoder.yudao.module.member.service.orderdetail.OrderDetailService;
import cn.iocoder.yudao.module.member.service.storeorderdetail.StoreOrderDetailService; import cn.iocoder.yudao.module.member.service.storeorderdetail.StoreOrderDetailService;
import cn.iocoder.yudao.module.system.api.carteen.CarteenApi; import cn.iocoder.yudao.module.system.api.carteen.CarteenApi;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -361,6 +362,8 @@ public class BillingServiceImpl implements BillingService {
} }
billingMapper.updateById(updateObj); billingMapper.updateById(updateObj);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void updateBillingUnit(BillingSaveReqVO updateReqVO) { public void updateBillingUnit(BillingSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
BillingDO billingDO = billingMapper.selectById(updateReqVO.getId()); BillingDO billingDO = billingMapper.selectById(updateReqVO.getId());
@ -383,10 +386,10 @@ public class BillingServiceImpl implements BillingService {
//设置同意人 //设置同意人
updateObj.setSystemId(SecurityFrameworkUtils.getLoginUserId()); updateObj.setSystemId(SecurityFrameworkUtils.getLoginUserId());
//拒绝就把锁住的订单释放掉 //拒绝就把锁住的订单释放掉
LambdaUpdateChainWrapper<CardDO> wrapper = new LambdaUpdateChainWrapper<>(cardMapper); LambdaUpdateWrapper<CardDO> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(CardDO::getId,orderIds); wrapper.in(CardDO::getId, orderIds);
wrapper.set(CardDO::getBillingExist,BillingStatusEnum.BILLING_INVOICING_IS_COMPLETE.getCode()); wrapper.set(CardDO::getBillingExist, BillingStatusEnum.BILLING_INVOICING_IS_COMPLETE.getCode());
cardMapper.update(wrapper); cardMapper.update(null, wrapper);
}else{ }else{
//开票回拒 //开票回拒
if(StrUtil.isBlank(updateObj.getRefuseDetails())){ if(StrUtil.isBlank(updateObj.getRefuseDetails())){
@ -395,11 +398,11 @@ public class BillingServiceImpl implements BillingService {
updateObj.setStatus(BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode()); updateObj.setStatus(BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode());
updateObj.setRefuseTime(LocalDateTime.now()); updateObj.setRefuseTime(LocalDateTime.now());
//拒绝就把锁住的订单释放掉 //拒绝就把锁住的订单释放掉
LambdaUpdateChainWrapper<CardDO> wrapper = new LambdaUpdateChainWrapper<>(cardMapper); LambdaUpdateWrapper<CardDO> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(CardDO::getId,orderIds); wrapper.in(CardDO::getId, orderIds);
wrapper.set(CardDO::getBillingExist,BillingStatusEnum.BILLING_INVOICING_REJECTION.getCode()); wrapper.set(CardDO::getBillingExist, BillingStatusEnum.BILLING_INVOICING_IS_COMPLETE.getCode());
wrapper.set(CardDO::getBillingNum,null); wrapper.set(CardDO::getBillingNum,null);
cardMapper.update(wrapper); cardMapper.update(null, wrapper);
} }
billingMapper.updateById(updateObj); billingMapper.updateById(updateObj);
} }