|
@@ -12,6 +12,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.trade.common.utils.ConstantUtil;
|
|
|
import com.trade.common.utils.LoggerUtil;
|
|
|
import com.trade.common.utils.StringUtils;
|
|
|
import com.trade.common.utils.file.ExcelImportUtils;
|
|
@@ -20,6 +21,7 @@ import com.trade.common.utils.file.FileUtils;
|
|
|
import com.trade.service.companyrelated.domain.VendorEntity;
|
|
|
import com.trade.service.companyrelated.service.IVendorEntityService;
|
|
|
import com.trade.service.sales.vo.ImportCommodityVo;
|
|
|
+import com.trade.service.serialNum.service.SerialNumberGenerator;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
@@ -93,6 +95,8 @@ public class SalesServiceImpl implements SalesService {
|
|
|
private ContractTermsExtendService contractTermsExtendService;
|
|
|
@Resource
|
|
|
private IVendorEntityService iVendorEntityService;
|
|
|
+ @Resource
|
|
|
+ private SerialNumberGenerator serialNumberGenerator;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -156,14 +160,18 @@ public class SalesServiceImpl implements SalesService {
|
|
|
if (SubmitStatus.FORMAL.getCode().equals(contractTermsDto.getSubmitStatus())) {
|
|
|
ValidatorUtil.validator(ValidatorGroup.ValidatorType.SUBMIT, contractTermsDto);
|
|
|
}
|
|
|
- ContractTerms contractTermsExist = contractTermsService.lambdaQuery()
|
|
|
- .eq(ContractTerms::getContractNo, contractTermsDto.getContractNo()).eq(ContractTerms::getDeleted, 0)
|
|
|
- .one();
|
|
|
+ // ContractTerms contractTermsExist = contractTermsService.lambdaQuery()
|
|
|
+ // .eq(ContractTerms::getContractNo, contractTermsDto.getContractNo()).eq(ContractTerms::getDeleted, 0)
|
|
|
+ // .one();
|
|
|
+ ContractTerms contractTermsExist = contractTermsService.getByContractIdAndType(contractTermsDto.getContractId(),
|
|
|
+ ConstantUtil.SALES_CONTRACT_NO_PREFIX);
|
|
|
ContractTerms contractTerms = salesDataConverter.convertContractTermsDo(contractTermsDto);
|
|
|
if (contractTermsExist != null) {
|
|
|
contractTerms.setId(contractTermsExist.getId());
|
|
|
contractTermsService.updateById(contractTerms);
|
|
|
} else {
|
|
|
+ contractTerms.setContractId(contractTermsDto.getContractId());
|
|
|
+ contractTerms.setContractType(ConstantUtil.SALES_CONTRACT_NO_PREFIX);
|
|
|
contractTermsService.save(contractTerms);
|
|
|
}
|
|
|
List<ContractTermsExtend> contractTermsExtendsExist = contractTermsExtendService.lambdaQuery()
|
|
@@ -411,7 +419,7 @@ public class SalesServiceImpl implements SalesService {
|
|
|
contractFile.setOperatorName(customerUser.getNickname());
|
|
|
if (salesContractDto.getTemplateType() && isTemplate) {
|
|
|
// 生成合同文件
|
|
|
- contractFile.setContractNo(BizNoUtil.generateSalesContractNo());
|
|
|
+ contractFile.setContractNo(serialNumberGenerator.nextValue(ConstantUtil.SALES_CONTRACT_NO_PREFIX));
|
|
|
// ContractGenInput input = new ContractGenInput();
|
|
|
// input.setBizNo(contractFile.getContractNo());
|
|
|
// input.setUserId(customerUser.getId());
|
|
@@ -453,7 +461,7 @@ public class SalesServiceImpl implements SalesService {
|
|
|
contractFile.setSignFileType(FileTypeEnum.SALES_CONTRACT.getCode());
|
|
|
contractFile.setGenerationTime(LocalDateTime.now());
|
|
|
contractFile.setOperatorName(customerUser.getNickname());
|
|
|
- contractFile.setContractNo(BizNoUtil.generateSalesContractNo());
|
|
|
+ contractFile.setContractNo(serialNumberGenerator.nextValue(ConstantUtil.SALES_CONTRACT_NO_PREFIX));
|
|
|
// ContractGenInput input = new ContractGenInput();
|
|
|
// input.setBizNo(contractFile.getContractNo());
|
|
|
// input.setUserId(customerUser.getId());
|