创建门店

This commit is contained in:
shuo.wang
2025-07-11 10:39:59 +08:00
parent 0a5ca1e4f5
commit d257c19496
9 changed files with 254 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
package com.cool.store.enums; package com.cool.store.enums;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -13,7 +14,7 @@ public enum ExtendFieldTypeEnum {
TEST_STORE_MANAGER_MOBILE("extend_field_1746670633436","店长手机号"), TEST_STORE_MANAGER_MOBILE("extend_field_1746670633436","店长手机号"),
TEST_SIGNATORY_NAME_1("extend_field_1746670645231","签约人1名称"), TEST_SIGNATORY_NAME_1("extend_field_1746670645231","签约人1名称"),
TEST_SIGNATORY_MOBILE_1("extend_field_1746670652805","签约人2手机号"), TEST_SIGNATORY_MOBILE_1("extend_field_1746670652805","签约人1手机号"),
TEST_SIGNATORY_NAME_2("extend_field_1746670671614","签约人2名称"), TEST_SIGNATORY_NAME_2("extend_field_1746670671614","签约人2名称"),
TEST_SIGNATORY_MOBILE_2("extend_field_1746670686307","签约人2手机号"), TEST_SIGNATORY_MOBILE_2("extend_field_1746670686307","签约人2手机号"),
TEST_ORDER_NAME("extend_field_1747103227333","订单小程序名称"), TEST_ORDER_NAME("extend_field_1747103227333","订单小程序名称"),
@@ -22,7 +23,7 @@ public enum ExtendFieldTypeEnum {
TEST_BRAND("extend_field_1749177175079","品牌"), TEST_BRAND("extend_field_1749177175079","品牌"),
ONLINE_STORE_MANAGER_MOBILE("extend_field_1746598536903","店长手机号"), ONLINE_STORE_MANAGER_MOBILE("extend_field_1746598536903","店长手机号"),
ONLINE_SIGNATORY_NAME_1("extend_field_1746598562255","签约人1名称"), ONLINE_SIGNATORY_NAME_1("extend_field_1746598562255","签约人1名称"),
ONLINE_SIGNATORY_MOBILE_1("extend_field_1746598570479","签约人2手机号"), ONLINE_SIGNATORY_MOBILE_1("extend_field_1746598570479","签约人1手机号"),
ONLINE_SIGNATORY_NAME_2("extend_field_1746598584139","签约人2名称"), ONLINE_SIGNATORY_NAME_2("extend_field_1746598584139","签约人2名称"),
ONLINE_SIGNATORY_MOBILE_2("extend_field_1746598594140","签约人2手机号"), ONLINE_SIGNATORY_MOBILE_2("extend_field_1746598594140","签约人2手机号"),
ONLINE_ORDER_NAME("extend_field_1746599049206","订单小程序名称"), ONLINE_ORDER_NAME("extend_field_1746599049206","订单小程序名称"),
@@ -38,7 +39,34 @@ public enum ExtendFieldTypeEnum {
this.key = key; this.key = key;
this.msg = msg; this.msg = msg;
} }
public static Map<String, ExtendFieldTypeEnum> getConfigMapByActive(String active){
Map<String, ExtendFieldTypeEnum> configMap =new HashMap<>();
switch (active){
case "online":
configMap.put(ONLINE_STORE_MANAGER_MOBILE.getMsg(),ONLINE_STORE_MANAGER_MOBILE);
configMap.put(ONLINE_SIGNATORY_NAME_1.getMsg(),ONLINE_SIGNATORY_NAME_1);
configMap.put(ONLINE_SIGNATORY_MOBILE_1.getMsg(),ONLINE_SIGNATORY_MOBILE_1);
configMap.put(ONLINE_SIGNATORY_NAME_2.getMsg(),ONLINE_SIGNATORY_NAME_2);
configMap.put(ONLINE_SIGNATORY_MOBILE_2.getMsg(),ONLINE_SIGNATORY_MOBILE_2);
configMap.put(ONLINE_ORDER_NAME.getMsg(),ONLINE_ORDER_NAME);
configMap.put(ONLINE_JOIN_MODE.getMsg(),ONLINE_JOIN_MODE);
configMap.put(ONLINE_STORE_TYPE.getMsg(),ONLINE_STORE_TYPE);
configMap.put(ONLINE_BRAND.getMsg(),ONLINE_BRAND);
break;
default:
configMap.put(TEST_STORE_MANAGER_MOBILE.getMsg(),TEST_STORE_MANAGER_MOBILE);
configMap.put(TEST_SIGNATORY_NAME_1.getMsg(),TEST_SIGNATORY_NAME_1);
configMap.put(TEST_SIGNATORY_MOBILE_1.getMsg(),TEST_SIGNATORY_MOBILE_1);
configMap.put(TEST_SIGNATORY_NAME_2.getMsg(),TEST_SIGNATORY_NAME_2);
configMap.put(TEST_SIGNATORY_MOBILE_2.getMsg(),TEST_SIGNATORY_MOBILE_2);
configMap.put(TEST_ORDER_NAME.getMsg(),TEST_ORDER_NAME);
configMap.put(TEST_JOIN_MODE.getMsg(),TEST_JOIN_MODE);
configMap.put(TEST_STORE_TYPE.getMsg(),TEST_STORE_TYPE);
configMap.put(TEST_BRAND.getMsg(),TEST_BRAND);
break;
}
return configMap;
}
public static Map<String, ExtendFieldTypeEnum> configMap(){ public static Map<String, ExtendFieldTypeEnum> configMap(){
return Arrays.stream(ExtendFieldTypeEnum.values()) return Arrays.stream(ExtendFieldTypeEnum.values())
.collect(Collectors.toMap( .collect(Collectors.toMap(

View File

@@ -15,6 +15,7 @@ public enum RocketMqTagEnum {
USER_EVENT("user_event","钉钉通讯录变更事件"), USER_EVENT("user_event","钉钉通讯录变更事件"),
DEPT_EVENT("dept_event","部门事件"), DEPT_EVENT("dept_event","部门事件"),
STORE_DING_QUEUE("store_ding_queue", "微应用钉钉消息发送"), STORE_DING_QUEUE("store_ding_queue", "微应用钉钉消息发送"),
ZXJP_CREATE_STORE("zxjp_create_store", "正新鸡排招商创建门店"),
PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步"); PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步");
; ;

View File

@@ -35,6 +35,7 @@
<result column="city_code" jdbcType="INTEGER" property="cityCode"/> <result column="city_code" jdbcType="INTEGER" property="cityCode"/>
<result column="district" jdbcType="VARCHAR" property="district"/> <result column="district" jdbcType="VARCHAR" property="district"/>
<result column="district_code" jdbcType="INTEGER" property="districtCode"/> <result column="district_code" jdbcType="INTEGER" property="districtCode"/>
<result column="manager_supervisor" jdbcType="VARCHAR" property="managerSupervisor"/>
</resultMap> </resultMap>
<sql id="allColumn"> <sql id="allColumn">
@@ -43,7 +44,7 @@
shop_code, store_num, shop_manager_user_id, supervisor_user_id, shop_code, store_num, shop_manager_user_id, supervisor_user_id,
plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time, plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time,
join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status,create_user_id,update_user_id,store_type join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status,create_user_id,update_user_id,store_type
, province,province_code,city,city_code,district,district_code , province,province_code,city,city_code,district,district_code,manager_supervisor
</sql> </sql>
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> <insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">

View File

@@ -149,4 +149,6 @@ public class ShopInfoDO {
//区code //区code
@Column(name = "district_code") @Column(name = "district_code")
private Integer districtCode; private Integer districtCode;
@Column(name = "manager_supervisor")
private String managerSupervisor;
} }

View File

@@ -86,4 +86,6 @@ public class StoreRequestBody {
* 品牌id * 品牌id
*/ */
private Long brandId; private Long brandId;
private String eid;
} }

View File

@@ -0,0 +1,12 @@
package com.cool.store.service;
/**
* @Author: WangShuo
* @Date: 2025/07/10/17:14
* @Version 1.0
* @注释:
*/
public interface SyncMainSysServer {
void syncStore(Long shopId);
}

View File

@@ -0,0 +1,120 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.mapper.SignFranchiseMapper;
import com.cool.store.mq.producer.SimpleMessageService;
import com.cool.store.request.StoreRequestBody;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.SyncMainSysServer;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.poi.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import static com.cool.store.enums.ExtendFieldTypeEnum.*;
/**
* @Author: WangShuo
* @Date: 2025/07/10/17:14
* @Version 1.0
* @注释:
*/
@Service
@Slf4j
public class SyncMainSysServerImpl implements SyncMainSysServer {
@Value("${spring.profiles.active}")
private String active;
@Resource
private SimpleMessageService simpleMessageService;
@Resource
private SignFranchiseMapper signFranchiseMapper;
@Resource
private BuildInformationDAO buildInformationDAO;
@Resource
private PointInfoDAO pointInfoDAO;
@Resource
FranchiseFeeMapper franchiseFeeMapper;
@Resource
private OperationLogDAO operationLogDAO;
@Resource
private OrderSysInfoDAO orderSysInfoDAO;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private PreparationServiceImpl preparationService;
@Resource
private UserAuthMappingService userAuthMappingService;
@Resource
private CommonService commonService;
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Value("${mybatis.configuration.variables.enterpriseId}")
private String eid;
@Override
//@Async
public void syncStore(Long shopId) {
StoreRequestBody requestBody = new StoreRequestBody();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId());
PointInfoDO pointInfoDO = pointInfoDAO.getPointInfoById(shopInfo.getPointId());
BuildInformationDO buildInformationDO = buildInformationDAO.selectOneByShopId(shopId);
SignFranchiseDO signFranchiseDO = signFranchiseMapper.selectByShopId(shopId);
requestBody.setStore_name(shopInfo.getShopName());
requestBody.setStore_num(shopInfo.getShopCode());
requestBody.setProvince(pointInfoDO.getProvince());
requestBody.setCity(pointInfoDO.getCity());
requestBody.setCounty(pointInfoDO.getDistrict());
requestBody.setLocation_address(shopInfo.getDetailAddress());
requestBody.setStore_address(shopInfo.getDetailAddress());
//todo 等待王硕确认
requestBody.setStore_area(shopInfo.getManagerSupervisor());
//未开业
requestBody.setStore_status("not_open");
requestBody.setStore_acreage(pointInfoDO.getPointArea());
requestBody.setLongitude_latitude(pointInfoDO.getLongitude() + "," + pointInfoDO.getLatitude());
if (StringUtils.isNotBlank(buildInformationDO.getBusinessHours())) {
try {
String[] times = buildInformationDO.getBusinessHours().split("~");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
LocalTime startTime = LocalTime.parse(times[0], formatter);
LocalTime endTime = LocalTime.parse(times[1], formatter);
String startMillis = String.valueOf(startTime.toSecondOfDay() * 1000L);
String endMillis = String.valueOf(endTime.toSecondOfDay() * 1000L);
requestBody.setBusiness_hours(startMillis + "," + endMillis);
} catch (Exception e) {
log.info("时间转换异常:{},shopId:{},time:{}", e.getMessage(), shopId.toString(), buildInformationDO.getBusinessHours());
}
}
Map<String, ExtendFieldTypeEnum> configMapByActive = ExtendFieldTypeEnum.getConfigMapByActive(active);
Map<String, String> extendField = new HashMap<>();
extendField.put(configMapByActive.get(ONLINE_SIGNATORY_NAME_1.getMsg()).getKey(), signFranchiseDO.getPartnershipSignatoryFirst());
extendField.put(configMapByActive.get(ONLINE_SIGNATORY_MOBILE_1.getMsg()).getKey(), lineInfoDO.getMobile());
extendField.put(configMapByActive.get(ONLINE_SIGNATORY_NAME_2.getMsg()).getKey(), signFranchiseDO.getPartnershipSignatorySecond());
extendField.put(configMapByActive.get(ONLINE_SIGNATORY_MOBILE_2.getMsg()).getKey(), signFranchiseDO.getPartnershipSignatorySecondMobile());
extendField.put(configMapByActive.get(ONLINE_ORDER_NAME.getMsg()).getKey(), buildInformationDO.getCShopName());
extendField.put(configMapByActive.get(ONLINE_JOIN_MODE.getMsg()).getKey(), JoinModeEnum.getByCode(shopInfo.getJoinMode()));
extendField.put(configMapByActive.get(ONLINE_STORE_TYPE.getMsg()).getKey(), StoreTypeEnum.getMessage(shopInfo.getStoreType()));
extendField.put(configMapByActive.get(ONLINE_BRAND.getMsg()).getKey(), FranchiseBrandEnum.getDescByCode(shopInfo.getFranchiseBrand()));
requestBody.setExtend_field(JSONObject.toJSONString(extendField));
requestBody.setEid(eid);
simpleMessageService.send(JSONObject.toJSONString(requestBody), RocketMqTagEnum.ZXJP_CREATE_STORE);
}
}

View File

@@ -50,6 +50,8 @@ import java.util.stream.Collectors;
@RequestMapping("/pc/test") @RequestMapping("/pc/test")
public class PCTestController { public class PCTestController {
@Resource
private SyncMainSysServer syncMainSysServer;
@Resource @Resource
private CommonService commonService; private CommonService commonService;
@Resource @Resource
@@ -80,6 +82,12 @@ public class PCTestController {
@Resource @Resource
LinePayDAO linePayDAO; LinePayDAO linePayDAO;
@GetMapping("/syncStore")
public ResponseResult<Boolean> syncStore(@RequestParam("shopId")Long shopId){
syncMainSysServer.syncStore(shopId);
return ResponseResult.success(Boolean.TRUE);
}
@GetMapping("/sendMessage") @GetMapping("/sendMessage")
public ResponseResult<Boolean> sendMessage(@RequestParam("lineId")Long lineId, public ResponseResult<Boolean> sendMessage(@RequestParam("lineId")Long lineId,
@RequestParam("pointId")Long pointId, @RequestParam("pointId")Long pointId,

View File

@@ -4,8 +4,8 @@ default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3
default.datasource.username=coolstore default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT default.datasource.password=CSCErYcXniNYm7bT
redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege.redis.rds.aliyuncs.com:6379/0 #redis
redis.isv.host.uri=http://userInfo:Cx111111@tstore-coolcollege.redis.rds.aliyuncs.com:6379/2 redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege-open.redis.rds.aliyuncs.com:6379/0
#pagehelper #pagehelper
pagehelper.helper-dialect=mysql pagehelper.helper-dialect=mysql
@@ -26,56 +26,57 @@ mybatis.configuration.map-underscore-to-camel-case=true
isv.domain=https://abstore-isv.coolstore.cn/isv isv.domain=https://abstore-isv.coolstore.cn/isv
#rocketmq \u914D\u7F6E #rocketmq \u914D\u7F6E
rocketmq.accessKey=zK2oVEz4G1ts23d2 rocketmq.accessKey=LTAI5tGBwmXwZkMuHK4MudMJ
rocketmq.secretKey=0UstLCS0mh2ASgBh rocketmq.secretKey=bnZoUMRQ9834STgz5E291YrqlBu6yn
rocketmq.nameSrvAdder=http://rmq-cn-9lb38l1rx04.cn-hangzhou.rmq.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1748142459508127_BZfpFxuJ.cn-hangzhou.mq.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=zx_simple_message
rocketmq.orderTopic=zx_order_message
#oss配置 #oss配置
oss.host=https://oss-store.coolcollege.cn/ #oss.host=https://oss-store.coolcollege.cn/
oss.accessKeyId=LTAI5t6Zk3Y3vyrMXC87jGYB #oss.accessKeyId=LTAI5t6Zk3Y3vyrMXC87jGYB
oss.accessKeySecret=6Gw06jtW5xNKWqbhnt1KmVZx1z9Dev #oss.accessKeySecret=6Gw06jtW5xNKWqbhnt1KmVZx1z9Dev
oss.endpoint=oss-cn-hangzhou.aliyuncs.com #oss.endpoint=oss-cn-hangzhou.aliyuncs.com
oss.bucket=cool-store-hsay #oss.bucket=cool-store-hsay
oss.file.dir=partner/171cddee76471740/ #oss.file.dir=partner/171cddee76471740/
oss.excelFile.dir=lineExcel/ oss.excelFile.dir=lineExcel/
oss.accessKeyId=LTAI5tGBwmXwZkMuHK4MudMJ
oss.accessKeySecret=bnZoUMRQ9834STgz5E291YrqlBu6yn
oss.bucket=store-ossfile
oss.file.dir=eid/${mybatis.configuration.variables.enterpriseId}/
oss.endpoint=oss-cn-hangzhou.aliyuncs.com
oss.host=https://oss-cool.coolstore.cn/
#cdn地址 #cdn地址
cdn.url=https://testhsaypic.coolstore.cn cdn.url=https://oss-cool.coolstore.cn
#TRTC #TRTC
trtc.sdkAppId=1600026212 trtc.sdkAppId=1600026212
trtc.secretKey=e036b654c665f649f053a01ff6f5652a826980027be298d4d49949f6e26434a5 trtc.secretKey=e036b654c665f649f053a01ff6f5652a826980027be298d4d49949f6e26434a5
trtc.video.callback.secretKey=ur4wq2iFbRI03Q35 trtc.video.callback.secretKey=ur4wq2iFbRI03Q35
weixin.appId=wx997f2206e276e513 weixin.appId=wxd77a2761c1911ee1
weixin.appSecret=2ddea4374abeace05e83c948392c2952 weixin.appSecret=fb669b90fcdcdd0e2da21b6e066df83e
weixin.index.url=pages/index/index weixin.index.url=pages/index/index
signKey=77fea013c3a6459685b83c21a2fc3411 signKey=77fea013c3a6459685b83c21a2fc3411
fixMobileOpenid=HSAY5531DA7 fixMobileOpenid=HSAY5531DA7
#xxljob配置 #xxljob配置
#xxljob配置 #xxljob配置
xxl.job.admin.addresses= xxl.job.admin.addresses = http://10.6.48.226:10001/xxl-job-admin
xxl.job.executor.appname=${spring.application.name} xxl.job.executor.appname = ${spring.application.name}
xxl.job.executor.ip= xxl.job.executor.ip =
xxl.job.executor.port=31001 xxl.job.executor.port = 40301
xxl.job.executor.logpath=logs/xxl-job/jobhandler xxl.job.executor.logpath = logs/xxl-job/jobhandler
xxl.job.executor.logretentiondays=3 xxl.job.executor.logretentiondays = 30
xxl.job.accessToken=25365115eed84e9ba5e0040abb255a09 xxl.job.accessToken = 25365115eed84e9ba5e0040abb255a09
exhibition.channel.id=52399 exhibition.channel.id=52399
recommended.channel.id=52400 recommended.channel.id=52400
wx.pay.privateKeyPath=D:\\weixin\\apiclient_key.pem
aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD
aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA
cool.app.id=80685 cool.app.id=80685
coolstore.page.domain=https://t2store.coolstore.cn coolstore.page.domain=https://tstore.coolstore.cn
xfsg.url=https://inf-test.xianfengsg.com/InfService xfsg.url=https://inf-test.xianfengsg.com/InfService
@@ -84,6 +85,51 @@ aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
aliyun.sms.signName=酷店掌 aliyun.sms.signName=酷店掌
mybatis.configuration.variables.enterpriseId=5558ce7a3aa84e3590392fcaa8697ffb mybatis.configuration.variables.enterpriseId=5558ce7a3aa84e3590392fcaa8697ffb
enterprise.dingCorpId=ding0006ae30cf81071ea1320dcb25e91351 enterprise.dingCorpId=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg
##qywx.task.notice.url1=https://tstore-api.coolstore.cn/notice?corpId=%s&appType=%s&target=%s
qywx.task.notice.url2=https://tstore-h5.coolstore.cn/?corpId=%s&appType=%s#/notice?target=%s&noticeType=zx&corpId=%s&appType=%s&eid=%s qywx.task.notice.url2=https://tstore-h5.coolstore.cn/?corpId=%s&appType=%s#/notice?target=%s&noticeType=zx&corpId=%s&appType=%s&eid=%s
#机会点地址
third.party.appKey=IGSAEQoakR2HEaYx
third.party.appSecret=aPsA99K1obFeFm3m
zx.opportunity.url=https://snp.wenmatech.com/
#大数据地址
zx.big.data.url=https://ds.zhengxinfood.com/
zx.big.data.appKey=ff203b5567744feaaae49fb86f58c5bf
zx.big.data.appSecret=35b8b9a400b4430fa022190be0913cd6
#火吗POS
api.auth.url=https://api.hmdzg.top
api.auth.username=VA59C0ubfcpcVpl
api.auth.secret=H9YKHF6R7N16Fvy
#新管家账号
xgj.api.auth.url=http://117.139.13.24:11180
xgj.api.auth.username=6446346061e043e392dd53c9c8d1af0b
xgj.api.auth.secret=3ba6e4c5632547b8b2b3acefe08667bb
xgj.api.token.url=http://117.139.13.24:29000
#云流水账号
#yls.api.auth.url=http://scm330-test.366ec.net
#yls.api.auth.username=096d4009072c927c
#yls.api.auth.secret=3b56198f096d4009072c927c96fbc8b6
yls.api.auth.url=http://yuanguiwuliu.com
yls.api.auth.username=096d4009072c927c
yls.api.auth.secret=3b56198f096d4009072c927c96fbc8b6
#新掌柜账号
xzg.api.auth.url=http://webapi.zhengxinfood.com
zx.food.url=https://datacenter.zhengxinfood.com
cool.api.appKey=k8J7fG2qR5tY9vX3
cool.api.secret=wP4sN6dL8zK2xM9c
#maozhejun userID
special.user.id=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg_woayJeDAAA0TC8mkCJeXouw94hYA-D3Q
ask.bot.url=https://test.auth.wx.askbot.cn