|
|
@@ -1,6 +1,7 @@
|
|
|
package com.jeeplus.finance.reimbursementApproval.approvalInfo.service;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@@ -540,8 +541,18 @@ public class CwReimbursementInfoService {
|
|
|
public CwReimbursementInfo add(SaveInfoDto dto, UserDTO userDTO) throws Exception{
|
|
|
// 生成id
|
|
|
String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
+
|
|
|
+ // 判断超过 2026-01-01
|
|
|
+ Date targetDate = DateUtil.parseDate("2026-01-01");
|
|
|
+ boolean isAfterTargetDate = DateUtil.date().after(targetDate);
|
|
|
+ String bizCode = isAfterTargetDate ? dto.NEW_BIZ_CODE : dto.BIZ_CODE;
|
|
|
// 生成编号
|
|
|
- String no = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), dto.BIZ_CODE, TokenProvider.getCurrentToken());
|
|
|
+ String no = SpringUtil.getBean(IWorkAttachmentApi.class)
|
|
|
+ .genSerialNum(
|
|
|
+ userDTO.getCompanyDTO().getId(),
|
|
|
+ bizCode,
|
|
|
+ TokenProvider.getCurrentToken()
|
|
|
+ );
|
|
|
// 保存基础信息表信息
|
|
|
CwReimbursementInfo info = new CwReimbursementInfo();
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
|
@@ -1005,45 +1016,42 @@ public class CwReimbursementInfoService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public String remove(String id) {
|
|
|
- // 删除基础信息表
|
|
|
- infoMapper.deleteById(id);
|
|
|
- // 删除详情列表
|
|
|
- LambdaQueryWrapper<CwReimbursementDetailInfo> detailWrapper = new LambdaQueryWrapper<>();
|
|
|
- detailWrapper.eq(CwReimbursementDetailInfo::getInfoId, id);
|
|
|
- detailInfoMapper.delete(detailWrapper);
|
|
|
- // 删除合同列表
|
|
|
- LambdaQueryWrapper<CwReimbursementDetailInfoContract> detailWrapperContract = new LambdaQueryWrapper<>();
|
|
|
- detailWrapperContract.eq(CwReimbursementDetailInfoContract::getInfoId, id);
|
|
|
- cwReimbursementDetailInfoContractMapper.delete(detailWrapperContract);
|
|
|
- // 删除报告列表
|
|
|
- LambdaQueryWrapper<CwReimbursementDetailInfoReport> detailWrapperReport = new LambdaQueryWrapper<>();
|
|
|
- detailWrapperReport.eq(CwReimbursementDetailInfoReport::getInfoId, id);
|
|
|
- cwReimbursementDetailInfoReportMapper.delete(detailWrapperReport);
|
|
|
- // 删除其他报销列表
|
|
|
- LambdaQueryWrapper<CwReimbursementDetailInfoOther> detailWrapperOther = new LambdaQueryWrapper<>();
|
|
|
- detailWrapperOther.eq(CwReimbursementDetailInfoOther::getInfoId, id);
|
|
|
- cwReimbursementDetailInfoOtherMapper.delete(detailWrapperOther);
|
|
|
- // 删除采购报销列表
|
|
|
- LambdaQueryWrapper<CwReimbursementDetailInfoProcured> detailWrapperProcured = new LambdaQueryWrapper<>();
|
|
|
- detailWrapperProcured.eq(CwReimbursementDetailInfoProcured::getInfoId, id);
|
|
|
- cwReimbursementDetailInfoProcuredMapper.delete(detailWrapperProcured);
|
|
|
- // 删除实习报销列表
|
|
|
- LambdaQueryWrapper<HumanReimbursementDetailInfoProcured> humanDetailWrapperProcured = new LambdaQueryWrapper<>();
|
|
|
- humanDetailWrapperProcured.eq(HumanReimbursementDetailInfoProcured::getInfoId, id);
|
|
|
- humanReimbursementDetailInfoProcuredMapper.delete(humanDetailWrapperProcured);
|
|
|
- // 删除专用发票信息列表
|
|
|
- LambdaQueryWrapper<CwReimbursementAmountInfo> amountInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- amountInfoLambdaQueryWrapper.eq(CwReimbursementAmountInfo::getInfoId, id);
|
|
|
- amountInfoMapper.delete(amountInfoLambdaQueryWrapper);
|
|
|
- // 删除附件信息
|
|
|
-// LambdaQueryWrapper<WorkAttachmentInfo> wrapper = new LambdaQueryWrapper<>();
|
|
|
-// wrapper.eq(WorkAttachmentInfo::getAttachmentId, id);
|
|
|
-// ossServiceMapper.delete(wrapper);
|
|
|
- SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(id);
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String remove(String ids) {
|
|
|
+
|
|
|
+ List<String> idList = Arrays.asList(ids.split(","));
|
|
|
+
|
|
|
+ infoMapper.deleteBatchIds(idList);
|
|
|
+
|
|
|
+ detailInfoMapper.delete(new LambdaQueryWrapper<CwReimbursementDetailInfo>()
|
|
|
+ .in(CwReimbursementDetailInfo::getInfoId, idList));
|
|
|
+
|
|
|
+ cwReimbursementDetailInfoContractMapper.delete(new LambdaQueryWrapper<CwReimbursementDetailInfoContract>()
|
|
|
+ .in(CwReimbursementDetailInfoContract::getInfoId, idList));
|
|
|
+
|
|
|
+ cwReimbursementDetailInfoReportMapper.delete(new LambdaQueryWrapper<CwReimbursementDetailInfoReport>()
|
|
|
+ .in(CwReimbursementDetailInfoReport::getInfoId, idList));
|
|
|
+
|
|
|
+ cwReimbursementDetailInfoOtherMapper.delete(new LambdaQueryWrapper<CwReimbursementDetailInfoOther>()
|
|
|
+ .in(CwReimbursementDetailInfoOther::getInfoId, idList));
|
|
|
+
|
|
|
+ cwReimbursementDetailInfoProcuredMapper.delete(new LambdaQueryWrapper<CwReimbursementDetailInfoProcured>()
|
|
|
+ .in(CwReimbursementDetailInfoProcured::getInfoId, idList));
|
|
|
+
|
|
|
+ humanReimbursementDetailInfoProcuredMapper.delete(new LambdaQueryWrapper<HumanReimbursementDetailInfoProcured>()
|
|
|
+ .in(HumanReimbursementDetailInfoProcured::getInfoId, idList));
|
|
|
+
|
|
|
+ amountInfoMapper.delete(new LambdaQueryWrapper<CwReimbursementAmountInfo>()
|
|
|
+ .in(CwReimbursementAmountInfo::getInfoId, idList));
|
|
|
+
|
|
|
+ idList.forEach(id ->
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class)
|
|
|
+ .deleteByAttachmentId(id)
|
|
|
+ );
|
|
|
return "操作成功";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public String getOfficeNameByIds(String ids){
|
|
|
List<String> deptIdList = new ArrayList<>();
|
|
|
if (ids != null && !ids.trim().isEmpty()) {
|