|
@@ -8,8 +8,6 @@ import com.sunxung.factoring.component.exception.ValidatorException;
|
|
|
import com.sunxung.factoring.component.util.*;
|
|
|
import com.sunxung.factoring.dict.impl.FileModuleDict;
|
|
|
import com.sunxung.factoring.dict.impl.ProjectInitiationStatusDict;
|
|
|
-import com.sunxung.factoring.dict.impl.SalesContractStatusDict;
|
|
|
-import com.sunxung.factoring.entity.project.BusinessAssignee;
|
|
|
import com.sunxung.factoring.entity.project.BusinessProcessingLog;
|
|
|
import com.sunxung.factoring.entity.project.ProjectInformation;
|
|
|
import com.sunxung.factoring.entity.project.vo.BusinessProcessingTaskVo;
|
|
@@ -22,14 +20,12 @@ import com.sunxung.factoring.entity.sys.FileStorage;
|
|
|
import com.sunxung.factoring.entity.sys.FileStorageDO;
|
|
|
import com.sunxung.factoring.entity.sys.User;
|
|
|
import com.sunxung.factoring.mapper.salescontractmanagement.SalesContractMapper;
|
|
|
-import com.sunxung.factoring.service.project.BusinessAssigneeService;
|
|
|
import com.sunxung.factoring.service.project.BusinessProcessingLogService;
|
|
|
import com.sunxung.factoring.service.project.IProjectInformationService;
|
|
|
import com.sunxung.factoring.service.salescontractmanagement.*;
|
|
|
import com.sunxung.factoring.service.sys.*;
|
|
|
import com.sunxung.factoring.service.sys.dto.AttachmentDto;
|
|
|
import com.sunxung.factoring.service.sys.flowable.FlowableService;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.flowable.engine.runtime.ProcessInstance;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
@@ -66,9 +62,6 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
@Autowired
|
|
|
private DictionaryService dictService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private BusinessAssigneeService assigneeService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private FlowableService flowableService;
|
|
|
|
|
@@ -96,6 +89,21 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
@Autowired
|
|
|
private ISalesContractSupplementInfoService salesContractSupplementInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICSalesSignConfirmationService salesSignConfirmationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICSalesSignConfirmationElectronicInfoService signConfirmationElectronicInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICSalesContractSupplementBasicInfoService salesContractSupplementBasicInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICSalesSupplementSignConfirmationService salesSupplementSignConfirmationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICSalesSupplementSignConfirmationElectronicInfoService salesSupplementSignConfirmationElectronicInfoService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void doCreate(CSalesContract salesContractManagement) {
|
|
@@ -118,8 +126,8 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
//开启流程
|
|
|
startSalesContractProcess(salesContractManagement);
|
|
|
//变更项目的是否已做销售合同标识
|
|
|
- projectInformationService.lambdaUpdate().set(ProjectInformation::getSales,1)
|
|
|
- .eq(ProjectInformation::getBusinessNumber,salesContractManagement.getBusinessNumber())
|
|
|
+ projectInformationService.lambdaUpdate().set(ProjectInformation::getSales, 1)
|
|
|
+ .eq(ProjectInformation::getBusinessNumber, salesContractManagement.getBusinessNumber())
|
|
|
.update();
|
|
|
} else {
|
|
|
updateById(salesContractManagement);
|
|
@@ -172,7 +180,6 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public List<BusinessProcessingTaskVo> findMyCompletedList(SearchBusinessProcessingTask search) {
|
|
|
return baseMapper.findMyCompletedList(search);
|
|
@@ -187,11 +194,11 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
BusinessProcessingLog log = businessProcessingLogService.getByBusinessTypeBusinessKey(search.getSimpleClassName(), r.getId());
|
|
|
if (log != null && log.getEndTime() == null) {
|
|
|
String taskName = log.getTaskName();
|
|
|
- if (taskName.contains("创建") || taskName.contains("录入") || taskName.contains("签署确认")){
|
|
|
+ if (taskName.contains("创建") || taskName.contains("录入") || taskName.contains("签署确认")) {
|
|
|
r.setExecutor("供应商");
|
|
|
- }else if (taskName.contains("初审") || taskName.contains("审核") || taskName.contains("签署确认审核")){
|
|
|
+ } else if (taskName.contains("初审") || taskName.contains("审核") || taskName.contains("签署确认审核")) {
|
|
|
r.setExecutor("法务专员");
|
|
|
- } else if (taskName.contains("模板复审")){
|
|
|
+ } else if (taskName.contains("模板复审")) {
|
|
|
r.setExecutor("法务经理");
|
|
|
}
|
|
|
}
|
|
@@ -369,24 +376,80 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
|
|
|
@Override
|
|
|
public void downloadAllSalesContractFile(Long id, HttpServletResponse response) {
|
|
|
- List<FileStorage> salesContractAllFile = new ArrayList<>();
|
|
|
-
|
|
|
- CSalesContractBasicInfo basicInfo = salesContractBasicInfoService
|
|
|
- .lambdaQuery().eq(CSalesContractBasicInfo::getcSalesContractManagementId,id).one();
|
|
|
- //销售合同文件
|
|
|
- List<FileStorage> salesContractFile = attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.SALES_CONTRACT_FILE).setEntityId(basicInfo.getId()).build());
|
|
|
- salesContractAllFile.addAll(salesContractFile);
|
|
|
|
|
|
+ List<FileStorage> salesContractAllFile = new ArrayList<>();
|
|
|
+ CSalesContract salesContractManagement = get(id);
|
|
|
+ CSalesContractBasicInfo salesContractBasicInfo = salesContractBasicInfoService
|
|
|
+ .getOne(new QueryWrapper<CSalesContractBasicInfo>().eq("c_sales_contract_management_id", id));
|
|
|
+ //销售合同原件
|
|
|
+ //合同文件
|
|
|
+ List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(salesContractBasicInfo.getId(), FileModuleDict.ChildEnum.SALES_CONTRACT_FILE.getCode());
|
|
|
+ if (CollectionUtil.isNotEmpty(fileStorageDOS)) {
|
|
|
+ fileStorageDOS.forEach(fileStorageDO -> {
|
|
|
+ FileStorage fileStorage = new FileStorage();
|
|
|
+ fileStorage.setAbsolutePath(fileStorageDO.getAbsolutePath());
|
|
|
+ fileStorage.setName(fileStorageDO.getOriginalName());
|
|
|
+ fileStorage.setPath(fileStorageDO.getPath());
|
|
|
+ fileStorage.setId(fileStorageDO.getId());
|
|
|
+ fileStorage.setOriginalName(fileStorageDO.getOriginalName());
|
|
|
+ salesContractAllFile.add(fileStorage);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //已签署的文件
|
|
|
+ CSalesSignConfirmation salesSignConfirmation = salesSignConfirmationService
|
|
|
+ .lambdaQuery().eq(CSalesSignConfirmation::getcSalesContractManagementId, id).one();
|
|
|
+ if (salesSignConfirmation != null) {
|
|
|
+ List<CSalesSignConfirmationElectronicInfo> signElectronicInfos = signConfirmationElectronicInfoService
|
|
|
+ .list(new QueryWrapper<CSalesSignConfirmationElectronicInfo>().eq("c_sales_sign_confirmation_id", salesSignConfirmation.getId()));
|
|
|
+ if (CollectionUtil.isNotEmpty(signElectronicInfos)) {
|
|
|
+ signElectronicInfos.forEach(signElectronicInfo -> {
|
|
|
+ salesContractAllFile.addAll(attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.SIGN_CONFIRM_BACK_FILE).setEntityId(signElectronicInfo.getId()).build()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
//销售合同补充文件
|
|
|
List<CSalesContractSupplementInfo> salesContractSupplementInfos = salesContractSupplementInfoService
|
|
|
- .lambdaQuery().eq(CSalesContractSupplementInfo::getcSalesContractManagementId,id).list();
|
|
|
+ .list(new QueryWrapper<CSalesContractSupplementInfo>().eq("c_sales_contract_management_id", salesContractManagement.getId()));
|
|
|
if (CollectionUtil.isNotEmpty(salesContractSupplementInfos)) {
|
|
|
salesContractSupplementInfos.stream().forEach(s -> {
|
|
|
- List<FileStorage> salesContractSupplementFiles = attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.SALES_CONTRACT_SUPPLEMENT_FILE).setEntityId(s.getId()).build());
|
|
|
- salesContractAllFile.addAll(salesContractSupplementFiles);
|
|
|
+ if (salesContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
|
|
|
+
|
|
|
+ //补充合同原件
|
|
|
+ CSalesContractSupplementBasicInfo salesContractSupplementBasicInfo = salesContractSupplementBasicInfoService.lambdaQuery()
|
|
|
+ .eq(CSalesContractSupplementBasicInfo::getcSalesContractSupplementInfoId, s.getId())
|
|
|
+ .one();
|
|
|
+ List<FileStorageDO> SupplementFileStorageDOS = fileService.findByBusinessId(salesContractSupplementBasicInfo.getId(),
|
|
|
+ FileModuleDict.ChildEnum.SALES_CONTRACT_SUPPLEMENT_CONTRACT_FILE.getCode());
|
|
|
+ if (CollectionUtil.isNotEmpty(SupplementFileStorageDOS)) {
|
|
|
+ SupplementFileStorageDOS.forEach(fileStorageDO -> {
|
|
|
+ FileStorage fileStorage = new FileStorage();
|
|
|
+ fileStorage.setAbsolutePath(fileStorageDO.getAbsolutePath());
|
|
|
+ fileStorage.setName(fileStorageDO.getOriginalName());
|
|
|
+ fileStorage.setPath(fileStorageDO.getPath());
|
|
|
+ fileStorage.setId(fileStorageDO.getId());
|
|
|
+ fileStorage.setOriginalName(fileStorageDO.getOriginalName());
|
|
|
+ salesContractAllFile.add(fileStorage);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ CSalesSupplementSignConfirmation salesSupplementSignConfirmation = salesSupplementSignConfirmationService
|
|
|
+ .lambdaQuery().eq(CSalesSupplementSignConfirmation::getcSalesContractSupplementInfoId, s.getId()).one();
|
|
|
+ if (salesSupplementSignConfirmation != null) {
|
|
|
+ List<CSalesSupplementSignConfirmationElectronicInfo> supplementSignConfirmationElectronicInfos = salesSupplementSignConfirmationElectronicInfoService
|
|
|
+ .lambdaQuery().eq(CSalesSupplementSignConfirmationElectronicInfo::getcSalesSupplementSignConfirmationId, salesSupplementSignConfirmation.getId()).list();
|
|
|
+ if (CollectionUtil.isNotEmpty(supplementSignConfirmationElectronicInfos)) {
|
|
|
+ //获取销售合同补充签署的附件
|
|
|
+ supplementSignConfirmationElectronicInfos.forEach(supplementSignConfirmationElectronicInfo -> {
|
|
|
+ List<FileStorage> salesContractSupplementFiles = attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.SALES_SUPPLEMENT_SIGN_CONFIRM_BACK_FILE)
|
|
|
+ .setEntityId(supplementSignConfirmationElectronicInfo.getId()).build());
|
|
|
+ salesContractAllFile.addAll(salesContractSupplementFiles);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -397,5 +460,62 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, C
|
|
|
FileModuleDict.ChildEnum.SALES_CONTRACT_ZIP_FILE, response);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void downloadReportUrl(Long id, HttpServletResponse res) throws IOException {
|
|
|
+
|
|
|
+ List<FileStorage> salesReportFiles = new ArrayList<>();
|
|
|
+
|
|
|
+ CSalesContract cSalesContract = get(id);
|
|
|
+ CSalesSignConfirmation salesSignConfirmation = salesSignConfirmationService
|
|
|
+ .lambdaQuery().eq(CSalesSignConfirmation::getcSalesContractManagementId, id).one();
|
|
|
+ //销售合同 出证文件
|
|
|
+ if (salesSignConfirmation != null) {
|
|
|
+ List<CSalesSignConfirmationElectronicInfo> signElectronicInfos = signConfirmationElectronicInfoService
|
|
|
+ .list(new QueryWrapper<CSalesSignConfirmationElectronicInfo>().eq("c_sales_sign_confirmation_id", salesSignConfirmation.getId()));
|
|
|
+ if (CollectionUtil.isNotEmpty(signElectronicInfos)) {
|
|
|
+ signElectronicInfos.forEach(signElectronicInfo -> {
|
|
|
+ salesReportFiles.addAll(attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.SIGN_CONFIRM_BACK_FILE).setEntityId(signElectronicInfo.getId()).build()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //销售合同变更 出证文件
|
|
|
+ List<CSalesContractSupplementInfo> salesContractSupplementInfos = salesContractSupplementInfoService
|
|
|
+ .list(new QueryWrapper<CSalesContractSupplementInfo>().eq("c_sales_contract_management_id", id));
|
|
|
+ if (CollectionUtil.isNotEmpty(salesContractSupplementInfos)) {
|
|
|
+ salesContractSupplementInfos.stream().forEach(s -> {
|
|
|
+ if (cSalesContract.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
|
|
|
+
|
|
|
+ CSalesSupplementSignConfirmation salesSupplementSignConfirmation = salesSupplementSignConfirmationService
|
|
|
+ .lambdaQuery().eq(CSalesSupplementSignConfirmation::getcSalesContractSupplementInfoId, s.getId()).one();
|
|
|
+ if (salesSupplementSignConfirmation != null) {
|
|
|
+ List<CSalesSupplementSignConfirmationElectronicInfo> supplementSignConfirmationElectronicInfos = salesSupplementSignConfirmationElectronicInfoService
|
|
|
+ .lambdaQuery().eq(CSalesSupplementSignConfirmationElectronicInfo::getcSalesSupplementSignConfirmationId, salesSupplementSignConfirmation.getId()).list();
|
|
|
+ if (CollectionUtil.isNotEmpty(supplementSignConfirmationElectronicInfos)) {
|
|
|
+ supplementSignConfirmationElectronicInfos.forEach(supplementSignConfirmationElectronicInfo -> {
|
|
|
+ List<FileStorage> salesContractSupplementFiles = attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.SSALES_SUPPLEMENT_SIGN_CONFIRM_BACK_REPORT_FILE)
|
|
|
+ .setEntityId(supplementSignConfirmationElectronicInfo.getId()).build());
|
|
|
+ salesReportFiles.addAll(salesContractSupplementFiles);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtil.isEmpty(salesReportFiles)) {
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "为查询到出证文件!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //文件名去重
|
|
|
+ fileStorageService.renameFileStorageList(salesReportFiles);
|
|
|
+ //打包下载文件
|
|
|
+ fileStorageService.downloadZipFile(salesReportFiles, FileModuleDict.ChildEnum.SALES_CONTRACT_ZIP_FILE.getCname(),
|
|
|
+ FileModuleDict.ChildEnum.SALES_CONTRACT_ZIP_FILE, res);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|