Commit 61a1a95e by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents e2556f29 cb185b9d
package com.gic.store.constant;
/**
* @author zhiwj
* @date 2019/7/4
*/
public interface Constants {
String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4";
// String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0";
Integer STORE_BATCH_IMPORT_TASK_TYPE = 6;
}
......@@ -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);
}
......@@ -58,5 +58,7 @@ public interface TabStoreTmpMapper {
void delStoreTmp(@Param("enterpriseId") Integer enterpriseId);
List<TabStoreTmp> listStoreTmp(@Param("enterpriseId") Integer enterpriseId, @Param("isSuccess") Boolean isSuccess, @Param("isWait") Boolean isWait);
List<TabStoreTmp> listStoreTmp(@Param("enterpriseId") Integer enterpriseId, @Param("isSuccess") Boolean isSuccess);
List<TabStoreTmp> listUnImportStore(@Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
......@@ -43,12 +43,12 @@ public class StoreImportServiceImpl implements StoreImportService {
@Override
public Page listStoreTmp(Integer enterpriseId, boolean isSuccess, Integer currentPage, Integer pageSize) {
PageHelper.startPage(currentPage, pageSize);
return (Page) tabStoreTmpMapper.listStoreTmp(enterpriseId, isSuccess, null);
return (Page) tabStoreTmpMapper.listStoreTmp(enterpriseId, isSuccess);
}
@Override
public List<TabStoreTmp> listUnImportStore(String enterpriseId) {
return tabStoreTmpMapper.listStoreTmp(Integer.parseInt(enterpriseId), null, true);
return tabStoreTmpMapper.listUnImportStore(Integer.parseInt(enterpriseId));
}
@Override
......
......@@ -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));
// }
}
......@@ -327,14 +327,18 @@
<include refid="Base_Column_List" />
from tab_store_tmp
where enterprise_id = #{enterpriseId}
<if test="isSuccess != null and isSuccess">
<if test="isSuccess != null and isSuccess == true ">
and error_message = 'success'
</if>
<if test="isSuccess != null and !isSuccess">
<if test="isSuccess != null and isSuccess == false ">
and error_message &lt;&gt; 'success' and error_message &lt;&gt; 'wait'
</if>
<if test="isWait != null and isWait">
and error_message = 'wait'
</if>
</select>
<select id="listUnImportStore" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_store_tmp
where enterprise_id = #{enterpriseId}
and error_message = 'wait'
</select>
</mapper>
\ No newline at end of file
......@@ -21,6 +21,7 @@
<libraryVersion>4.0-SNAPSHOT</libraryVersion>
<!-- api依赖,正式版会在 gic-pom-base 里生成 -->
<gic-store-api>4.0-SNAPSHOT</gic-store-api>
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
</properties>
<dependencies>
......@@ -107,6 +108,11 @@
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>com.gic </groupId>
<artifactId>gic-redis-data </artifactId>
<version>${gic-redis-data} </version>
</dependency>
</dependencies>
<build>
......
......@@ -3,6 +3,9 @@ package com.gic.store.web;
import com.gic.dubbo.util.DubboContextUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ImportResource;
......@@ -11,12 +14,20 @@ import org.springframework.context.annotation.ImportResource;
*
* @author zhurz
*/
@SpringBootApplication
@SpringBootApplication(
scanBasePackages = "com.gic",
exclude = {
RedisAutoConfiguration.class,
RedisRepositoriesAutoConfiguration.class,
QuartzAutoConfiguration.class
}
)
@ImportResource(value = {
"classpath*:applicationContext-init.xml",
"classpath*:dubbo-setting.xml",
"classpath*:dubbo-gic-store-web.xml",
"classpath*:spring-interceptor.xml"
"classpath*:spring-interceptor.xml",
"classpath*:redis-init.xml"
})
public class Main {
......
......@@ -59,7 +59,7 @@ public class StoreImportController {
if (StringUtils.isBlank(regionIdStr)) {
return RestResponse.failure(ErrorCode.ERR_5.getCode(), "请选择门店域");
}
Integer enterpriseId = 10000;
Integer enterpriseId = 1111;
List<List<String>> list = new ArrayList<>();
ServiceResponse<List<List<String>>> titleServiceResponse = storeApiService.listImportTitle(enterpriseId, Integer.parseInt(regionIdStr));
......@@ -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(), "文件不存在");
}
......@@ -140,7 +140,7 @@ public class StoreImportController {
}
try {
if (!storeImportApiService.hasImportingStore(enterpriseId).getResult()) {
if (storeImportApiService.hasImportingStore(enterpriseId).getResult()) {
// TODO userId
String r = storeImportApiService.importDataToStore(enterpriseId, "123", uuId).getResult();
if (StringUtils.isNotBlank(r)) {
......@@ -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