Commit cb013d9a authored by 张永's avatar 张永
parents 0eb7a707 b8e48df3
...@@ -46,14 +46,13 @@ ...@@ -46,14 +46,13 @@
<version>1.1.20</version> <version>1.1.20</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.microsoft.sqlserver</groupId> <groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId> <artifactId>mssql-jdbc</artifactId>
<version>4.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.38</version> <version>1.2.70</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.egolm</groupId> <groupId>com.egolm</groupId>
...@@ -90,10 +89,6 @@ ...@@ -90,10 +89,6 @@
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version> <version>2.9.2</version>
</dependency> </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
...@@ -191,7 +186,7 @@ ...@@ -191,7 +186,7 @@
<repository> <repository>
<id>my</id> <id>my</id>
<name>my</name> <name>my</name>
<url>http://git.egolm.com:9003/nexus/content/groups/public/</url> <url>https://gitlab.linkfern.com/content/groups/public/</url>
</repository> </repository>
<repository> <repository>
<id>repo1</id> <id>repo1</id>
......
...@@ -4,11 +4,13 @@ import org.springframework.boot.SpringApplication; ...@@ -4,11 +4,13 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableAsync(proxyTargetClass=true)
@EnableScheduling @EnableScheduling
@EnableCaching @EnableCaching
@EnableSwagger2 @EnableSwagger2
......
package com.egolm.shop.api; package com.egolm.shop.api;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -107,7 +108,7 @@ public class CommonController { ...@@ -107,7 +108,7 @@ public class CommonController {
public Object getConfig(String appId) { public Object getConfig(String appId) {
Map<String, Object> map = null; Map<String, Object> map = null;
try { try {
map = jdbcTemplate.queryForMap("select sOrgNO, sOrgDesc from tOrg where sAppID = ? and nTag&1 = 0", appId); map = jdbcTemplate.queryForMap("select sOrgNO, sOrgDesc, sOrgPicUrl from tOrg where sAppID = ? and nTag&1 = 0", appId);
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
throw new XException("配置不存在", e); throw new XException("配置不存在", e);
} }
...@@ -121,9 +122,36 @@ public class CommonController { ...@@ -121,9 +122,36 @@ public class CommonController {
" where sCode = @ChoiceOssKEY"; " where sCode = @ChoiceOssKEY";
Map<String, Object> omap = jdbcTemplate.queryForMap(ossSql.replaceAll("\\s+", " ")); Map<String, Object> omap = jdbcTemplate.queryForMap(ossSql.replaceAll("\\s+", " "));
Map<String, Object> cmap = jdbcTemplate.queryForMap("select sDesc,sValue1 from tSystemCtrl where sCode = 'ExemptCheck'"); Map<String, Object> cmap = jdbcTemplate.queryForMap("select sDesc,sValue1 from tSystemCtrl where sCode = 'ExemptCheck'");
List<Map<String, Object>> payTypes = jdbcTemplate.queryForList("select sSalesOrderPayTypeID, sSalesOrderPayType from tOrgPayType where sOrgNO = ? and nTag&1=0", sOrgNO); List<Map<String, Object>> payTypes = jdbcTemplate.queryForList("select sSalesOrderPayTypeID, sSalesOrderPayType from tOrgPayType where sOrgNO = ? and nTag&1=0 order by nSort desc", sOrgNO);
List<Map<String, Object>> goodsTags = jdbcTemplate.queryForList("select sGoodsTagID, sGoodsTag from tOrgGoodsTag where sOrgNO = ? and nTag&1 = 0", sOrgNO); List<Map<String, Object>> goodsTags = jdbcTemplate.queryForList("select sGoodsTagID, sGoodsTag from tOrgGoodsTag where sOrgNO = ? and nTag&1 = 0", sOrgNO);
return Rjx.jsonOk().set("OrgInfo", map).set("PicInfo", omap).set("ExemptCheck", cmap).set("payTypes", payTypes).set("goodsTags", goodsTags).toJson(); Map<String, Object> shareInfo = new HashMap<String, Object>();
try {
String sql = ""
+ "SELECT "
+ "SharePicUrl = sPicUrl, "
+ "ShareTitle = sShareTitle "
+ "FROM "
+ "tOrg "
+ "WHERE "
+ "sOrgNO = ? "
+ "AND sAppID = ?";
shareInfo = jdbcTemplate.queryForMap(sql, sOrgNO, appId);
} catch (EmptyResultDataAccessException e) {}
Map<String, Object> AppSystemInfo = new HashMap<String, Object>();
try {
String sql = ""
+ "SELECT "
+ "IsAppCustService = convert(BIT, CASE WHEN nIsAppCustService = 1 THEN 1 ELSE 0 END), "
+ "IsExemptCheck = convert(BIT, CASE WHEN nIsExemptCheck = 1 THEN 1 ELSE 0 END) "
+ "FROM "
+ "tOrg "
+ "WHERE "
+ "sOrgNO = ? "
+ "AND sAppID = ?";
AppSystemInfo = jdbcTemplate.queryForMap(sql, sOrgNO, appId);
} catch (EmptyResultDataAccessException e) {}
return Rjx.jsonOk().set("OrgInfo", map).set("PicInfo", omap).set("ExemptCheck", cmap).set("payTypes", payTypes).set("goodsTags", goodsTags).set("AppSystemInfo", AppSystemInfo).set("shareInfo", shareInfo).toJson();
} }
} }
package com.egolm.shop.api.service; package com.egolm.shop.api.service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
public interface OrderService { public interface OrderService {
public String orderCheck(Map<String,Object> params); public String orderCheck(Map<String,Object> params);
public String submit(JSONObject submitObj); public String submit(JSONObject submitObj);
public String queryOrderList(String orgNo, String shopNo, Integer status, String[] orderType, String langID, Page page); public String queryOrderList(String orgNo, String shopNo, Integer status, String[] orderType, String langID, Page page);
public String queryOrderDetailList(String salesOrderId); public String queryOrderDetailList(String salesOrderId);
public String getOrderDetail(String salesOrderId); public String getOrderDetail(String salesOrderId);
public void paySuccess(String sSalesOrderID, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO, Date dPayDateTime); public void paySuccess(String sSalesOrderID, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO, Date dPayDateTime);
public String getSubOrderDetail(String subOrderID); public String getSubOrderDetail(String subOrderID);
public void cancelOrder(String sSalesOrderID); public void cancelOrder(String sSalesOrderID);
public String submitByGroup(String orgNo, String shopNo, String prompPaperNO, String promoGroupNO, Integer saleQty, String addrId, String payTypeId, String terminal, String salesmanNo, String formId, String bankType, String bankAccount, String bankAccountName, String revBankType, String revBankAccount, String revBankAccountNo, String memo); public String submitByGroup(String orgNo, String shopNo, String prompPaperNO, String promoGroupNO, Integer saleQty, String addrId, String payTypeId, String terminal, String salesmanNo, String formId, String bankType, String bankAccount, String bankAccountName, String revBankType, String revBankAccount, String revBankAccountNo, String memo);
public String submitByZhc(String orgNo, String shopNo, Integer planId, Integer saleQty, String addrId, String payTypeId, String terminal, String salesmanNo, String formId, String bankType, String bankAccount, String bankAccountName, String revBankType, String revBankAccount, String revBankAccountNo, String memo); public String submitByZhc(String orgNo, String shopNo, Integer planId, Integer saleQty, String addrId, String payTypeId, String terminal, String salesmanNo, String formId, String bankType, String bankAccount, String bankAccountName, String revBankType, String revBankAccount, String revBankAccountNo, String memo);
public String submitByMdzs(String orgNo, String shopNo, String contractNo, Integer goodsId, Integer saleQty, String addrId, String email, String payTypeId, String terminal, String salesmanNo, String formId, String bankType, String bankAccount, String bankAccountName, String revBankType, String revBankAccount, String revBankAccountNo, String memo); public String submitByMdzs(String orgNo, String shopNo, String contractNo, Integer goodsId, Integer saleQty, String addrId, String email, String payTypeId, String terminal, String salesmanNo, String formId, String bankType, String bankAccount, String bankAccountName, String revBankType, String revBankAccount, String revBankAccountNo, String memo);
public void confirmReceipt(String custNo, String subOrderID); public void confirmReceipt(String custNo, String subOrderID);
public List<Map<String, Object>> getDeliverSubDetail(String aocOrderID); public List<Map<String, Object>> getDeliverSubDetail(String aocOrderID);
} }
package com.egolm.shop.api.service.impl; package com.egolm.shop.api.service.impl;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -9,6 +11,7 @@ import org.apache.commons.logging.LogFactory; ...@@ -9,6 +11,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
...@@ -51,7 +54,7 @@ public class AddressServiceImpl implements AddressService { ...@@ -51,7 +54,7 @@ public class AddressServiceImpl implements AddressService {
+ " lastUpdateTime = t.dLastUpdateTime " + " lastUpdateTime = t.dLastUpdateTime "
+ " from tCustAddress t where t.sShopNO=? and t.sCustNO = ? and t.nTag&1=0 "; + " from tCustAddress t where t.sShopNO=? and t.sCustNO = ? and t.nTag&1=0 ";
jdbcTemplate.setDialect(new SqlServerDialect()); jdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page, shopNO,userNO); return jdbcTemplate.queryForList(sql, shopNO,userNO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
...@@ -152,9 +155,7 @@ public class AddressServiceImpl implements AddressService { ...@@ -152,9 +155,7 @@ public class AddressServiceImpl implements AddressService {
return null; return null;
} }
} }
public static void main(String[] args) {
System.out.println(0|1|2|1);
}
public String delete(String addId,String userNO,String shopNO,String langID) { public String delete(String addId,String userNO,String shopNO,String langID) {
try { try {
boolean isShopExists = userService.checkShopExists(userNO, shopNO); boolean isShopExists = userService.checkShopExists(userNO, shopNO);
...@@ -229,7 +230,7 @@ public class AddressServiceImpl implements AddressService { ...@@ -229,7 +230,7 @@ public class AddressServiceImpl implements AddressService {
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Operate_failure")).set("errorMsg",I18NUtils.getMessage(langID, "Msg_Paramtype_error")).toJson(); return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Operate_failure")).set("errorMsg",I18NUtils.getMessage(langID, "Msg_Paramtype_error")).toJson();
} }
} }
@Override @Override
public Map<String, Object> getDefaultAddress(String custNo, String shopNo) { public Map<String, Object> getDefaultAddress(String custNo, String shopNo) {
...@@ -254,25 +255,37 @@ public class AddressServiceImpl implements AddressService { ...@@ -254,25 +255,37 @@ public class AddressServiceImpl implements AddressService {
+ " from tCustAddress where nTag&1 = 0 and sCustNO = ? and (sShopNO = ? or sShopNO is null or sShopNO = '') order by nTag desc, dLastUpdateTime desc"; + " from tCustAddress where nTag&1 = 0 and sCustNO = ? and (sShopNO = ? or sShopNO is null or sShopNO = '') order by nTag desc, dLastUpdateTime desc";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, custNo, shopNo); List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, custNo, shopNo);
Map<String, Object> defMap = null; Map<String, Object> defMap = null;
Integer nTag_Cur = 0;
List<Map<String, Object>> listTag6 = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> listTag4 = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> listTag2 = new ArrayList<Map<String, Object>>();
for(Map<String, Object> map : list) { for(Map<String, Object> map : list) {
Integer nTag = (Integer)map.get("nTag"); Integer nTag = (Integer)map.get("tag");
if(nTag != null) { if(nTag != null) {
if((nTag&6) == 6) { if((nTag&6) == 6) {
defMap = map; listTag6.add(map);
break; }
} else if((nTag&4) == 4 && nTag_Cur < 4) { if((nTag&4) == 4) {
defMap = map; listTag4.add(map);
} else if((nTag&4) == 2 && nTag_Cur < 2) { }
defMap = map; if((nTag&2) == 2) {
listTag2.add(map);
} }
nTag_Cur = nTag;
} }
} }
if(defMap == null && list.size() > 0) { if(listTag6.size() > 0) {
defMap = listTag6.get(0);
} else if(listTag2.size() > 0) {
defMap = listTag2.get(0);
} else if(listTag4.size() > 0) {
defMap = listTag4.get(0);
} else if(list.size() > 0) {
defMap = list.get(0); defMap = list.get(0);
} }
return defMap; return defMap;
} }
} }
...@@ -86,7 +86,8 @@ public class BrandServiceImpl implements BrandService { ...@@ -86,7 +86,8 @@ public class BrandServiceImpl implements BrandService {
+ "WHERE " + "WHERE "
+ "acg.sBrandID = b.sBrandID " + "acg.sBrandID = b.sBrandID "
+ "and acg.sOrgNO = ? " + "and acg.sOrgNO = ? "
+ "and b.nTag&1 = 0 " + "and b.nTag&1=0 "
+ "and acg.nTag&19=18 "
+ "and b.sBrandID not in (select ip.sBrandID from tIPBrand ip)" + "and b.sBrandID not in (select ip.sBrandID from tIPBrand ip)"
+ "group by " + "group by "
+ "b.sPinyinCode, " + "b.sPinyinCode, "
...@@ -112,7 +113,10 @@ public class BrandServiceImpl implements BrandService { ...@@ -112,7 +113,10 @@ public class BrandServiceImpl implements BrandService {
+ "tBrand b " + "tBrand b "
+ "WHERE " + "WHERE "
+ "acg.sBrandID = b.sBrandID " + "acg.sBrandID = b.sBrandID "
+ "and acg.sOrgNO = ? " + "and acg.sOrgNO = '1006' "
+ "and b.nTag&1=0 "
+ "and acg.nTag&3=2 "
+ "and b.sBrandID not in (select ip.sBrandID from tIPBrand ip)"
+ "group by " + "group by "
+ "b.sPinyinCode, " + "b.sPinyinCode, "
+ "acg.sBrandID, " + "acg.sBrandID, "
......
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.egolm.shop.api.service.impl; package com.egolm.shop.api.service.impl;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.egolm.common.DateUtil; import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.shop.api.service.QiyeWxService; import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.common.utils.HttpUtil; import com.egolm.shop.common.utils.HttpUtil;
import com.egolm.shop.common.utils.HttpUtil.HttpReqObject; import com.egolm.shop.common.utils.HttpUtil.HttpReqObject;
import com.egolm.shop.common.utils.HttpUtil.HttpRespObject; import com.egolm.shop.common.utils.HttpUtil.HttpRespObject;
import com.egolm.shop.common.utils.HttpUtil.JsonReqObject; import com.egolm.shop.common.utils.HttpUtil.JsonReqObject;
import com.egolm.shop.common.utils.HttpUtil.SSLVersion; import com.egolm.shop.common.utils.HttpUtil.SSLVersion;
@Service @Service
public class QiyeWxServiceImpl implements QiyeWxService { public class QiyeWxServiceImpl implements QiyeWxService {
@Value("${qiyewx.corpid}") @Value("${qiyewx.corpid}")
private String corpid; private String corpid;
@Value("${qiyewx.corpsecret}") @Value("${qiyewx.corpsecret}")
private String corpsecret; private String corpsecret;
@Value("${qiyewx.baseUrl}") @Value("${qiyewx.baseUrl}")
private String baseUrl; private String baseUrl;
@Value("${qiyewx.msg.redirect.appid}") @Value("${qiyewx.msg.redirect.appid}")
private String redirectAppid; private String redirectAppid;
@Autowired @Autowired
private RedisTemplate<String, String> redis; private RedisTemplate<String, String> redis;
@Override @Override
public String getTokenString() { public String getTokenString() {
String redisCacheKey = PrefixRedisTokenKey + corpid; String redisCacheKey = PrefixRedisTokenKey + corpid;
Long systemTime = System.currentTimeMillis(); Long systemTime = System.currentTimeMillis();
String tokenObjectString = redis.opsForValue().get(redisCacheKey); String tokenObjectString = redis.opsForValue().get(redisCacheKey);
if(StringUtil.isNotBlank(tokenObjectString)) { if(StringUtil.isNotBlank(tokenObjectString)) {
JSONObject tokenObject = JSON.parseObject(tokenObjectString); JSONObject tokenObject = JSON.parseObject(tokenObjectString);
Integer errcode = tokenObject.getInteger("errcode"); Integer errcode = tokenObject.getInteger("errcode");
if(errcode == 0) { if(errcode == 0) {
Long expires_in = tokenObject.getLong("expires_in"); Long expires_in = tokenObject.getLong("expires_in");
String loadTimeString = tokenObject.getString("loadTime"); String loadTimeString = tokenObject.getString("loadTime");
if(expires_in != null && StringUtil.isNotBlank(loadTimeString)) { if(expires_in != null && StringUtil.isNotBlank(loadTimeString)) {
Date loadTime = DateUtil.parse(loadTimeString, "yyyy-MM-dd HH:mm:ss"); Date loadTime = DateUtil.parse(loadTimeString, "yyyy-MM-dd HH:mm:ss");
Long expireTime = loadTime.getTime() + (expires_in*1000L); Long expireTime = loadTime.getTime() + (expires_in*1000L);
if((expireTime - DevTime) > systemTime) { if((expireTime - DevTime) > systemTime) {
String access_token = tokenObject.getString("access_token"); String access_token = tokenObject.getString("access_token");
if(StringUtil.isNotBlank(access_token)) { if(StringUtil.isNotBlank(access_token)) {
return access_token; return access_token;
} }
} }
} }
} }
} }
String requestUrl = baseUrl + MessageFormat.format(UrlGetToken, corpid, corpsecret); String requestUrl = baseUrl + MessageFormat.format(UrlGetToken, corpid, corpsecret);
HttpRespObject resp = HttpUtil.newInstance().setSSLVersion(SSLVersion.SSLv3).get(new HttpReqObject(requestUrl, null, null)); HttpRespObject resp = HttpUtil.newInstance().setSSLVersion(SSLVersion.SSLv3).get(new HttpReqObject(requestUrl, null, null));
if(resp.getHttpCode() == 200) { if(resp.getHttpCode() == 200) {
String text = resp.getResponseBody(); String text = resp.getResponseBody();
JSONObject tokenObject = JSON.parseObject(text); JSONObject tokenObject = JSON.parseObject(text);
Integer code = tokenObject.getInteger("errcode"); Integer code = tokenObject.getInteger("errcode");
if(code == 0) { if(code == 0) {
tokenObject.put("loadTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); tokenObject.put("loadTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
redis.opsForValue().set(redisCacheKey, tokenObject.toJSONString()); redis.opsForValue().set(redisCacheKey, tokenObject.toJSONString());
return tokenObject.getString("access_token"); return tokenObject.getString("access_token");
} }
} }
return null; return null;
} }
@Override @Override
public void refreshToken() { public void refreshToken() {
String redisCacheKey = PrefixRedisTokenKey + corpid; String redisCacheKey = PrefixRedisTokenKey + corpid;
redis.delete(redisCacheKey); redis.delete(redisCacheKey);
} }
@Override @Override
public void sendMessage(WxMessage wxMessage) { public void sendMessage(WxMessage wxMessage) {
String tokenString = this.getTokenString(); String tokenString = this.getTokenString();
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); 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));
} }
} }
...@@ -875,8 +875,10 @@ public class UserServiceImpl implements UserService { ...@@ -875,8 +875,10 @@ public class UserServiceImpl implements UserService {
if(shopList.size() == 0) { if(shopList.size() == 0) {
throw new XException("该账号暂未绑定门店"); throw new XException("该账号暂未绑定门店");
} }
Map<String, Object> custMap = datas.get(1).get(0);
custMap.put("sOpenID", openId);
map.put("userinfo", uMap); map.put("userinfo", uMap);
map.put("customer", datas.get(1).get(0)); map.put("customer", custMap);
map.put("bankList", datas.get(2)); map.put("bankList", datas.get(2));
map.put("shopList", shopList); map.put("shopList", shopList);
return map; return map;
......
package com.egolm.shop.common.interceptor; package com.egolm.shop.common.interceptor;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.scheduling.annotation.Async;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.alibaba.fastjson.JSON;
import com.egolm.common.jdbc.JdbcTemplate; import com.alibaba.fastjson.JSON;
import com.egolm.common.web.ServletUtil; import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.web.ServletUtil;
@Component
public class LogInterceptor extends HandlerInterceptorAdapter { @Component
public class LogInterceptor extends HandlerInterceptorAdapter {
@Value("${log.isOpen}")
private Boolean isOpen; @Value("${log.isOpen}")
private Boolean isOpen;
@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception { @Value("${log.sProjectID:SHOP}")
this.exec(req); private String sProjectID;
return super.preHandle(req, resp, handler);
} @Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
@Autowired this.exec(req);
@Qualifier("log") return super.preHandle(req, resp, handler);
private JdbcTemplate jdbcTemplate; }
private void exec(HttpServletRequest req) { @Autowired
if(isOpen) { @Qualifier("log")
try { private JdbcTemplate jdbcTemplate;
String contextPath = req.getContextPath();
String uri = req.getRequestURI().substring(contextPath.length()); private void exec(HttpServletRequest req) {
String remoteIp = ServletUtil.remoteIp(req); if(isOpen) {
String params = JSON.toJSONString(req.getParameterMap()); try {
Map<String, Object> map = new HashMap<String,Object>(); String contextPath = req.getContextPath();
map.put("sProjectID", "SHOP"); String uri = req.getRequestURI().substring(contextPath.length());
map.put("sURI", uri); String remoteIp = ServletUtil.remoteIp(req);
map.put("sClientIP", remoteIp); String params = JSON.toJSONString(req.getParameterMap());
map.put("sParams", params); Map<String, Object> map = new HashMap<String,Object>();
map.put("dCreateTime", new Date()); map.put("sProjectID", sProjectID);
jdbcTemplate.save("tLog", map); map.put("sURI", uri);
} catch (Throwable e) { map.put("sClientIP", remoteIp);
e.printStackTrace(); map.put("sParams", params);
} map.put("dCreateTime", new Date());
} this.save(map);
} } catch (Throwable e) {
e.printStackTrace();
} }
}
}
@Async
public void save(Map<String, Object> map) {
jdbcTemplate.save("tLog", map);
}
}
package com.egolm.shop.common.interceptor; package com.egolm.shop.common.interceptor;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.common.GsonUtil;
import com.egolm.common.MD5Util; import com.egolm.common.GsonUtil;
import com.egolm.common.StringUtil; import com.egolm.common.MD5Util;
import com.egolm.shop.common.XException; import com.egolm.common.StringUtil;
import com.egolm.shop.common.utils.I18NUtils; import com.egolm.common.Util;
import com.egolm.shop.common.utils.ShopContstrant; import com.egolm.shop.common.XException;
import com.egolm.shop.common.utils.I18NUtils;
@Component import com.egolm.shop.common.utils.ShopContstrant;
public class OpenInterceptor extends HandlerInterceptorAdapter {
Log logger = LogFactory.getLog(OpenInterceptor.class); @Component
String encoding = "UTF-8"; public class OpenInterceptor extends HandlerInterceptorAdapter {
Log logger = LogFactory.getLog(OpenInterceptor.class);
@Autowired String encoding = "UTF-8";
private RedisTemplate<String, Object> redisTemplate;
@Value("${ignoreTimestamp:false}")
/*签名规则:1.按照参数字段名ASCII码排序;2.参数进行url拼接;3.加上签名字符串secret;4.得到字符串后进行SHA1签名;5.将签名得到的字符串加入参数列表中,字段名为sig*/ private Boolean ignoreTimestamp;
@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception { @Autowired
String uri = req.getRequestURI(); private RedisTemplate<String, Object> redisTemplate;
if((uri.indexOf("swagger") == -1 && uri.indexOf("/v2/api-docs") == -1) ) {
Map<String, String[]> paramMap = req.getParameterMap(); /*签名规则:1.按照参数字段名ASCII码排序;2.参数进行url拼接;3.加上签名字符串secret;4.得到字符串后进行SHA1签名;5.将签名得到的字符串加入参数列表中,字段名为sig*/
logger.info(GsonUtil.toJson(paramMap)); @Override
String sign = req.getParameter("sign"); public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
String timestamp = req.getParameter("timestamp"); String uri = req.getRequestURI();
String langID = req.getParameter("langID"); if((uri.indexOf("swagger") == -1 && uri.indexOf("/v2/api-docs") == -1) ) {
String terminal = req.getParameter("terminal"); Map<String, String[]> paramMap = req.getParameterMap();
logger.info(GsonUtil.toJson(paramMap));
if(!StringUtil.isNotBlank(sign,timestamp,langID,terminal)) { String sign = req.getParameter("sign");
throw new XException(I18NUtils.getMessage(langID, "Msg_Paramter_Empty","[sign,timestamp,langID,terminal]")) ; String timestamp = req.getParameter("timestamp");
} String langID = req.getParameter("langID");
String terminal = req.getParameter("terminal");
SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
Set<String> keys = paramMap.keySet() ; if(!StringUtil.isNotBlank(sign,timestamp,langID,terminal)) {
for (String key : keys) { throw new XException(I18NUtils.getMessage(langID, "Msg_Paramter_Empty","[sign,timestamp,langID,terminal]")) ;
String value = req.getParameter(key); }
parameters.put(key,value);
} Long timeLong = Util.objTo(timestamp, Long.class, 0L);
redisTemplate.opsForHash().put("SystemCtl1111", "test","111"); if(!ignoreTimestamp && Math.abs(timeLong - System.currentTimeMillis()) > (60L*5L)) {
System.out.println(redisTemplate.opsForHash().get("SystemCtl1111", "test")); throw new XException("时间戳无效");
}
Map<?, ?> map = (Map<?, ?>)redisTemplate.opsForHash().get(ShopContstrant.SystemCtl_Redis_Base_Key, ShopContstrant.CLIENT_MD5KEY);
System.out.println(map); SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
if(map != null) { Set<String> keys = paramMap.keySet() ;
parameters.put("md5Key", map.get("sValue1")+""); for (String key : keys) {
}else { String value = req.getParameter(key);
logger.info("从redis中获取 计算签名用的md5key 获取失败"); parameters.put(key,value);
throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure")); }
} redisTemplate.opsForHash().put("SystemCtl1111", "test","111");
System.out.println(redisTemplate.opsForHash().get("SystemCtl1111", "test"));
logger.info("request sign >>>>>>"+sign);
String createSign = MD5Util.createSign(encoding, parameters); Map<?, ?> map = (Map<?, ?>)redisTemplate.opsForHash().get(ShopContstrant.SystemCtl_Redis_Base_Key, ShopContstrant.CLIENT_MD5KEY);
logger.info("create sign >>>>>>>"+createSign); System.out.println(map);
if(createSign.toUpperCase().equals(sign.toUpperCase())) { if(map != null) {
return super.preHandle(req, resp, handler); parameters.put("md5Key", map.get("sValue1")+"");
} else { }else {
throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure")); logger.info("从redis中获取 计算签名用的md5key 获取失败");
} throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure"));
}else { }
return super.preHandle(req, resp, handler); //swagger-ui.html 界面不进行验证
} logger.info("request sign >>>>>>"+sign);
} String createSign = MD5Util.createSign(encoding, parameters);
logger.info("create sign >>>>>>>"+createSign);
public static void main(String[] args) { if(createSign.toUpperCase().equals(sign.toUpperCase())) {
String a= "/A0001/20181023/2018_10_23_17_27_00_58303479.png"; return super.preHandle(req, resp, handler);
System.out.println(a.length()); } else {
} throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure"));
} }
}else {
return super.preHandle(req, resp, handler); //swagger-ui.html 界面不进行验证
}
}
public static void main(String[] args) {
String a= "/A0001/20181023/2018_10_23_17_27_00_58303479.png";
System.out.println(a.length());
}
}
...@@ -73,7 +73,7 @@ public class QiyeWxMsgTask { ...@@ -73,7 +73,7 @@ public class QiyeWxMsgTask {
WxMessage wxMessage = new WxMessage(sCompanyAccountID); WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice(); MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice); wxMessage.setMiniprogram_notice(notice);
notice.setTitle("客户订单通知"); notice.setTitle("客户订单通知");
notice.setDescription(dateString); notice.setDescription(dateString);
notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSubOrderID + "&isActive=1"); notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSubOrderID + "&isActive=1");
Map<Object, Object> params = new LinkedHashMap<Object, Object>(); Map<Object, Object> params = new LinkedHashMap<Object, Object>();
......
...@@ -6,4 +6,9 @@ spring.datasource.url=jdbc:sqlserver://172.16.0.8:55433;instanceName=SQLSERVER;D ...@@ -6,4 +6,9 @@ spring.datasource.url=jdbc:sqlserver://172.16.0.8:55433;instanceName=SQLSERVER;D
log.datasource.username=root log.datasource.username=root
log.datasource.password=asters#2019 log.datasource.password=asters#2019
log.datasource.url=jdbc:mysql://127.0.0.1:3306/shopLog?useSSL=false&useUnicode=true&characterEncoding=utf8 log.datasource.url=jdbc:mysql://127.0.0.1:3306/shopLog?useSSL=false&useUnicode=true&characterEncoding=utf8
\ No newline at end of file
qiyewx.corpid=ww92480eb625f6cf0f
qiyewx.corpsecret=sRDiUjmmr2yD4q-2A8d2_Y-1b_XPkbGmdD0goIYAGwU
qiyewx.msg.redirect.appid=wx79ba889cb1d94c27
...@@ -25,7 +25,7 @@ solr.goods.offset-minute-for-day: 1500 ...@@ -25,7 +25,7 @@ solr.goods.offset-minute-for-day: 1500
solr.goods.offset-minute-for-minute: 10 solr.goods.offset-minute-for-minute: 10
solr.goods.cron-for-day: 0 0 3 * * ? solr.goods.cron-for-day: 0 0 3 * * ?
solr.goods.cron-for-minute: 0 * * * * ? solr.goods.cron-for-minute: 0 * * * * ?
solr.baseURL=http://127.0.0.1:8983/solr/goods solr.baseURL=http://127.0.0.1:18004/solr/goods
logProducer.logName=AST_SHOP_ERROR_LOG logProducer.logName=AST_SHOP_ERROR_LOG
logProducer.isOpen=false logProducer.isOpen=false
......
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