|
|
|
@@ -0,0 +1,427 @@ |
|
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.enums.EnumCouponSendSendType; |
|
|
|
import com.iformall.mapper.*; |
|
|
|
import com.iformall.service.WxProjectConfigService; |
|
|
|
import com.iformall.utils.PasswordHelper; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class WxProjectConfigServiceImpl implements WxProjectConfigService { |
|
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxProjectConfigMapper wxProjectConfigMapper; |
|
|
|
@Autowired |
|
|
|
WxMallMapper wxMallMapper; |
|
|
|
@Autowired |
|
|
|
WxCouponSendConfigMapper wxCouponSendConfigMapper; |
|
|
|
@Autowired |
|
|
|
WxMallBuildingMapper wxMallBuildingMapper; |
|
|
|
@Autowired |
|
|
|
WxMallFloorMapper wxMallFloorMapper; |
|
|
|
@Autowired |
|
|
|
WxPayAccountMapper wxPayAccountMapper; |
|
|
|
@Autowired |
|
|
|
WxPayAccountBillMapper wxPayAccountBillMapper; |
|
|
|
@Autowired |
|
|
|
WxAppinfoMapper wxAppinfoMapper; |
|
|
|
@Autowired |
|
|
|
WxWeappExtSetMapper wxWeappExtSetMapper; |
|
|
|
@Autowired |
|
|
|
MallUserInfoMapper mallUserInfoMapper; |
|
|
|
@Autowired |
|
|
|
MallRoleMapper mallRoleMapper; |
|
|
|
@Autowired |
|
|
|
MallRolePermissionMapper mallRolePermissionMapper; |
|
|
|
@Autowired |
|
|
|
MallUserRoleMapper mallUserRoleMapper; |
|
|
|
@Autowired |
|
|
|
WxMsgConfigMapper wxMsgConfigMapper; |
|
|
|
@Autowired |
|
|
|
WxParkMapper wxParkMapper; |
|
|
|
@Autowired |
|
|
|
WxScoreRulesMapper wxScoreRulesMapper; |
|
|
|
@Autowired |
|
|
|
WxTemplateMsgMapper wxTemplateMsgMapper; |
|
|
|
@Autowired |
|
|
|
WxWiwideInfoMapper wxWiwideInfoMapper; |
|
|
|
@Autowired |
|
|
|
WxQuestionMapper wxQuestionMapper; |
|
|
|
@Autowired |
|
|
|
WxMsgValidationcodeModelMapper wxMsgValidationcodeModelMapper; |
|
|
|
@Autowired |
|
|
|
WxFlowConfigMapper wxFlowConfigMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void initProjectConfig(Long id) { |
|
|
|
WxProjectConfig wxProjectConfig = wxProjectConfigMapper.selectById(id); |
|
|
|
if(wxProjectConfig!=null && wxProjectConfig.getDelType()<10000){ |
|
|
|
Date nowTime = new Date(); |
|
|
|
// 1. wx_mall 商场 |
|
|
|
WxMall wxMall = new WxMall(); |
|
|
|
wxMall.setTenantId("-1"); |
|
|
|
wxMall.setName(wxProjectConfig.getName()); |
|
|
|
wxMall.setGroup(wxProjectConfig.getName());//无用 |
|
|
|
wxMall.setCountry(wxProjectConfig.getCountry()); |
|
|
|
wxMall.setProvince(wxProjectConfig.getProvince()); |
|
|
|
wxMall.setCity(wxProjectConfig.getCity()); |
|
|
|
wxMall.setAddr(wxProjectConfig.getAddr()); |
|
|
|
wxMall.setTotalArea(wxProjectConfig.getTotalArea()); |
|
|
|
wxMall.setOperatingArea(wxProjectConfig.getTotalArea());//无用 |
|
|
|
wxMall.setParkArea(wxProjectConfig.getParkArea()); |
|
|
|
wxMall.setParkPlaceNumber(wxProjectConfig.getParkPlaceNumber()); |
|
|
|
wxMall.setServicePhone(wxProjectConfig.getServicePhone()); |
|
|
|
wxMall.setImgUrl(wxProjectConfig.getImgUrl()); |
|
|
|
wxMall.setImgUrlH(wxProjectConfig.getImgUrlH()); |
|
|
|
String weapNote = "{\"carpage\": {\"desc\": \"分享个停车小程序,希望你喜欢\", \"title\": \"" |
|
|
|
+ wxProjectConfig.getName() |
|
|
|
+ "\"}, \"firstpage\": {\"desc\": \"分享个小程序,希望你喜欢\", \"title\": \"" |
|
|
|
+ wxProjectConfig.getName() |
|
|
|
+ "\"}}"; |
|
|
|
|
|
|
|
wxMall.setWeapNote(weapNote); |
|
|
|
|
|
|
|
//(1(全能版)、2(营销版,除了合同,账单功能),3.速享版(营销版加3个月限制)分别什么意思) |
|
|
|
wxMall.setSaleType(wxProjectConfig.getSaleType()); |
|
|
|
wxMall.setBusinessHours("[]"); |
|
|
|
wxMall.setIntroduction(""); |
|
|
|
wxMall.setImg(""); |
|
|
|
wxMallMapper.insert(wxMall); |
|
|
|
wxMall.setTenantId(wxMall.getId().toString()); |
|
|
|
wxMallMapper.updateById(wxMall); |
|
|
|
logger.info("wx_mall 商场---------------------init--success"); |
|
|
|
|
|
|
|
// 2. wx_coupon_send_config |
|
|
|
WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(); |
|
|
|
wxCouponSendConfig.setTenantId(wxMall.getTenantId()); |
|
|
|
wxCouponSendConfig.setValue(0);//默认停用 |
|
|
|
wxCouponSendConfig.setCreateTime(nowTime); |
|
|
|
wxCouponSendConfig.setUpdateTime(nowTime); |
|
|
|
for (EnumCouponSendSendType value : EnumCouponSendSendType.values()) { |
|
|
|
wxCouponSendConfig.setId(null); |
|
|
|
if (value.getCode() > 1) { |
|
|
|
wxCouponSendConfig.setSendType(value.getCode()); |
|
|
|
wxCouponSendConfig.setRemark( value.getMessage() + "开关"); |
|
|
|
wxCouponSendConfigMapper.insert(wxCouponSendConfig); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info("wx_coupon_send_config ---------------------init--success"); |
|
|
|
|
|
|
|
// 3. wx_mall_building 商场楼座 |
|
|
|
//{"A座":"B2层,B1层,1层,2层,3层,4层","B座":"1层,2层,3层"} |
|
|
|
JSONObject obj= JSON.parseObject(wxProjectConfig.getMallBuilding()); |
|
|
|
Iterator it =obj.entrySet().iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next(); |
|
|
|
//System.out.println(entry.getKey() + "-------" + entry.getValue()); |
|
|
|
String[] split = entry.getValue().replace(",",",").split(","); |
|
|
|
WxMallBuilding wxMallBuilding = new WxMallBuilding(); |
|
|
|
wxMallBuilding.setTenantId(wxMall.getTenantId()); |
|
|
|
wxMallBuilding.setMallId(wxMall.getId()); |
|
|
|
wxMallBuilding.setBuildingName(entry.getKey()); |
|
|
|
wxMallBuilding.setFloorNumber(split.length); |
|
|
|
wxMallBuilding.setCreateDate(nowTime); |
|
|
|
wxMallBuilding.setUpdateDate(nowTime); |
|
|
|
wxMallBuildingMapper.insert(wxMallBuilding); |
|
|
|
|
|
|
|
for (String cha:split) { |
|
|
|
WxMallFloor wxMallFloor = new WxMallFloor(); |
|
|
|
wxMallFloor.setTenantId(wxMall.getTenantId()); |
|
|
|
wxMallFloor.setMallId(wxMall.getId()); |
|
|
|
wxMallFloor.setBuildingId(wxMallBuilding.getId()); |
|
|
|
wxMallFloor.setFloorName(cha); |
|
|
|
//默认图片---------------------------------------------------- |
|
|
|
wxMallFloor.setBackgroundImg("https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/789/9eea8e0e-15ea-4be0-a43d-31e2e9d8db8c.jpg"); |
|
|
|
wxMallFloor.setCreateDate(nowTime); |
|
|
|
wxMallFloor.setUpdateDate(nowTime); |
|
|
|
wxMallFloorMapper.insert(wxMallFloor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("wx_mall_building---floor ---------------------init--success"); |
|
|
|
|
|
|
|
//# --- 特殊商户号开通后,填写此数据 |
|
|
|
//# 5. wx_pay_account |
|
|
|
WxPayAccount wxPayAccount = new WxPayAccount(); |
|
|
|
wxPayAccount.setTenantId(wxMall.getTenantId()); |
|
|
|
wxPayAccount.setMchId(wxProjectConfig.getMchId()); |
|
|
|
wxPayAccount.setSubMchId(wxProjectConfig.getSubMchId()); |
|
|
|
wxPayAccount.setApiKey(wxProjectConfig.getApiKey()); |
|
|
|
//----------------------------------------------------------- |
|
|
|
//默认 |
|
|
|
// wxPayAccount.setNotifyUrl(wxProjectConfig.getNotifyUrl()); |
|
|
|
// wxPayAccount.setCertPath(wxProjectConfig.getCertPath()); |
|
|
|
wxPayAccount.setNotifyUrl("https://admin.malls.iformall.com/wxPay/notify"); |
|
|
|
wxPayAccount.setCertPath("/opt/iformall/service/apiclient_cert.p12"); |
|
|
|
//------------------------------------------------------------- |
|
|
|
wxPayAccount.setType(1);//0:普通商户模式, 1:服务商模式(默认服务商模式) |
|
|
|
wxPayAccount.setShare(0);//0: 未分账,1:分账(默认不分账) |
|
|
|
wxPayAccount.setRate(wxProjectConfig.getRate()); |
|
|
|
wxPayAccount.setRealRate(wxProjectConfig.getRealRate()); |
|
|
|
wxPayAccountMapper.insert(wxPayAccount); |
|
|
|
|
|
|
|
logger.info("wx_pay_account ---------------------init--success"); |
|
|
|
|
|
|
|
//# --- 特殊商户号开通后,填写此数据 |
|
|
|
//# 6. wx_pay_account_bill |
|
|
|
WxPayAccountBill wxPayAccountBill = new WxPayAccountBill(); |
|
|
|
wxPayAccountBill.setTenantId(wxPayAccount.getTenantId()); |
|
|
|
wxPayAccountBill.setMchId(wxPayAccount.getMchId()); |
|
|
|
wxPayAccountBill.setSubMchId(wxPayAccount.getSubMchId()); |
|
|
|
wxPayAccountBill.setApiKey(wxPayAccount.getApiKey()); |
|
|
|
wxPayAccountBill.setNotifyUrl(wxPayAccount.getNotifyUrl()); |
|
|
|
wxPayAccountBill.setCertPath(wxPayAccount.getCertPath()); |
|
|
|
wxPayAccountBill.setType(wxPayAccount.getType()); |
|
|
|
wxPayAccountBill.setShare(!(wxPayAccount.getShare() == 0)); |
|
|
|
wxPayAccountBill.setRate(wxPayAccount.getRate()); |
|
|
|
wxPayAccountBill.setRealRate(wxPayAccount.getRealRate()); |
|
|
|
wxPayAccountBillMapper.insert(wxPayAccountBill); |
|
|
|
|
|
|
|
logger.info("wx_pay_account_bill ---------------------init--success"); |
|
|
|
|
|
|
|
|
|
|
|
//# --- 小程序开通后,填写此数据,并设置域名及业务域名等 |
|
|
|
//# 7. wx_appinfo |
|
|
|
WxAppinfo wxAppinfo = new WxAppinfo(); |
|
|
|
wxAppinfo.setTenantId(wxMall.getTenantId()); |
|
|
|
wxAppinfo.setType(1); |
|
|
|
wxAppinfo.setAppId(wxProjectConfig.getAppIdB()); |
|
|
|
wxAppinfo.setParentAppId(wxProjectConfig.getParentAppId()); |
|
|
|
wxAppinfo.setName(wxProjectConfig.getAppNameB()); |
|
|
|
wxAppinfo.setSecret(wxProjectConfig.getAppSecretB()); |
|
|
|
wxAppinfo.setPayId(wxPayAccount.getId()); |
|
|
|
wxAppinfo.setPayBillId(wxPayAccountBill.getId()); |
|
|
|
wxAppinfoMapper.insert(wxAppinfo); |
|
|
|
wxAppinfo = new WxAppinfo(); |
|
|
|
wxAppinfo.setTenantId(wxMall.getTenantId()); |
|
|
|
wxAppinfo.setType(2); |
|
|
|
wxAppinfo.setAppId(wxProjectConfig.getAppIdC()); |
|
|
|
wxAppinfo.setParentAppId(wxProjectConfig.getParentAppId()); |
|
|
|
wxAppinfo.setName(wxProjectConfig.getAppNameC()); |
|
|
|
wxAppinfo.setSecret(wxProjectConfig.getAppSecretC()); |
|
|
|
wxAppinfo.setPayId(wxPayAccount.getId()); |
|
|
|
wxAppinfo.setPayBillId(wxPayAccountBill.getId()); |
|
|
|
wxAppinfoMapper.insert(wxAppinfo); |
|
|
|
|
|
|
|
logger.info("wx_appinfo ---------------------init--success"); |
|
|
|
|
|
|
|
WxWeappExtSet wxWeappExtSet = new WxWeappExtSet(); |
|
|
|
wxWeappExtSet.setAppId(wxProjectConfig.getAppIdB()); |
|
|
|
wxWeappExtSet.setType(1); |
|
|
|
wxWeappExtSet.setExtJson("{}"); |
|
|
|
wxWeappExtSet.setReleaseJson("{}"); |
|
|
|
wxWeappExtSet.setCreateDate(nowTime); |
|
|
|
wxWeappExtSet.setUpdateDate(nowTime); |
|
|
|
wxWeappExtSetMapper.insert(wxWeappExtSet); |
|
|
|
wxWeappExtSet = new WxWeappExtSet(); |
|
|
|
wxWeappExtSet.setAppId(wxProjectConfig.getAppIdC()); |
|
|
|
wxWeappExtSet.setType(2); |
|
|
|
wxWeappExtSet.setExtJson("{}"); |
|
|
|
wxWeappExtSet.setReleaseJson("{}"); |
|
|
|
wxWeappExtSet.setCarSupport(0); |
|
|
|
wxWeappExtSet.setCreateDate(nowTime); |
|
|
|
wxWeappExtSet.setUpdateDate(nowTime); |
|
|
|
wxWeappExtSetMapper.insert(wxWeappExtSet); |
|
|
|
|
|
|
|
logger.info("wx_weapp_ext_set ---------------------init--success"); |
|
|
|
|
|
|
|
//生成id |
|
|
|
//final IdWorker idWorker = IdWorker.get(); |
|
|
|
//密码加密 |
|
|
|
PasswordHelper passwordHelper = new PasswordHelper(); |
|
|
|
// 9. mall_user_info mfadmin/m2F@of0 |
|
|
|
// |
|
|
|
MallUserInfo mallUserInfo = new MallUserInfo(); |
|
|
|
//mallUserInfo.setId(idWorker.nextId()); |
|
|
|
mallUserInfo.setTenantId(wxMall.getTenantId()); |
|
|
|
mallUserInfo.setUsername(wxProjectConfig.getUsernameA()); |
|
|
|
mallUserInfo.setName(wxProjectConfig.getName()); |
|
|
|
//mallUserInfo.setPassword("2ddc17f6073a85dd7d7b030df5392364"); |
|
|
|
mallUserInfo.setPassword(wxProjectConfig.getPassword()); |
|
|
|
passwordHelper.encryptPassword(mallUserInfo); |
|
|
|
mallUserInfo.setCreateTime(nowTime); |
|
|
|
mallUserInfo.setStatus(1); |
|
|
|
mallUserInfo.setIsAdmin(1); |
|
|
|
mallUserInfo.setPhone(wxProjectConfig.getPhone()); |
|
|
|
mallUserInfoMapper.insert(mallUserInfo); |
|
|
|
|
|
|
|
logger.info("mall_user_info ---------------------init--success"); |
|
|
|
|
|
|
|
//# 10. mall_role |
|
|
|
MallRole mallRole = new MallRole(); |
|
|
|
//mallRole.setId(idWorker.nextId()); |
|
|
|
mallRole.setTenantId(wxMall.getTenantId()); |
|
|
|
mallRole.setName("系统管理员"); |
|
|
|
mallRole.setAvailable("0"); |
|
|
|
mallRoleMapper.insert(mallRole); |
|
|
|
|
|
|
|
logger.info("mall_role ---------------------init--success"); |
|
|
|
|
|
|
|
//# 11. mall_role_permission |
|
|
|
|
|
|
|
// MallRolePermission mallRolePermission = new MallRolePermission(); |
|
|
|
// mallRolePermission.setTenantId(wxMall.getTenantId()); |
|
|
|
// mallRolePermission.setRoleId(mallRole.getId()); |
|
|
|
// List<MallRolePermission> mallRolePermissionList = new ArrayList<MallRolePermission>(); |
|
|
|
// for(int i=1;i<=10 ;i++){ |
|
|
|
// mallRolePermission.setPermissionId((long) i); |
|
|
|
// mallRolePermissionList.add(mallRolePermission); |
|
|
|
// } |
|
|
|
// mallRolePermission.setPermissionId((long) 50); |
|
|
|
// mallRolePermissionList.add(mallRolePermission); |
|
|
|
// mallRolePermissionMapper.insertBatch(mallRolePermissionList); |
|
|
|
|
|
|
|
//# 12. mall_user_role |
|
|
|
MallUserRole mallUserRole = new MallUserRole(); |
|
|
|
//mallUserRole.setId(idWorker.nextId()); |
|
|
|
mallUserRole.setUid(mallUserInfo.getId()); |
|
|
|
mallUserRole.setRoleId(mallRole.getId()); |
|
|
|
mallUserRoleMapper.insert(mallUserRole); |
|
|
|
|
|
|
|
logger.info("mall_user_role ---------------------init--success"); |
|
|
|
|
|
|
|
//# 13. wx_msg_config |
|
|
|
WxMsgConfig wxMsgConfig = new WxMsgConfig(); |
|
|
|
wxMsgConfig.setTenantId(wxMall.getTenantId()); |
|
|
|
wxMsgConfig.setSecret("7305150347587283553aa8898e7dbf20"); |
|
|
|
wxMsgConfig.setPublickey("MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvh8j/zagfxQdnSh5OIic\\r\\nMzN+MuRuWQJPjgu4Gza4+gX3j5Ln2xNDBOTjpwyuLBjh/JcBd1cGO3lAaKCwcaix\\r\\nsmhTq56wVXXUMgDiAChu4ud8FSvRc8G8tdZAirKVAIi3NW+/pYgpWBs/0wnF8hz4\\r\\n8no4pyJHl9Jc1LH3VNIMz8vqzKUPc4ack4pFUXlcNj6C+sBlaurmI4/vwLqNxBGs\\r\\n7/zyM7dv6oy3DSU/Y1qBArM1YPjfL2dNun8rmtPgJvlPwXqA7uoHPwQ2Ym3aUn59\\r\\npkS7QI6IE8uuqNkfSte8BXLd2nIqPLFxLYLDmdll7eoyRblHcHqAYSj8stK6StC7\\r\\nDNryNKEjTEwbgf9trUI0uvF1pfgTy2gpclnY69FtD/m0+FvLyorMq+nmBqYMjka5\\r\\nK0txDQJPOa7gsi//uXd/cJW2SAXY9MSO1AfMi8Xq/YKRQzN9FW5iapskXFHca7uX\\r\\ng5NhH7flr6DW+QInFlpoN6WIEAuDF1aj4O49Ikm3WxwhTqnvEkdSCfivpYQkp9Sh\\r\\n4kQ/SQdxuT7VX+Nz6k+uMx2z4cySk33bHi0KoHbA9QFGg/54Qd0+eU4qZnd4mrgh\\r\\nhH7/QQhL7Z9eF1U5UPrsHq2Vq3rEnN+tYQ26AuKeU8vzTxBrC/SxC6C/SMFt3f/Y\\r\\nnuFh1UnNJZleZwyQt+ZdGO0CAwEAAQ=="); |
|
|
|
wxMsgConfig.setBid("465565"); |
|
|
|
wxMsgConfig.setRecharge((long) 0); |
|
|
|
wxMsgConfig.setRemains((long) 100000); |
|
|
|
wxMsgConfig.setTotal((long) 100000); |
|
|
|
wxMsgConfig.setAccount("15626593768"); |
|
|
|
wxMsgConfig.setReminderstatus(0); |
|
|
|
wxMsgConfig.setNotifyurl("https://admin.malls.iformall.com/wxMsgCallback/receivemsg/"+wxMall.getTenantId()); |
|
|
|
wxMsgConfig.setModelnotifyurl("https://admin.malls.iformall.com/wxMsgCallback/receivemodel/"+wxMall.getTenantId()); |
|
|
|
wxMsgConfig.setVerifynotifyurl("https://admin.malls.iformall.com/wxMsgCallback/receiveverifymodel/"+wxMall.getTenantId()); |
|
|
|
wxMsgConfig.setAppid(wxProjectConfig.getAppIdB()); |
|
|
|
wxMsgConfigMapper.insert(wxMsgConfig); |
|
|
|
|
|
|
|
logger.info("wx_msg_config ---------------------init--success"); |
|
|
|
|
|
|
|
|
|
|
|
//# --- 14. ETCP 设置完后再填写此数据 |
|
|
|
//# 14. wx_park |
|
|
|
WxPark wxPark = new WxPark(); |
|
|
|
wxPark.setVendorParams("{}"); |
|
|
|
wxPark.setCreateDate(nowTime); |
|
|
|
wxPark.setUpdateDate(nowTime); |
|
|
|
wxPark.setAddr(wxProjectConfig.getName()); |
|
|
|
wxPark.setTenantId(wxMall.getTenantId()); |
|
|
|
wxPark.setNumber(wxMall.getParkPlaceNumber()); |
|
|
|
wxPark.setVendorType(0); |
|
|
|
wxPark.setParkId("0"); |
|
|
|
wxPark.setEntryExit(1); |
|
|
|
wxPark.setStopFee(""); |
|
|
|
wxParkMapper.insert(wxPark); |
|
|
|
|
|
|
|
logger.info("wx_park ---------------------init--success"); |
|
|
|
|
|
|
|
|
|
|
|
//# 积分成长值设置wx_score_rules |
|
|
|
WxScoreRules wxScoreRules = new WxScoreRules(); |
|
|
|
//wxScoreRules.setId(idWorker.nextId()); |
|
|
|
wxScoreRules.setTenantId(wxMall.getTenantId()); |
|
|
|
wxScoreRules.setRules("[{\"id\": 1, \"desc\": \"每日登陆\", \"step\": 1, \"limit\": 0, \"score\": 0}, {\"id\": 2, \"score\": null, \"childs\": [{\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"餐饮\", \"businessId\": 1}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"娱乐\", \"businessId\": 2}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"服饰\", \"businessId\": 3}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"亲子\", \"businessId\": 4}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"超市\", \"businessId\": 5}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"美妆\", \"businessId\": 7}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"珠宝\", \"businessId\": 8}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"服务\", \"businessId\": 9}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"家居\", \"businessId\": 10}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"数码家电\", \"businessId\": 11}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"其他\", \"businessId\": 6}]}, {\"id\": 3, \"desc\": \"绑定车牌1个\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 5, \"desc\": \"授权个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 6, \"desc\": \"授权手机号\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 8, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]"); |
|
|
|
wxScoreRules.setCreateDate(nowTime); |
|
|
|
wxScoreRules.setUpdateDate(nowTime); |
|
|
|
wxScoreRules.setType(2); |
|
|
|
wxScoreRules.setClearYear(1); |
|
|
|
wxScoreRules.setScale(10); |
|
|
|
wxScoreRules.setCreditLocked(1); |
|
|
|
wxScoreRulesMapper.insert(wxScoreRules); |
|
|
|
wxScoreRules = new WxScoreRules(); |
|
|
|
wxScoreRules.setTenantId(wxMall.getTenantId()); |
|
|
|
wxScoreRules.setRules("[{\"id\": 1, \"desc\": \"每日登陆\", \"step\": 1, \"limit\": 0, \"score\": 0}, {\"id\": 2, \"score\": 0, \"childs\": [{\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"餐饮\", \"businessId\": 1}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"娱乐\", \"businessId\": 2}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"服饰\", \"businessId\": 3}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"亲子\", \"businessId\": 4}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"超市\", \"businessId\": 5}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"美妆\", \"businessId\": 7}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"珠宝\", \"businessId\": 8}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"服务\", \"businessId\": 9}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"家居\", \"businessId\": 10}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"数码家电\", \"businessId\": 11}, {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"其他\", \"businessId\": 6}]}, {\"id\": 3, \"desc\": \"绑定车牌1个\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 5, \"desc\": \"授权个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 6, \"desc\": \"授权手机号\", \"step\": 1, \"limit\": 1, \"score\": 0}, {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]"); |
|
|
|
wxScoreRules.setCreateDate(nowTime); |
|
|
|
wxScoreRules.setUpdateDate(nowTime); |
|
|
|
wxScoreRules.setType(1); |
|
|
|
wxScoreRules.setCreditLocked(0); |
|
|
|
wxScoreRulesMapper.insert(wxScoreRules); |
|
|
|
|
|
|
|
logger.info("wx_score_rules ---------------------init--success"); |
|
|
|
|
|
|
|
//# 17. wx_template_msg |
|
|
|
//# C端登录,设置域名 |
|
|
|
//# 设置核销成功通知,核销失败通知 |
|
|
|
WxTemplateMsg wxTemplateMsg = new WxTemplateMsg(); |
|
|
|
wxTemplateMsg.setTenantId(wxMall.getTenantId()); |
|
|
|
wxTemplateMsg.setTemplateId(""); |
|
|
|
wxTemplateMsg.setType(1); |
|
|
|
wxTemplateMsg.setCustomParam("{\"index\":[\"keyword1\",\"keyword2\",\"keyword3\",\"keyword4\",\"keyword5\",\"keyword6\",\"keyword7\"],\"keyword1\":\"可抵{keyword1}元\",\"keyword2\":\"{keyword2}\",\"keyword3\":\"{keyword3}\",\"keyword4\":\"{keyword4}\",\"keyword5\":\"{keyword5}元\",\"keyword6\":\"{keyword6}\",\"keyword7\":\"猜也猜不到的优惠,只有幸运的人才能看到,就是你,{keyword7}\\n☟☟☟☟☟☟☟\\n☞ 快看看 ☜\\n☝︎☝︎☝︎☝︎☝︎☝︎☝︎\\n\",\"emphasis\":\"keyword1.DATA\"}"); |
|
|
|
wxTemplateMsg.setCreateDate(nowTime); |
|
|
|
wxTemplateMsg.setUpdateDate(nowTime); |
|
|
|
wxTemplateMsgMapper.insert(wxTemplateMsg); |
|
|
|
wxTemplateMsg.setId(null); |
|
|
|
wxTemplateMsg.setType(2); |
|
|
|
wxTemplateMsg.setCustomParam("{\"index\":[\"keyword1\",\"keyword2\",\"keyword3\",\"keyword4\"],\"keyword1\":\"可抵{keyword1}元\",\"keyword2\":\"{keyword2}\",\"keyword3\":\"{keyword3}\",\"keyword4\":\"猜也猜不到的优惠,只有幸运的人才能看到,就是你,{keyword4}\\n☟☟☟☟☟☟☟\\n☞ 快看看 ☜\\n☝︎☝︎☝︎☝︎☝︎☝︎☝︎\\n\",\"emphasis\":\"keyword1.DATA\"}"); |
|
|
|
wxTemplateMsgMapper.insert(wxTemplateMsg); |
|
|
|
|
|
|
|
logger.info("wx_template_msg ---------------------init--success"); |
|
|
|
|
|
|
|
// # 18. wx_wiwide_info -- 迈外迪 服务商后台设置商户(点击获取商户bid),再找迈外迪初始化,收到激活邮件激活后,再在数据库中插入此数据 |
|
|
|
// # 数据格式如下 |
|
|
|
// # szld1086@iformall |
|
|
|
// # 1391054397 |
|
|
|
// # wuguoqiang@iformall.com |
|
|
|
// WxWiWideInfo wxWiWideInfo = new WxWiWideInfo(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// # 19. wx_question |
|
|
|
String questionJson = "[{\"flag\": \"single\", \"title\": \"请问您的职业是?\", \"answers\": [{\"id\": \"59\", \"name\": \"学生\"}, {\"id\": \"60\", \"name\": \"上班族\"}, {\"id\": \"61\", \"name\": \"企业高管\"}, {\"id\": \"62\", \"name\": \"个体户\"}, {\"id\": \"63\", \"name\": \"自由职业\"}, {\"id\": \"64\", \"name\": \"其他\"}]}," |
|
|
|
+ "{\"flag\": \"single\", \"title\": \"请问您目前的学历是?\", \"answers\": [{\"id\": \"34\", \"name\": \"高中\"}, {\"id\": \"35\", \"name\": \"大专\"}, {\"id\": \"36\", \"name\": \"本科\"}, {\"id\": \"37\", \"name\": \"硕士及以上\"}, {\"id\": \"38\", \"name\": \"博士及以上\"}]}," |
|
|
|
+ "{\"flag\": \"single\", \"title\": \"请问您是如何到达商场的?\", \"answers\": [{\"id\": \"127\", \"name\": \"走路\"}, {\"id\": \"128\", \"name\": \"乘车\"}]}," |
|
|
|
+ "{\"flag\": \"single\", \"title\": \"请问您和父母一起居住吗?\", \"answers\": [{\"id\": \"65\", \"name\": \"不是,我已租房\"}, {\"id\": \"66\", \"name\": \"是,我已购房\"}, {\"id\": \"67\", \"name\": \"不是,我和室友住宿舍\"}]}," |
|
|
|
+ "{\"flag\": \"multi\", \"title\": \"请问您的孩子愿意与您一起?\", \"answers\": [{\"id\": \"57\", \"name\": \"逛街\"}, {\"id\": \"57\", \"name\": \"玩乐\"}, {\"id\": \"57\", \"name\": \"阅读\"}, {\"id\": \"55\", \"name\": \"我还没有宝宝\"}]}," |
|
|
|
+ "{\"flag\": \"single\", \"title\": \"主人,您结婚了吗?\", \"answers\": [{\"id\": \"56\", \"name\": \"结婚啦\"}, {\"id\": \"55\", \"name\": \"还没有哦\"}]}," |
|
|
|
+ "{\"flag\": \"single\", \"title\": \"您是?\", \"answers\": [{\"id\": \"42\", \"name\": \"贫下中农\"}, {\"id\": \"43\", \"name\": \"小康家庭\"}, {\"id\": \"44\", \"name\": \"中产家庭\"}, {\"id\": \"45\", \"name\": \"富裕家庭\"}]}," |
|
|
|
+ "{\"flag\": \"single\", \"title\": \"请问您是?\", \"answers\": [{\"id\": \"104\", \"name\": \"实惠型消费\"}, {\"id\": \"105\", \"name\": \"享乐型消费\"}, {\"id\": \"106\", \"name\": \"品质型消费\"}]}," |
|
|
|
+ "{\"flag\": \"multi\", \"title\": \"请问您喜欢哪种口味的食物?\", \"answers\": [{\"id\": \"92\", \"name\": \"轻餐\"}, {\"id\": \"93\", \"name\": \"小吃快餐\"}, {\"id\": \"94\", \"name\": \"西餐\"}, {\"id\": \"95\", \"name\": \"日料中餐甜点\"}, {\"id\": \"96\", \"name\": \"火锅\"}]}," |
|
|
|
+ "{\"flag\": \"multi\", \"title\": \"请问您的爱好是?\", \"answers\": [{\"id\": \"121\", \"name\": \"时尚\"}, {\"id\": \"122\", \"name\": \"旅游\"}, {\"id\": \"123\", \"name\": \"运动\"}, {\"id\": \"124\", \"name\": \"电玩\"}, {\"id\": \"125\", \"name\": \"看书\"}, {\"id\": \"126\", \"name\": \"其他\"}]}]"; |
|
|
|
WxQuestion wxQuestion = new WxQuestion(); |
|
|
|
wxQuestion.setTenantId(wxMall.getTenantId()); |
|
|
|
JSONArray jsonObject = JSON.parseArray(questionJson); |
|
|
|
for (Object object : jsonObject) { |
|
|
|
wxQuestion.setId(null); |
|
|
|
wxQuestion.setContent(object.toString()); |
|
|
|
wxQuestionMapper.insert(wxQuestion); |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("wx_question ---------------------init--success"); |
|
|
|
|
|
|
|
//# 20. wx_msg_validationcode_model, 数据重新一下 |
|
|
|
//--------EnumMsgModel |
|
|
|
// WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); |
|
|
|
|
|
|
|
// WxFlowConfig wxFlowConfig = new WxFlowConfig(); |
|
|
|
//初始化成功 删除标记 |
|
|
|
wxProjectConfig.setDelType(10000); |
|
|
|
wxProjectConfigMapper.updateById(wxProjectConfig); |
|
|
|
|
|
|
|
|
|
|
|
logger.info("init--success----------------tenantId--"+wxMall.getTenantId()); |
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
logger.info("------数据已初始化"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |