Commit 8ce81009 by kangxiaoshan

提示已存在合同

parent 5c101ea4
......@@ -120,6 +120,6 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select contract_code from contract where customer_body =?1 and contract_code <> ?2 and status in ('backfirst','normal','late') limit 3 ", nativeQuery = true)
List<String> findContractBodyNames(String customerBody, String contractCode);
@Query(value = "select count(*) from contract where contract_code=?1 ", nativeQuery = true)
int checkByCode(String code);
@Query(value = "select * from contract where contract_code=?1 limit 1 ", nativeQuery = true)
Contract checkByCode(String code);
}
......@@ -473,7 +473,6 @@ public class ContractServiceImpl implements ContractService {
}
resource.setInvoice(0L);
Long extraFlow = resource.getExtraFlow();
if (extraFlow == null) {
......@@ -2199,8 +2198,8 @@ public class ContractServiceImpl implements ContractService {
} catch (Exception ex) {
logger.error("批量上传合同错误", ex);
return ResultModel.ERROR(ResultStatus.UPLOAD_ERRO);
}
return ResultModel.ERROR(ResultStatus.NONE_FILE_EXIST);
}
......@@ -2282,8 +2281,8 @@ public class ContractServiceImpl implements ContractService {
"合同编号[" + dataSTR + "]已存在,请重新上传");
}
int countCode = contractRepository.checkByCode(dataSTR);
if (countCode > 0) {
Contract contractExist = contractRepository.checkByCode(dataSTR);
if (contractExist != null) {
return ResultModel.ERROR(ResultStatus.CCODE_EXITS.getCode(),
"合同编号[" + dataSTR + "]已存在,请重新上传");
}
......
......@@ -56,8 +56,8 @@ public enum ResultStatus {
NONE_FILE_EXIST(-1000, "上传文件为空"),
FORMAT_FILE_ERRO(-10001, "模板文件格式错误"),
UPLOAD_CONTENT_ERRO(-10002, "模板文件内容错误"),
CCODE_EXITS(-10003, "合同编号已存在");
CCODE_EXITS(-10003, "合同编号已存在"),
UPLOAD_ERRO(-10004, "上传时系统错误");
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment