|
|
|
@ -4,12 +4,21 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import com.dxhy.common.constant.DbConstant; |
|
|
|
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
|
|
|
|
import com.dxhy.common.enums.JxszcCancelEnum; |
|
|
|
|
import com.dxhy.common.enums.JxszcZtEnum; |
|
|
|
|
import com.dxhy.common.service.impl.MpBaseServiceImpl; |
|
|
|
|
import com.dxhy.erp.dao.BaseTDxRecordInvoiceDao; |
|
|
|
|
import com.dxhy.erp.dao.TdxRecordInvoiceDao; |
|
|
|
|
import com.dxhy.erp.entity.BaseTDxRecordInvoice; |
|
|
|
|
import com.dxhy.erp.entity.BaseTDxRecordInvoiceOut; |
|
|
|
|
import com.dxhy.erp.model.BaseReceiptOutCancelEditReqVO; |
|
|
|
|
import com.dxhy.erp.service.BaseIReceiptInvoiceService; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -24,6 +33,8 @@ import java.util.List; |
|
|
|
|
@SuppressWarnings("AlibabaUndefineMagicConstant") |
|
|
|
|
@Service("baseIReceiptInvoiceService") |
|
|
|
|
public class BaseIReceiptInvoiceServiceImpl extends MpBaseServiceImpl<BaseTDxRecordInvoiceDao, BaseTDxRecordInvoice> implements BaseIReceiptInvoiceService { |
|
|
|
|
@Resource |
|
|
|
|
private TdxRecordInvoiceDao tdxRecordInvoiceDao; |
|
|
|
|
@Override |
|
|
|
|
public List<BaseTDxRecordInvoice> selectByUuids(String[] uuids) { |
|
|
|
|
QueryWrapper<BaseTDxRecordInvoice> queryWrapper = new QueryWrapper<>(); |
|
|
|
@ -42,4 +53,85 @@ public class BaseIReceiptInvoiceServiceImpl extends MpBaseServiceImpl<BaseTDxRec |
|
|
|
|
super.succResult(new JSONObject()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 取消已转出进项税 请求确认 |
|
|
|
|
* |
|
|
|
|
* @param reqVO 请求参数 |
|
|
|
|
* @return 返回结果 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public String cancelOut(BaseReceiptOutCancelEditReqVO reqVO) { |
|
|
|
|
DynamicContextHolder.push("business"+ DbConstant.BUSINESS_WRITE); |
|
|
|
|
|
|
|
|
|
String[] uuids = reqVO.getPrimaryKey().split(","); |
|
|
|
|
excuteCancelWrite(uuids); |
|
|
|
|
|
|
|
|
|
return "取消转出成功"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 数据库操作 |
|
|
|
|
* |
|
|
|
|
* @param uuids 请求参数 |
|
|
|
|
*/ |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void excuteCancelWrite(String[] uuids) { |
|
|
|
|
// 批量将状态设置为 已取消
|
|
|
|
|
updateBatchByUuid(uuids); |
|
|
|
|
// 批量revert抵账表 转出时候更新的数据
|
|
|
|
|
updatePartInvoiceForCancel(uuids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 批量将 进项税 明细转为已取消 |
|
|
|
|
* |
|
|
|
|
* @param uuids 请求参数 |
|
|
|
|
*/ |
|
|
|
|
private void updateBatchByUuid(String[] uuids) { |
|
|
|
|
BaseTDxRecordInvoiceOut entity = new BaseTDxRecordInvoiceOut(); |
|
|
|
|
// 已取消
|
|
|
|
|
entity.setIsCancel(JxszcCancelEnum.YQX.getQxztDm()); |
|
|
|
|
|
|
|
|
|
UpdateWrapper<BaseTDxRecordInvoiceOut> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
updateWrapper.lambda().in(BaseTDxRecordInvoiceOut::getUuid, uuids); |
|
|
|
|
tdxRecordInvoiceDao.deleteByuuid(uuids); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 取消进项税转出,批量revert抵账表已经更新的字段 |
|
|
|
|
* |
|
|
|
|
* @param ids 请求参数 |
|
|
|
|
*/ |
|
|
|
|
private void updatePartInvoiceForCancel(String[] ids) { |
|
|
|
|
QueryWrapper<BaseTDxRecordInvoice> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.lambda().in(BaseTDxRecordInvoice::getUuid, ids); |
|
|
|
|
List<BaseTDxRecordInvoice> list = super.list(queryWrapper); |
|
|
|
|
for (BaseTDxRecordInvoice condRecord : list) { |
|
|
|
|
// 转出状态 revert为未转出
|
|
|
|
|
condRecord.setOutStatus(JxszcZtEnum.WZC.getZcztDm()); |
|
|
|
|
// 转出原因
|
|
|
|
|
condRecord.setOutReason(null); |
|
|
|
|
// 备注
|
|
|
|
|
condRecord.setOutRemark(null); |
|
|
|
|
// 转出日期
|
|
|
|
|
condRecord.setOutDate(null); |
|
|
|
|
// 转出人
|
|
|
|
|
condRecord.setOutBy(null); |
|
|
|
|
// 转出金额
|
|
|
|
|
condRecord.setOutInvoiceAmout(null); |
|
|
|
|
// 转出税额
|
|
|
|
|
condRecord.setOutTaxAmount(null); |
|
|
|
|
UpdateWrapper<BaseTDxRecordInvoice> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
updateWrapper.set("out_status",condRecord.getOutStatus()); |
|
|
|
|
updateWrapper.set("out_reason",condRecord.getOutReason()); |
|
|
|
|
updateWrapper.set("out_date",condRecord.getOutDate()); |
|
|
|
|
updateWrapper.set("out_by",condRecord.getOutBy()); |
|
|
|
|
updateWrapper.set("out_invoice_amout",condRecord.getOutInvoiceAmout()); |
|
|
|
|
updateWrapper.set("out_tax_amount",condRecord.getOutTaxAmount()); |
|
|
|
|
updateWrapper.eq("uuid",condRecord.getUuid()); |
|
|
|
|
super.baseMapper.update(null,updateWrapper); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|