Commit 80514e88 authored by zhangyong's avatar zhangyong

加签名

parent 8cbee67e
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId> <artifactId>spring-security-core</artifactId>
......
package com.egolm.shop.config; package com.egolm.shop.config;
import java.util.EventListener; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.egolm.shop.config.interceptor.OpenInterceptor;
@Configuration @Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter { public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
@Override private OpenInterceptor openInterceptor;
public void configurePathMatch(PathMatchConfigurer configurer) { @Override
configurer.setUseSuffixPatternMatch(false).setUseTrailingSlashMatch(false); public void addInterceptors(InterceptorRegistry registry) {
//注册自定义拦截器,添加拦截路径和排除拦截路径
System.out.println("-addInterceptors------");
registry.addInterceptor(openInterceptor).excludePathPatterns("api/path/login");
super.addInterceptors(registry);
} }
@Bean
public ServletListenerRegistrationBean<EventListener> getDemoListener(){
ServletListenerRegistrationBean<EventListener> registrationBean = new ServletListenerRegistrationBean<>();
registrationBean.setListener(new RequestContextListener());
return registrationBean;
}
public static HttpServletRequest getRequest() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes != null) {
return servletRequestAttributes.getRequest();
}
return null;
}
public static HttpServletResponse getResponse() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes != null) {
return servletRequestAttributes.getResponse();
}
return null;
}
public static HttpSession getSession() {
HttpServletRequest request = WebMvcConfig.getRequest();
if(request != null) {
return request.getSession();
}
return null;
}
} }
package com.egolm.shop.config.interceptor;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.common.GsonUtil;
import com.egolm.common.HttpUtil;
import com.egolm.common.MD5Util;
import com.egolm.common.StringUtil;
import com.egolm.shop.config.XException;
import com.egolm.shop.util.I18NUtils;
import com.egolm.shop.util.ShopContstrant;
@Component
public class OpenInterceptor extends HandlerInterceptorAdapter {
private static final Log logger = LogFactory.getLog(OpenInterceptor.class);
String encoding = "UTF-8";
@Autowired
private RedisTemplate redisTemplate;
/*签名规则:1.按照参数字段名ASCII码排序;2.参数进行url拼接;3.加上签名字符串secret;4.得到字符串后进行SHA1签名;5.将签名得到的字符串加入参数列表中,字段名为sig*/
@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
String uri = req.getRequestURI();
if((uri.indexOf("swagger") == -1 && uri.indexOf("/v2/api-docs") == -1) ) {
Map<String, String[]> paramMap = req.getParameterMap();
logger.info(GsonUtil.toJson(paramMap));
String sign = req.getParameter("sign");
String timestamp = req.getParameter("timestamp");
String langID = req.getParameter("langID");
String terminal = req.getParameter("terminal");
if(!StringUtil.isNotBlank(sign,timestamp,langID,terminal)) {
throw new XException(I18NUtils.getMessage(langID, "Msg_Paramter_Empty","[sign,timestamp,langID,terminal]")) ;
}
SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
Set<String> keys = paramMap.keySet() ;
for (String key : keys) {
String value = req.getParameter(key);
parameters.put(key,value);
}
String md5Key = (String)redisTemplate.opsForValue().get(ShopContstrant.CLIENT_MD5KEY);
parameters.put("md5Key", md5Key);
logger.info("request sign >>>>>>"+sign);
String createSign = MD5Util.createSign(encoding, parameters);
logger.info("create sign >>>>>>>"+createSign);
if(createSign.toUpperCase().equals(sign.toUpperCase())) {
return super.preHandle(req, resp, handler);
} 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());
}
}
...@@ -37,6 +37,8 @@ public class AddressController { ...@@ -37,6 +37,8 @@ public class AddressController {
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "int", required = true, value = "页码", defaultValue = "1"), @ApiImplicitParam(paramType = "query", name = "index", dataType = "int", required = true, value = "页码", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"), @ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
}) })
@RequestMapping(value = "/list",method=RequestMethod.GET) @RequestMapping(value = "/list",method=RequestMethod.GET)
public String list(HttpServletRequest request) { public String list(HttpServletRequest request) {
...@@ -90,6 +92,8 @@ public class AddressController { ...@@ -90,6 +92,8 @@ public class AddressController {
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/saveOrUpdate",method=RequestMethod.POST) @RequestMapping(value = "/saveOrUpdate",method=RequestMethod.POST)
...@@ -143,7 +147,9 @@ public class AddressController { ...@@ -143,7 +147,9 @@ public class AddressController {
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = true, value = "用户编码", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = true, value = "用户编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "addId", dataType = "String", required = true, value = "地址ID", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "addId", dataType = "String", required = true, value = "地址ID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/delete",method=RequestMethod.GET) @RequestMapping(value = "/delete",method=RequestMethod.GET)
public String delete(HttpServletRequest request) { public String delete(HttpServletRequest request) {
...@@ -162,7 +168,9 @@ public class AddressController { ...@@ -162,7 +168,9 @@ public class AddressController {
@ApiImplicitParam(paramType = "query", name = "addId", dataType = "String", required = true, value = "地址ID", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "addId", dataType = "String", required = true, value = "地址ID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "type", dataType = "String", required = true, value = "操作类型 0为取消默认 ,2为设置默认", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "type", dataType = "String", required = true, value = "操作类型 0为取消默认 ,2为设置默认", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/defaultAdd",method=RequestMethod.GET) @RequestMapping(value = "/defaultAdd",method=RequestMethod.GET)
public String defaultAdd(HttpServletRequest request) { public String defaultAdd(HttpServletRequest request) {
...@@ -181,6 +189,8 @@ public class AddressController { ...@@ -181,6 +189,8 @@ public class AddressController {
@ApiImplicitParam(paramType = "query", name = "addId", dataType = "String", required = true, value = "地址ID", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "addId", dataType = "String", required = true, value = "地址ID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/detail",method=RequestMethod.GET) @RequestMapping(value = "/detail",method=RequestMethod.GET)
public String detail(HttpServletRequest request) { public String detail(HttpServletRequest request) {
......
...@@ -40,6 +40,9 @@ public class BrandController { ...@@ -40,6 +40,9 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "int", required = true, value = "页码", defaultValue = "1"), @ApiImplicitParam(paramType = "query", name = "index", dataType = "int", required = true, value = "页码", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"), @ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getBanner",method=RequestMethod.GET) @RequestMapping(value = "/getBanner",method=RequestMethod.GET)
public String getBanner(HttpServletRequest request) { public String getBanner(HttpServletRequest request) {
...@@ -72,8 +75,11 @@ public class BrandController { ...@@ -72,8 +75,11 @@ public class BrandController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "OrgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "OrgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "ShopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "ShopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getBrandList",method=RequestMethod.GET) @RequestMapping(value = "/getBrandList",method=RequestMethod.GET)
public String getBrandList(HttpServletRequest request, HttpServletResponse response) { public String getBrandList(HttpServletRequest request, HttpServletResponse response) {
...@@ -122,7 +128,12 @@ public class BrandController { ...@@ -122,7 +128,12 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"), @ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"), @ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getHotSaleBrands",method=RequestMethod.GET) @RequestMapping(value = "/getHotSaleBrands",method=RequestMethod.GET)
public String getHotSaleBrands(HttpServletRequest request, HttpServletResponse response) { public String getHotSaleBrands(HttpServletRequest request, HttpServletResponse response) {
......
...@@ -33,7 +33,9 @@ public class CartController { ...@@ -33,7 +33,9 @@ public class CartController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name="shopNO", dataType = "String", required = true, value = "店铺编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name="shopNO", dataType = "String", required = true, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/cartQuery",method=RequestMethod.GET) @RequestMapping(value = "/cartQuery",method=RequestMethod.GET)
...@@ -49,44 +51,52 @@ public class CartController { ...@@ -49,44 +51,52 @@ public class CartController {
@ApiOperation("加入购物车(JSON格式)") @ApiOperation("加入购物车(JSON格式)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"terminal\": \"wechat\",\"langID\": \"936\",\"cartList\": [{\"goodsID\": \"30771\",\"goodsTypeID\": 0,\"saleQty\": \"24\",\"agentContractNO\": \"600327002\",\"promoGroupNO\":\"\",\"promoPaperNO\":\"00001810100007\" }]}"), @ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"cartList\": [{\"goodsID\": \"30771\",\"goodsTypeID\": 0,\"saleQty\": \"24\",\"agentContractNO\": \"600327002\",\"promoGroupNO\":\"\",\"promoPaperNO\":\"00001810100007\" }]}"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/appendCart",method=RequestMethod.POST,produces = "application/json") @RequestMapping(value = "/appendCart",method=RequestMethod.POST,produces = "application/json")
public String appendCart(HttpServletRequest request, HttpServletResponse response) { public String appendCart(HttpServletRequest request, HttpServletResponse response) {
String reqJson = ServletUtil.readReqJson(request); String reqJson =request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson); JSONObject jsonObj = JSONObject.parseObject(reqJson);
System.out.println("appendCart-------"+reqJson); System.out.println("appendCart-------"+reqJson);
String terminal = request.getParameter("terminal");
return cartService.append(jsonObj); return cartService.append(jsonObj,terminal);
} }
@ApiOperation("删除购物车(JSON格式)") @ApiOperation("删除购物车(JSON格式)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"terminal\": \"wechat\",\"langID\": \"936\",\"idxs\": [1,2,3]}"), @ApiImplicitParam(paramType = "query",name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"terminal\": \"wechat\",\"langID\": \"936\",\"idxs\": [1,2,3]}"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/remove",method=RequestMethod.POST) @RequestMapping(value = "/remove",method=RequestMethod.POST)
public String remove(HttpServletRequest request, HttpServletResponse response) { public String remove(HttpServletRequest request, HttpServletResponse response) {
String reqJson = ServletUtil.readReqJson(request); String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson); JSONObject jsonObj = JSONObject.parseObject(reqJson);
System.out.println("remove-------"+reqJson); System.out.println("remove-------"+reqJson);
String terminal = request.getParameter("terminal");
return cartService.remove(jsonObj); return cartService.remove(jsonObj,terminal);
} }
@ApiOperation("修改数量(JSON格式)") @ApiOperation("修改数量(JSON格式)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"terminal\": \"wechat\",\"langID\": \"936\", \"idx\": 2,\"saleQty\": \"23\" }"), @ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\", \"idx\": 2,\"saleQty\": \"23\" }"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/updateQty",method=RequestMethod.POST) @RequestMapping(value = "/updateQty",method=RequestMethod.POST)
public String updateQty(HttpServletRequest request, HttpServletResponse response) { public String updateQty(HttpServletRequest request, HttpServletResponse response) {
String reqJson = ServletUtil.readReqJson(request); String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson); JSONObject jsonObj = JSONObject.parseObject(reqJson);
System.out.println("updateQty-------"+reqJson); System.out.println("updateQty-------"+reqJson);
String terminal = request.getParameter("terminal");
return cartService.updateQty(jsonObj); return cartService.updateQty(jsonObj,terminal);
} }
} }
...@@ -32,6 +32,8 @@ public class CategoryController { ...@@ -32,6 +32,8 @@ public class CategoryController {
@ApiImplicitParam(paramType = "query", name = "scopeTypeID", dataType = "String", required = true, value = "店铺类型", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "scopeTypeID", dataType = "String", required = true, value = "店铺类型", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/queryCategory",method=RequestMethod.GET) @RequestMapping(value = "/queryCategory",method=RequestMethod.GET)
......
...@@ -27,6 +27,8 @@ public class CommonController { ...@@ -27,6 +27,8 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/queryDistrictByOrgNO",method=RequestMethod.GET) @RequestMapping(value = "/queryDistrictByOrgNO",method=RequestMethod.GET)
public String detail(HttpServletRequest request) { public String detail(HttpServletRequest request) {
......
...@@ -35,6 +35,8 @@ public class CouponController { ...@@ -35,6 +35,8 @@ public class CouponController {
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = true, value = "用户编码", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = true, value = "用户编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/allCoupon",method=RequestMethod.GET) @RequestMapping(value = "/allCoupon",method=RequestMethod.GET)
public String allCoupon(HttpServletRequest request) { public String allCoupon(HttpServletRequest request) {
...@@ -71,6 +73,8 @@ public class CouponController { ...@@ -71,6 +73,8 @@ public class CouponController {
@ApiImplicitParam(paramType = "query", name = "endDate", dataType = "String", required = false, value = "结束日期", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "endDate", dataType = "String", required = false, value = "结束日期", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/myCoupon",method=RequestMethod.GET) @RequestMapping(value = "/myCoupon",method=RequestMethod.GET)
public String myCoupon(HttpServletRequest request) { public String myCoupon(HttpServletRequest request) {
...@@ -112,6 +116,8 @@ public class CouponController { ...@@ -112,6 +116,8 @@ public class CouponController {
@ApiImplicitParam(paramType = "query", name = "point", dataType = "int", required = false, value = "抵扣金币", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "point", dataType = "int", required = false, value = "抵扣金币", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getCoupon",method=RequestMethod.GET) @RequestMapping(value = "/getCoupon",method=RequestMethod.GET)
public String getCoupon(HttpServletRequest request) { public String getCoupon(HttpServletRequest request) {
......
...@@ -41,6 +41,8 @@ public class GoodsController { ...@@ -41,6 +41,8 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/thinkLike",method=RequestMethod.GET) @RequestMapping(value = "/thinkLike",method=RequestMethod.GET)
public String thinkLike(HttpServletRequest request) { public String thinkLike(HttpServletRequest request) {
...@@ -86,6 +88,8 @@ public class GoodsController { ...@@ -86,6 +88,8 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"), @ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getHotSaleGoods",method=RequestMethod.GET) @RequestMapping(value = "/getHotSaleGoods",method=RequestMethod.GET)
public String getHotSaleGoods(HttpServletRequest request, HttpServletResponse response) { public String getHotSaleGoods(HttpServletRequest request, HttpServletResponse response) {
...@@ -111,6 +115,8 @@ public class GoodsController { ...@@ -111,6 +115,8 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"), @ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getCategoryGoods",method=RequestMethod.GET) @RequestMapping(value = "/getCategoryGoods",method=RequestMethod.GET)
...@@ -138,6 +144,8 @@ public class GoodsController { ...@@ -138,6 +144,8 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"), @ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/hotSearchKey",method=RequestMethod.GET) @RequestMapping(value = "/hotSearchKey",method=RequestMethod.GET)
public String hotSearchKey(HttpServletRequest request, HttpServletResponse response) { public String hotSearchKey(HttpServletRequest request, HttpServletResponse response) {
...@@ -154,25 +162,29 @@ public class GoodsController { ...@@ -154,25 +162,29 @@ public class GoodsController {
@ApiOperation("统一搜索(支持品牌,分类,关键字,仓库等)") @ApiOperation("统一搜索(支持品牌,分类,关键字,仓库等)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "String", required = true, value = "JSON参数", defaultValue = "{\"topCategoryNO\":\"01\",\"upCategoryNO\":\"\",\"categoryID\":[\"\"],\"brandID\":[\"\"],\"agentID\":\"\",\"warehouseNO\":\"\",\"scopeTypeID\":\"1\",\"districtID\":\"\",\"keyword\":\"*\",\"index\":1,\"limit\":10,\"userNO\":\"00034\",\"orgNO\":\"XIAN\",\"shopNO\":\"167728271\",\"langID\":\"936\",\"terminal\":\"wechat\"}"), @ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = true, value = "JSON参数", defaultValue = "{\"topCategoryNO\":\"01\",\"upCategoryNO\":\"\",\"categoryID\":[\"\"],\"brandID\":[\"\"],\"agentID\":\"\",\"warehouseNO\":\"\",\"scopeTypeID\":\"1\",\"districtID\":\"\",\"keyword\":\"*\",\"index\":1,\"limit\":10,\"userNO\":\"00034\",\"orgNO\":\"XIAN\",\"shopNO\":\"167728271\"}"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/searchGoods",method=RequestMethod.POST) @RequestMapping(value = "/searchGoods",method=RequestMethod.POST)
public String searchGoods(HttpServletRequest request, HttpServletResponse response) { public String searchGoods(HttpServletRequest request, HttpServletResponse response) {
String reqJson = ServletUtil.readReqJson(request); String reqJson = request.getParameter("data");
System.out.println("searchGoods-------"+reqJson); System.out.println("searchGoods-------"+reqJson);
Map<String, Object> argsMap = new HashMap<String,Object>(); Map<String, Object> argsMap = new HashMap<String,Object>();
argsMap = GsonUtil.toMap(reqJson); argsMap = GsonUtil.toMap(reqJson);
String LangID = argsMap.get("langID")+""; String langID = request.getParameter("langID");
argsMap.put("langID", langID);
try { try {
if(!argsMap.containsKey("index") || !argsMap.containsKey("limit") || !argsMap.containsKey("userNO") || !argsMap.containsKey("shopNO") || !argsMap.containsKey("orgNO") || !argsMap.containsKey("langID") if(!argsMap.containsKey("index") || !argsMap.containsKey("limit") || !argsMap.containsKey("userNO") || !argsMap.containsKey("shopNO") || !argsMap.containsKey("orgNO") ) {
|| !argsMap.containsKey("terminal") ) { return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Parameter_empty")).set("errorMsg", "index,limit,userNO,shopNO,orgNO " +I18NUtils.getMessage(langID, "Msg_Must_enter")).toJson();
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(LangID, "Msg_Parameter_empty")).set("errorMsg", "index,limit,userNO,shopNO,orgNO,langID,terminal " +I18NUtils.getMessage(LangID, "Msg_Must_enter")).toJson();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(LangID, "Msg_QueryParam_error")).toJson(); return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_QueryParam_error")).toJson();
} }
return goodsService.searchGoods(argsMap); return goodsService.searchGoods(argsMap);
} }
...@@ -188,6 +200,8 @@ public class GoodsController { ...@@ -188,6 +200,8 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/goodsDetail",method=RequestMethod.GET) @RequestMapping(value = "/goodsDetail",method=RequestMethod.GET)
...@@ -226,6 +240,8 @@ public class GoodsController { ...@@ -226,6 +240,8 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "override", dataType = "String", required = true, value = "收藏状态(1为收藏,0为取消)", defaultValue = "1"), @ApiImplicitParam(paramType = "query", name = "override", dataType = "String", required = true, value = "收藏状态(1为收藏,0为取消)", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/myFlavor",method=RequestMethod.GET) @RequestMapping(value = "/myFlavor",method=RequestMethod.GET)
......
...@@ -32,6 +32,8 @@ public class PageController { ...@@ -32,6 +32,8 @@ public class PageController {
@ApiOperation("查询(只有一条)") @ApiOperation("查询(只有一条)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/query",method=RequestMethod.GET) @RequestMapping(value = "/query",method=RequestMethod.GET)
public String query(HttpServletRequest request) { public String query(HttpServletRequest request) {
......
...@@ -47,6 +47,8 @@ public class SolrGoodsController { ...@@ -47,6 +47,8 @@ public class SolrGoodsController {
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="keywords", value="精确搜索条件"), @ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="keywords", value="精确搜索条件"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="facetFields", value="单字段分组字段"), @ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="facetFields", value="单字段分组字段"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="facetPivotFields", value="多字段分组字段"), @ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="facetPivotFields", value="多字段分组字段"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
public Object query(Long index, Long limit, String queryKey, String[] orders, String[] keywords, String[] facetFields, String[] facetPivotFields) { public Object query(Long index, Long limit, String queryKey, String[] orders, String[] keywords, String[] facetFields, String[] facetPivotFields) {
Page page = new Page(index, limit, orders); Page page = new Page(index, limit, orders);
...@@ -58,6 +60,8 @@ public class SolrGoodsController { ...@@ -58,6 +60,8 @@ public class SolrGoodsController {
@ApiOperation("搜索引擎按区域编号更新商品索引") @ApiOperation("搜索引擎按区域编号更新商品索引")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=false, required=true, name="sDistrictID", value="区域编号"), @ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=false, required=true, name="sDistrictID", value="区域编号"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
public Object updateByDistrictID(String sDistrictID) { public Object updateByDistrictID(String sDistrictID) {
service.update(sDistrictID); service.update(sDistrictID);
......
...@@ -32,6 +32,8 @@ public class SystemCtrlController { ...@@ -32,6 +32,8 @@ public class SystemCtrlController {
@ApiImplicitParam(paramType = "query", name = "code", dataType = "String", required = true, value = "编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "code", dataType = "String", required = true, value = "编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getSystemCtrlByCode",method=RequestMethod.GET) @RequestMapping(value = "/getSystemCtrlByCode",method=RequestMethod.GET)
......
...@@ -35,6 +35,8 @@ public class UserController { ...@@ -35,6 +35,8 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = "SHBS"), @ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/createGuest",method=RequestMethod.GET) @RequestMapping(value = "/createGuest",method=RequestMethod.GET)
...@@ -57,6 +59,8 @@ public class UserController { ...@@ -57,6 +59,8 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "openID", dataType = "String", required = false, value = "openID(优先级小于账号)", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "openID", dataType = "String", required = false, value = "openID(优先级小于账号)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/login",method=RequestMethod.POST) @RequestMapping(value = "/login",method=RequestMethod.POST)
...@@ -81,6 +85,8 @@ public class UserController { ...@@ -81,6 +85,8 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/userInfo",method=RequestMethod.GET) @RequestMapping(value = "/userInfo",method=RequestMethod.GET)
public String userInfo(HttpServletRequest request, HttpServletResponse response) { public String userInfo(HttpServletRequest request, HttpServletResponse response) {
...@@ -116,6 +122,8 @@ public class UserController { ...@@ -116,6 +122,8 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "smsTmpID", dataType = "String", required = true, value = "短信模板ID", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "smsTmpID", dataType = "String", required = true, value = "短信模板ID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/modifyPwd",method=RequestMethod.POST) @RequestMapping(value = "/modifyPwd",method=RequestMethod.POST)
public String modifyPwd(HttpServletRequest request, HttpServletResponse response) { public String modifyPwd(HttpServletRequest request, HttpServletResponse response) {
...@@ -143,6 +151,8 @@ public class UserController { ...@@ -143,6 +151,8 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "content", dataType = "String", required = true, value = "内容,按模板上的参数填值,以,分隔", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "content", dataType = "String", required = true, value = "内容,按模板上的参数填值,以,分隔", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/sendSms",method=RequestMethod.GET) @RequestMapping(value = "/sendSms",method=RequestMethod.GET)
public String sendSms(HttpServletRequest request, HttpServletResponse response) { public String sendSms(HttpServletRequest request, HttpServletResponse response) {
......
...@@ -6,11 +6,11 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,11 +6,11 @@ import com.alibaba.fastjson.JSONObject;
public interface CartService { public interface CartService {
public String append(JSONObject obj); public String append(JSONObject obj,String terminal);
public String remove(JSONObject obj); public String remove(JSONObject obj,String terminal);
public String updateQty (JSONObject obj); public String updateQty (JSONObject obj,String terminal);
public String query (Map<String,Object> params); public String query (Map<String,Object> params);
} }
...@@ -49,9 +49,8 @@ public class CartServiceImpl implements CartService { ...@@ -49,9 +49,8 @@ public class CartServiceImpl implements CartService {
* @return * @return
* @see com.egolm.shop.service.CartService#append(com.alibaba.fastjson.JSONObject) * @see com.egolm.shop.service.CartService#append(com.alibaba.fastjson.JSONObject)
*/ */
public String append(JSONObject obj) { public String append(JSONObject obj,String terminal) {
String shopNO = obj.getString("shopNO"); String shopNO = obj.getString("shopNO");
String terminal = obj.getString("terminal");
JSONArray cartList = obj.getJSONArray("cartList"); JSONArray cartList = obj.getJSONArray("cartList");
Integer nMaxIdx = jdbcTemplate.queryForInt("select max(nIdx) from tCart where sShopNO = '" + shopNO + "'"); Integer nMaxIdx = jdbcTemplate.queryForInt("select max(nIdx) from tCart where sShopNO = '" + shopNO + "'");
...@@ -128,10 +127,9 @@ public class CartServiceImpl implements CartService { ...@@ -128,10 +127,9 @@ public class CartServiceImpl implements CartService {
* {"shopNO": "00029975","terminal": "wechat","langID": "936","idxs": [1,2,3]} * {"shopNO": "00029975","terminal": "wechat","langID": "936","idxs": [1,2,3]}
*/ */
@Override @Override
public String remove(JSONObject obj) { public String remove(JSONObject obj,String terminal) {
String shopNO = obj.getString("shopNO"); String shopNO = obj.getString("shopNO");
JSONArray idxArray = obj.getJSONArray("idxs"); JSONArray idxArray = obj.getJSONArray("idxs");
String terminal = obj.getString("terminal");
System.out.println("idxArray----"+idxArray); System.out.println("idxArray----"+idxArray);
List<String> nIdx = new ArrayList<String>(); List<String> nIdx = new ArrayList<String>();
if(idxArray == null) { if(idxArray == null) {
...@@ -161,12 +159,11 @@ public class CartServiceImpl implements CartService { ...@@ -161,12 +159,11 @@ public class CartServiceImpl implements CartService {
* @throws * @throws
* {"shopNO": "00029975","terminal": "wechat","langID": "936", "idx": 2,"saleQty": "23" } * {"shopNO": "00029975","terminal": "wechat","langID": "936", "idx": 2,"saleQty": "23" }
*/ */
public String updateQty (JSONObject obj) { public String updateQty (JSONObject obj,String terminal) {
String shopNO = obj.getString("shopNO"); String shopNO = obj.getString("shopNO");
Integer idx = obj.getInteger("idx"); Integer idx = obj.getInteger("idx");
Double saleQty = obj.getDouble("saleQty"); Double saleQty = obj.getDouble("saleQty");
String terminal = obj.getString("terminal"); String langID = obj.getString("langID");
String langID = obj.getString("langID");
System.out.println(saleQty ); System.out.println(saleQty );
System.out.println(saleQty == 0 ); System.out.println(saleQty == 0 );
if(saleQty == 0) { if(saleQty == 0) {
...@@ -178,7 +175,7 @@ public class CartServiceImpl implements CartService { ...@@ -178,7 +175,7 @@ public class CartServiceImpl implements CartService {
removeIdxArray.add(idx); removeIdxArray.add(idx);
removeObj.put("idxs", removeIdxArray); removeObj.put("idxs", removeIdxArray);
System.out.println(removeObj); System.out.println(removeObj);
this.remove(removeObj); this.remove(removeObj,terminal);
} else { } else {
jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + saleQty + " where sShopNO = '" + shopNO + "' and nIdx = " + idx); jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + saleQty + " where sShopNO = '" + shopNO + "' and nIdx = " + idx);
} }
......
...@@ -11,4 +11,6 @@ public class ShopContstrant { ...@@ -11,4 +11,6 @@ public class ShopContstrant {
public static final String SMS_TEMPLATE_CODE = "SmsTemplate"; //模板字典 code tcommon表 public static final String SMS_TEMPLATE_CODE = "SmsTemplate"; //模板字典 code tcommon表
public static final String CLIENT_MD5KEY ="Client_Md5Key"; //客户端计算签名的MD5 Key
} }
...@@ -48,3 +48,5 @@ Msg_Redemption_failure=The gold coin is insufficient and the redemption failed. ...@@ -48,3 +48,5 @@ Msg_Redemption_failure=The gold coin is insufficient and the redemption failed.
Msg_Coupon_Redemption_success=Coupon redemption success Msg_Coupon_Redemption_success=Coupon redemption success
Msg_Coupon_Redemption_failure=Coupon redemption failure Msg_Coupon_Redemption_failure=Coupon redemption failure
Msg_Gold_return_failure=Gold coin return failed Msg_Gold_return_failure=Gold coin return failed
Msg_Sign_failure=Signature mismatch
Msg_Paramter_Empty=Parameter {0} can not be empty.
\ No newline at end of file
...@@ -47,4 +47,6 @@ Msg_Deduction_failure=\u64CD\u4F5C\u5F02\u5E38\uFF0C\u6263\u79EF\u5206\u5931\u8D ...@@ -47,4 +47,6 @@ Msg_Deduction_failure=\u64CD\u4F5C\u5F02\u5E38\uFF0C\u6263\u79EF\u5206\u5931\u8D
Msg_Redemption_failure=\u91D1\u5E01\u4E0D\u8DB3,\u5151\u6362\u5931\u8D25. Msg_Redemption_failure=\u91D1\u5E01\u4E0D\u8DB3,\u5151\u6362\u5931\u8D25.
Msg_Coupon_Redemption_success=\u4F18\u60E0\u5238\u5151\u6362\u6210\u529F Msg_Coupon_Redemption_success=\u4F18\u60E0\u5238\u5151\u6362\u6210\u529F
Msg_Coupon_Redemption_failure=\u4F18\u60E0\u5238\u5151\u6362\u5931\u8D25 Msg_Coupon_Redemption_failure=\u4F18\u60E0\u5238\u5151\u6362\u5931\u8D25
Msg_Gold_return_failure=\u91D1\u5E01\u8FD4\u8FD8\u5931\u8D25 Msg_Gold_return_failure=\u91D1\u5E01\u8FD4\u8FD8\u5931\u8D25
\ No newline at end of file Msg_Sign_failure=\u7B7E\u540D\u4E0D\u5339\u914D
Msg_Paramter_Empty=\u53C2\u6570{0}\u4E0D\u80FD\u4E3A\u7A7A
\ No newline at end of file
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