Commit fdc87eca authored by zhangc's avatar zhangc

Merge branch 'dm_dev' of http://gitlab.ioubuy.cn/yaobenzhang/dm_project into dm_dev

parents e4a57ce0 3c1a67a6
alter table t_data_goods add use_person varchar(64) DEFAULT '0' COMMENT '使用人数'; 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_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'; 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 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 { ...@@ -323,6 +323,22 @@ public class DateUtils {
return calendar; 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) { public static void main(String[] args) {
try { 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; package com.jz.manage.moduls.controller.customer.bean.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* @ClassName: CustomerDto * @ClassName: CustomerDto
...@@ -15,31 +16,38 @@ public class CustomerDto { ...@@ -15,31 +16,38 @@ public class CustomerDto {
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty(value = "用户id")
private Long customerId; private Long customerId;
/** /**
* 企业id * 企业id
*/ */
@ApiModelProperty(value = "企业id")
private Long departmentId; private Long departmentId;
/** /**
* 密码 * 密码
*/ */
@ApiModelProperty(value = "密码")
private String password; private String password;
/** /**
* 账户 * 账户
*/ */
@ApiModelProperty(value = "账户")
private String customerAccount; private String customerAccount;
/** /**
* 用户真实姓名 * 用户真实姓名
*/ */
@ApiModelProperty(value = "用户真实姓名")
private String customerName; private String customerName;
/** /**
* 联系电话 * 联系电话
*/ */
@ApiModelProperty(value = "联系电话")
private String customerPhone; private String customerPhone;
/** /**
* 资产账户id * 资产账户id
*/ */
@ApiModelProperty(value = "资产账户id")
private String assetsId; private String assetsId;
public Long getCustomerId() { public Long getCustomerId() {
......
...@@ -69,7 +69,7 @@ public class PlatformTradeFlowInfoController extends BaseController { ...@@ -69,7 +69,7 @@ public class PlatformTradeFlowInfoController extends BaseController {
@ApiOperation(value = "财务管理---我的订单", notes = "我的订单") @ApiOperation(value = "财务管理---我的订单", notes = "我的订单")
public PageInfoResponse<OrderCountInfoDto> findList(@RequestBody BasePageBean pageBean, HttpServletRequest httpRequest) throws Exception { public PageInfoResponse<OrderCountInfoDto> findList(@RequestBody BasePageBean pageBean, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<OrderCountInfoDto> pageInfo = new PageInfoResponse<OrderCountInfoDto>(); PageInfoResponse<OrderCountInfoDto> pageInfo = new PageInfoResponse<OrderCountInfoDto>();
Map map = new HashMap(); // Map map = new HashMap();
//从session中获取平台用户id //从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser"); //SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//map.put("userId", user.getUserId()); //map.put("userId", user.getUserId());
...@@ -141,7 +141,7 @@ public class PlatformTradeFlowInfoController extends BaseController { ...@@ -141,7 +141,7 @@ public class PlatformTradeFlowInfoController extends BaseController {
* @author Bellamy * @author Bellamy
* @since 2020-12-06 * @since 2020-12-06
*/ */
@PostMapping(value = "/cashOutInfoById") @GetMapping(value = "/cashOutInfoById")
@ApiOperation(value = "提现管理--提现详情", notes = "提现详情") @ApiOperation(value = "提现管理--提现详情", notes = "提现详情")
public Result<Object> getFinanceCashOutInfoById(@RequestParam(value = "cashOutId") String cashOutId, HttpServletRequest httpRequest) throws Exception { public Result<Object> getFinanceCashOutInfoById(@RequestParam(value = "cashOutId") String cashOutId, HttpServletRequest httpRequest) throws Exception {
Result<Object> result = new Result<>(); Result<Object> result = new Result<>();
......
...@@ -4,6 +4,8 @@ import com.jz.common.bean.BasePageBean; ...@@ -4,6 +4,8 @@ import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/** /**
* 平台利润中心--财务管理交易明细参数对象 * 平台利润中心--财务管理交易明细参数对象
* *
...@@ -36,6 +38,17 @@ public class TradeDetilRequest extends BasePageBean { ...@@ -36,6 +38,17 @@ public class TradeDetilRequest extends BasePageBean {
@ApiModelProperty(value = "订单方式") @ApiModelProperty(value = "订单方式")
private String orderMethod; private String orderMethod;
@ApiModelProperty(value = "创建时间")
private Date creTime;
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDepartmentName() { public String getDepartmentName() {
return departmentName; return departmentName;
} }
......
package com.jz.manage.moduls.controller.goods; package com.jz.manage.moduls.controller.goods;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode; import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.BaseController; 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 com.jz.manage.moduls.service.DataGoodsApiService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* api商品(TDataGoodsApi)表控制层 * api商品(TDataGoodsApi)表控制层
...@@ -49,4 +44,5 @@ public class DataGoodsApiController extends BaseController { ...@@ -49,4 +44,5 @@ public class DataGoodsApiController extends BaseController {
} }
return new Result<>(false, "查询商品详情失败!", StatusCode.ERROR); return new Result<>(false, "查询商品详情失败!", StatusCode.ERROR);
} }
} }
\ No newline at end of file
...@@ -5,15 +5,19 @@ import com.jz.common.bean.BaseResponse; ...@@ -5,15 +5,19 @@ import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.common.entity.DataGoods; 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.BaseController;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto; 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.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.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest; import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.manage.moduls.service.DataGoodsService; import com.jz.manage.moduls.service.DataGoodsService;
import javax.servlet.http.HttpServletRequest; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -25,6 +29,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -25,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
*/ */
@RestController @RestController
@RequestMapping("dataGoods") @RequestMapping("dataGoods")
@Api(tags = "自营数据")
public class DataGoodsController extends BaseController { public class DataGoodsController extends BaseController {
/** /**
* 服务对象 * 服务对象
...@@ -37,6 +42,7 @@ public class DataGoodsController extends BaseController { ...@@ -37,6 +42,7 @@ public class DataGoodsController extends BaseController {
* @return * @return
*/ */
@PostMapping(value = "/findList") @PostMapping(value = "/findList")
@ApiOperation(value = "自营数据--列表查询数据")
public PageInfoResponse<DataGoodsListDto> findList(@RequestBody DataGoodsListRequest dataGoodsListRequest, HttpServletRequest httpRequest){ public PageInfoResponse<DataGoodsListDto> findList(@RequestBody DataGoodsListRequest dataGoodsListRequest, HttpServletRequest httpRequest){
PageInfoResponse<DataGoodsListDto> pageInfo = new PageInfoResponse<>(); PageInfoResponse<DataGoodsListDto> pageInfo = new PageInfoResponse<>();
try { try {
...@@ -69,6 +75,27 @@ public class DataGoodsController extends BaseController { ...@@ -69,6 +75,27 @@ public class DataGoodsController extends BaseController {
return baseBeanResponse; 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 * @param DataGoodsRequest
* @return * @return
...@@ -83,30 +110,12 @@ public class DataGoodsController extends BaseController { ...@@ -83,30 +110,12 @@ public class DataGoodsController extends BaseController {
baseResponse.setCode(Constants.FAILURE_CODE); baseResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace(); e.printStackTrace();
} }
return baseResponse; 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 * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/edit") @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 { ...@@ -37,8 +37,8 @@ public class PlatformLogController extends BaseController {
*/ */
@PostMapping("/listManageLogInfo") @PostMapping("/listManageLogInfo")
@ApiOperation(value = "后台用户日志信息列表") @ApiOperation(value = "后台用户日志信息列表")
public Mono<Result<IPage<PlatformLog>>> getLogInfo(@RequestBody @Validated ManageLogInfoQueryReq req) { public Result<IPage<PlatformLog>> getLogInfo(@RequestBody @Validated ManageLogInfoQueryReq req) {
return Mono.fromSupplier(() -> tPlatformLogService.listManageUserLogInfo(req)); return tPlatformLogService.listManageUserLogInfo(req);
} }
/** /**
...@@ -46,9 +46,9 @@ public class PlatformLogController extends BaseController { ...@@ -46,9 +46,9 @@ public class PlatformLogController extends BaseController {
* @Author: Mr.zhang * @Author: Mr.zhang
* @Date: 2020-12-2 * @Date: 2020-12-2
*/ */
@PostMapping("/getLogDetail") @GetMapping("/getLogDetail/{id}")
@ApiOperation(value = "获取用户日志信息详情") @ApiOperation(value = "获取用id户日志信息详情")
public Mono<Result> getLogInfoDetail(@RequestParam(value = "日志信息Id") Long platformLogId) { public Result getLogInfoDetail(@PathVariable(value = "id")Long platformLogId) {
return Mono.fromSupplier(() -> tPlatformLogService.getMallUserLogDetail(platformLogId)); return tPlatformLogService.getMallUserLogDetail(platformLogId);
} }
} }
\ No newline at end of file
package com.jz.manage.moduls.entity; 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 com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -19,50 +23,63 @@ public class DataGoodsApiParams implements Serializable { ...@@ -19,50 +23,63 @@ public class DataGoodsApiParams implements Serializable {
/** /**
* api参数id * api参数id
*/ */
@ApiModelProperty("主健ID")
@TableId(value = "id", type = IdType.AUTO)
private Long apiParamsId; private Long apiParamsId;
/** /**
* api商品id * api商品id
*/ */
@ApiModelProperty(value = "api商品id")
private Long goodsApi; private Long goodsApi;
/** /**
* 参数分类:01公共参数,02请求参数,03响应参数,04请求头参数,05状态码参数 * 参数分类:01公共参数,02请求参数,03响应参数,04请求头参数,05状态码参数
*/ */
@ApiModelProperty(value = "参数分类")
private String paramsDiff; private String paramsDiff;
/** /**
* 参数名称 * 参数名称
*/ */
@ApiModelProperty(value = "参数名称")
private String paramsName; private String paramsName;
/** /**
* 参数类型 * 参数类型
*/ */
@ApiModelProperty(value = "参数类型")
private String paramsType; private String paramsType;
/** /**
* 参数描述 * 参数描述
*/ */
@ApiModelProperty(value = "参数描述")
private String paramsDesc; private String paramsDesc;
/** /**
* 默认值 * 默认值
*/ */
@ApiModelProperty(value = "默认值")
private String defaultValue; private String defaultValue;
/** /**
* 备注 * 备注
*/ */
@ApiModelProperty(value = "备注")
private String remark; private String remark;
/** /**
* 是否必选:Y是,N否 * 是否必选:Y是,N否
*/ */
@ApiModelProperty(value = "是否必选")
private String ifRequird; private String ifRequird;
/** /**
* 删除标识:Y是,N否 * 删除标识:Y是,N否
*/ */
@ApiModelProperty(value = "删除标识")
private String delFlag; private String delFlag;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value = "创建时间")
private Date creTime; private Date creTime;
/** /**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty(value = "更新时间")
private Date uptTime; private Date uptTime;
......
package com.jz.manage.moduls.entity; package com.jz.manage.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -20,88 +22,119 @@ public class PlatformLog implements Serializable { ...@@ -20,88 +22,119 @@ public class PlatformLog implements Serializable {
/** /**
* 日志id * 日志id
*/ */
@ApiModelProperty(value = "日志id")
private Long platformLogId; private Long platformLogId;
/** /**
* 请求ip * 请求ip
*/ */
@ApiModelProperty(value = "请求ip")
private String requestIp; private String requestIp;
/** /**
* 调用人id * 调用人id
*/ */
@ApiModelProperty(value = "调用人id")
private String callerId; private String callerId;
/** /**
* 商品id * 商品id
*/ */
@ApiModelProperty(value = "商品id")
private Long dataGoodsId; private Long dataGoodsId;
/** /**
* apikey * apikey
*/ */
@ApiModelProperty(value = "apikey")
private String apiKey; private String apiKey;
/** /**
* 请求参数 * 请求参数
*/ */
@ApiModelProperty(value = "请求参数")
private String requestParams; private String requestParams;
/** /**
* 返回参数 * 返回参数
*/ */
@ApiModelProperty(value = "返回参数")
private String returnParams; private String returnParams;
/** /**
* 请求路径 * 请求路径
*/ */
@ApiModelProperty(value = "请求路径")
private String requestUrl; private String requestUrl;
/** /**
* 请求时间 * 请求时间
*/ */
@ApiModelProperty(value = "请求时间")
private Date requestTime; private Date requestTime;
/** /**
* 服务类型:01年,02月,03次 * 服务类型:01年,02月,03次
*/ */
@ApiModelProperty(value = "服务类型")
private String serviceType; private String serviceType;
/** /**
* 数据类型:01api,02数据包 * 数据类型:01api,02数据包
*/ */@ApiModelProperty(value = "数据类型")
private String dataGoodsType; private String dataGoodsType;
/** /**
* 下载地址 * 下载地址
*/ */
@ApiModelProperty(value = "下载地址")
private String downloadAddress; private String downloadAddress;
/** /**
* 数据商品单价 * 数据商品单价
*/ */
@ApiModelProperty(value = "数据商品单价")
private BigDecimal dataPrice; private BigDecimal dataPrice;
/** /**
* 价格类型:01免费,02收费 * 价格类型:01免费,02收费
*/ */
@ApiModelProperty(value = "价格类型")
private String priceType; private String priceType;
/** /**
* 调用总次数 * 调用总次数
*/ */
@ApiModelProperty(value = "调用总次数")
private Long totalTimes; private Long totalTimes;
/** /**
* 已使用次数 * 已使用次数
*/ */
@ApiModelProperty(value = "已使用次数")
private Long usedTimes; private Long usedTimes;
/** /**
* 剩余次数 * 剩余次数
*/ */
@ApiModelProperty(value = "剩余次数")
private Long remainTimes; private Long remainTimes;
/** /**
* 有效开始时间 * 有效开始时间
*/ */
@ApiModelProperty(value = "有效开始时间")
private Date startTime; private Date startTime;
/** /**
* 有效结束时间 * 有效结束时间
*/ */
@ApiModelProperty(value = "有效结束时间")
private Date endTime; private Date endTime;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value = "创建时间")
private Date creTime; private Date creTime;
/** /**
* 删除标识 * 删除标识
*/ */
@ApiModelProperty(value = "删除标识")
private String delFlag; 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() { public Long getPlatformLogId() {
return platformLogId; return platformLogId;
......
package com.jz.manage.moduls.mapper; 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.common.base.BaseMapper;
import com.jz.manage.moduls.entity.PlatformLog; import com.jz.manage.moduls.entity.PlatformLog;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -17,7 +21,7 @@ public interface PlatformLogDao extends BaseMapper<PlatformLog> { ...@@ -17,7 +21,7 @@ public interface PlatformLogDao extends BaseMapper<PlatformLog> {
* 查询平台用户日志列表 * 查询平台用户日志列表
* @return * @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; package com.jz.manage.moduls.service;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
/** /**
...@@ -17,4 +18,6 @@ public interface DataGoodsApiService { ...@@ -17,4 +18,6 @@ public interface DataGoodsApiService {
* @return * @return
*/ */
Result selectById(Long id) throws Exception; Result selectById(Long id) throws Exception;
} }
\ No newline at end of file
...@@ -6,8 +6,10 @@ import com.jz.common.bean.BaseBeanResponse; ...@@ -6,8 +6,10 @@ import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse; import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.DataGoods; 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.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto; 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.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest; import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
...@@ -34,7 +36,11 @@ public interface DataGoodsService { ...@@ -34,7 +36,11 @@ public interface DataGoodsService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest)throws Exception; /**
* 自营数据-上传api
* @param dataApiUpReq
*/
Result uploadApi(DataApiUpReq dataApiUpReq)throws Exception;
/**主键查询数据商品 /**主键查询数据商品
* @param DataGoodsRequest * @param DataGoodsRequest
......
package com.jz.manage.moduls.service.impl; 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.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.Result;
import com.jz.common.utils.StatusCode; 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.DataBasicDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto; 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.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.DataGoodsApiDao;
import com.jz.manage.moduls.mapper.DataGoodsApiParamsDao;
import com.jz.manage.moduls.mapper.DataGoodsDao;
import com.jz.manage.moduls.service.DataGoodsApiService; import com.jz.manage.moduls.service.DataGoodsApiService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -29,6 +43,8 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService { ...@@ -29,6 +43,8 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
@Autowired @Autowired
private DataGoodsApiDao tDataGoodsApiDao; private DataGoodsApiDao tDataGoodsApiDao;
/** /**
* 主键查询数据详情 * 主键查询数据详情
* *
...@@ -95,4 +111,6 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService { ...@@ -95,4 +111,6 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
result.setData(map); result.setData(map);
return Result.of_success(ResultMsg.SUCCESS, result); return Result.of_success(ResultMsg.SUCCESS, result);
} }
} }
\ No newline at end of file
package com.jz.manage.moduls.service.impl; package com.jz.manage.moduls.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse; import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.Constants; 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.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.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto; 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.DataGoodsListRequest;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest; 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.mapper.DataGoodsDao;
import com.jz.manage.moduls.service.DataGoodsService; import com.jz.manage.moduls.service.DataGoodsService;
...@@ -21,10 +34,14 @@ import java.util.Map; ...@@ -21,10 +34,14 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; 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.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
/** /**
* 数据商品(DataGoods)表服务实现类 * 数据商品(DataGoods)表服务实现类
...@@ -37,127 +54,211 @@ public class DataGoodsServiceImpl implements DataGoodsService { ...@@ -37,127 +54,211 @@ public class DataGoodsServiceImpl implements DataGoodsService {
@Autowired @Autowired
private DataGoodsDao dataGoodsDao; private DataGoodsDao dataGoodsDao;
/** @Autowired
* 条件分页查询数据列表 private DataGoodsApiParamsDao apiParamsDao;
* @param goodsListRequest
* @param httpRequest @Autowired
* @return private RedisTemplate redisTemplate;
* @throws Exception
*/ @Autowired
@Override private DataGoodsApiDao tDataGoodsApiDao;
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 goodsListRequest
param.put("dataGoodsId", goodsListRequest.getDataGoodsId()); * @param httpRequest
} * @return
//商品分类id(行业) * @throws Exception
if (goodsListRequest.getCategoryId() != null) { */
param.put("categoryId", goodsListRequest.getCategoryId()); @Override
} public PageInfoResponse<DataGoodsListDto> findList(DataGoodsListRequest goodsListRequest, HttpServletRequest httpRequest) throws Exception {
//数据商品名称 PageInfoResponse<DataGoodsListDto> pageInfoResponse = new PageInfoResponse<>();
if (!StringUtils.isEmpty(goodsListRequest.getDataName())) {
param.put("dataName", goodsListRequest.getDataName()); Map<String, Object> param = new HashMap<>();
} //数据商品id
//数据类型:01api,02数据包 if (goodsListRequest.getDataGoodsId() != null) {
if (!StringUtils.isEmpty(goodsListRequest.getDataType())) { param.put("dataGoodsId", goodsListRequest.getDataGoodsId());
param.put("dataType", goodsListRequest.getDataType()); }
} //商品分类id(行业)
//数据状态:01预售,02在售中,03下架,04上架 if (goodsListRequest.getCategoryId() != null) {
if (!StringUtils.isEmpty(goodsListRequest.getDataStatus())) { param.put("categoryId", goodsListRequest.getCategoryId());
param.put("dataStatus", goodsListRequest.getDataStatus()); }
} //数据商品名称
if (!StringUtils.isEmpty(goodsListRequest.getDataName())) {
PageHelper.startPage(goodsListRequest.getPageNum(), goodsListRequest.getPageSize()); param.put("dataName", goodsListRequest.getDataName());
List<DataGoodsListDto> list = dataGoodsDao.findList(param); }
PageInfo<DataGoodsListDto> pageInfo = new PageInfo<>(list); //数据类型:01api,02数据包
if (!StringUtils.isEmpty(goodsListRequest.getDataType())) {
pageInfoResponse.setCode(Constants.SUCCESS_CODE); param.put("dataType", goodsListRequest.getDataType());
pageInfoResponse.setMessage("查询成功"); }
pageInfoResponse.setData(pageInfo); //数据状态:01预售,02在售中,03下架,04上架
return pageInfoResponse; if (!StringUtils.isEmpty(goodsListRequest.getDataStatus())) {
} param.put("dataStatus", goodsListRequest.getDataStatus());
}
/* (non-Javadoc) PageHelper.startPage(goodsListRequest.getPageNum(), goodsListRequest.getPageSize());
* @see com.ycxc.vmts.service.DataGoodsService#add(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest) List<DataGoodsListDto> list = dataGoodsDao.findList(param);
*/ PageInfo<DataGoodsListDto> pageInfo = new PageInfo<>(list);
@Override
@Transactional(rollbackFor=Exception.class) pageInfoResponse.setCode(Constants.SUCCESS_CODE);
public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception { pageInfoResponse.setMessage("查询成功");
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>(); pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
/*$*seDataGoodsIdCodeReplace*$*/ }
//创建人
//dataGoods.setCreateUser(getHttpRequestUserId(httpRequest));
//创建时间 /* (non-Javadoc)
dataGoods.setCreTime(new Date()); * @see com.ycxc.vmts.service.DataGoodsService#add(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
dataGoodsDao.insertSelective(dataGoods); // @Override
// @Transactional(rollbackFor=Exception.class)
baseBeanResponse.setCode(Constants.SUCCESS_CODE); // public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
baseBeanResponse.setMessage("新增成功"); // BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
baseBeanResponse.setData(dataGoods); //
// /*$*seDataGoodsIdCodeReplace*$*/
return baseBeanResponse; // //创建人
} // //dataGoods.setCreateUser(getHttpRequestUserId(httpRequest));
// //创建时间
/* (non-Javadoc) // dataGoods.setCreTime(new Date());
* @see com.ycxc.vmts.service.DataGoodsService#edit(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest) //
*/ // dataGoodsDao.insertSelective(dataGoods);
@Override //
@Transactional(rollbackFor=Exception.class) // baseBeanResponse.setCode(Constants.SUCCESS_CODE);
public BaseBeanResponse<DataGoods> edit(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception { // baseBeanResponse.setMessage("新增成功");
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>(); // baseBeanResponse.setData(dataGoods);
//
//修改人 // return baseBeanResponse;
//dataGoods.setUpdateUser(getHttpRequestUserId(httpRequest)); // }
//修改时间
dataGoods.setUptTime(new Date()); /* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#edit(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
dataGoodsDao.updateByPrimaryKeySelective(dataGoods); */
@Override
baseBeanResponse.setCode(Constants.SUCCESS_CODE); @Transactional(rollbackFor = Exception.class)
baseBeanResponse.setMessage("修改成功"); public BaseBeanResponse<DataGoods> edit(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
baseBeanResponse.setData(dataGoods); BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
return baseBeanResponse; //修改人
} //dataGoods.setUpdateUser(getHttpRequestUserId(httpRequest));
//修改时间
/* (non-Javadoc) dataGoods.setUptTime(new Date());
* @see com.ycxc.vmts.service.DataGoodsService#findById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/ dataGoodsDao.updateByPrimaryKeySelective(dataGoods);
@Override
public BaseBeanResponse<DataGoodsDto> findById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest) baseBeanResponse.setCode(Constants.SUCCESS_CODE);
throws Exception { baseBeanResponse.setMessage("修改成功");
BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<>(); baseBeanResponse.setData(dataGoods);
DataGoodsDto DataGoodsDto = dataGoodsDao.findById(dataGoodsRequest.getDataGoodsId()); return baseBeanResponse;
}
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功"); /* (non-Javadoc)
baseBeanResponse.setData(DataGoodsDto); * @see com.ycxc.vmts.service.DataGoodsService#findById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
return baseBeanResponse; @Override
} public BaseBeanResponse<DataGoodsDto> findById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
/* (non-Javadoc) BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<>();
* @see com.ycxc.vmts.service.DataGoodsService#deleteById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/ DataGoodsDto DataGoodsDto = dataGoodsDao.findById(dataGoodsRequest.getDataGoodsId());
@Override
@Transactional(rollbackFor=Exception.class) baseBeanResponse.setCode(Constants.SUCCESS_CODE);
public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest) baseBeanResponse.setMessage("查询成功");
throws Exception { baseBeanResponse.setData(DataGoodsDto);
BaseResponse baseResponse = new BaseResponse();
return baseBeanResponse;
dataGoodsDao.deleteByPrimaryKey(dataGoodsRequest.getDataGoodsId()); }
baseResponse.setCode(Constants.SUCCESS_CODE); /* (non-Javadoc)
baseResponse.setMessage("删除成功"); * @see com.ycxc.vmts.service.DataGoodsService#deleteById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
return baseResponse; @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; ...@@ -8,9 +8,11 @@ import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultMsg; import com.jz.common.constant.ResultMsg;
import com.jz.manage.moduls.entity.MallCustomer;
import com.jz.manage.moduls.entity.PlatformLog; import com.jz.manage.moduls.entity.PlatformLog;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.log.bean.ManageLogInfoQueryReq; 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.mapper.PlatformLogDao;
import com.jz.manage.moduls.service.PlatformLogService; import com.jz.manage.moduls.service.PlatformLogService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,15 +31,16 @@ public class PlatformLogServiceImpl implements PlatformLogService { ...@@ -29,15 +31,16 @@ public class PlatformLogServiceImpl implements PlatformLogService {
@Autowired @Autowired
private PlatformLogDao tPlatformLogDao; private PlatformLogDao tPlatformLogDao;
@Autowired
private MallCustomerDao mallCustomerDao;
@Override @Override
public Result listManageUserLogInfo(ManageLogInfoQueryReq req) { public Result listManageUserLogInfo(ManageLogInfoQueryReq req) {
IPage<PlatformLog> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<PlatformLog> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<PlatformLog> query = new QueryWrapper<>(); QueryWrapper<PlatformLog> query = new QueryWrapper<>();
query.eq("del_flag" ,"N"); query.eq("t1.del_flag" ,"N");
query.orderByDesc("cre_time"); query.orderByDesc("t1.cre_time");
IPage<PlatformLog> platformLogIPage = tPlatformLogDao.selectPage(page, query); List<PlatformLog> platformLogs = tPlatformLogDao.listMallLogInfo(page, query);
return Result.of_success(platformLogIPage); return Result.of_success(platformLogs);
} }
/** /**
...@@ -52,6 +55,10 @@ public class PlatformLogServiceImpl implements PlatformLogService { ...@@ -52,6 +55,10 @@ public class PlatformLogServiceImpl implements PlatformLogService {
query.eq("del_flag","N"); query.eq("del_flag","N");
query.orderByDesc("cre_time"); query.orderByDesc("cre_time");
PlatformLog platformLog = tPlatformLogDao.selectOne(query); PlatformLog platformLog = tPlatformLogDao.selectOne(query);
// 获取调用人
MallCustomer mallCustomer = mallCustomerDao.selectOne(
new QueryWrapper<MallCustomer>().eq("customer_id", platformLog.getCallerId()));
platformLog.setCustomerName(mallCustomer.getCustomerName());
if (null == platformLog){ if (null == platformLog){
return Result.of_error(ResultMsg.DATA_NOT_FOUND); return Result.of_error(ResultMsg.DATA_NOT_FOUND);
} }
......
...@@ -58,28 +58,27 @@ ...@@ -58,28 +58,27 @@
t1.upt_time as uptTime, t1.upt_time as uptTime,
(CASE WHEN t1.data_status = '01' then '预售' (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 '下架' WHEN t1.data_status = '03' then '下架'
WHEN t1.data_status = '02' then '上架' end) dataStatus WHEN t1.data_status = '04' then '上架' end) dataStatus
FROM FROM
t_data_goods t1 INNER JOIN t_data_goods_category t2 ON t1.category_id = t2. category_id t_data_goods t1 INNER JOIN t_data_goods_category t2 ON t1.category_id = t2.category_id
where where t1.del_flag = 'N'
1= 1 and and
t1.del_flag = 'N' and
t1.audit_status = '02' t1.audit_status = '02'
<if test="dataGoodsId != null"> <if test="dataGoodsId != null">
and data_goods_id = #{dataGoodsId} and t1.data_goods_id = #{dataGoodsId}
</if> </if>
<if test="categoryId != null"> <if test="categoryId != null">
and category_id = #{categoryId} and t1.category_id = #{categoryId}
</if> </if>
<if test="dataName != null and dataName != ''"> <if test="dataName != null and dataName != ''">
and data_name like concat('%',#{dataName},'%') and t1.data_name like concat('%',#{dataName},'%')
</if> </if>
<if test="dataType != null and dataType != ''"> <if test="dataType != null and dataType != ''">
and data_type = #{dataType} and t1.data_type = #{dataType}
</if> </if>
<if test="dataStatus != null and dataStatus != ''"> <if test="dataStatus != null and dataStatus != ''">
and data_status = #{dataStatus} and t1.data_status = #{dataStatus}
</if> </if>
order by t1.upt_time desc order by t1.upt_time desc
</select> </select>
......
...@@ -27,15 +27,17 @@ ...@@ -27,15 +27,17 @@
</resultMap> </resultMap>
<sql id="allFiled"> <sql id="allFiled">
platform_log_id AS platformLogId,request_ip AS requestIp,caller_id AS callerId,data_goods_id AS dataGoodsId, t1.platform_log_id AS platformLogId,t1.request_ip AS requestIp,t1.caller_id AS callerId,t1.data_goods_id AS dataGoodsId,
api_key AS apiKey,request_params AS requestParams,return_params AS returnParams,request_url AS requestUrl t1.api_key AS apiKey,t1.request_params AS requestParams,t1.return_params AS returnParams,t1.request_url AS requestUrl,
,request_time AS requestTime,service_type AS serviceType,data_goods_type AS dataGoodsType,download_address AS downloadAddress, t1.request_time AS requestTime,t1.service_type AS serviceType,t1.data_goods_type AS dataGoodsType,t1.download_address AS downloadAddress,
data_price AS dataPrice,price_type AS priceType,total_times AS totalTimes,used_times AS usedTimes 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,
,remain_times AS remainTimes,caller_type AS callerType,start_time AS startTime,end_time AS endTime,cre_time AS creTime, 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,
cre_person AS crePerson,upt_time AS uptTime,upt_person AS uptPerson,del_flag AS delFlag t1.upt_time AS uptTime,t1.upt_person AS uptPerson,t1.del_flag AS delFlag
</sql> </sql>
<select id="listMallLogInfo" resultType="com.jz.manage.moduls.entity.PlatformLog"> <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> </select>
</mapper> </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