Commit bccc81cf by zhiwj

批量导入

parent 025e050a
package com.gic.store.constant;
/**
* @author zhiwj
* @date 2019/7/4
*/
public interface Constants {
String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq";
// String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0";
Integer STORE_BATCH_IMPORT_TASK_TYPE = 5;
}
......@@ -32,4 +32,6 @@ public interface StoreImportApiService {
ServiceResponse<String> isExistStoreGroup(Integer enterpriseId, String storeGroupName);
ServiceResponse<List<String>> listBrandByNotExist(Integer enterpriseId, String brands);
// List<StoreTmpDTO> listStoreTmp(Integer enterpriseId, Boolean isSuccess, Boolean isWait);
}
......@@ -133,8 +133,8 @@ public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implem
if (erpStatusResponse.isSuccess()) {
List<StoreDictDTO> erpList = erpStatusResponse.getResult();
final String erpStatusTmp = t.getErpStatus().replace("\\s+", "");
Optional<StoreDictDTO> erpStatusDTO = erpList.stream().filter(e -> e.getValue().equals(erpStatusTmp)).findFirst();
storeDTO.setErpStatus(Integer.parseInt(erpStatusDTO.get().getKey()));
Optional<StoreDictDTO> erpStatusDTO = erpList.stream().filter(e -> e.getKey().equals(erpStatusTmp)).findFirst();
storeDTO.setErpStatus(Integer.parseInt(erpStatusDTO.get().getValue()));
} else {
logger.warn("字典模块调用失败");
}
......@@ -143,8 +143,8 @@ public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implem
if (storeTypeResponse.isSuccess()) {
List<StoreDictDTO> typeList = storeTypeResponse.getResult();
final String typeTmp = t.getStoreType().replace("\\s+", "");
Optional<StoreDictDTO> typeTmpDTO = typeList.stream().filter(e -> e.getValue().equals(typeTmp)).findFirst();
storeDTO.setStoreType(Integer.parseInt(typeTmpDTO.get().getKey()));
Optional<StoreDictDTO> typeTmpDTO = typeList.stream().filter(e -> e.getKey().equals(typeTmp)).findFirst();
storeDTO.setStoreType(Integer.parseInt(typeTmpDTO.get().getValue()));
} else {
logger.warn("字典模块调用失败");
}
......
......@@ -34,9 +34,6 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
private StoreBrandService storeBrandService;
@Autowired
private StoreApiService storeApiService;
@Autowired
private StoreService storeService;
@Autowired
......@@ -46,12 +43,6 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
private StoreGroupService storeGroupService;
@Autowired
private ProvincesApiService provincesApiService;
@Autowired
private StoreDictApiService storeDictApiService;
@Autowired
private StoreTaskService storeTaskService;
@Override
......@@ -118,4 +109,14 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
}
return ServiceResponse.failure(ErrorCode.ERR_3.getCode(), "队列错误");
}
// @Autowired
// TabStoreTmpMapper tabStoreTmpMapper;
//
// @Override
// public List<StoreTmpDTO> listStoreTmp(Integer enterpriseId, Boolean isSuccess, Boolean isWait) {
// return EntityUtil.changeEntityListByOrika(StoreTmpDTO.class, tabStoreTmpMapper.listStoreTmp(enterpriseId, isSuccess, isWait));
// }
}
......@@ -95,7 +95,7 @@ public class StoreImportController {
@RequestMapping("/store-tmp-file-upload")
public RestResponse fileUpload(HttpServletRequest request, MultipartFile file, PageQO pageQO) throws IOException {
Integer enterpriseId = 10000;
Integer enterpriseId = 1111;
if (file == null || file.isEmpty()) {
return RestResponse.failure(ErrorCode.ERR_5.getCode(), "文件不存在");
}
......@@ -223,12 +223,13 @@ public class StoreImportController {
validate = false;
}
}
if (validate) {
if (this.storeTypeValidate(enterpriseId, storeType) == -1) {
bean.setErrorMessage("门店类型不存在");
validate = false;
}
}
// todo
// if (validate) {
// if (this.storeTypeValidate(enterpriseId, storeType) == -1) {
// bean.setErrorMessage("门店类型不存在");
// validate = false;
// }
// }
// 验证门店状态
String erpStatus = row.get(4);
bean.setErpStatus(erpStatus);
......@@ -238,12 +239,13 @@ public class StoreImportController {
validate = false;
}
}
if (validate) {
if (this.erpStatusValidate(enterpriseId, erpStatus) == -1) {
bean.setErrorMessage("门店状态不存在");
validate = false;
}
}
//todo
// if (validate) {
// if (this.erpStatusValidate(enterpriseId, erpStatus) == -1) {
// bean.setErrorMessage("门店状态不存在");
// validate = false;
// }
// }
// 验证门店电话
String conactsPhone = row.get(5);
bean.setConactsPhone(conactsPhone);
......@@ -364,7 +366,7 @@ public class StoreImportController {
if (serviceResponse.isSuccess()) {
List<StoreDictDTO> list = serviceResponse.getResult();
final String erpStatusTmp = erpStatus.replace("\\s+", "");
long count = list.stream().filter(e -> e.getValue().equals(erpStatusTmp)).count();
long count = list.stream().filter(e -> e.getKey().equals(erpStatusTmp)).count();
if (count > 0) {
return (int)count;
}
......@@ -377,7 +379,7 @@ public class StoreImportController {
if (serviceResponse.isSuccess()) {
List<StoreDictDTO> list = serviceResponse.getResult();
final String storeTypeTmp = storeType.replace("\\s+", "");
long count = list.stream().filter(e -> e.getValue().equals(storeTypeTmp)).count();
long count = list.stream().filter(e -> e.getKey().equals(storeTypeTmp)).count();
if (count > 0) {
return (int)count;
}
......@@ -394,10 +396,16 @@ public class StoreImportController {
XSSFSheet sheet = workbook.getSheetAt(0);
XSSFRow row = sheet.getRow(0);
XSSFCell cell = row.getCell(0);
String regionId = cell.getStringCellValue();
ServiceResponse<StoreRegionDTO> serviceResponse = storeRegionApiService.getStoreRegionByRegion(enterpriseId, Integer.parseInt(regionId));
ServiceResponse<StoreRegionDTO> serviceResponse = storeRegionApiService.getStoreRegionByRegion(enterpriseId, (int) cell.getNumericCellValue());
return serviceResponse.isSuccess() ? serviceResponse.getResult() : null;
}
// @RequestMapping("/test")
// public Object re() {
// List<StoreTmpDTO> storeTmpDTOS = storeImportApiService.listStoreTmp(1111, null, true);
// System.out.println(storeTmpDTOS);
// return null;
// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment