Commit a17d9005 by fudahua

会员标签同步-更新门店名称

parent 0afda885
......@@ -80,4 +80,12 @@ public interface TabHaobanStoreRelationMapper {
* @return
*/
List<String> listStoreIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
/**
* 更新门店名称
*
* @param enterpriseId
* @return
*/
public int updateStoreName(@Param("enterpriseId") String enterpriseId, @Param("storeId") String storeId, @Param("storeName") String storeName);
}
\ No newline at end of file
......@@ -23,10 +23,31 @@ public class StoreSyncPojo extends BinlogBasePojo {
@JSONField(name = "enterprise_id")
private String enterpriseId;
@JSONField(name = "store_name")
private String storeName;
private String oldStoreName;
private Integer status;
private Integer oldStatus;
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getOldStoreName() {
return oldStoreName;
}
public void setOldStoreName(String oldStoreName) {
this.oldStoreName = oldStoreName;
}
public String getOldStoreGroupId() {
return oldStoreGroupId;
}
......
......@@ -96,5 +96,13 @@ public interface StoreRangeService {
*/
public List<String> listStoreIdByWxEnterpriseId(String wxEnterpriseId, String enterpriseId);
/**
* 更新门店名称
*
* @param enterpriseId
* @param storeId
* @param storeName
*/
public void updatwStoreName(String enterpriseId, String storeId, String storeName);
}
......@@ -262,4 +262,9 @@ public class StoreRangeServiceImpl implements StoreRangeService {
public List<String> listStoreIdByWxEnterpriseId(String wxEnterpriseId, String enterpriseId) {
return tabHaobanStoreRelationMapper.listStoreIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
}
@Override
public void updatwStoreName(String enterpriseId, String storeId, String storeName) {
tabHaobanStoreRelationMapper.updateStoreName(enterpriseId, storeId, storeName);
}
}
......@@ -207,6 +207,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
&& recordType.equals(GicRecordType.UPDATE)
&& !mid.containsKey("oldStoreGroupId")) {
mid.put("oldStoreGroupId", gicField.getValue());
} else if (gicField.getName().equals("store_name")
&& recordType.equals(GicRecordType.UPDATE)
&& !mid.containsKey("oldStoreName")) {
mid.put("oldStoreName", gicField.getValue());
}else {
mid.put(gicField.getName(), gicField.getValue());
}
......@@ -223,6 +227,13 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
* @param syncPojo
*/
private void dealStore(StoreSyncPojo syncPojo) {
if (syncPojo.getRecordType() == GicRecordType.UPDATE.value()
&& (!syncPojo.getStoreName().equals(syncPojo.getOldStoreName()))) {
logger.info("门店名称变更:{}", JSONObject.toJSONString(syncPojo));
storeRangeService.updatwStoreName(syncPojo.getEnterpriseId(), syncPojo.getStoreId(), syncPojo.getStoreName());
}
//门店状态变更 包括删除
if (syncPojo.getRecordType() == GicRecordType.UPDATE.value()
&& (!syncPojo.getStatus().equals(syncPojo.getOldStatus()))) {
......
......@@ -208,4 +208,14 @@
</foreach>
and status_flag=1
</update>
<update id="updateStoreName">
update tab_haoban_store_relation
set
store_name = #{storeName},
update_time = now()
where enterprise_id=#{enterpriseId}
and store_id=#{storeId}
and status_flag=1
</update>
</mapper>
\ No newline at end of file
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