Commit c3d1df13 by guojuxing

批量重新同步门店

parent 70c684e0
......@@ -30,12 +30,12 @@ public class WmStoreSyncLogDTO implements Serializable{
/**
*
*/
private String storeId;
private Integer storeId;
/**
* 1:总店 2:门店同步(实体)
*/
private Integer type;
private Integer storeType;
/**
* 门店名称
......@@ -89,21 +89,21 @@ public class WmStoreSyncLogDTO implements Serializable{
return this;
}
public String getStoreId() {
public Integer getStoreId() {
return storeId;
}
public WmStoreSyncLogDTO setStoreId(String storeId) {
public WmStoreSyncLogDTO setStoreId(Integer storeId) {
this.storeId = storeId;
return this;
}
public Integer getType() {
return type;
public Integer getStoreType() {
return storeType;
}
public WmStoreSyncLogDTO setType(Integer type) {
this.type = type;
public WmStoreSyncLogDTO setStoreType(Integer storeType) {
this.storeType = storeType;
return this;
}
......
......@@ -69,4 +69,6 @@ public interface WmStoreSyncLogApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.enterprise.dto.wm.WmStoreSyncLogDTO>>


*/
ServiceResponse<List<WmStoreSyncLogDTO>> listByStoreId(Integer storeId, Integer enterpriseId);
ServiceResponse<List<WmStoreSyncLogDTO>> listByStoreId(List<Integer> storeIdList, Integer wmMallStoreId);
}
......@@ -62,4 +62,6 @@ public interface TabWmStoreSyncLogMapper {
int deleteLogic(@Param("storeId") Integer storeId, @Param("wmMallStoreId") Integer wmMallStoreId);
List<TabWmStoreSyncLog> listByStoreId(@Param("storeId") Integer storeId, @Param("enterpriseId") Integer enterpriseId);
List<TabWmStoreSyncLog> listByStoreIdList(@Param("storeIdList") List<Integer> storeIdList,@Param("wmMallStoreId") Integer wmMallStoreId);
}
\ No newline at end of file
......@@ -19,4 +19,6 @@ public interface WmStoreSyncLogService {
int deleteLogic(Integer storeId, Integer wmMallStoreId);
List<TabWmStoreSyncLog> listByStoreId(Integer storeId, Integer enterpriseId);
List<TabWmStoreSyncLog> listByStoreId(List<Integer> storeIdList, Integer wmMallStoreId);
}
......@@ -56,4 +56,9 @@ public class WmStoreSyncLogServiceImpl implements WmStoreSyncLogService {
public List<TabWmStoreSyncLog> listByStoreId(Integer storeId, Integer enterpriseId) {
return tabWmStoreSyncLogMapper.listByStoreId(storeId, enterpriseId);
}
@Override
public List<TabWmStoreSyncLog> listByStoreId(List<Integer> storeIdList, Integer wmMallStoreId) {
return tabWmStoreSyncLogMapper.listByStoreIdList(storeIdList, wmMallStoreId);
}
}
......@@ -80,4 +80,13 @@ public class WmStoreSyncLogApiServiceImpl implements WmStoreSyncLogApiService {
}
return ServiceResponse.success(EntityUtil.changeEntityListNew(WmStoreSyncLogDTO.class, list));
}
@Override
public ServiceResponse<List<WmStoreSyncLogDTO>> listByStoreId(List<Integer> storeIdList, Integer wmMallStoreId) {
List<TabWmStoreSyncLog> list = wmStoreSyncLogService.listByStoreId(storeIdList, wmMallStoreId);
if (CollectionUtils.isEmpty(list)) {
return ServiceResponse.success(Collections.emptyList());
}
return ServiceResponse.success(EntityUtil.changeEntityListNew(WmStoreSyncLogDTO.class, list));
}
}
......@@ -193,4 +193,15 @@
and enterprise_id = #{enterpriseId}
group by wm_mall_store_id
</select>
<select id="listByStoreIdList" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_wm_store_sync_log
where status = 1
and store_id in
<foreach collection="storeIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and wm_mall_store_id = #{wmMallStoreId}
</select>
</mapper>
\ No newline at end of file
......@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dto.wm.WmStoreSyncLogDTO;
import com.gic.enterprise.web.vo.wm.WmBranchVO;
import com.gic.weimob.api.dto.WeimobGuiderSynDTO;
import com.gic.weimob.api.dto.WeimobStoreGicInfoDTO;
......@@ -205,7 +206,7 @@ public class WmStoreSyncController {
wmStoreSyncLogApiService.saveWmStoreSyncLog(Arrays.asList(headStoreId), wmMallStoreId, 1, enterpriseId);
//同步导购
List<Integer> storeIdList = new ArrayList<>();
if (isBranch) {
if (!isBranch) {
storeIdList.add(headStoreId);
}
storeIdList.addAll(getListByStr(storeIds));
......@@ -289,6 +290,40 @@ public class WmStoreSyncController {
}
/**
* 批量重新同步门店
* @param storeInfoIds
* @param wmMallStoreId
* @return
*/
@RequestMapping("/sync-store-to-wm-again")
public RestResponse syncStoreToWmAgain(String storeInfoIds, Integer wmMallStoreId) {
//区分是一对一还是总店
List<StoreDTO> storeList = getStoreList(storeInfoIds, true);
if (CollectionUtils.isNotEmpty(storeList)) {
List<Integer> storeIdList = storeList.stream().map(e -> e.getStoreId()).collect(Collectors.toList());
ServiceResponse<List<WmStoreSyncLogDTO>> wmStoreLogResult = wmStoreSyncLogApiService.listByStoreId(storeIdList, wmMallStoreId);
if (wmStoreLogResult.isSuccess()) {
List<WmStoreSyncLogDTO> wmStoreLogList = wmStoreLogResult.getResult();
List<Integer> headStoreIdList = wmStoreLogList
.stream()
.filter(e -> e.getStoreType().intValue() == 1)
.map(e -> e.getStoreId())
.collect(Collectors.toList());
//同步总店
headStoreIdList.forEach(head -> {
LOGGER.info("批量重新同步门店(总店):{}", JSON.toJSONString(syncHeadStore(wmMallStoreId, head, null, false)));
});
StringBuilder storeIds = new StringBuilder();
wmStoreLogList.stream().filter(e -> e.getStoreType().intValue() == 2)
.map(e -> e.getStoreId())
.forEach(storeId -> storeIds.append(storeId).append(","));
LOGGER.info("批量重新同步门店(一对一):{}", JSON.toJSONString(weimobInitStore(wmMallStoreId, storeIds.toString())));
}
}
return RestResponse.success();
}
/**
* 门店错误日志-不处理
* @Title: deleteStoreClerkErrorLog

* @Description:
......
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