Commit d8be9485 by 陶光胜

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-store into developer

parents 51a771f7 65ef6181
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;
}
......@@ -66,6 +66,11 @@ public class StoreStrategyDTO implements Serializable{
private Double sort;
/**
* 策略类型,1门店状态策略时候,可以多选,门店创建方式,1:后台新增 2:批量导入 3:订单生成 4:erp同步,可以多选 _1_2_格式
*/
private String storeCreateType;
/**
* 排序值
*/
private Integer seq;
......@@ -165,4 +170,12 @@ public class StoreStrategyDTO implements Serializable{
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getStoreCreateType() {
return storeCreateType;
}
public void setStoreCreateType(String storeCreateType) {
this.storeCreateType = storeCreateType;
}
}
......@@ -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);
}
package com.gic.store.dao.mapper;
import com.gic.store.entity.TabStoreGroupStrategyWeights;
public interface TabStoreGroupStrategyWeightsMapper {
/**
* 根据主键删除
*
* @param weightsId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer weightsId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabStoreGroupStrategyWeights record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabStoreGroupStrategyWeights record);
/**
* 根据主键查询
*
* @param weightsId 主键
* @return 实体对象
*/
TabStoreGroupStrategyWeights selectByPrimaryKey(Integer weightsId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabStoreGroupStrategyWeights record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabStoreGroupStrategyWeights record);
/**
* 查询
* @param record
* @return
*/
TabStoreGroupStrategyWeights selectByPrimary(TabStoreGroupStrategyWeights record);
}
\ No newline at end of file
......@@ -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
package com.gic.store.entity;
import java.util.Date;
/**
* tab_store_group_strategy_weights
*/
public class TabStoreGroupStrategyWeights {
/**
*
*/
private Integer weightsId;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 人为操作填写过门店分组后,门店资料更新不再执行快捷分组策略 1开启 0不开启
*/
private Integer status;
/**
*
*/
private Integer enterpriseId;
public Integer getWeightsId() {
return weightsId;
}
public void setWeightsId(Integer weightsId) {
this.weightsId = weightsId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
}
\ No newline at end of file
......@@ -61,6 +61,11 @@ public class TabStoreStrategy {
*/
private Double sort;
/**
* 策略类型,1门店状态策略时候,可以多选,门店创建方式,1:后台新增 2:批量导入 3:订单生成 4:erp同步,可以多选 _1_2_格式
*/
private String storeCreateType;
public Integer getStrategyId() {
return strategyId;
}
......@@ -148,4 +153,12 @@ public class TabStoreStrategy {
public void setSort(Double sort) {
this.sort = sort;
}
public String getStoreCreateType() {
return storeCreateType;
}
public void setStoreCreateType(String storeCreateType) {
this.storeCreateType = storeCreateType;
}
}
\ 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));
// }
}
......@@ -5,6 +5,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.redis.data.util.RedisUtil;
import com.gic.store.constant.StoreGroupConstant;
import com.gic.store.dto.StoreStrategyDTO;
import com.gic.store.entity.TabStoreStrategy;
import com.gic.store.service.StoreStrategyApiService;
......@@ -41,6 +42,16 @@ public class StoreStrategyApiServiceImpl implements StoreStrategyApiService{
if (StringUtils.isBlank(storeStrategyDTO.getTargetValue())) {
return ServiceResponse.failure(ErrorCode.ERR_5.getCode(), "策略命中值不能为空");
}
if (storeStrategyDTO.getStrategyType() == null) {
return ServiceResponse.failure(ErrorCode.ERR_5.getCode(), "策略类型不能为空");
}
if (storeStrategyDTO.getStrategyType() == StoreGroupConstant.STORE_STRATEGY_TYPE) {
//如果是门店状态策略类型,必须有
if (StringUtils.isBlank(storeStrategyDTO.getStoreCreateType())) {
return ServiceResponse.failure(ErrorCode.ERR_5.getCode(), "门店创建方式不能为空");
}
}
storeStrategyDTO.setCreateTime(new Date());
storeStrategyDTO.setUpdateTime(new Date());
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.store.dao.mapper.TabStoreGroupStrategyWeightsMapper">
<resultMap id="BaseResultMap" type="com.gic.store.entity.TabStoreGroupStrategyWeights">
<id column="weights_id" jdbcType="INTEGER" property="weightsId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
</resultMap>
<sql id="Base_Column_List">
weights_id, create_time, update_time, status, enterprise_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_store_group_strategy_weights
where weights_id = #{weightsId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_store_group_strategy_weights
where weights_id = #{weightsId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.store.entity.TabStoreGroupStrategyWeights">
insert into tab_store_group_strategy_weights (weights_id, create_time, update_time,
status, enterprise_id)
values (#{weightsId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.store.entity.TabStoreGroupStrategyWeights">
insert into tab_store_group_strategy_weights
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="weightsId != null">
weights_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="weightsId != null">
#{weightsId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.store.entity.TabStoreGroupStrategyWeights">
update tab_store_group_strategy_weights
<set>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
</set>
where weights_id = #{weightsId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.store.entity.TabStoreGroupStrategyWeights">
update tab_store_group_strategy_weights
set create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
enterprise_id = #{enterpriseId,jdbcType=INTEGER}
where weights_id = #{weightsId,jdbcType=INTEGER}
</update>
<select id="selectByPrimary" parameterType="com.gic.store.entity.TabStoreGroupStrategyWeights" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_store_group_strategy_weights
where 1 = 1
<if test="weightsId != null">
and weights_id = #{weightsId}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="enterpriseId != null">
and enterprise_id = #{enterpriseId}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -13,10 +13,11 @@
<result column="status" jdbcType="INTEGER" property="status" />
<result column="strategy_type" jdbcType="INTEGER" property="strategyType" />
<result column="sort" jdbcType="DOUBLE" property="sort" />
<result column="store_create_type" jdbcType="VARCHAR" property="storeCreateType" />
</resultMap>
<sql id="Base_Column_List">
strategy_id, strategy_name, enterprise_id, store_region_id, condition, target_value,
create_time, update_time, status, strategy_type, sort
create_time, update_time, status, strategy_type, sort, store_create_type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -32,11 +33,11 @@
insert into tab_store_strategy (strategy_id, strategy_name, enterprise_id,
store_region_id, condition, target_value,
create_time, update_time, status,
strategy_type, sort)
strategy_type, sort, store_create_type)
values (#{strategyId,jdbcType=INTEGER}, #{strategyName,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=INTEGER},
#{storeRegionId,jdbcType=INTEGER}, #{condition,jdbcType=VARCHAR}, #{targetValue,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER},
#{strategyType,jdbcType=INTEGER}, #{sort,jdbcType=DOUBLE})
#{strategyType,jdbcType=INTEGER}, #{sort,jdbcType=DOUBLE}, #{storeCreateType,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.gic.store.entity.TabStoreStrategy">
insert into tab_store_strategy
......@@ -74,6 +75,9 @@
<if test="sort != null">
sort,
</if>
<if test="storeCreateType != null">
store_create_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="strategyId != null">
......@@ -109,6 +113,9 @@
<if test="sort != null">
#{sort,jdbcType=DOUBLE},
</if>
<if test="storeCreateType != null">
#{storeCreateType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.store.entity.TabStoreStrategy">
......@@ -144,6 +151,9 @@
<if test="sort != null">
sort = #{sort,jdbcType=DOUBLE},
</if>
<if test="storeCreateType != null">
store_create_type = #{storeCreateType,jdbcType=VARCHAR},
</if>
</set>
where strategy_id = #{strategyId,jdbcType=INTEGER}
</update>
......@@ -158,7 +168,8 @@
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
strategy_type = #{strategyType,jdbcType=INTEGER},
sort = #{sort,jdbcType=DOUBLE}
sort = #{sort,jdbcType=DOUBLE},
store_create_type = #{storeCreateType,jdbcType=VARCHAR}
where strategy_id = #{strategyId,jdbcType=INTEGER}
</update>
......
......@@ -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
......@@ -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;
// }
}
......@@ -111,9 +111,9 @@ public class StoreStrategyController {
}
@RequestMapping("/list-store-strategy")
public RestResponse listStoreStrategy(String search, PageQO pageQO) {
public RestResponse listStoreStrategy(String search, PageQO pageQO, @Validated({StoreStrategyQO.StoreStrategyTypeValidView.class}) StoreStrategyQO storeStrategyQO) {
ServiceResponse<Page<StoreStrategyDTO>> result = storeStrategyApiService.listStoreField(StoreGroupConstant.TEST_ENTERPRISE_ID
, search, StoreGroupConstant.STORE_GROUP_STRATEGY_TYPE, pageQO.getCurrentPage(), pageQO.getPageSize());
, search, storeStrategyQO.getStrategyType(), pageQO.getCurrentPage(), pageQO.getPageSize());
if (result.isSuccess()) {
Page<StoreStrategyDTO> resultPage = result.getResult();
Page<StoreGroupStrateVO> voPage = EntityUtil.changeEntityNew(Page.class, resultPage);
......
......@@ -95,6 +95,11 @@ public class StoreStrategyQO implements Serializable{
private Double sort;
/**
* 策略类型,1门店状态策略时候,可以多选,门店创建方式,1:后台新增 2:批量导入 3:订单生成 4:erp同步,可以多选 _1_2_格式
*/
private String storeCreateType;
/**
* 排序值
*/
private Integer seq;
......@@ -225,4 +230,8 @@ public class StoreStrategyQO implements Serializable{
public void setSortValue(Integer sortValue) {
this.sortValue = sortValue;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
}
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