企业管理,联系人管理新增之后返回id

This commit is contained in:
梁琦涛
2021-09-03 18:00:43 +08:00
parent 50d89b584f
commit f18b023d6f
4 changed files with 91 additions and 10 deletions
@@ -136,7 +136,7 @@ public class PayCompanyManagementController extends JeroController<PayCompanyMan
}
}
payCompanyManagementService.save(payCompanyManagement);
return Result.OK("添加成功!");
return Result.OK("添加成功!",payCompanyManagement);
}
/**
@@ -153,7 +153,7 @@ public class PayContactsManagementController extends JeroController<PayContactsM
log.error("手机号、邮箱加密异常!",e);
}
payContactsManagementService.save(payContactsManagement);
return Result.OK("添加成功!");
return Result.OK("添加成功!",payContactsManagement);
}
/**
@@ -13,6 +13,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* @Description: pay_income_contract
* @Author: jeecg-boot
@@ -34,62 +39,85 @@ public class PayIncomeContract implements Serializable {
/**合同编号*/
@Excel(name = "合同编号", width = 15)
@ApiModelProperty(value = "合同编号")
@NotEmpty(message = "合同编号不能为空!")
@Size(max = 50, message = "合同编号长度不能大于50个字符")
private java.lang.String contractNum;
/**合同名称*/
@Excel(name = "合同名称", width = 15)
@ApiModelProperty(value = "合同名称")
@NotEmpty(message = "合同名称不能为空!")
@Size(max = 50, message = "合同名称长度不能大于50个字符")
private java.lang.String contractName;
/**签订单位id*/
@ApiModelProperty(value = "签订单位id")
@NotEmpty(message = "签订单位id不能为空!")
@Size(max = 32, message = "签订单位id长度不能大于32个字符")
private java.lang.String signedCompanyId;
/**临时签订单位id*/
@Excel(name = "临时签订单位id", width = 15)
@ApiModelProperty(value = "临时签订单位id")
@Size(max = 50, message = "临时签订单位id长度不能大于50个字符")
private java.lang.String signedCompanyTemporaryId;
/**临时签订单位名称*/
@Excel(name = "临时签订单位名称", width = 15)
@ApiModelProperty(value = "临时签订单位名称")
@Size(max = 50, message = "临时签订单位名称长度不能大于50个字符")
private java.lang.String signedCompanyTemporaryName;
/**签订单位联系人id*/
@Excel(name = "签订单位联系人id", width = 15)
@ApiModelProperty(value = "签订单位联系人id")
@NotEmpty(message = "签订单位联系人id不能为空!")
@Size(max = 32, message = "签订单位联系人id长度不能大于32个字符")
private java.lang.String signedContactsId;
/**临时签订单位联系人id*/
@Excel(name = "临时签订单位联系人id", width = 15)
@ApiModelProperty(value = "临时签订单位联系人id")
@Size(max = 32, message = "临时签订单位联系人id长度不能大于32个字符")
private java.lang.String signedContactsTemporaryId;
/**临时签订单位联系人名称*/
@Excel(name = "临时签订单位联系人名称", width = 15)
@ApiModelProperty(value = "临时签订单位联系人名称")
@Size(max = 50, message = "临时签订单位联系人名称长度不能大于50个字符")
private java.lang.String signedContactsTemporaryName;
/**是否开口(1为是,2为否)*/
@Excel(name = "是否开口(1为是,2为否)", width = 15)
@ApiModelProperty(value = "是否开口(1为是,2为否)")
@Max(2)
private java.lang.Integer opening;
/**负责人id*/
@Excel(name = "负责人id", width = 15)
@ApiModelProperty(value = "负责人id")
@NotEmpty(message = "负责人id不能为空!")
@Size(max = 32, message = "负责人id长度不能大于32个字符")
private java.lang.String principalId;
/**负责人名称*/
@Excel(name = "负责人名称", width = 15)
@ApiModelProperty(value = "负责人名称")
@Size(max = 50, message = "负责人名称长度不能大于50个字符")
private java.lang.String principalName;
/**部门名称*/
@Excel(name = "部门名称", width = 15)
@ApiModelProperty(value = "部门名称")
@Size(max = 50, message = "部门名称长度不能大于50个字符")
private java.lang.String departmentName;
/**签订合同金额*/
@Excel(name = "签订合同金额", width = 15)
@ApiModelProperty(value = "签订合同金额")
private java.lang.String contractAmount;
@NotNull(message = "签订合同金额不能为空!")
@Max(value = 999999999,message = "签订合同金额格式错误")
private java.lang.Integer contractAmount;
/**税率*/
@Excel(name = "税率", width = 15)
@ApiModelProperty(value = "税率")
@NotNull(message = "税率不能为空!")
@Max(value = 100,message = "税率格式错误")
private java.lang.String rate;
/**未税金额*/
@Excel(name = "未税金额", width = 15)
@ApiModelProperty(value = "未税金额")
private java.lang.String noTaxAmount;
@NotNull(message = "未税金额不能为空!")
@Max(value = 999999999,message = "未税金额格式错误")
private java.lang.Integer noTaxAmount;
/**合同签订日期*/
@Excel(name = "合同签订日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@@ -105,22 +133,29 @@ public class PayIncomeContract implements Serializable {
/**合同约定主要时点*/
@Excel(name = "合同约定主要时点", width = 15)
@ApiModelProperty(value = "合同约定主要时点")
@Size(max = 20, message = "合同约定主要时点不能大于20个字符")
private java.lang.String contractTimePoints;
/**应收金额*/
@Excel(name = "应收金额", width = 15)
@ApiModelProperty(value = "应收金额")
private java.lang.String accountsReceivableAmount;
@NotNull(message = "应收金额不能为空!")
@Max(value = 999999999,message = "应收金额格式错误")
private java.lang.Integer accountsReceivableAmount;
/**已收金额*/
@Excel(name = "已收金额", width = 15)
@ApiModelProperty(value = "已收金额")
private java.lang.String amountReceived;
@NotNull(message = "应收金额不能为空!")
@Max(value = 999999999,message = "应收金额格式错误")
private java.lang.Integer amountReceived;
/**未收金额*/
@Excel(name = "未收金额", width = 15)
@ApiModelProperty(value = "未收金额")
@Max(value = 999999999,message = "应收金额格式错误")
private java.lang.String outstandingAmount;
/**账款状态(1:未支付,2:部分支付,3:已付全款)*/
@Excel(name = "账款状态(1:未支付,2:部分支付,3:已付全款)", width = 15)
@ApiModelProperty(value = "账款状态(1:未支付,2:部分支付,3:已付全款)")
@Max(value = 3,message = "账款状态格式错误")
private java.lang.Integer accountStatus;
/**合同约定付款次数*/
@Excel(name = "合同约定付款次数", width = 15)
@@ -142,16 +177,16 @@ public class PayIncomeContract implements Serializable {
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private java.util.Date updateTime;
}
@@ -19,6 +19,7 @@ import com.jero.contract.service.IPayIncomeContractAuditService;
import com.jero.contract.service.IPayIncomeContractInstallmentService;
import com.jero.contract.service.IPayIncomeContractService;
import com.jero.contract.vo.PayIncomeContractInput;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
* @Date: 2021-09-03
* @Version: V1.0
*/
@Slf4j
@Service
public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractMapper, PayIncomeContract> implements IPayIncomeContractService {
@@ -77,6 +79,28 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(!StringUtils.isBlank(input.getInstallment())){
listPayIncomeContractInstallment = JSONArray.parseArray(input.getInstallment(),PayIncomeContractInstallment.class);
}
try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
query.eq(PayIncomeContract::getContractNum,payIncomeContract.getContractNum());
PayIncomeContract payIncomeContractNew = payIncomeContractService.getOne(query);
if(!Objects.isNull(payIncomeContractNew)){
throw new JeroBootException("合同编号已存在!");
}
}catch (Exception e){
log.info("收入合同-添加异常",e);
throw new JeroBootException("合同编号已存在!");
}
try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
query.eq(PayIncomeContract::getContractName,payIncomeContract.getContractName());
PayIncomeContract payIncomeContractNew = payIncomeContractService.getOne(query);
if(!Objects.isNull(payIncomeContractNew)){
throw new JeroBootException("合同名称已存在!");
}
}catch (Exception e){
log.info("收入合同-添加异常",e);
throw new JeroBootException("合同名称已存在!");
}
payIncomeContractService.save(payIncomeContract);
StringBuilder msgPayIncomeContractInstallment = new StringBuilder();
if(!CollectionUtils.isEmpty(listPayIncomeContractInstallment)){
@@ -113,6 +137,28 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(!StringUtils.isBlank(input.getInstallment())){
listPayIncomeContractInstallment = JSONArray.parseArray(input.getInstallment(),PayIncomeContractInstallment.class);
}
try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
query.eq(PayIncomeContract::getContractNum,payIncomeContract.getContractNum());
PayIncomeContract payIncomeContractNew = payIncomeContractService.getOne(query);
if(!Objects.isNull(payIncomeContractNew) && !Objects.equals(payIncomeContractNew.getId(),payIncomeContract.getId())){
throw new JeroBootException("合同编号已存在!");
}
}catch (Exception e){
log.info("收入合同-添加异常",e);
throw new JeroBootException("合同编号已存在!");
}
try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
query.eq(PayIncomeContract::getContractName,payIncomeContract.getContractName());
PayIncomeContract payIncomeContractNew = payIncomeContractService.getOne(query);
if(!Objects.isNull(payIncomeContractNew) && !Objects.equals(payIncomeContractNew.getId(),payIncomeContract.getId())){
throw new JeroBootException("合同名称已存在!");
}
}catch (Exception e){
log.info("收入合同-添加异常",e);
throw new JeroBootException("合同名称已存在!");
}
StringBuilder msgPayIncomeContractInstallment = new StringBuilder();
if(!CollectionUtils.isEmpty(listPayIncomeContractInstallment)){
List<String> list = listPayIncomeContractInstallment.stream().map(PayIncomeContractInstallment::getId).collect(Collectors.toList());