Commit 1d53c633 authored by ysongq's avatar ysongq

上传api

parent 41f0aa68
alter table t_data_goods add use_person varchar(64) DEFAULT '0' COMMENT '使用人数';
alter table t_mall_customer add head_portrait_url varchar(512) COMMENT '头像';
alter table t_data_goods_api add file_deposit_id Bigint(20) default NULL COMMENT'文件存入id';
\ No newline at end of file
alter table t_data_goods_api add file_deposit_id Bigint(20) default NULL COMMENT'文件存入id';
alter table t_data_goods add data_desc varchar(512) DEFAULT '0' COMMENT '数据描述';
alter table t_data_goods_api add api_type char(2) NOT NULL COMMENT 'api类型:01制作api,02制作数据包';
alter table t_data_goods_api add target_url varchar(128) DEFAULT '0' COMMENT '目标地址';
alter table t_data_goods_api add api_desc varchar(512) DEFAULT '0' COMMENT '接口描述';
\ No newline at end of file
......@@ -323,6 +323,22 @@ public class DateUtils {
return calendar;
}
// 获取当前时间时分秒+6位随机数
public static String getHMS() {
Calendar ca = Calendar.getInstance();
int minute=ca.get(Calendar.MINUTE);//分
int hour=ca.get(Calendar.HOUR);//小时
int second=ca.get(Calendar.SECOND);//秒
String format1 = String.format("%02d", hour);
String format2 = String.format("%02d", minute);
String format3 = String.format("%02d", second);
Random rdm = new Random();
String hash1 = Integer.toHexString(rdm.nextInt());
String capstr = hash1.substring(0, 6);
return format1+ format2 + format3+ capstr;
}
public static void main(String[] args) {
try {
......
package com.jz.common.utils;
import com.alibaba.fastjson.JSONWriter;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.*;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Slf4j
public final class WebUtils {
private static final int CONNECT_TIMEOUT = Config.getHttpConnectTimeout();// 设置连接建立的超时时间为10s
private static final int SOCKET_TIMEOUT = Config.getHttpSocketTimeout();
private static final int MAX_CONN = Config.getHttpMaxPoolSize(); // 最大连接数
private static final int MAX_PRE_ROUTE = Config.getHttpMaxPoolSize();
private static final int MAX_ROUTE = Config.getHttpMaxPoolSize();
private static CloseableHttpClient httpClient; // 发送请求的客户端单例
private static PoolingHttpClientConnectionManager manager; // 连接池管理类
private static ScheduledExecutorService monitorExecutor;
private final static Object syncLock = new Object(); // 相当于线程锁,用于线程安全
/**
* http 请求
*
* @param url
* @param params
* @return
* @throws Exception
*/
public static String post(String url, Map<String, String> params) throws Exception {
CloseableHttpClient client = getHttpClient(url);
String responseText = "";
CloseableHttpResponse response = null;
try {
HttpPost method = new HttpPost(url);
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(CONNECT_TIMEOUT)
.setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
method.setConfig(requestConfig);
if (params != null) {
List<NameValuePair> paramList = new ArrayList<NameValuePair>();
for (Entry<String, String> param : params.entrySet()) {
NameValuePair pair = new BasicNameValuePair(param.getKey(), param.getValue());
paramList.add(pair);
}
method.setEntity(new UrlEncodedFormEntity(paramList, "UTF-8"));
}
response = client.execute(method, HttpClientContext.create());
HttpEntity entity = response.getEntity();
if (entity != null) {
responseText = EntityUtils.toString(entity);
}
} catch (Exception e) {
throw e;
} finally {
try {
if (null != response) {
response.close();
}
} catch (Exception e) {
throw e;
}
}
return responseText;
}
public static String post(String url, Map<String, String> headers, Map<String, String> params) throws Exception {
CloseableHttpClient client = getHttpClient(url);
String responseText = "";
CloseableHttpResponse response = null;
try {
HttpPost method = new HttpPost(url);
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(CONNECT_TIMEOUT)
.setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
method.setConfig(requestConfig);
if (null != headers && !headers.isEmpty()) {
for (Entry<String, String> entry : headers.entrySet()) {
method.setHeader(entry.getKey(), entry.getValue());
}
}
if (params != null) {
List<NameValuePair> paramList = new ArrayList<NameValuePair>();
for (Entry<String, String> param : params.entrySet()) {
NameValuePair pair = new BasicNameValuePair(param.getKey(), param.getValue());
paramList.add(pair);
}
method.setEntity(new UrlEncodedFormEntity(paramList, "UTF-8"));
}
response = client.execute(method, HttpClientContext.create());
HttpEntity entity = response.getEntity();
if (entity != null) {
responseText = EntityUtils.toString(entity);
}
} catch (Exception e) {
throw e;
} finally {
try {
if (null != response) {
response.close();
}
} catch (Exception e) {
throw e;
}
}
return responseText;
}
/**
* 通过流方式传数据
*
* @param uri
* @param data
* @return
*/
public static String post(String uri, String data) {
log.info("向银行发起参数:{}", data);
CloseableHttpClient httpClient = getHttpClient(uri);
HttpPost method = new HttpPost(uri);
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(CONNECT_TIMEOUT)
.setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
method.setConfig(requestConfig);
String readContent = null;
try {
method.addHeader("Content-type", "application/xml; charset=ISO-8859-1");
method.setHeader("Accept", "application/xml");
method.setEntity(new StringEntity(data, Charset.forName("utf-8")));
HttpResponse response = httpClient.execute(method, HttpClientContext.create());
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
return "failed";
}
HttpEntity entity = response.getEntity();
InputStream in = entity.getContent();
int count = 0;
while (count == 0) {
count = Integer.parseInt("" + entity.getContentLength());// in.available();
}
if (count <= 0) {
return EntityUtils.toString(entity);
}
byte[] bytes = new byte[count];
int readCount = 0; // 已经成功读取的字节的个数
while (readCount <= count) {
if (readCount == count) {
break;
}
readCount += in.read(bytes, readCount, count - readCount);
}
readContent = new String(bytes, 0, readCount, "UTF-8");
log.info("Get Response Content():\n {}", readContent);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return readContent;
}
/**
* 关闭连接池
*/
public static void closeConnectionPool() {
try {
httpClient.close();
manager.close();
monitorExecutor.shutdown();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 把map转为xml
*
* @param parameters
* @return
*/
public static String parseXML(Map<String, String> parameters) {
StringBuffer sb = new StringBuffer();
sb.append("<xml>");
Iterator<Entry<String, String>> itor = parameters.entrySet().iterator();
while (itor.hasNext()) {
Entry<String, String> entry = itor.next();
String k = entry.getKey();
String v = entry.getValue();
if (null != v && !"".equals(v) && !"appkey".equals(k)) {
sb.append("<" + k + ">" + parameters.get(k) + "</" + k + ">\n");
}
}
sb.append("</xml>");
return sb.toString();
}
/**
* 把map转为xml
*
* @param parameters
* @return
*/
// public static String parseJSON(Map<String, String> parameters) {
// return new JSONWriter().write(parameters);
// }
/**
* 从URL中提取所有的参数。
*
* @param query URL地址
* @return 参数映射
*/
public static Map<String, String> splitUrlQuery(String query) {
Map<String, String> result = new HashMap<String, String>();
String[] pairs = query.split("&");
if (pairs != null && pairs.length > 0) {
for (String pair : pairs) {
String[] param = pair.split("=", 2);
if (param != null && param.length == 2) {
result.put(param[0], param[1]);
}
}
}
return result;
}
public static CloseableHttpClient getHttpClient(String url) {
int port = 80;
String hostName = url.split("/")[2];
if (hostName.contains(":")){
String[] args = hostName.split(":");
hostName = args[0];
port = Integer.parseInt(args[1]);
}
if (httpClient == null) {
// 多线程下多个线程同时调用getHttpClient容易导致重复创建httpClient对象的问题,所以加上了同步锁
synchronized (syncLock) {
if (httpClient == null) {
httpClient = createHttpClient(hostName, port);
// 开启监控线程,对异常和空闲线程进行关闭
monitorExecutor = Executors.newScheduledThreadPool(1);
monitorExecutor.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
// 关闭异常连接
manager.closeExpiredConnections();
// 关闭5s空闲的连接
manager.closeIdleConnections(Config.getHttpIdelTimeout(), TimeUnit.MILLISECONDS);
}
}, Config.getHttpMonitorInterval(), Config.getHttpMonitorInterval(), TimeUnit.MILLISECONDS);
}
}
}
return httpClient;
}
/**
* 根据host和port构建httpclient实例
*
* @param host 要访问的域名
* @param port 要访问的端口
* @return
*/
public static CloseableHttpClient createHttpClient(String host, int port) {
ConnectionSocketFactory plainSocketFactory = PlainConnectionSocketFactory.getSocketFactory();
LayeredConnectionSocketFactory sslSocketFactory = SSLConnectionSocketFactory.getSocketFactory();
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", plainSocketFactory).register("https", sslSocketFactory).build();
manager = new PoolingHttpClientConnectionManager(registry);
// 设置连接参数
manager.setMaxTotal(MAX_CONN); // 最大连接数
manager.setDefaultMaxPerRoute(MAX_PRE_ROUTE); // 路由最大连接数
HttpHost httpHost = new HttpHost(host, port);
manager.setMaxPerRoute(new HttpRoute(httpHost), MAX_ROUTE);
// 请求失败时,进行请求重试
HttpRequestRetryHandler handler = new HttpRequestRetryHandler() {
@Override
public boolean retryRequest(IOException e, int i, HttpContext httpContext) {
if (i > 3) {
// 重试超过3次,放弃请求
log.error("retry has more than 3 time, give up request");
return false;
}
if (e instanceof NoHttpResponseException) {
// 服务器没有响应,可能是服务器断开了连接,应该重试
log.error("receive no response from server, retry");
return true;
}
if (e instanceof SSLHandshakeException) {
// SSL握手异常
log.error("SSL hand shake exception");
return false;
}
if (e instanceof InterruptedIOException) {
// 超时
log.error("InterruptedIOException");
return false;
}
if (e instanceof UnknownHostException) {
// 服务器不可达
log.error("server host unknown");
return false;
}
if (e instanceof ConnectTimeoutException) {
// 连接超时
log.error("Connection Time out");
return false;
}
if (e instanceof SSLException) {
log.error("SSLException");
return false;
}
HttpClientContext context = HttpClientContext.adapt(httpContext);
HttpRequest request = context.getRequest();
if (!(request instanceof HttpEntityEnclosingRequest)) {
// 如果请求不是关闭连接的请求
return true;
}
return false;
}
};
return HttpClients.custom().setConnectionManager(manager).setRetryHandler(handler).build();
}
}
class Config {
static int httpConnectTimeout = 3000;
static int httpSocketTimeout = 60000;
static int httpMaxPoolSize = 2000;
static int httpMonitorInterval = 3000;
static int httpIdelTimeout = 2000;
public static int getHttpIdelTimeout() {
return httpIdelTimeout;
}
public static int getHttpSocketTimeout() {
return httpSocketTimeout;
}
public static int getHttpMaxPoolSize() {
return httpMaxPoolSize;
}
public static int getHttpMonitorInterval() {
return httpMonitorInterval;
}
public static int getHttpConnectTimeout() {
return httpConnectTimeout;
}
}
package com.jz.manage.moduls.controller.customer.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: CustomerDto
......@@ -15,31 +16,38 @@ public class CustomerDto {
/**
* 用户id
*/
@ApiModelProperty(value = "用户id")
private Long customerId;
/**
* 企业id
*/
@ApiModelProperty(value = "企业id")
private Long departmentId;
/**
* 密码
*/
@ApiModelProperty(value = "密码")
private String password;
/**
* 账户
*/
@ApiModelProperty(value = "账户")
private String customerAccount;
/**
* 用户真实姓名
*/
@ApiModelProperty(value = "用户真实姓名")
private String customerName;
/**
* 联系电话
*/
@ApiModelProperty(value = "联系电话")
private String customerPhone;
/**
* 资产账户id
*/
@ApiModelProperty(value = "资产账户id")
private String assetsId;
public Long getCustomerId() {
......
......@@ -69,7 +69,7 @@ public class PlatformTradeFlowInfoController extends BaseController {
@ApiOperation(value = "财务管理---我的订单", notes = "我的订单")
public PageInfoResponse<OrderCountInfoDto> findList(@RequestBody BasePageBean pageBean, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<OrderCountInfoDto> pageInfo = new PageInfoResponse<OrderCountInfoDto>();
Map map = new HashMap();
// Map map = new HashMap();
//从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//map.put("userId", user.getUserId());
......@@ -141,7 +141,7 @@ public class PlatformTradeFlowInfoController extends BaseController {
* @author Bellamy
* @since 2020-12-06
*/
@PostMapping(value = "/cashOutInfoById")
@GetMapping(value = "/cashOutInfoById")
@ApiOperation(value = "提现管理--提现详情", notes = "提现详情")
public Result<Object> getFinanceCashOutInfoById(@RequestParam(value = "cashOutId") String cashOutId, HttpServletRequest httpRequest) throws Exception {
Result<Object> result = new Result<>();
......
......@@ -4,6 +4,8 @@ import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* 平台利润中心--财务管理交易明细参数对象
*
......@@ -36,6 +38,17 @@ public class TradeDetilRequest extends BasePageBean {
@ApiModelProperty(value = "订单方式")
private String orderMethod;
@ApiModelProperty(value = "创建时间")
private Date creTime;
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDepartmentName() {
return departmentName;
}
......
package com.jz.manage.moduls.controller.goods;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.service.DataGoodsApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* api商品(TDataGoodsApi)表控制层
......@@ -49,4 +44,5 @@ public class DataGoodsApiController extends BaseController {
}
return new Result<>(false, "查询商品详情失败!", StatusCode.ERROR);
}
}
\ No newline at end of file
......@@ -5,15 +5,19 @@ import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.manage.moduls.service.DataGoodsService;
import javax.servlet.http.HttpServletRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -25,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequestMapping("dataGoods")
@Api(tags = "自营数据")
public class DataGoodsController extends BaseController {
/**
* 服务对象
......@@ -37,6 +42,7 @@ public class DataGoodsController extends BaseController {
* @return
*/
@PostMapping(value = "/findList")
@ApiOperation(value = "自营数据--列表查询数据")
public PageInfoResponse<DataGoodsListDto> findList(@RequestBody DataGoodsListRequest dataGoodsListRequest, HttpServletRequest httpRequest){
PageInfoResponse<DataGoodsListDto> pageInfo = new PageInfoResponse<>();
try {
......@@ -69,6 +75,27 @@ public class DataGoodsController extends BaseController {
return baseBeanResponse;
}
/**新增数据商品
* @param
* @return
*/
@PostMapping("/uploadApi")
@ApiOperation(value = "自营数据api上传", notes = "api上传")
public Result uploadApi(@RequestBody DataApiUpReq dataApiUpReq) throws Exception{
Result result = new Result();
try{
result = dataGoodsService.uploadApi(dataApiUpReq);
result.getMessage();
result.getCode();
result.getData();
}catch (Exception e) {
e.printStackTrace();
result.getMessage();
result.getCode();
}
return result;
}
/**删除数据商品
* @param DataGoodsRequest
* @return
......@@ -83,30 +110,12 @@ public class DataGoodsController extends BaseController {
baseResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**新增数据商品
* @param DataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
public BaseBeanResponse<DataGoods> add(@RequestBody DataGoods dataGoods, HttpServletRequest httpRequest){
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<DataGoods>();
try {
baseBeanResponse = dataGoodsService.add(dataGoods, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**修改数据商品
* @param DataGoodsRequest
* @param
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/edit")
......
package com.jz.manage.moduls.controller.goods.bean.request;
import com.jz.manage.moduls.entity.DataGoodsApiParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/29
* @Version:
*/
@Data
@ApiModel(value = "自营数据--api上传参数对象", description = "api上传参数对象")
public class DataApiUpReq {
/**
* api表
*/
@ApiModelProperty(value = "api服务名称")
private String apiName;
@ApiModelProperty(value = "请求类型")
private String requestType;
@ApiModelProperty(value = "接口地址")
private String apiUrl;
@ApiModelProperty(value = "api请求协议")
private String apiProtocl;
@ApiModelProperty(value = "api返回数据样例")
private String returnDataExample;
@ApiModelProperty(value = "api请求样例")
private String requestExample;
@ApiModelProperty(value = "返回类型")
private String returnType;
@ApiModelProperty(value = "apikey")
private String apiKey;
@ApiModelProperty(value = "加密方式")
private String encryMode;
@ApiModelProperty(value = "传输方式")
private String transMode;
@ApiModelProperty(value = "功能")
private String apiFunction;
@ApiModelProperty(value = "每单接口调用频率")
private String oneCallFrequency;
@ApiModelProperty(value = "每个接口的调用频率")
private String allCallFrequency;
@ApiModelProperty(value = "客户请求token")
private String requestToken;
@ApiModelProperty(value = "版本号")
private String versionNumber;
@ApiModelProperty(value = "创建人")
private String crePerson;
@ApiModelProperty(value = "创建时间")
private Date creTime;
@ApiModelProperty(value = "价格类型")
private String priceType;
@ApiModelProperty(value = "api类型")
private String apiType;
@ApiModelProperty(value = "接口描述",required = false)
private String apiDesc;
@ApiModelProperty(value = "目标地址",required = false)
private String targetUrl;
@ApiModelProperty(value = "超时时间")
private Date overTime;
/**
* goods表
*/
@ApiModelProperty(value = "数据名称")
private String dataName;
@ApiModelProperty(value = "商品分类")
private Long categoryId;
@ApiModelProperty(value = "数据id")
private String dataGoodsId;
@ApiModelProperty(value = "数据描述")
private String dataDesc;
@ApiModelProperty(value = "商品图片")
private String dataPicture;
@ApiModelProperty(value = "数据状态")
private String dataStatus;
@ApiModelProperty(value = "唯一数据商品标识")
private String apiOpenId;
@ApiModelProperty(value = "审核状态")
private String auditStatus;
@ApiModelProperty(value = "审核人")
private String auditPerson;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
@ApiModelProperty(value = "年(元)")
private BigDecimal yearType;
@ApiModelProperty(value = "季(元)")
private BigDecimal seasonType;
@ApiModelProperty(value = "月(元)")
private BigDecimal monthType;
@ApiModelProperty(value = "次(元)")
private BigDecimal secondType;
/**
* apiParam
*/
@ApiModelProperty(value = "参数集合")
private List<DataGoodsApiParams> paramsList;
}
......@@ -37,8 +37,8 @@ public class PlatformLogController extends BaseController {
*/
@PostMapping("/listManageLogInfo")
@ApiOperation(value = "后台用户日志信息列表")
public Mono<Result<IPage<PlatformLog>>> getLogInfo(@RequestBody @Validated ManageLogInfoQueryReq req) {
return Mono.fromSupplier(() -> tPlatformLogService.listManageUserLogInfo(req));
public Result<IPage<PlatformLog>> getLogInfo(@RequestBody @Validated ManageLogInfoQueryReq req) {
return tPlatformLogService.listManageUserLogInfo(req);
}
/**
......@@ -46,9 +46,9 @@ public class PlatformLogController extends BaseController {
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/getLogDetail")
@ApiOperation(value = "获取用户日志信息详情")
public Mono<Result> getLogInfoDetail(@RequestParam(value = "日志信息Id") Long platformLogId) {
return Mono.fromSupplier(() -> tPlatformLogService.getMallUserLogDetail(platformLogId));
@GetMapping("/getLogDetail/{id}")
@ApiOperation(value = "获取用id户日志信息详情")
public Result getLogInfoDetail(@PathVariable(value = "id")Long platformLogId) {
return tPlatformLogService.getMallUserLogDetail(platformLogId);
}
}
\ No newline at end of file
package com.jz.manage.moduls.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
......@@ -19,50 +23,63 @@ public class DataGoodsApiParams implements Serializable {
/**
* api参数id
*/
@ApiModelProperty("主健ID")
@TableId(value = "id", type = IdType.AUTO)
private Long apiParamsId;
/**
* api商品id
*/
@ApiModelProperty(value = "api商品id")
private Long goodsApi;
/**
* 参数分类:01公共参数,02请求参数,03响应参数,04请求头参数,05状态码参数
*/
@ApiModelProperty(value = "参数分类")
private String paramsDiff;
/**
* 参数名称
*/
@ApiModelProperty(value = "参数名称")
private String paramsName;
/**
* 参数类型
*/
@ApiModelProperty(value = "参数类型")
private String paramsType;
/**
* 参数描述
*/
@ApiModelProperty(value = "参数描述")
private String paramsDesc;
/**
* 默认值
*/
@ApiModelProperty(value = "默认值")
private String defaultValue;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
/**
* 是否必选:Y是,N否
*/
@ApiModelProperty(value = "是否必选")
private String ifRequird;
/**
* 删除标识:Y是,N否
*/
@ApiModelProperty(value = "删除标识")
private String delFlag;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date uptTime;
......
package com.jz.manage.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -20,88 +22,119 @@ public class PlatformLog implements Serializable {
/**
* 日志id
*/
@ApiModelProperty(value = "日志id")
private Long platformLogId;
/**
* 请求ip
*/
@ApiModelProperty(value = "请求ip")
private String requestIp;
/**
* 调用人id
*/
@ApiModelProperty(value = "调用人id")
private String callerId;
/**
* 商品id
*/
@ApiModelProperty(value = "商品id")
private Long dataGoodsId;
/**
* apikey
*/
@ApiModelProperty(value = "apikey")
private String apiKey;
/**
* 请求参数
*/
@ApiModelProperty(value = "请求参数")
private String requestParams;
/**
* 返回参数
*/
@ApiModelProperty(value = "返回参数")
private String returnParams;
/**
* 请求路径
*/
@ApiModelProperty(value = "请求路径")
private String requestUrl;
/**
* 请求时间
*/
@ApiModelProperty(value = "请求时间")
private Date requestTime;
/**
* 服务类型:01年,02月,03次
*/
@ApiModelProperty(value = "服务类型")
private String serviceType;
/**
* 数据类型:01api,02数据包
*/
*/@ApiModelProperty(value = "数据类型")
private String dataGoodsType;
/**
* 下载地址
*/
@ApiModelProperty(value = "下载地址")
private String downloadAddress;
/**
* 数据商品单价
*/
@ApiModelProperty(value = "数据商品单价")
private BigDecimal dataPrice;
/**
* 价格类型:01免费,02收费
*/
@ApiModelProperty(value = "价格类型")
private String priceType;
/**
* 调用总次数
*/
@ApiModelProperty(value = "调用总次数")
private Long totalTimes;
/**
* 已使用次数
*/
@ApiModelProperty(value = "已使用次数")
private Long usedTimes;
/**
* 剩余次数
*/
@ApiModelProperty(value = "剩余次数")
private Long remainTimes;
/**
* 有效开始时间
*/
@ApiModelProperty(value = "有效开始时间")
private Date startTime;
/**
* 有效结束时间
*/
@ApiModelProperty(value = "有效结束时间")
private Date endTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 删除标识
*/
@ApiModelProperty(value = "删除标识")
private String delFlag;
@ApiModelProperty(value = "调用人")
@TableField(exist = false)
private String customerName;
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public Long getPlatformLogId() {
return platformLogId;
......
package com.jz.manage.moduls.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jz.common.base.BaseMapper;
import com.jz.manage.moduls.entity.PlatformLog;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -17,7 +21,7 @@ public interface PlatformLogDao extends BaseMapper<PlatformLog> {
* 查询平台用户日志列表
* @return
*/
List<PlatformLog> listMallLogInfo();
List<PlatformLog> listMallLogInfo(IPage<PlatformLog> page, @Param("ew") Wrapper<PlatformLog> query);
}
\ No newline at end of file
package com.jz.manage.moduls.service;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
/**
......@@ -17,4 +18,6 @@ public interface DataGoodsApiService {
* @return
*/
Result selectById(Long id) throws Exception;
}
\ No newline at end of file
......@@ -6,8 +6,10 @@ import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
......@@ -34,7 +36,11 @@ public interface DataGoodsService {
* @return
* @throws Exception
*/
public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest)throws Exception;
/**
* 自营数据-上传api
* @param dataApiUpReq
*/
Result uploadApi(DataApiUpReq dataApiUpReq)throws Exception;
/**主键查询数据商品
* @param DataGoodsRequest
......
package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.goods.bean.dto.DataBasicDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataInterfaceDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
import com.jz.manage.moduls.entity.DataGoodsApi;
import com.jz.manage.moduls.entity.DataGoodsApiParams;
import com.jz.manage.moduls.mapper.DataGoodsApiDao;
import com.jz.manage.moduls.mapper.DataGoodsApiParamsDao;
import com.jz.manage.moduls.mapper.DataGoodsDao;
import com.jz.manage.moduls.service.DataGoodsApiService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
......@@ -29,6 +43,8 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
@Autowired
private DataGoodsApiDao tDataGoodsApiDao;
/**
* 主键查询数据详情
*
......@@ -95,4 +111,6 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
result.setData(map);
return Result.of_success(ResultMsg.SUCCESS, result);
}
}
\ No newline at end of file
package com.jz.manage.moduls.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.Result;
import com.jz.common.utils.WebUtils;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.manage.moduls.entity.DataGoodsApi;
import com.jz.manage.moduls.entity.DataGoodsApiParams;
import com.jz.manage.moduls.mapper.DataGoodsApiDao;
import com.jz.manage.moduls.mapper.DataGoodsApiParamsDao;
import com.jz.manage.moduls.mapper.DataGoodsDao;
import com.jz.manage.moduls.service.DataGoodsService;
......@@ -21,10 +34,14 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
/**
* 数据商品(DataGoods)表服务实现类
......@@ -37,127 +54,211 @@ public class DataGoodsServiceImpl implements DataGoodsService {
@Autowired
private DataGoodsDao dataGoodsDao;
/**
* 条件分页查询数据列表
* @param goodsListRequest
* @param httpRequest
* @return
* @throws Exception
*/
@Override
public PageInfoResponse<DataGoodsListDto> findList(DataGoodsListRequest goodsListRequest, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<DataGoodsListDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>();
//数据商品id
if (goodsListRequest.getDataGoodsId() != null) {
param.put("dataGoodsId", goodsListRequest.getDataGoodsId());
}
//商品分类id(行业)
if (goodsListRequest.getCategoryId() != null) {
param.put("categoryId", goodsListRequest.getCategoryId());
}
//数据商品名称
if (!StringUtils.isEmpty(goodsListRequest.getDataName())) {
param.put("dataName", goodsListRequest.getDataName());
}
//数据类型:01api,02数据包
if (!StringUtils.isEmpty(goodsListRequest.getDataType())) {
param.put("dataType", goodsListRequest.getDataType());
}
//数据状态:01预售,02在售中,03下架,04上架
if (!StringUtils.isEmpty(goodsListRequest.getDataStatus())) {
param.put("dataStatus", goodsListRequest.getDataStatus());
}
PageHelper.startPage(goodsListRequest.getPageNum(), goodsListRequest.getPageSize());
List<DataGoodsListDto> list = dataGoodsDao.findList(param);
PageInfo<DataGoodsListDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#add(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
/*$*seDataGoodsIdCodeReplace*$*/
//创建人
//dataGoods.setCreateUser(getHttpRequestUserId(httpRequest));
//创建时间
dataGoods.setCreTime(new Date());
dataGoodsDao.insertSelective(dataGoods);
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dataGoods);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#edit(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseBeanResponse<DataGoods> edit(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
//修改人
//dataGoods.setUpdateUser(getHttpRequestUserId(httpRequest));
//修改时间
dataGoods.setUptTime(new Date());
dataGoodsDao.updateByPrimaryKeySelective(dataGoods);
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setData(dataGoods);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#findById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DataGoodsDto> findById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<>();
DataGoodsDto DataGoodsDto = dataGoodsDao.findById(dataGoodsRequest.getDataGoodsId());
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(DataGoodsDto);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#deleteById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dataGoodsDao.deleteByPrimaryKey(dataGoodsRequest.getDataGoodsId());
baseResponse.setCode(Constants.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
@Autowired
private DataGoodsApiParamsDao apiParamsDao;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private DataGoodsApiDao tDataGoodsApiDao;
/**
* 条件分页查询数据列表
*
* @param goodsListRequest
* @param httpRequest
* @return
* @throws Exception
*/
@Override
public PageInfoResponse<DataGoodsListDto> findList(DataGoodsListRequest goodsListRequest, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<DataGoodsListDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>();
//数据商品id
if (goodsListRequest.getDataGoodsId() != null) {
param.put("dataGoodsId", goodsListRequest.getDataGoodsId());
}
//商品分类id(行业)
if (goodsListRequest.getCategoryId() != null) {
param.put("categoryId", goodsListRequest.getCategoryId());
}
//数据商品名称
if (!StringUtils.isEmpty(goodsListRequest.getDataName())) {
param.put("dataName", goodsListRequest.getDataName());
}
//数据类型:01api,02数据包
if (!StringUtils.isEmpty(goodsListRequest.getDataType())) {
param.put("dataType", goodsListRequest.getDataType());
}
//数据状态:01预售,02在售中,03下架,04上架
if (!StringUtils.isEmpty(goodsListRequest.getDataStatus())) {
param.put("dataStatus", goodsListRequest.getDataStatus());
}
PageHelper.startPage(goodsListRequest.getPageNum(), goodsListRequest.getPageSize());
List<DataGoodsListDto> list = dataGoodsDao.findList(param);
PageInfo<DataGoodsListDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#add(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
// @Override
// @Transactional(rollbackFor=Exception.class)
// public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
// BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
//
// /*$*seDataGoodsIdCodeReplace*$*/
// //创建人
// //dataGoods.setCreateUser(getHttpRequestUserId(httpRequest));
// //创建时间
// dataGoods.setCreTime(new Date());
//
// dataGoodsDao.insertSelective(dataGoods);
//
// baseBeanResponse.setCode(Constants.SUCCESS_CODE);
// baseBeanResponse.setMessage("新增成功");
// baseBeanResponse.setData(dataGoods);
//
// return baseBeanResponse;
// }
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#edit(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseBeanResponse<DataGoods> edit(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
//修改人
//dataGoods.setUpdateUser(getHttpRequestUserId(httpRequest));
//修改时间
dataGoods.setUptTime(new Date());
dataGoodsDao.updateByPrimaryKeySelective(dataGoods);
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setData(dataGoods);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#findById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DataGoodsDto> findById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<>();
DataGoodsDto DataGoodsDto = dataGoodsDao.findById(dataGoodsRequest.getDataGoodsId());
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(DataGoodsDto);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#deleteById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dataGoodsDao.deleteByPrimaryKey(dataGoodsRequest.getDataGoodsId());
baseResponse.setCode(Constants.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/**
* 自营数据-上传api
*
* @param dataApiUpReq
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result uploadApi(DataApiUpReq dataApiUpReq) {
// 获取当前用户
SysUserDto user = (SysUserDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
if (dataApiUpReq == null) {
return Result.error("上传失败!");
}
if (!StringUtils.isNotEmpty(dataApiUpReq.getApiKey())) {
return Result.error("apiKey不存在!");
}
if (!StringUtils.isNotEmpty(dataApiUpReq.getApiType())) {
return Result.error("api类型不存在!");
}
if (!StringUtils.isNotEmpty(dataApiUpReq.getTransMode())) {
return Result.error("传输方式不能为空!");
}
if (!StringUtils.isNotEmpty(dataApiUpReq.getEncryMode())) {
return Result.error("加密方式不能为空!");
}
DataGoods dataGoods = new DataGoods();
dataApiUpReq.setApiOpenId("wj"+DateUtils.getHMS());
dataApiUpReq.setCreTime(DateUtils.getToday());
dataApiUpReq.setCrePerson(user.getUserId() + "");
dataApiUpReq.setAuditTime(DateUtils.getToday());
dataApiUpReq.setAuditPerson(user.getUserId() + "");
dataApiUpReq.setAuditStatus("02");
dataApiUpReq.setDataStatus("02");
BeanUtils.copyProperties(dataApiUpReq, dataGoods);
dataGoodsDao.insert(dataGoods);
// 赋值api
Long dataGoodsId = dataGoods.getDataGoodsId();
if (dataGoodsId != null) {
DataGoodsApi dataGoodsApi = new DataGoodsApi();
dataGoodsApi.setDataGoodsId(dataGoodsId);
dataApiUpReq.setCreTime(DateUtils.getToday());
dataApiUpReq.setCrePerson(user.getUserId() + "");
dataApiUpReq.setEncryMode("MD5");
dataApiUpReq.setTransMode("http");
dataApiUpReq.setVersionNumber("1.0");
BeanUtils.copyProperties(dataApiUpReq, dataGoodsApi);
tDataGoodsApiDao.insert(dataGoodsApi);
// 赋值params
Long goodsApi = dataGoodsApi.getGoodsApi();
if (goodsApi != null) {
List<DataGoodsApiParams> paramsList = dataApiUpReq.getParamsList();
for (DataGoodsApiParams params : paramsList) {
params.setGoodsApi(goodsApi);
dataApiUpReq.setCreTime(DateUtils.getToday());
dataApiUpReq.setCrePerson(user.getUserId() + "");
BeanUtils.copyProperties(dataApiUpReq, params);
apiParamsDao.insert(params);
}
}
}
WebUtils.post("http://localhost:8088/apigateway/", JSONObject.toJSONString(dataApiUpReq));
// return Result.of_success(ResultMsg.SUCCESS, ResultCode.SUCCESS);
return Result.of_success(ResultMsg.SUCCESS, dataApiUpReq);
}
}
\ No newline at end of file
......@@ -8,9 +8,11 @@ import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultMsg;
import com.jz.manage.moduls.entity.MallCustomer;
import com.jz.manage.moduls.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.log.bean.ManageLogInfoQueryReq;
import com.jz.manage.moduls.mapper.MallCustomerDao;
import com.jz.manage.moduls.mapper.PlatformLogDao;
import com.jz.manage.moduls.service.PlatformLogService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,15 +31,16 @@ public class PlatformLogServiceImpl implements PlatformLogService {
@Autowired
private PlatformLogDao tPlatformLogDao;
@Autowired
private MallCustomerDao mallCustomerDao;
@Override
public Result listManageUserLogInfo(ManageLogInfoQueryReq req) {
IPage<PlatformLog> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<PlatformLog> query = new QueryWrapper<>();
query.eq("del_flag" ,"N");
query.orderByDesc("cre_time");
IPage<PlatformLog> platformLogIPage = tPlatformLogDao.selectPage(page, query);
return Result.of_success(platformLogIPage);
query.eq("t1.del_flag" ,"N");
query.orderByDesc("t1.cre_time");
List<PlatformLog> platformLogs = tPlatformLogDao.listMallLogInfo(page, query);
return Result.of_success(platformLogs);
}
/**
......@@ -52,6 +55,10 @@ public class PlatformLogServiceImpl implements PlatformLogService {
query.eq("del_flag","N");
query.orderByDesc("cre_time");
PlatformLog platformLog = tPlatformLogDao.selectOne(query);
// 获取调用人
MallCustomer mallCustomer = mallCustomerDao.selectOne(
new QueryWrapper<MallCustomer>().eq("customer_id", platformLog.getCallerId()));
platformLog.setCustomerName(mallCustomer.getCustomerName());
if (null == platformLog){
return Result.of_error(ResultMsg.DATA_NOT_FOUND);
}
......
......@@ -58,28 +58,27 @@
t1.upt_time as uptTime,
(CASE WHEN t1.data_status = '01' then '预售'
WHEN t1.data_status = '02' then '在售中'
WHEN t1.data_status = '02' then '下架'
WHEN t1.data_status = '02' then '上架' end) dataStatus
WHEN t1.data_status = '03' then '下架'
WHEN t1.data_status = '04' then '上架' end) dataStatus
FROM
t_data_goods t1 INNER JOIN t_data_goods_category t2 ON t1.category_id = t2. category_id
where
1= 1 and
t1.del_flag = 'N' and
t_data_goods t1 INNER JOIN t_data_goods_category t2 ON t1.category_id = t2.category_id
where t1.del_flag = 'N'
and
t1.audit_status = '02'
<if test="dataGoodsId != null">
and data_goods_id = #{dataGoodsId}
and t1.data_goods_id = #{dataGoodsId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
and t1.category_id = #{categoryId}
</if>
<if test="dataName != null and dataName != ''">
and data_name like concat('%',#{dataName},'%')
and t1.data_name like concat('%',#{dataName},'%')
</if>
<if test="dataType != null and dataType != ''">
and data_type = #{dataType}
and t1.data_type = #{dataType}
</if>
<if test="dataStatus != null and dataStatus != ''">
and data_status = #{dataStatus}
and t1.data_status = #{dataStatus}
</if>
order by t1.upt_time desc
</select>
......
......@@ -27,15 +27,17 @@
</resultMap>
<sql id="allFiled">
platform_log_id AS platformLogId,request_ip AS requestIp,caller_id AS callerId,data_goods_id AS dataGoodsId,
api_key AS apiKey,request_params AS requestParams,return_params AS returnParams,request_url AS requestUrl
,request_time AS requestTime,service_type AS serviceType,data_goods_type AS dataGoodsType,download_address AS downloadAddress,
data_price AS dataPrice,price_type AS priceType,total_times AS totalTimes,used_times AS usedTimes
,remain_times AS remainTimes,caller_type AS callerType,start_time AS startTime,end_time AS endTime,cre_time AS creTime,
cre_person AS crePerson,upt_time AS uptTime,upt_person AS uptPerson,del_flag AS delFlag
t1.platform_log_id AS platformLogId,t1.request_ip AS requestIp,t1.caller_id AS callerId,t1.data_goods_id AS dataGoodsId,
t1.api_key AS apiKey,t1.request_params AS requestParams,t1.return_params AS returnParams,t1.request_url AS requestUrl,
t1.request_time AS requestTime,t1.service_type AS serviceType,t1.data_goods_type AS dataGoodsType,t1.download_address AS downloadAddress,
t1.data_price AS dataPrice,t1.price_type AS priceType,t1.total_times AS totalTimes,t1.used_times AS usedTimes,t1.remain_times AS remainTimes,
t1.caller_type AS callerType,t1.start_time AS startTime,t1.end_time AS endTime,t1.cre_time AS creTime,t1.cre_person AS crePerson,
t1.upt_time AS uptTime,t1.upt_person AS uptPerson,t1.del_flag AS delFlag
</sql>
<select id="listMallLogInfo" resultType="com.jz.manage.moduls.entity.PlatformLog">
SELECT <include refid="allFiled"/> FROM t_platform_log
SELECT <include refid="allFiled"/>, t2.customer_name as customerName
FROM t_platform_log t1 INNER JOIN t_mall_customer t2 on t1.caller_id = t2.customer_id
${ew.customSqlSegment}
</select>
</mapper>
\ 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