Commit 46a8baa6 authored by 张永's avatar 张永

V1.1.2

parent daa77baa
......@@ -33,7 +33,11 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
......
......@@ -6,6 +6,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
......@@ -20,6 +21,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableCaching
@EnableSwagger2
@SpringBootApplication
@ServletComponentScan
@EnableTransactionManagement
public class ShopApplication {
private static Logger logger = LoggerFactory.getLogger(ShopApplication.class);
......
......@@ -17,8 +17,9 @@ import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.ActivityService;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -42,6 +43,7 @@ public class ActivityController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
})
@RequestMapping(value = "/crowdFundingProjectList",method=RequestMethod.GET)
@IDCLogResource(name="众筹项目列表")
public String crowdFundingProjectList(HttpServletRequest request, HttpServletResponse response) {
String orgNO = request.getParameter("orgNo");
String index = request.getParameter("index");
......@@ -76,6 +78,7 @@ public class ActivityController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = ""),
})
@RequestMapping(value = "/crowdFundingProjectDetail",method=RequestMethod.GET)
@IDCLogResource(name="众筹项目下的商品列表")
public String crowdFundingProjectDetail(HttpServletRequest request, HttpServletResponse response) {
String projectId = request.getParameter("projectId");
String orgNo = request.getParameter("orgNo");
......
......@@ -18,6 +18,7 @@ import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.BrandService;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
......@@ -45,6 +46,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getBanner",method=RequestMethod.GET)
@IDCLogResource(name="首页Banner图片")
public String getBanner(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO");
......@@ -82,6 +84,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getGroupBrandList",method=RequestMethod.GET)
@IDCLogResource(name="品牌列表接口按首字母")
public String getGroupBrandList(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
listMap=brandService.queryBrandList(request.getParameter("orgNo"));
......@@ -129,6 +132,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getBrandList",method=RequestMethod.GET)
@IDCLogResource(name="获取品牌列表")
public String getBrandList(String orgNo, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, Object>> returnList = brandService.queryBrandList(orgNo);
List<String> cs = new ArrayList<String>();
......@@ -151,6 +155,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getHotSaleBrands",method=RequestMethod.GET)
@IDCLogResource(name="热销品牌列表")
public String getHotSaleBrands(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
......@@ -178,6 +183,7 @@ public class BrandController {
})
@RequestMapping(value = "/hotIPList",method=RequestMethod.GET)
@IDCLogResource(name="热门IP列表")
public String hotIPList(HttpServletRequest request) {
String orgNO = request.getParameter("orgNo");
String comId = request.getParameter("comId");
......@@ -213,6 +219,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = true),
})
@RequestMapping(value = "/hotIPDetail",method=RequestMethod.GET)
@IDCLogResource(name="热门IP详情")
public String hotIPDetail(HttpServletRequest request) {
String orgNO = request.getParameter("orgNo");
String ipId = request.getParameter("ipId");
......@@ -248,6 +255,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "contact", dataType = "String", required = false, value = "contact", defaultValue = ""),
})
@RequestMapping(value = "/saveAuthorizationIP",method=RequestMethod.POST)
@IDCLogResource(name="IP授权保存")
public String authorizationIP(HttpServletRequest request) {
String orgNO = request.getParameter("orgNo");
String ipId = request.getParameter("ipId");
......@@ -279,6 +287,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = true, value = "用户编号", defaultValue = ""),
})
@RequestMapping(value = "/authorizationIPList",method=RequestMethod.POST)
@IDCLogResource(name="获取IP授权列表")
public Object authorizationIPList(String custNo, String orgNo) {
List<Map<String, Object>> list = brandService.queryAuthorizationIPList(custNo, orgNo);
return Rjx.jsonOk().set("list", list).toJson();
......@@ -294,6 +303,7 @@ public class BrandController {
@ApiImplicitParam(paramType = "query", name = "brandId", dataType = "String", required = true, value = "品牌ID", defaultValue = ""),
})
@RequestMapping(value = "/authorizationIPDetail",method=RequestMethod.POST)
@IDCLogResource(name="获取IP授权详情")
public Object authorizationIPDetail(String custNo, String brandId, String orgNo) {
Map<String, Object> map = brandService.queryAuthorizationIPDetail(custNo, brandId, orgNo);
return Rjx.jsonOk().set("data", map).toJson();
......
......@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.CartService;
import com.egolm.shop.common.component.IDCLogResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -40,6 +41,7 @@ public class CartController {
})
@RequestMapping(value = "/getCartCount",method=RequestMethod.GET)
@IDCLogResource(name="购物车商品种类数量")
public String cartQuery(String orgNo, String shopNo) {
Map<String, Object> map = cartService.count(orgNo, shopNo);
return Rjx.jsonOk().set("count", map.get("totalCount")).set("qty", map.get("totalSaleQty")).toJson();
......@@ -58,6 +60,7 @@ public class CartController {
})
@RequestMapping(value = "/cartQuery",method=RequestMethod.GET)
@IDCLogResource(name="购物车信息")
public String cartQuery(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String isCaclPromo = request.getParameter("isCalcPromo");
if(StringUtil.isNotUndefinedAndNull(isCaclPromo) && StringUtil.isNotEmpty(isCaclPromo)) {
......@@ -87,6 +90,7 @@ public class CartController {
})
@RequestMapping(value = "/appendCart",method=RequestMethod.POST,produces = "application/json")
@IDCLogResource(name="加入购物车(JSON格式)")
public String appendCart(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String reqJson =request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson);
......@@ -108,6 +112,7 @@ public class CartController {
})
@RequestMapping(value = "/remove",method=RequestMethod.POST)
@IDCLogResource(name="删除购物车(JSON格式)")
public String remove(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson);
......@@ -126,6 +131,7 @@ public class CartController {
})
@RequestMapping(value = "/updateQty",method=RequestMethod.POST)
@IDCLogResource(name="修改数量(JSON格式)")
public String updateQty(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson);
......@@ -145,6 +151,7 @@ public class CartController {
})
@RequestMapping(value = "/updateSelected",method=RequestMethod.POST)
@IDCLogResource(name="增加可选择商品去结算(JSON格式)")
public String updateSelected(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson);
......@@ -164,6 +171,7 @@ public class CartController {
})
@RequestMapping(value = "/setPrice",method=RequestMethod.POST)
@IDCLogResource(name="修改价格(JSON格式)")
public String setPrice(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson);
......@@ -185,6 +193,7 @@ public class CartController {
})
@RequestMapping(value = "/clear",method=RequestMethod.GET)
@IDCLogResource(name="清空购物车")
public String clear(String orgNo, String shopNo) {
cartService.clear(orgNo, shopNo);
return Rjx.jsonOk().toJson();
......
package com.egolm.shop.api;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"分类相关接口"})
@RestController
@RequestMapping("category")
public class CategoryController {
@Autowired
private CategoryService categoryService;
@ApiOperation("分类列表(按Level查询)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "level", dataType = "int", required = true, value = "级别", defaultValue = "3"),
@ApiImplicitParam(paramType = "query", name = "orgNo", 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 = "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 = "/queryCategoryByLevel",method=RequestMethod.GET)
public String queryCategoryByLevel(String orgNo, String scopeTypeID, Integer level, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, Object>> list = categoryService.queryCategoryByLevel(orgNo, scopeTypeID, level);
List<String> cs = new ArrayList<String>();
for(Map<String, Object> map : list) {
cs.add((String)map.get("sCategoryDesc"));
}
return Rjx.jsonOk().set("keys", cs).set("list", list).toJson();
}
@ApiOperation("分类列表(按上级分类查询)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "upCategoryNo", dataType = "int", required = true, value = "上级分类编码", defaultValue = "3"),
@ApiImplicitParam(paramType = "query", name = "orgNo", 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 = "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)
public String queryCategory(String orgNo, String scopeTypeID, Integer level, String upCategoryNo, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, Object>> list = categoryService.queryCategory(orgNo, scopeTypeID, upCategoryNo);
List<String> cs = new ArrayList<String>();
for(Map<String, Object> map : list) {
cs.add((String)map.get("sCategoryDesc"));
}
return Rjx.jsonOk().set("keys", cs).set("list", list).toJson();
}
}
package com.egolm.shop.api;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.CategoryService;
import com.egolm.shop.common.component.IDCLogResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"分类相关接口"})
@RestController
@RequestMapping("category")
public class CategoryController {
@Autowired
private CategoryService categoryService;
@ApiOperation("分类列表(按Level查询)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "level", dataType = "int", required = true, value = "级别", defaultValue = "3"),
@ApiImplicitParam(paramType = "query", name = "orgNo", 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 = "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 = "/queryCategoryByLevel",method=RequestMethod.GET)
@IDCLogResource(name="分类列表(按Level查询)")
public String queryCategoryByLevel(String orgNo, String scopeTypeID, Integer level, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, Object>> list = categoryService.queryCategoryByLevel(orgNo, scopeTypeID, level);
List<String> cs = new ArrayList<String>();
for(Map<String, Object> map : list) {
cs.add((String)map.get("sCategoryDesc"));
}
return Rjx.jsonOk().set("keys", cs).set("list", list).toJson();
}
@ApiOperation("分类列表(按上级分类查询)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "upCategoryNo", dataType = "int", required = true, value = "上级分类编码", defaultValue = "3"),
@ApiImplicitParam(paramType = "query", name = "orgNo", 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 = "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)
@IDCLogResource(name="分类列表(按上级分类查询)")
public String queryCategory(String orgNo, String scopeTypeID, Integer level, String upCategoryNo, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, Object>> list = categoryService.queryCategory(orgNo, scopeTypeID, upCategoryNo);
List<String> cs = new ArrayList<String>();
for(Map<String, Object> map : list) {
cs.add((String)map.get("sCategoryDesc"));
}
return Rjx.jsonOk().set("keys", cs).set("list", list).toJson();
}
}
......@@ -17,6 +17,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.api.service.CommonService;
import com.egolm.shop.common.XException;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
......@@ -44,6 +45,7 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/queryDistrictByOrgNO",method=RequestMethod.GET)
@IDCLogResource(name="组织构购获取省市区")
public String queryDistrictByOrgNO(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO");
String langID = request.getParameter("langID");
......@@ -58,6 +60,7 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getOpenCity",method=RequestMethod.GET)
@IDCLogResource(name="获取已开通的城市")
public String getOpenCity(HttpServletRequest request) {
String langID = request.getParameter("langID");
return commonService.getOpenCity(langID);
......@@ -72,6 +75,7 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getCommonArgs",method=RequestMethod.GET)
@IDCLogResource(name="获取共同参数")
public String getCommonArgs(HttpServletRequest request) {
String langID = request.getParameter("langID");
String commonNo = request.getParameter("commonNo");
......@@ -88,6 +92,7 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getPayTypeList",method=RequestMethod.GET)
@IDCLogResource(name="获取付款方式")
public String getPayTypeList(HttpServletRequest request) {
String langID = request.getParameter("langID");
String shopNo = request.getParameter("shopNo");
......@@ -111,6 +116,7 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getRegionList",method=RequestMethod.GET)
@IDCLogResource(name="获取省市区数据")
public String getCityListByProvince(String regionNo) {
if(StringUtil.isBlank(regionNo)) {
regionNo = "000000";
......@@ -130,6 +136,7 @@ public class CommonController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getConfig",method=RequestMethod.GET)
@IDCLogResource(name="获取配置信息")
public Object getConfig(String appId,String orgNo,String agentID) {
Map<String, Object> map = null;
try {
......
package com.egolm.shop.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.common.utils.Express;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@RestController
@Api(tags={"快递接口"})
@RequestMapping("express")
public class ExpressController {
@Autowired
private Express express;
@ApiOperation("快递查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "sExpressNO", dataType = "String", required = true, value = "快递单号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "sExpressType", dataType = "String", required = false, value = "快递公司", defaultValue = ""),
@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 = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getExpressDetail",method=RequestMethod.GET)
public Object getExpressDetail(String sExpressNO, String sExpressType) {
JSONArray data = express.get(sExpressNO, sExpressType);
return Rjx.jsonOk().setData(data);
}
package com.egolm.shop.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.Express;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@RestController
@Api(tags={"快递接口"})
@RequestMapping("express")
public class ExpressController {
@Autowired
private Express express;
@ApiOperation("快递查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "sExpressNO", dataType = "String", required = true, value = "快递单号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "sExpressType", dataType = "String", required = false, value = "快递公司", defaultValue = ""),
@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 = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getExpressDetail",method=RequestMethod.GET)
@IDCLogResource(name="快递查询")
public Object getExpressDetail(String sExpressNO, String sExpressType) {
JSONArray data = express.get(sExpressNO, sExpressType);
return Rjx.jsonOk().setData(data);
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.GoodsService;
import com.egolm.shop.common.XException;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
......@@ -43,6 +44,7 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/thinkLike",method=RequestMethod.GET)
@IDCLogResource(name="猜你喜欢商品")
public String thinkLike(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO");
......@@ -90,6 +92,7 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getHotSaleGoods",method=RequestMethod.GET)
@IDCLogResource(name="热销商品列表")
public String getHotSaleGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
......@@ -118,6 +121,7 @@ public class GoodsController {
})
@RequestMapping(value = "/getCategoryGoods",method=RequestMethod.GET)
@IDCLogResource(name="分类商品页数据")
public String getCategoryGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
......@@ -147,6 +151,7 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/hotSearchKey",method=RequestMethod.GET)
@IDCLogResource(name="热搜词")
public String hotSearchKey(HttpServletRequest request, HttpServletResponse response) {
String agentID= request.getParameter("agentID");
List<Map<String,Object>> listMap;
......@@ -176,6 +181,7 @@ public class GoodsController {
})
@RequestMapping(value = "/goodsDetail",method=RequestMethod.GET)
@IDCLogResource(name="商品详情")
public String goodsDetail(String orgNo, String goodsId, String contractNo, String custTypeId, String terminal, String langID,String agentID, HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
......@@ -201,6 +207,7 @@ public class GoodsController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/queryStockPrice",method=RequestMethod.GET)
@IDCLogResource(name="查询库存价格")
public String queryStockPrice(String uid, String shopNo, String orgNo,String agentID) {
XException.assertNotBlank(uid, "商品唯一标识不能为空");
uid = uid.replaceAll("\\s+", "");
......@@ -223,6 +230,7 @@ public class GoodsController {
})
@RequestMapping(value = "/myFlavor",method=RequestMethod.GET)
@IDCLogResource(name="收藏及取消收藏")
public String myFlavor(HttpServletRequest request, HttpServletResponse response) {
String goodsID = request.getParameter("goodsID");
String shopNO = request.getParameter("shopNO");
......
......@@ -16,6 +16,7 @@ import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.PageService;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
......@@ -43,6 +44,7 @@ public class PageController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
})
@RequestMapping(value = "/queryBanner",method=RequestMethod.GET)
@IDCLogResource(name="查询banner1")
public String queryBanner(HttpServletRequest request) {
String custNo = request.getParameter("custNo");
String orgNO = request.getParameter("orgNo");
......@@ -86,6 +88,7 @@ public class PageController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
})
@RequestMapping(value = "/queryNews",method=RequestMethod.GET)
@IDCLogResource(name="查询快报")
public String queryNews(HttpServletRequest request) {
String orgNO = request.getParameter("orgNo");
String msgTypeID = request.getParameter("msgTypeID");
......@@ -125,6 +128,7 @@ public class PageController {
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
})
@RequestMapping(value = "/queryFinanceProd",method=RequestMethod.GET)
@IDCLogResource(name="查询金融产品")
public String queryFinanceProd(HttpServletRequest request) {
String orgNO = request.getParameter("orgNo");
String index = request.getParameter("index");
......
......@@ -26,6 +26,7 @@ import com.egolm.common.HttpsUtil;
import com.egolm.common.StringUtil;
import com.egolm.shop.api.service.OrderService;
import com.egolm.shop.bean.WxPayResponse;
import com.egolm.shop.common.component.IDCLogResource;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
......@@ -46,6 +47,7 @@ public class PayNotifyController {
@ApiIgnore
@ApiOperation("支付回调通知接口")
@RequestMapping(value = "/callback", method = RequestMethod.POST)
public Object callback(HttpServletRequest req, HttpServletResponse resp) {
WxPayResponse postData = null;
......
......@@ -14,6 +14,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.PromoService;
import com.egolm.shop.common.XException;
import com.egolm.shop.common.component.IDCLogResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -38,6 +39,7 @@ public class PromoController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@GetMapping("getGroupList")
@IDCLogResource(name="获取组合列表")
public Object getGroupList(String orgNo, String shopNo, Long index, Long limit) {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
......@@ -60,6 +62,7 @@ public class PromoController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@GetMapping("getGroupGoodsDetail")
@IDCLogResource(name="获取组合详情")
public Object getGroupGoodsDetail(String orgNo, String shopNo, String promoPaperNO, String promoGroupNO,String agentID) {
Integer status = 0;
String statusDesc = "正常活动";
......
package com.egolm.shop.api;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.SystemCtrlService;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"数据字典接口"})
@RestController
@RequestMapping("ctrl")
public class SystemCtrlController {
@Autowired
private SystemCtrlService systemCtrlService;
@ApiOperation("获取字典参数")
@ApiImplicitParams({
@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 = "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)
public String createGuest(HttpServletRequest request, HttpServletResponse response) {
String code = request.getParameter("code");
String langID = request.getParameter("langID");
Map<String, Object> result = systemCtrlService.queryTSystemCtrlByCode(code, langID);
if(result != null) {
return Rjx.jsonOk().setData(result).toJson();
}else {
return Rjx.jsonErr().setCode(-1).setMessage(I18NUtils.getMessage(langID, "Msg_DataDictionary_query_error")).toJson();
}
}
}
package com.egolm.shop.api;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.SystemCtrlService;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"数据字典接口"})
@RestController
@RequestMapping("ctrl")
public class SystemCtrlController {
@Autowired
private SystemCtrlService systemCtrlService;
@ApiOperation("获取字典参数")
@ApiImplicitParams({
@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 = "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)
@IDCLogResource(name="获取字典参数")
public String createGuest(HttpServletRequest request, HttpServletResponse response) {
String code = request.getParameter("code");
String langID = request.getParameter("langID");
Map<String, Object> result = systemCtrlService.queryTSystemCtrlByCode(code, langID);
if(result != null) {
return Rjx.jsonOk().setData(result).toJson();
}else {
return Rjx.jsonErr().setCode(-1).setMessage(I18NUtils.getMessage(langID, "Msg_DataDictionary_query_error")).toJson();
}
}
}
......@@ -17,6 +17,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.UserService;
import com.egolm.shop.bean.TCustomer;
import com.egolm.shop.common.XException;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.I18NUtils;
import io.swagger.annotations.Api;
......@@ -43,6 +44,7 @@ public class UserController {
})
@RequestMapping(value = "/createGuest",method=RequestMethod.GET)
@IDCLogResource(name="创建游客账号")
public String createGuest(HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
params.put("orgNO", request.getParameter("orgNO"));
......@@ -65,6 +67,7 @@ public class UserController {
})
@RequestMapping(value = "/login",method=RequestMethod.POST)
@IDCLogResource(name="登陆")
public String login(HttpServletRequest request, HttpServletResponse response) {
String userNO = request.getParameter("userNO")==null?"":request.getParameter("userNO");
String password = request.getParameter("password")==null?"":request.getParameter("password");
......@@ -89,6 +92,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/userInfo",method=RequestMethod.GET)
@IDCLogResource(name="获取用户信息")
public String userInfo(HttpServletRequest request, HttpServletResponse response) {
String custNO = request.getParameter("custNO");
String shopNO = request.getParameter("shopNO")==null?"":request.getParameter("shopNO");
......@@ -126,6 +130,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/modifyPwd",method=RequestMethod.POST)
@IDCLogResource(name="修改密码")
public String modifyPwd(HttpServletRequest request, HttpServletResponse response) {
String mobile = request.getParameter("mobile");
String password = request.getParameter("password")==null?"":request.getParameter("password");
......@@ -155,6 +160,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/sendSms",method=RequestMethod.GET)
@IDCLogResource(name="发送短信")
public String sendSms(HttpServletRequest request, HttpServletResponse response) {
String mobile = request.getParameter("mobile");
String smsTmpID = request.getParameter("smsTmpID");
......@@ -179,6 +185,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/logoutByOpenId",method=RequestMethod.POST)
@IDCLogResource(name="小程序注销")
public String logoutByOpenId(String openId, String langID, HttpServletRequest request, HttpServletResponse response) {
userService.deleteOpenId(openId);
return Rjx.jsonOk().toJson();
......@@ -197,6 +204,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/loginByOpenId",method=RequestMethod.POST)
@IDCLogResource(name="小程序登陆")
public String loginByOpenId(String appId,String openId, String mobile, String orgNo, String name, String unionId, String langID, HttpServletRequest request, HttpServletResponse response) {
XException.assertNotBlank(appId, "appId不能为空");
XException.assertNotBlank(openId, "OpenID不能为空");
......@@ -236,6 +244,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/modifyShopAuthInfo",method=RequestMethod.POST)
@IDCLogResource(name="修改认证信息")
public String modifyShopAuthInfo(
String shopNo,
String shopName,
......@@ -289,6 +298,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/queryShopAuthInfo",method=RequestMethod.GET)
@IDCLogResource(name="查询认证信息")
public String queryShopAuthInfo(String shopNo, String langID) {
return userService.queryShopAuthInfo(shopNo, langID);
}
......@@ -302,6 +312,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/queryUserInfoByOpenId",method=RequestMethod.GET)
@IDCLogResource(name="根据OPENID获取用户信息")
public String queryUserInfoByOpenId(String orgNo, String openId, String langID, HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> customerMap = userService.queryCustomerByOpenId(openId);
if(customerMap == null) {
......@@ -334,6 +345,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getSalesmanByShopNo",method=RequestMethod.GET)
@IDCLogResource(name="根据店铺编号查询业务员")
public String getSalesmanByShopNo(String shopNo) {
Map<String, Object> map = userService.getSalesmanByShopNo(shopNo);
return Rjx.jsonOk().set("data", map).toJson();
......@@ -349,6 +361,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getCustomer",method=RequestMethod.GET)
@IDCLogResource(name="查询个人信息")
public String getCustomer(String custNo) {
Map<String, Object> map = userService.getCustomerByNO(custNo);
return Rjx.jsonOk().set("data", map).toJson();
......@@ -364,6 +377,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/updateCustomerEmail",method=RequestMethod.GET)
@IDCLogResource(name="修改个人信息邮箱")
public String updateCustomerEmail(String custNo, String email) {
userService.updateCustomerEmail(custNo, email);
return Rjx.jsonOk().toJson();
......@@ -380,6 +394,7 @@ public class UserController {
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/updateB2BUnionID",method=RequestMethod.GET)
@IDCLogResource(name="修改B2B用户UnionID")
public String updateB2BUnionID(String UserNO, String UnionID) {
userService.updateB2BUnionID(UserNO, UnionID);
return Rjx.jsonOk().toJson();
......
......@@ -23,6 +23,7 @@ import com.aliyuncs.profile.IClientProfile;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.api.service.SystemCtrlService;
import com.egolm.shop.common.component.IDCLogResource;
import com.egolm.shop.common.utils.ShopContstrant;
import com.tencent.cloud.CosStsClient;
......@@ -47,6 +48,7 @@ public class YunController {
})
@RequestMapping(value = "/getPolicy",method=RequestMethod.GET)
@IDCLogResource(name="获取上传凭证及上传的云平台")
public String createGuest(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> choiceMap = systemCtrlService.queryTSystemCtrlByCode(ShopContstrant.Choice_OSS_KEY, "936");
if(choiceMap != null) {
......
package com.egolm.shop.bean;
import javax.persistence.Entity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.util.Date;
@Entity(name="tIdcServicesLogs")
public class TIdcServicesLogs implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(columnDefinition="int")
private Integer nID;
@Column(columnDefinition="varchar")
private String sChannel;
@Column(columnDefinition="varchar")
private String sName;
@Column(columnDefinition="varchar")
private String sFunctionName;
@Column(columnDefinition="varchar")
private String sClassName;
@Column(columnDefinition="varchar")
private String sHttpMethod;
@Column(columnDefinition="text")
private String sRequestText;
@Column(columnDefinition="text")
private String sRequestHeader;
@Column(columnDefinition="text")
private String sResponseText;
@Column(columnDefinition="varchar")
private String sUserAgent;
@Column(columnDefinition="varchar")
private String sIp;
@Column(columnDefinition="datetime")
private Date dStartTime;
@Column(columnDefinition="datetime")
private Date dEndTime;
@Column(columnDefinition="int")
private Integer nCost;
@Column(columnDefinition="int")
private Integer nTag;
@Column(columnDefinition="varchar")
private String sCreateUser;
@Column(columnDefinition="datetime")
private Date dCreateDate;
@Column(columnDefinition="datetime")
private Date dLastUpdateTime;
@Column(columnDefinition="varchar")
private String sTraceId;
public void setnID(Integer nID) {
this.nID = nID;
}
public Integer getnID() {
return nID;
}
public void setsChannel(String sChannel) {
this.sChannel = sChannel;
}
public String getsChannel() {
return sChannel;
}
public void setsName(String sName) {
this.sName = sName;
}
public String getsName() {
return sName;
}
public void setsFunctionName(String sFunctionName) {
this.sFunctionName = sFunctionName;
}
public String getsFunctionName() {
return sFunctionName;
}
public void setsClassName(String sClassName) {
this.sClassName = sClassName;
}
public String getsClassName() {
return sClassName;
}
public void setsHttpMethod(String sHttpMethod) {
this.sHttpMethod = sHttpMethod;
}
public String getsHttpMethod() {
return sHttpMethod;
}
public void setsRequestText(String sRequestText) {
this.sRequestText = sRequestText;
}
public String getsRequestText() {
return sRequestText;
}
public void setsRequestHeader(String sRequestHeader) {
this.sRequestHeader = sRequestHeader;
}
public String getsRequestHeader() {
return sRequestHeader;
}
public void setsResponseText(String sResponseText) {
this.sResponseText = sResponseText;
}
public String getsResponseText() {
return sResponseText;
}
public void setsUserAgent(String sUserAgent) {
this.sUserAgent = sUserAgent;
}
public String getsUserAgent() {
return sUserAgent;
}
public void setsIp(String sIp) {
this.sIp = sIp;
}
public String getsIp() {
return sIp;
}
public void setdStartTime(Date dStartTime) {
this.dStartTime = dStartTime;
}
public Date getdStartTime() {
return dStartTime;
}
public void setdEndTime(Date dEndTime) {
this.dEndTime = dEndTime;
}
public Date getdEndTime() {
return dEndTime;
}
public void setnCost(Integer nCost) {
this.nCost = nCost;
}
public Integer getnCost() {
return nCost;
}
public void setnTag(Integer nTag) {
this.nTag = nTag;
}
public Integer getnTag() {
return nTag;
}
public void setsCreateUser(String sCreateUser) {
this.sCreateUser = sCreateUser;
}
public String getsCreateUser() {
return sCreateUser;
}
public void setdCreateDate(Date dCreateDate) {
this.dCreateDate = dCreateDate;
}
public Date getdCreateDate() {
return dCreateDate;
}
public void setdLastUpdateTime(Date dLastUpdateTime) {
this.dLastUpdateTime = dLastUpdateTime;
}
public Date getdLastUpdateTime() {
return dLastUpdateTime;
}
public void setsTraceId(String sTraceId) {
this.sTraceId = sTraceId;
}
public String getsTraceId() {
return sTraceId;
}
}
package com.egolm.shop.common.component;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* AOP 记录日志
* @ClassName: IDCLogResource
* @Description: TODO(这里用一句话描述这个类的作用)
* @author zhangyong0129@126.com
* @date 2023年10月18日 下午4:36:25
*
*/
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface IDCLogResource {
/**
* 服务名称
*
* @return
*/
String name();
/**
* 操作位置描述
*
* @return
*/
String position() default "";
/**
* 日志类型
*
* @return
*/
String logType() default "";
}
package com.egolm.shop.common.component;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHeaders;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.egolm.common.GsonUtil;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.bean.TIdcServicesLogs;
import com.egolm.shop.common.utils.ShopUtil;
/**
* aop 操作日志切面
*
* @ClassName: IDCSystemLogAspect
* @Description: TODO(这里用一句话描述这个类的作用)
* @author zhangyong0129@126.com
* @date 2023年10月18日 下午4:37:34
*
*/
@Aspect
@Component
public class IDCSystemLogAspect {
private static final Log logger = LogFactory.getLog(IDCSystemLogAspect.class);
@Autowired
private JdbcTemplate jdbcTemplate;
// 扫描使用@LogResource注解的方法
@Pointcut("@annotation(com.egolm.shop.common.component.IDCLogResource)")
public void logPointCut() {
};
@Around("logPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
Date startTime = new Date();
String exception = null;
String result = null;
try {
Object[] args = point.getArgs();
Object obj = point.proceed(args); //获取的完整 一些,不参加参则只有结果。
if (obj != null) {
result = JSONObject.toJSONString(obj);
}
return obj;
} catch (Exception e) {
//请求时报错
exception = e.toString();
throw e;
} finally {
//操作和报错日志都记录
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
int statusCode = response.getStatus();
if (exception != null) {
/** CHECKSTYLE:OFF:MagicNumber */
statusCode = 500;
/** CHECKSTYLE:ON:MagicNumber */
}
System.out.println();
syncSaveLog(point, startTime, new Date(), exception, result, statusCode);
}
}
@Async
void syncSaveLog(ProceedingJoinPoint joinPoint, Date startTime, Date endTime,
String exception, String result, int statusCode) {
TIdcServicesLogs log = new TIdcServicesLogs();
log.setsChannel("shop");
try {
//获取请求参数,不通过 joinPoint.getArgs() 获取。
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
if (request != null) {
log.setsUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setsHttpMethod(request.getMethod());
log.setsIp(request.getRemoteAddr());
log.setsRequestText(GsonUtil.toJson(ShopUtil.getParameterMap(request)));
}
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
IDCLogResource annotation = method.getAnnotation(IDCLogResource.class);
if (annotation != null) {
//注解上的描述
//log.setOperateName(annotation.name());
log.setsName(annotation.name());
System.out.println("--------------------"+annotation.name());
}
/* System.out.println("aop 获取目标方法名 "+joinPoint.getSignature().getName());
System.out.println("aop 获取目标方法所属类的简单类名 "+joinPoint.getSignature().getDeclaringType().getName());
System.out.println("aop 返回 "+result);*/
log.setsClassName(joinPoint.getSignature().getDeclaringType().getName());
log.setsFunctionName(joinPoint.getSignature().getName());
log.setdStartTime(startTime);
log.setdEndTime(endTime);
log.setsCreateUser("aop");
//入参
Long cost = endTime.getTime() - startTime.getTime();
log.setnCost(cost.intValue());
log.setsResponseText(result);
jdbcTemplate.saveOrUpdate(log);
} catch (Exception e) {
logger.info("aop 保存日志异常:",e);
}
}
}
package com.egolm.shop.common.utils;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
public class ShopUtil {
public static Map<String, Object> getParameterMap(HttpServletRequest request) {
// 参数Map
Map<String, String[]> properties = request.getParameterMap();
// 返回值Map
Map<String, Object> returnMap = new HashMap<String, Object>();
Iterator<Entry<String, String[]>> entries = properties.entrySet().iterator();
Map.Entry<String, String[]> entry;
String name = "";
String value = "";
while (entries.hasNext()) {
entry = (Map.Entry<String, String[]>) entries.next();
name = (String) entry.getKey();
Object valueObj = entry.getValue();
if (null == valueObj) {
value = "";
} else if (valueObj instanceof String[]) {
String[] values = (String[]) valueObj;
for (int i = 0; i < values.length; i++) {
value = values[i] + ",";
}
value = value.substring(0, value.length() - 1);
} else {
value = valueObj.toString();
}
returnMap.put(name, value);
}
return returnMap;
}
}
......@@ -14,7 +14,7 @@ spring.http.encoding.charset=utf-8
spring.aop.proxy-target-class=true
spring.profiles.active=dev
spring.messages.basename=messages
#thymeleaf
# 前缀
spring.thymeleaf.prefix=classpath:/templates/
......@@ -22,7 +22,7 @@ spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
#关闭swagger true开启 false关闭
swagger2.enable=false
swagger2.enable=true
spring.datasource.username=ERP
spring.datasource.password=qiyang@2013
......
......@@ -21,7 +21,9 @@
</head>
<body>
<div id="app">
<div id="app">
<el-divider content-position="left">V1.1.2 2023-10-19</el-divider>
<p class="title">1.接口调用日志通过AOP保存到tIdcServicesLogs表中</p>
<el-divider content-position="left">V1.1.1</el-divider>
<p class="title">1.修改微企付和网商银行的退款回调过程</p>
<el-divider content-position="left">V1.1.0</el-divider>
......
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