|
@@ -60,7 +60,7 @@ public class CustomerDataPublicController {
|
|
|
|
|
|
|
|
@Operation(summary = "新增公海客户数据接口")
|
|
@Operation(summary = "新增公海客户数据接口")
|
|
|
@PostMapping(value = "/customer/add")
|
|
@PostMapping(value = "/customer/add")
|
|
|
- public ApiResult<Void> add(@RequestBody @Valid AdminSysCustomerDataInsertOrUpdateDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> add(@RequestBody @Valid AdminSysCustomerDataInsertOrUpdateDTO dto) throws BusinessException {
|
|
|
sysCustomerDataPublicService.adminInsertCustomerData(dto);
|
|
sysCustomerDataPublicService.adminInsertCustomerData(dto);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
@@ -68,14 +68,14 @@ public class CustomerDataPublicController {
|
|
|
|
|
|
|
|
@Operation(summary = "修改公海客户数据接口")
|
|
@Operation(summary = "修改公海客户数据接口")
|
|
|
@PostMapping(value = "/customer/update")
|
|
@PostMapping(value = "/customer/update")
|
|
|
- public ApiResult<Void> update(@RequestBody @Valid AdminSysCustomerDataInsertOrUpdateDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> update(@RequestBody @Valid AdminSysCustomerDataInsertOrUpdateDTO dto) throws BusinessException {
|
|
|
sysCustomerDataPublicService.adminUpdateCustomerData(dto);
|
|
sysCustomerDataPublicService.adminUpdateCustomerData(dto);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "删除公海客户信息接口")
|
|
@Operation(summary = "删除公海客户信息接口")
|
|
|
@GetMapping(value = "/customer/delete/{customerId}")
|
|
@GetMapping(value = "/customer/delete/{customerId}")
|
|
|
- public ApiResult<Void> delete(@PathVariable Long customerId) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> delete(@PathVariable Long customerId) throws BusinessException {
|
|
|
sysCustomerDataPublicService.adminDeleteCustomerData(customerId);
|
|
sysCustomerDataPublicService.adminDeleteCustomerData(customerId);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
@@ -83,7 +83,7 @@ public class CustomerDataPublicController {
|
|
|
|
|
|
|
|
@Operation(summary = "认领公海客户信息接口")
|
|
@Operation(summary = "认领公海客户信息接口")
|
|
|
@GetMapping(value = "/customer/claim/{customerId}")
|
|
@GetMapping(value = "/customer/claim/{customerId}")
|
|
|
- public ApiResult<Void> claim(@PathVariable Long customerId) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> claim(@PathVariable Long customerId) throws BusinessException {
|
|
|
sysCustomerDataPublicService.claimCustomer(customerId);
|
|
sysCustomerDataPublicService.claimCustomer(customerId);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
@@ -91,42 +91,42 @@ public class CustomerDataPublicController {
|
|
|
|
|
|
|
|
@Operation(summary = "公海客户添加联系人数据接口")
|
|
@Operation(summary = "公海客户添加联系人数据接口")
|
|
|
@PostMapping(value = "/customer/person/add")
|
|
@PostMapping(value = "/customer/person/add")
|
|
|
- public ApiResult<Void> personAdd(@RequestBody @Valid AdminSysCustomerPersonInsertOrUpdateDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> personAdd(@RequestBody @Valid AdminSysCustomerPersonInsertOrUpdateDTO dto) throws BusinessException {
|
|
|
sysCustomerDataPublicService.adminInsertCustomerPerson(dto);
|
|
sysCustomerDataPublicService.adminInsertCustomerPerson(dto);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "公海客户修改联系人数据接口")
|
|
@Operation(summary = "公海客户修改联系人数据接口")
|
|
|
@PostMapping(value = "/customer/person/update")
|
|
@PostMapping(value = "/customer/person/update")
|
|
|
- public ApiResult<Void> personUpdate(@RequestBody @Valid AdminSysCustomerPersonInsertOrUpdateDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> personUpdate(@RequestBody @Valid AdminSysCustomerPersonInsertOrUpdateDTO dto) throws BusinessException {
|
|
|
sysCustomerDataPublicService.adminUpdateCustomerPerson(dto);
|
|
sysCustomerDataPublicService.adminUpdateCustomerPerson(dto);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "公海客户删除联系人数据接口")
|
|
@Operation(summary = "公海客户删除联系人数据接口")
|
|
|
@GetMapping(value = "/customer/person/delete/{personId}")
|
|
@GetMapping(value = "/customer/person/delete/{personId}")
|
|
|
- public ApiResult<Void> personDelete(@PathVariable Long personId) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> personDelete(@PathVariable Long personId) throws BusinessException {
|
|
|
sysCustomerDataPublicService.adminDeleteCustomerPerson(personId);
|
|
sysCustomerDataPublicService.adminDeleteCustomerPerson(personId);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "公海客户查询联系人数据接口")
|
|
@Operation(summary = "公海客户查询联系人数据接口")
|
|
|
@PostMapping(value = "/customer/person/query")
|
|
@PostMapping(value = "/customer/person/query")
|
|
|
- public ApiResult<List<SysCustomerPersonBO>> personQuery(@RequestBody @Valid CustomerPersonReqDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<List<SysCustomerPersonBO>> personQuery(@RequestBody @Valid CustomerPersonReqDTO dto) throws BusinessException {
|
|
|
List<SysCustomerPersonBO> sysCustomerPersonBOS = sysCustomerDataPublicService.adminListCustomerPerson(dto);
|
|
List<SysCustomerPersonBO> sysCustomerPersonBOS = sysCustomerDataPublicService.adminListCustomerPerson(dto);
|
|
|
return ApiResult.data(sysCustomerPersonBOS);
|
|
return ApiResult.data(sysCustomerPersonBOS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "查询详情信息接口")
|
|
@Operation(summary = "查询详情信息接口")
|
|
|
@PostMapping(value = "/customer/data/detail", produces = "application/json;charset=UTF-8")
|
|
@PostMapping(value = "/customer/data/detail", produces = "application/json;charset=UTF-8")
|
|
|
- public ApiResult<SysCustomerDetailBO> queryCustomerDetail(@RequestBody AdminSysCustomerFollowReqDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<SysCustomerDetailBO> queryCustomerDetail(@RequestBody AdminSysCustomerFollowReqDTO dto) throws BusinessException {
|
|
|
SysCustomerDetailBO detailBO = sysCustomerDataPublicService.queryCustomerDetail(dto);
|
|
SysCustomerDetailBO detailBO = sysCustomerDataPublicService.queryCustomerDetail(dto);
|
|
|
return ApiResult.data(detailBO);
|
|
return ApiResult.data(detailBO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "查询日志记录信息接口")
|
|
@Operation(summary = "查询日志记录信息接口")
|
|
|
@PostMapping(value = "/customer/oper/log/", produces = "application/json;charset=UTF-8")
|
|
@PostMapping(value = "/customer/oper/log/", produces = "application/json;charset=UTF-8")
|
|
|
- public ApiResult<SysCustomerOperLogDataBO> queryOperLogData(@RequestBody AdminSysCustomerOperLogListDTO dto) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<SysCustomerOperLogDataBO> queryOperLogData(@RequestBody AdminSysCustomerOperLogListDTO dto) throws BusinessException {
|
|
|
SysCustomerOperLogDataBO result = sysCustomerDataPublicService.queryOperLogData(dto);
|
|
SysCustomerOperLogDataBO result = sysCustomerDataPublicService.queryOperLogData(dto);
|
|
|
return ApiResult.data(result);
|
|
return ApiResult.data(result);
|
|
|
}
|
|
}
|
|
@@ -134,7 +134,7 @@ public class CustomerDataPublicController {
|
|
|
|
|
|
|
|
@Operation(summary = "导入客户数据接口")
|
|
@Operation(summary = "导入客户数据接口")
|
|
|
@PostMapping(value = "/importCustomerData")
|
|
@PostMapping(value = "/importCustomerData")
|
|
|
- public ApiResult<Void> importCustomerData(@Parameter(description = "文件参数") @RequestPart MultipartFile file) throws BusinessException{
|
|
|
|
|
|
|
+ public ApiResult<Void> importCustomerData(@Parameter(description = "文件参数") @RequestPart MultipartFile file) throws BusinessException {
|
|
|
permissionService.publicPrivateCustomerPermission();
|
|
permissionService.publicPrivateCustomerPermission();
|
|
|
this.handleImportCustomerData(file);
|
|
this.handleImportCustomerData(file);
|
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
@@ -145,7 +145,7 @@ public class CustomerDataPublicController {
|
|
|
*
|
|
*
|
|
|
* @param file
|
|
* @param file
|
|
|
*/
|
|
*/
|
|
|
- public void handleImportCustomerData(MultipartFile file) throws BusinessException{
|
|
|
|
|
|
|
+ public void handleImportCustomerData(MultipartFile file) throws BusinessException {
|
|
|
try {
|
|
try {
|
|
|
InputStream inputStream = file.getInputStream();
|
|
InputStream inputStream = file.getInputStream();
|
|
|
List<LinkedHashMap<Integer, Object>> allData = EasyExcel.read(inputStream)
|
|
List<LinkedHashMap<Integer, Object>> allData = EasyExcel.read(inputStream)
|
|
@@ -162,10 +162,10 @@ public class CustomerDataPublicController {
|
|
|
throw new BusinessException("excel数据异常,导入失败");
|
|
throw new BusinessException("excel数据异常,导入失败");
|
|
|
}
|
|
}
|
|
|
//批量插入数据
|
|
//批量插入数据
|
|
|
- dtoList.forEach(sysCustomerDataPublicService::adminInsertCustomerData);
|
|
|
|
|
|
|
+ sysCustomerDataPublicService.adminInsertCustomerData(dtoList);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("导入客户数据失败", e);
|
|
log.error("导入客户数据失败", e);
|
|
|
- throw new RuntimeException("导入客户数据失败");
|
|
|
|
|
|
|
+ throw new BusinessException(e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -203,37 +203,68 @@ public class CustomerDataPublicController {
|
|
|
dto.setName((String) rowData.get(0));
|
|
dto.setName((String) rowData.get(0));
|
|
|
|
|
|
|
|
if (rowData.get(1) == null) {
|
|
if (rowData.get(1) == null) {
|
|
|
- throw new BusinessException("学段不能为空");
|
|
|
|
|
|
|
+ throw new BusinessException(rowData.get(0)+"/学段不能为空");
|
|
|
}
|
|
}
|
|
|
dto.setStageName((String) rowData.get(1));
|
|
dto.setStageName((String) rowData.get(1));
|
|
|
List<SysParamBaseDataEntity> stageList = sysParamBaseDataEntities.stream()
|
|
List<SysParamBaseDataEntity> stageList = sysParamBaseDataEntities.stream()
|
|
|
.filter(sysParamBaseDataEntity -> sysParamBaseDataEntity.getTitle().equals(rowData.get(1)))
|
|
.filter(sysParamBaseDataEntity -> sysParamBaseDataEntity.getTitle().equals(rowData.get(1)))
|
|
|
.toList();
|
|
.toList();
|
|
|
if (CollUtil.isEmpty(stageList)) {
|
|
if (CollUtil.isEmpty(stageList)) {
|
|
|
- throw new BusinessException(rowData.get(1)+"学段不存在,导入失败");
|
|
|
|
|
|
|
+ throw new BusinessException(rowData.get(0)+ "学段不存在,导入失败");
|
|
|
}
|
|
}
|
|
|
dto.setStageId(stageList.getFirst().getId());
|
|
dto.setStageId(stageList.getFirst().getId());
|
|
|
|
|
|
|
|
if (rowData.get(2) == null) {
|
|
if (rowData.get(2) == null) {
|
|
|
- throw new BusinessException("省份不能为空");
|
|
|
|
|
|
|
+ throw new BusinessException(rowData.get(0)+"省份不能为空");
|
|
|
}
|
|
}
|
|
|
dto.setProvinceName((String) rowData.get(2));
|
|
dto.setProvinceName((String) rowData.get(2));
|
|
|
|
|
+ if (dto.getProvinceName().startsWith("北京")) {
|
|
|
|
|
+ dto.setProvinceName("北京市");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("天津")) {
|
|
|
|
|
+ dto.setProvinceName("天津市");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("上海")) {
|
|
|
|
|
+ dto.setProvinceName("上海市");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("重庆")) {
|
|
|
|
|
+ dto.setProvinceName("重庆市");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("内蒙")) {
|
|
|
|
|
+ dto.setProvinceName("内蒙自治区");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("西藏")) {
|
|
|
|
|
+ dto.setProvinceName("西藏自治区");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("广西")) {
|
|
|
|
|
+ dto.setProvinceName("广西壮族自治区");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("宁夏")) {
|
|
|
|
|
+ dto.setProvinceName("宁夏回族自治区");
|
|
|
|
|
+ } else if (dto.getProvinceName().startsWith("新疆")) {
|
|
|
|
|
+ dto.setProvinceName("新疆维吾尔自治区");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (!dto.getProvinceName().endsWith("省")) {
|
|
|
|
|
+ dto.setProvinceName(dto.getProvinceName() + "省");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
List<DictProvinceRegionBO> provinceList = dictProvinceRegionBOS.stream()
|
|
List<DictProvinceRegionBO> provinceList = dictProvinceRegionBOS.stream()
|
|
|
- .filter(dictProvinceRegionBO -> dictProvinceRegionBO.getName().equals(rowData.get(2)))
|
|
|
|
|
|
|
+ .filter(dictProvinceRegionBO -> dictProvinceRegionBO.getName().equals(dto.getProvinceName()))
|
|
|
.toList();
|
|
.toList();
|
|
|
if (CollUtil.isEmpty(provinceList)) {
|
|
if (CollUtil.isEmpty(provinceList)) {
|
|
|
- throw new BusinessException(rowData.get(2)+"省份不存在,导入失败");
|
|
|
|
|
|
|
+ throw new BusinessException(rowData.get(0)+"省份不存在,导入失败");
|
|
|
}
|
|
}
|
|
|
dto.setProvinceId(provinceList.getFirst().getId());
|
|
dto.setProvinceId(provinceList.getFirst().getId());
|
|
|
if (rowData.get(3) == null) {
|
|
if (rowData.get(3) == null) {
|
|
|
- throw new BusinessException("城市不能为空");
|
|
|
|
|
|
|
+ throw new BusinessException(rowData.get(0)+"城市不能为空");
|
|
|
}
|
|
}
|
|
|
dto.setCityName((String) rowData.get(3));
|
|
dto.setCityName((String) rowData.get(3));
|
|
|
|
|
+ if (dto.getProvinceName().startsWith("北京") ||
|
|
|
|
|
+ dto.getProvinceName().startsWith("天津") ||
|
|
|
|
|
+ dto.getProvinceName().startsWith("上海") ||
|
|
|
|
|
+ dto.getProvinceName().startsWith("重庆")) {
|
|
|
|
|
+ if(!dto.getCityName().endsWith("区")){
|
|
|
|
|
+ dto.setCityName(dto.getCityName() + "区");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
List<DictCityRegionBO> cityList = dictCityRegionBOS.stream()
|
|
List<DictCityRegionBO> cityList = dictCityRegionBOS.stream()
|
|
|
- .filter(dictCityRegionBO -> dictCityRegionBO.getName().equals(rowData.get(3)))
|
|
|
|
|
|
|
+ .filter(dictCityRegionBO -> dictCityRegionBO.getName().equals(dto.getCityName()))
|
|
|
.toList();
|
|
.toList();
|
|
|
if (CollUtil.isEmpty(cityList)) {
|
|
if (CollUtil.isEmpty(cityList)) {
|
|
|
- throw new BusinessException(rowData.get(3)+"城市不存在,导入失败");
|
|
|
|
|
|
|
+ throw new BusinessException(rowData.get(0)+"城市不存在,导入失败");
|
|
|
}
|
|
}
|
|
|
dto.setCityId(cityList.getFirst().getId());
|
|
dto.setCityId(cityList.getFirst().getId());
|
|
|
|
|
|