Commit 6ee0e62d by zhiwj

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

parents b69eb932 15204a23
......@@ -211,4 +211,14 @@ public interface ClerkApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> syncClerkToWeimob(Integer wmMallStoreId, String clerkIds, Integer enterpriseId);
/**
* @Title: syncClerkToWeimobWhenModify

* @Description: 导购增改时同步微盟任务

* @author guojuxing
* @param param

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> syncClerkToWeimobWhenModify(String param);
}
......@@ -7,9 +7,11 @@ import com.gic.commons.util.CollectionUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.dto.wm.WmStoreSyncLogDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.enterprise.service.WmStoreSyncLogApiService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.store.constant.ClerkLogReasonEnum;
import com.gic.store.constant.ImportClerkBatchResultEnum;
......@@ -62,6 +64,8 @@ public class ClerkApiServiceImpl implements ClerkApiService {
private EnterpriseApiService enterpriseApiService;
@Autowired
private WeimobStoreSiteService weimobStoreSiteService;
@Autowired
private WmStoreSyncLogApiService wmStoreSyncLogApiService;
@Override
public ServiceResponse saveOrUpdate(ClerkDTO clerkDTO) {
......@@ -112,12 +116,16 @@ public class ClerkApiServiceImpl implements ClerkApiService {
clerkLogService.saveClerkLogBySaveClerk(clerkDTO.getEnterpriseId(), id, clerkDTO.getReason(),
clerkDTO.getRemark(), clerkDTO.getOperatorId(), clerkDTO.getOperatorName());
storeLogByAddClerk(clerkDTO);
synClerkInfoToWeimobMQ(clerkDTO);
} else {
TabClerk oldClerk = this.clerkService.getById(clerkDTO.getClerkId());
clerkService.update(clerkDTO);
clerkLogService.saveClerkLogByUpdateClerk(oldClerk, clerkDTO, clerkDTO.getEnterpriseId(),
clerkDTO.getClerkId(), clerkDTO.getReason(), clerkDTO.getRemark(), clerkDTO.getOperatorId(),
clerkDTO.getOperatorName());
synClerkInfoToWeimobMQ(clerkDTO);
}
return ServiceResponse.success(clerkDTO.getClerkId());
}
......@@ -744,6 +752,49 @@ public class ClerkApiServiceImpl implements ClerkApiService {
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> syncClerkToWeimobWhenModify(String param) {
JSONObject jsonObject = JSONObject.parseObject(param);
String clerkInfo = jsonObject.getString("clerkInfo");
ClerkDTO clerkDTO = JSONObject.parseObject(clerkInfo, ClerkDTO.class);
ServiceResponse<StoreDTO> storeResult = storeApiService
.getStoreByStoreInfoId(clerkDTO.getEnterpriseId(), clerkDTO.getStoreInfoId());
if (storeResult.isSuccess()) {
StoreDTO storeDTO = storeResult.getResult();
ServiceResponse<List<WmStoreSyncLogDTO>> wmStoreListResult = wmStoreSyncLogApiService
.listByStoreId(storeDTO.getStoreId(), storeDTO.getEnterpriseId());
if (wmStoreListResult.isSuccess()) {
WeimobGuiderSynDTO weimobGuiderSynDTO = new WeimobGuiderSynDTO();
weimobGuiderSynDTO.setStoreNumber(storeDTO.getStoreCode());
weimobGuiderSynDTO.setClerkId(clerkDTO.getClerkId());
weimobGuiderSynDTO.setGuiderName(clerkDTO.getClerkName());
weimobGuiderSynDTO.setGuiderPhone(clerkDTO.getPhoneNumber());
weimobGuiderSynDTO.setJobNumber(clerkDTO.getClerkCode());
weimobGuiderSynDTO.setStoreInfoId(clerkDTO.getStoreInfoId());
List<WmStoreSyncLogDTO> wmStoreLog = wmStoreListResult.getResult();
wmStoreLog.forEach(storeLog -> {
ServiceResponse<Boolean> isExitClerkResult = weimobStoreSiteService
.isExitClerk(storeLog.getWmMallStoreId(), clerkDTO.getPhoneNumber());
if (isExitClerkResult.isSuccess()) {
ServiceResponse<Void> weimobResult;
if (isExitClerkResult.getResult()) {
//如果存在了,则是更新操作
weimobResult = weimobStoreSiteService
.updateWeimobGuider(storeLog.getWmMallStoreId(), storeLog.getEnterpriseId(), weimobGuiderSynDTO);
} else {
//新增操作
weimobResult = weimobStoreSiteService
.addWeimobGuider(storeLog.getWmMallStoreId(), storeLog.getEnterpriseId(), weimobGuiderSynDTO);
}
logger.warn("导购增改微盟返回结果:{}", JSONObject.toJSONString(weimobResult));
}
});
}
}
return ServiceResponse.success();
}
private void asynClerkInfoToWeimobMQ(Integer wmMallStoreId, Integer enterpriseId, WeimobGuiderSynDTO wmGuiderDTO) {
GicMQClient client = GICMQClientUtil.getClientInstance();
Map<String, Object> params = new HashMap<>(4);
......@@ -764,4 +815,17 @@ public class ClerkApiServiceImpl implements ClerkApiService {
return ServiceResponse.failure(error.getCode(), error.toString());
}
private void synClerkInfoToWeimobMQ(ClerkDTO powerClerkDTO) {
GicMQClient client = GICMQClientUtil.getClientInstance();
Map<String, Object> params = new HashMap<>(4);
params.put("clerkInfo", JSONObject.toJSONString(powerClerkDTO));
try {
logger.info("导购增改微盟参数:{}", JSONObject.toJSONString(params));
client.sendMessage("synClerkInfoToWeimobMq", JSONObject.toJSONString(params));
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
......@@ -34,6 +34,10 @@
</sql>
<sql id="Base_Column_List_Enterprise">
a.store_field_id, a.store_field_name, a.store_field_code, a.store_field_type, b.enterprise_id,
a.status, a.create_time, a.update_time, a.store_field_detail, a.erp_rel_code, a.sort, b.own_type
</sql>
<sql id="Base_Column_List_Field">
a.store_field_id, a.store_field_name, a.store_field_code, a.store_field_type, b.enterprise_id,
a.status, a.create_time, a.update_time, a.store_field_detail, a.erp_rel_code, a.sort, b.own_type,c.region_id
</sql>
<sql id="Base_Column_List_Region">
......@@ -234,7 +238,7 @@
<select id="listStoreField" resultMap="BaseResultMap_Dto">
select
<include refid="Base_Column_List_Enterprise" />
<include refid="Base_Column_List_Field" />
from tab_store_field a
left join tab_store_field_rel b
on a.store_field_id = b.store_field_id
......
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