Commit 26bf9f6b authored by Quxl's avatar Quxl

x

parent f1c21f90
package com.egolm.shop.api.service; package com.egolm.shop.api.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -15,21 +16,18 @@ public interface QiyeWxService { ...@@ -15,21 +16,18 @@ public interface QiyeWxService {
void sendMessage(WxMessage wxMessage); void sendMessage(WxMessage wxMessage);
public static class WxMessage { public static class WxMessage {
String touser; final String touser;
String msgtype = "miniprogram_notice"; final String msgtype = "miniprogram_notice";
MiniprogramNotice miniprogram_notice; MiniprogramNotice miniprogram_notice;
public WxMessage(String touser) {
this.touser = touser;
}
public String getTouser() { public String getTouser() {
return touser; return touser;
} }
public void setTouser(String touser) {
this.touser = touser;
}
public String getMsgtype() { public String getMsgtype() {
return msgtype; return msgtype;
} }
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public MiniprogramNotice getMiniprogram_notice() { public MiniprogramNotice getMiniprogram_notice() {
return miniprogram_notice; return miniprogram_notice;
} }
...@@ -41,8 +39,8 @@ public interface QiyeWxService { ...@@ -41,8 +39,8 @@ public interface QiyeWxService {
String page; String page;
String title; String title;
String description; String description;
Boolean emphasis_first_item = true; final Boolean emphasis_first_item = true;
List<Map<String, String>> content_item = new ArrayList<Map<String, String>>(); List<Map<String, ?>> content_item = new ArrayList<Map<String, ?>>();
public String getAppid() { public String getAppid() {
return appid; return appid;
} }
...@@ -70,15 +68,21 @@ public interface QiyeWxService { ...@@ -70,15 +68,21 @@ public interface QiyeWxService {
public Boolean getEmphasis_first_item() { public Boolean getEmphasis_first_item() {
return emphasis_first_item; return emphasis_first_item;
} }
public void setEmphasis_first_item(Boolean emphasis_first_item) { public List<Map<String, ?>> getContent_item() {
this.emphasis_first_item = emphasis_first_item;
}
public List<Map<String, String>> getContent_item() {
return content_item; return content_item;
} }
public void setContent_item(List<Map<String, String>> content_item) { public void setContent_item(List<Map<String, ?>> content_item) {
this.content_item = content_item; this.content_item = content_item;
} }
public void setContent_item(Map<?, ?> contentMap) {
for(Object key : contentMap.keySet()) {
Object vlaue = contentMap.get(key);
Map<String, Object> map = new HashMap<String, Object>();
map.put("key", key);
map.put("value", vlaue);
content_item.add(map);
}
}
} }
} }
......
...@@ -31,6 +31,9 @@ public class QiyeWxServiceImpl implements QiyeWxService { ...@@ -31,6 +31,9 @@ public class QiyeWxServiceImpl implements QiyeWxService {
@Value("${qiyewx.baseUrl}") @Value("${qiyewx.baseUrl}")
private String baseUrl; private String baseUrl;
@Value("${qiyewx.msg.redirect.appid}")
private String redirectAppid;
@Autowired @Autowired
private RedisTemplate<String, String> redis; private RedisTemplate<String, String> redis;
...@@ -84,6 +87,7 @@ public class QiyeWxServiceImpl implements QiyeWxService { ...@@ -84,6 +87,7 @@ public class QiyeWxServiceImpl implements QiyeWxService {
String requestUrl = baseUrl + MessageFormat.format(UrlSendMsg, tokenString); String requestUrl = baseUrl + MessageFormat.format(UrlSendMsg, tokenString);
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("content-type", "application/x-www-form-urlencoded"); headers.put("content-type", "application/x-www-form-urlencoded");
wxMessage.getMiniprogram_notice().setAppid(redirectAppid);
HttpUtil.newInstance().setSSLVersion(SSLVersion.SSLv3).postJson(new JsonReqObject(requestUrl, wxMessage, headers)); HttpUtil.newInstance().setSSLVersion(SSLVersion.SSLv3).postJson(new JsonReqObject(requestUrl, wxMessage, headers));
} }
......
...@@ -25,6 +25,7 @@ import org.springframework.jdbc.support.KeyHolder; ...@@ -25,6 +25,7 @@ import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.egolm.common.DateUtil;
import com.egolm.common.HttpsUtil; import com.egolm.common.HttpsUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.Util; import com.egolm.common.Util;
...@@ -35,6 +36,9 @@ import com.egolm.common.jdbc.dialect.Dialect; ...@@ -35,6 +36,9 @@ import com.egolm.common.jdbc.dialect.Dialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect; import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.common.jdbc.dialect.bean.Sql; import com.egolm.common.jdbc.dialect.bean.Sql;
import com.egolm.shop.api.service.CommonService; import com.egolm.shop.api.service.CommonService;
import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.api.service.QiyeWxService.WxMessage.MiniprogramNotice;
import com.egolm.shop.api.service.SystemCtrlService; import com.egolm.shop.api.service.SystemCtrlService;
import com.egolm.shop.api.service.UserService; import com.egolm.shop.api.service.UserService;
import com.egolm.shop.bean.TCommon; import com.egolm.shop.bean.TCommon;
...@@ -49,6 +53,8 @@ public class UserServiceImpl implements UserService { ...@@ -49,6 +53,8 @@ public class UserServiceImpl implements UserService {
private static final Log logger = LogFactory.getLog(UserServiceImpl.class); private static final Log logger = LogFactory.getLog(UserServiceImpl.class);
@Autowired
private QiyeWxService wxService;
@Value("${redis.guest.key}") @Value("${redis.guest.key}")
private String guestRedisKey; private String guestRedisKey;
...@@ -528,6 +534,13 @@ public class UserServiceImpl implements UserService { ...@@ -528,6 +534,13 @@ public class UserServiceImpl implements UserService {
e.printStackTrace(); e.printStackTrace();
} }
} }
Map<String, Object> salesman = null;
try {
salesman = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNO1);
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
}
List<Map<String, Object>> addrNameList = jdbcTemplate.queryForList("select sRegionNO, sRegionDesc from tRegion where sRegionNO = ? or sRegionNO = ? or sRegionNO = ?", provinceId, cityId, districtId); List<Map<String, Object>> addrNameList = jdbcTemplate.queryForList("select sRegionNO, sRegionDesc from tRegion where sRegionNO = ? or sRegionNO = ? or sRegionNO = ?", provinceId, cityId, districtId);
Map<String, Map<String, Object>> addrmm = Util.listToMM(addrNameList, "sRegionNO"); Map<String, Map<String, Object>> addrmm = Util.listToMM(addrNameList, "sRegionNO");
Map<String, Object> pMap = addrmm.get(provinceId); Map<String, Object> pMap = addrmm.get(provinceId);
...@@ -608,6 +621,28 @@ public class UserServiceImpl implements UserService { ...@@ -608,6 +621,28 @@ public class UserServiceImpl implements UserService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if(salesman != null) {
String sCompanyAccountID = (String)salesman.get("sCompanyAccountID");
if(StringUtil.isNotBlank(sCompanyAccountID)) {
WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice);
notice.setDescription("当前时间");
notice.setTitle("认证审核通知");
notice.setPage("pages/customer/customer_detail/customer_detail?SalesmanNO=" + salesmanNO1 + "&isShare=1&custNo=" + custNo + "&shopNo=" + shopNo + "");
Map<Object, Object> params = new HashMap<Object, Object>();
params.put("状态", "待审核");
params.put("客户", customerName);
params.put("店铺名称", shopName);
params.put("门店规模", storeCount == null ? "0" : String.valueOf(storeCount));
params.put("地址", address);
params.put("提交时间", DateUtil.format(new Date()));
params.put("备注", memo);
notice.setContent_item(params);
wxService.sendMessage(wxMessage);
}
}
return Rjx.jsonOk().setMessage(I18NUtils.getMessage(langID, "Msg_Update_success")).toJson(); return Rjx.jsonOk().setMessage(I18NUtils.getMessage(langID, "Msg_Update_success")).toJson();
} }
......
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