import cn.com.taiji.userw.manager.serviceHall.ServiceHallManager; | import cn.com.taiji.userw.manager.serviceHall.ServiceHallManager; | ||||
import cn.com.taiji.userw.model.FormatException; | import cn.com.taiji.userw.model.FormatException; | ||||
import cn.com.taiji.userw.model.comm.CommExportExcelResponse; | import cn.com.taiji.userw.model.comm.CommExportExcelResponse; | ||||
import cn.com.taiji.userw.model.serviceHall.ServiceHallLocationModel; | |||||
import cn.com.taiji.userw.model.serviceHall.ServiceHallSonQueryModel; | import cn.com.taiji.userw.model.serviceHall.ServiceHallSonQueryModel; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
public ApiResponse<List<QtkServicehallLocation>> queryLocations(@Valid @RequestBody ServiceHallDeleteRequestDTO reqDto) throws ManagerException { | public ApiResponse<List<QtkServicehallLocation>> queryLocations(@Valid @RequestBody ServiceHallDeleteRequestDTO reqDto) throws ManagerException { | ||||
return ApiResponse.of(manager.queryLocations(reqDto)); | return ApiResponse.of(manager.queryLocations(reqDto)); | ||||
} | } | ||||
@ApiOperation(value = "查询网点位置分页") | |||||
@PostMapping(value = "/locationPage") | |||||
public ApiResponse<Pagination> locationPage(@Valid @RequestBody ServiceHallDeleteRequestDTO reqDto) throws ManagerException { | |||||
return ApiResponse.of(manager.locationPage(reqDto)); | |||||
} | |||||
@ApiOperation(value = "网点位置新增/修改") | |||||
@PostMapping(value = "/locationAdd") | |||||
public ApiResponse<?> locationAdd(@Valid @RequestBody ServiceHallLocationModel reqDto) throws ManagerException { | |||||
manager.locationAdd(reqDto); | |||||
return ApiResponse.success(); | |||||
} | |||||
@ApiOperation(value = "网点位置删除") | |||||
@PostMapping(value = "/locationDelete") | |||||
public ApiResponse<?> locationDelete(@RequestBody String id) throws ManagerException { | |||||
manager.locationDelete(id); | |||||
return ApiResponse.success(); | |||||
} | |||||
@ApiOperation(value = "网点信息批量导入") | @ApiOperation(value = "网点信息批量导入") | ||||
@PostMapping(value = "/registerFullBath") | @PostMapping(value = "/registerFullBath") |
@NotBlank(message = "网点编号不能为空") | @NotBlank(message = "网点编号不能为空") | ||||
@ApiModelProperty(value = "网点编号") | @ApiModelProperty(value = "网点编号") | ||||
private String serviceHallId; | private String serviceHallId; | ||||
@ApiModelProperty(value = "办理点名称") | |||||
private String name; | |||||
@ApiModelProperty(value = "类型1-可办理2-禁止办理") | |||||
private Integer type = 1;//类型1-可办理2-禁止办理 | |||||
import cn.com.taiji.core.entity.basic.QtkServicehallLocation; | import cn.com.taiji.core.entity.basic.QtkServicehallLocation; | ||||
import cn.com.taiji.userw.dto.serviceHall.*; | import cn.com.taiji.userw.dto.serviceHall.*; | ||||
import cn.com.taiji.userw.model.comm.CommExportExcelResponse; | import cn.com.taiji.userw.model.comm.CommExportExcelResponse; | ||||
import cn.com.taiji.userw.model.serviceHall.ServiceHallLocationModel; | |||||
import cn.com.taiji.userw.model.serviceHall.ServiceHallSonQueryModel; | import cn.com.taiji.userw.model.serviceHall.ServiceHallSonQueryModel; | ||||
import java.util.List; | import java.util.List; | ||||
List<ServiceHallSonQueryModel> serviceHallGetByAgencyId(ServiceHallGetIdRequestDTO reqDto); | List<ServiceHallSonQueryModel> serviceHallGetByAgencyId(ServiceHallGetIdRequestDTO reqDto); | ||||
CommExportExcelResponse export(ServiceHallPageRequestDTO reqDto) throws ManagerException; | CommExportExcelResponse export(ServiceHallPageRequestDTO reqDto) throws ManagerException; | ||||
Pagination locationPage(ServiceHallDeleteRequestDTO reqDto); | |||||
void locationAdd(ServiceHallLocationModel reqDto) throws ServiceHandleException; | |||||
void locationDelete(String id); | |||||
} | } |
import cn.com.taiji.userw.model.excel.ServiceLocationRegisterData; | import cn.com.taiji.userw.model.excel.ServiceLocationRegisterData; | ||||
import cn.com.taiji.userw.model.serviceHall.*; | import cn.com.taiji.userw.model.serviceHall.*; | ||||
import cn.com.taiji.userw.repo.jpa.request.ServiceHallPageRequest; | import cn.com.taiji.userw.repo.jpa.request.ServiceHallPageRequest; | ||||
import cn.com.taiji.userw.repo.jpa.request.ServiceLocaltionPageRequest; | |||||
import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||
import cn.hutool.core.io.FileUtil; | import cn.hutool.core.io.FileUtil; | ||||
import com.alibaba.excel.EasyExcel; | import com.alibaba.excel.EasyExcel; | ||||
return response; | return response; | ||||
} | } | ||||
@Override | |||||
public Pagination locationPage(ServiceHallDeleteRequestDTO reqDto) { | |||||
ServiceLocaltionPageRequest request = copyProperties(reqDto, new ServiceLocaltionPageRequest()); | |||||
request.setName(reqDto.getName()); | |||||
request.setServicehallId(reqDto.getServiceHallId()); | |||||
request.setType(reqDto.getType()); | |||||
return locationRepo.page(request); | |||||
} | |||||
@Override | |||||
public void locationAdd(ServiceHallLocationModel reqDto) throws ServiceHandleException { | |||||
QtkServicehallLocation qtkServicehallLocation = null; | |||||
if (hasText(reqDto.getId())) { | |||||
qtkServicehallLocation = locationRepo.findById(reqDto.getId()).orElse(null); | |||||
} | |||||
if (qtkServicehallLocation == null){ | |||||
qtkServicehallLocation = new QtkServicehallLocation(); | |||||
} | |||||
copyProperties(reqDto, qtkServicehallLocation, "id"); | |||||
qtkServicehallLocation.setCreateOpenId(findOpenIdByToken(reqDto.getAccessToken())); | |||||
qtkServicehallLocation.setInsertTime(LocalDateTime.now()); | |||||
locationRepo.save(qtkServicehallLocation); | |||||
} | |||||
@Override | |||||
public void locationDelete(String id) { | |||||
locationRepo.deleteById(id); | |||||
} | |||||
private ServiceHallExcelModel converExcel(QtkServiceHall hall) { | private ServiceHallExcelModel converExcel(QtkServiceHall hall) { | ||||
ServiceHallExcelModel model = copyProperties(hall, new ServiceHallExcelModel()); | ServiceHallExcelModel model = copyProperties(hall, new ServiceHallExcelModel()); | ||||
// 设置上级网点名称 | // 设置上级网点名称 | ||||
qtkServiceHall.setContact(reqDto.getContact()); | qtkServiceHall.setContact(reqDto.getContact()); | ||||
qtkServiceHall.setLongitude(reqDto.getLongitude()); | qtkServiceHall.setLongitude(reqDto.getLongitude()); | ||||
qtkServiceHall.setLatitude(reqDto.getLatitude()); | qtkServiceHall.setLatitude(reqDto.getLatitude()); | ||||
qtkServiceHall.setRadial(reqDto.getRadial()); | |||||
qtkServiceHall.setUpdateTime(now); | qtkServiceHall.setUpdateTime(now); | ||||
qtkServiceHall.setUpdateOpenId(openId); | qtkServiceHall.setUpdateOpenId(openId); | ||||
// 更新 | // 更新 |
import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||
import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotNull; | ||||
@ApiModel("新增网点-位置信息") | @ApiModel("新增网点-位置信息") | ||||
@Data | @Data | ||||
public class ServiceHallLocationModel extends BaseModel { | public class ServiceHallLocationModel extends BaseModel { | ||||
@ApiModelProperty(value = "ID") | |||||
private String id; | |||||
@ApiModelProperty(value = "渠道编号") | |||||
private String agencyId;//渠道编号 | |||||
@ApiModelProperty(value = "网点编号") | |||||
private String servicehallId;//网点编号 | |||||
@ApiModelProperty(value = "网点名称") | |||||
private String servicehallName;//网点名称 | |||||
@NotBlank | @NotBlank | ||||
@ApiModelProperty(value = "位置名称") | @ApiModelProperty(value = "位置名称") | ||||
private String name;//名称 | private String name;//名称 | ||||
@NotNull | @NotNull | ||||
@ApiModelProperty(value = "1-可办理2-禁止办理") | @ApiModelProperty(value = "1-可办理2-禁止办理") | ||||
private Integer type = 1; | private Integer type = 1; | ||||
// @NotBlank(message = "accessToken不能为空") | |||||
private String accessToken; | |||||
} | } |
package cn.com.taiji.userw.repo.jpa.request; | |||||
import cn.com.taiji.common.pub.dao.HqlBuilder; | |||||
import cn.com.taiji.common.repo.request.jpa.JpaPageableDataRequest; | |||||
import cn.com.taiji.core.entity.basic.QtkServiceHall; | |||||
import cn.com.taiji.core.entity.basic.QtkServicehallLocation; | |||||
import lombok.Data; | |||||
import javax.persistence.Column; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.Size; | |||||
import java.util.List; | |||||
@Data | |||||
public class ServiceLocaltionPageRequest extends JpaPageableDataRequest<QtkServicehallLocation> { | |||||
private String name;//网点名称 | |||||
private Integer type = 1;//类型1-可办理2-禁止办理 | |||||
private String servicehallId;//网点编号 | |||||
@Override | |||||
public HqlBuilder toSelectHql() { | |||||
HqlBuilder hql = new HqlBuilder("from QtkServicehallLocation where 1=1 "); | |||||
hql.append(" and name like :name ", like(name)); | |||||
hql.append(" and type = :type ", type); | |||||
hql.append(" and servicehallId = :servicehallId ", servicehallId); | |||||
return hql; | |||||
} | |||||
} |