import lombok.Data; | import lombok.Data; | ||||
import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||
import javax.validation.constraints.NotNull; | |||||
/** | /** | ||||
* @description: | * @description: | ||||
@NotBlank(message = "") | @NotBlank(message = "") | ||||
@ApiModelProperty(value = "网点数据id") | @ApiModelProperty(value = "网点数据id") | ||||
private String serviceHallId; | private String serviceHallId; | ||||
@NotNull | |||||
@ApiModelProperty(value = "1-可办理2-禁止办理") | |||||
private Integer type; | |||||
} | } |
private Set<ServiceLocationRegisterData> errors = new HashSet<>(); | private Set<ServiceLocationRegisterData> errors = new HashSet<>(); | ||||
private List<ServiceLocationRegisterData> result = new ArrayList<>(); | private List<ServiceLocationRegisterData> result = new ArrayList<>(); | ||||
private String openId; | private String openId; | ||||
private Integer type; | |||||
public ServiceHallRegisterLocationBatchListener(QtkServicehallLocationRepo LocationRepo, QtkServiceHall serviceHall,String openId) { | |||||
public ServiceHallRegisterLocationBatchListener(QtkServicehallLocationRepo LocationRepo, QtkServiceHall serviceHall,String openId,Integer type) { | |||||
this.LocationRepo = LocationRepo; | this.LocationRepo = LocationRepo; | ||||
this.serviceHall = serviceHall; | this.serviceHall = serviceHall; | ||||
this.openId = openId; | this.openId = openId; | ||||
this.type = type; | |||||
} | } | ||||
@Override | @Override | ||||
for (ServiceLocationRegisterData serviceLocationRegisterData : result) { | for (ServiceLocationRegisterData serviceLocationRegisterData : result) { | ||||
QtkServicehallLocation serviceHall = covertToQtk(serviceLocationRegisterData); | QtkServicehallLocation serviceHall = covertToQtk(serviceLocationRegisterData); | ||||
serviceHall.setCreateOpenId(openId); | serviceHall.setCreateOpenId(openId); | ||||
serviceHall.setType(type); | |||||
locations.add(serviceHall); | locations.add(serviceHall); | ||||
} | } | ||||
LocationRepo.saveAll(locations); | LocationRepo.saveAll(locations); |
throw new ManagerException("通过文件流失败!"); | throw new ManagerException("通过文件流失败!"); | ||||
} | } | ||||
ServiceHallRegisterLocationBatchListener listener = | ServiceHallRegisterLocationBatchListener listener = | ||||
new ServiceHallRegisterLocationBatchListener(locationRepo, serviceHall,findOpenIdByToken(reqDto.getAccessToken())); | |||||
new ServiceHallRegisterLocationBatchListener(locationRepo, serviceHall,findOpenIdByToken(reqDto.getAccessToken()),reqDto.getType()); | |||||
//读取文件数据并保存 | //读取文件数据并保存 | ||||
EasyExcel.read(fileInputStream, | EasyExcel.read(fileInputStream, | ||||
ServiceLocationRegisterData.class, | ServiceLocationRegisterData.class, |
@NotNull | @NotNull | ||||
@ApiModelProperty(value = "半径距离") | @ApiModelProperty(value = "半径距离") | ||||
private Integer radial;//半径距离 | private Integer radial;//半径距离 | ||||
@NotNull | |||||
@ApiModelProperty(value = "1-可办理2-禁止办理") | |||||
private Integer type = 1; | |||||
} | } |