@@ -8,7 +8,9 @@ import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.Valid; | |||
import javax.validation.constraints.NotBlank; | |||
import java.util.List; | |||
@ApiModel(description = "渠道信息添加请求参数") | |||
@Data | |||
@@ -43,7 +45,8 @@ public class AgencyInsertRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "记账渠道号") | |||
private String accountId; | |||
@ApiModelProperty(value = "协议") | |||
private QtkAgencyBkModel[] agencyModels; | |||
@Valid | |||
private List<QtkAgencyBkModel> agencyModels; | |||
@ApiModelProperty(value = "邮箱") | |||
private String email; | |||
@ApiModelProperty(value = "发行组负责人") |
@@ -18,6 +18,7 @@ import cn.com.taiji.userw.model.agency.QtkAgencyBkModel; | |||
import cn.com.taiji.userw.repo.jpa.request.AgencyPageRequest; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
import java.util.ArrayList; | |||
@@ -66,6 +67,7 @@ public class AgencyManagerImpl extends AbstractManager implements AgencyManager | |||
return agencyId; | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
@Override | |||
public void insert(AgencyInsertRequestDTO req) throws ManagerException { | |||
req.validate(); | |||
@@ -78,9 +80,10 @@ public class AgencyManagerImpl extends AbstractManager implements AgencyManager | |||
QtkAgency qtkAgency = copyProperties(req, new QtkAgency()); | |||
qtkAgency.setMapAgencyId(req.getMapAgencyId()); | |||
qtkAgencyRepo.persist(qtkAgency); | |||
QtkAgencyBkModel[] agencyModels = req.getAgencyModels(); | |||
// QtkAgencyBkModel[] agencyModels = req.getAgencyModels(); | |||
List<QtkAgencyBkModel> agencyModels = req.getAgencyModels(); | |||
ArrayList<QtkAgencyModel> qtkAgencyModels = new ArrayList<>(); | |||
if (agencyModels != null && agencyModels.length > 0) { | |||
if (!isEmpty(agencyModels)) { | |||
for (QtkAgencyBkModel agencyModel : agencyModels) { | |||
QtkAgencyModel model = copyProperties(agencyModel, new QtkAgencyModel()); | |||
model.setAgencyId(req.getAgencyId()); |
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDate; | |||
import java.time.LocalDateTime; | |||
@@ -13,18 +15,23 @@ import java.time.LocalDateTime; | |||
@ApiModel(description = "渠道协议") | |||
public class QtkAgencyBkModel { | |||
@NotBlank(message = "协议名称不能为空") | |||
@ApiModelProperty(value = "协议名称") | |||
private String agreementName; | |||
@NotBlank(message = "协议编号不能为空") | |||
@ApiModelProperty(value = "协议编号") | |||
private String agreementId; | |||
@NotBlank(message = "对公账户不能为空") | |||
@ApiModelProperty(value = "对公账户") | |||
private String corporateAccount; | |||
@ApiModelProperty(value = "商户号") | |||
private String merchantId; | |||
@ApiModelProperty(value = "开户行") | |||
private String openingBank; | |||
@NotNull(message = "有效期不能为空") | |||
@ApiModelProperty(value = "有效期") | |||
private LocalDate termOfValidity; | |||
@ApiModelProperty(value = "协议附件") | |||
@NotBlank(message = "协议附件不能为空") | |||
private String agreementAnnex; | |||
} |