Commit 26bf9f6b authored by Quxl's avatar Quxl

x

parent f1c21f90
package com.egolm.shop.api.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -15,21 +16,18 @@ public interface QiyeWxService {
void sendMessage(WxMessage wxMessage);
public static class WxMessage {
String touser;
String msgtype = "miniprogram_notice";
final String touser;
final String msgtype = "miniprogram_notice";
MiniprogramNotice miniprogram_notice;
public WxMessage(String touser) {
this.touser = touser;
}
public String getTouser() {
return touser;
}
public void setTouser(String touser) {
this.touser = touser;
}
public String getMsgtype() {
return msgtype;
}
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public MiniprogramNotice getMiniprogram_notice() {
return miniprogram_notice;
}
......@@ -41,8 +39,8 @@ public interface QiyeWxService {
String page;
String title;
String description;
Boolean emphasis_first_item = true;
List<Map<String, String>> content_item = new ArrayList<Map<String, String>>();
final Boolean emphasis_first_item = true;
List<Map<String, ?>> content_item = new ArrayList<Map<String, ?>>();
public String getAppid() {
return appid;
}
......@@ -70,15 +68,21 @@ public interface QiyeWxService {
public Boolean getEmphasis_first_item() {
return emphasis_first_item;
}
public void setEmphasis_first_item(Boolean emphasis_first_item) {
this.emphasis_first_item = emphasis_first_item;
}
public List<Map<String, String>> getContent_item() {
public List<Map<String, ?>> getContent_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;
}
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 {
@Value("${qiyewx.baseUrl}")
private String baseUrl;
@Value("${qiyewx.msg.redirect.appid}")
private String redirectAppid;
@Autowired
private RedisTemplate<String, String> redis;
......@@ -84,6 +87,7 @@ public class QiyeWxServiceImpl implements QiyeWxService {
String requestUrl = baseUrl + MessageFormat.format(UrlSendMsg, tokenString);
Map<String, String> headers = new HashMap<String, String>();
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));
}
......
......@@ -25,6 +25,7 @@ import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.egolm.common.DateUtil;
import com.egolm.common.HttpsUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
......@@ -35,6 +36,9 @@ import com.egolm.common.jdbc.dialect.Dialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.common.jdbc.dialect.bean.Sql;
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.UserService;
import com.egolm.shop.bean.TCommon;
......@@ -49,6 +53,8 @@ public class UserServiceImpl implements UserService {
private static final Log logger = LogFactory.getLog(UserServiceImpl.class);
@Autowired
private QiyeWxService wxService;
@Value("${redis.guest.key}")
private String guestRedisKey;
......@@ -528,6 +534,13 @@ public class UserServiceImpl implements UserService {
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);
Map<String, Map<String, Object>> addrmm = Util.listToMM(addrNameList, "sRegionNO");
Map<String, Object> pMap = addrmm.get(provinceId);
......@@ -608,6 +621,28 @@ public class UserServiceImpl implements UserService {
} catch (Exception e) {
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();
}
......
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