Commit 5110bf16 authored by zhangc's avatar zhangc

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

parents 986c9500 eeae9c4a
package com.jz.common.entity; package com.jz.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
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;
...@@ -20,6 +22,7 @@ public class DataGoods implements Serializable { ...@@ -20,6 +22,7 @@ public class DataGoods implements Serializable {
/** /**
* 数据商品id * 数据商品id
*/ */
@TableId(value = "data_goods_id", type = IdType.AUTO)
private Long dataGoodsId; private Long dataGoodsId;
/** /**
* 商品分类id(行业) * 商品分类id(行业)
......
package com.jz.common.enums.auth;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums.auth
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthModeEnum
* @DATE: 2020-12-26/23:53
* @DAY_NAME_SHORT: 周六
* @Description: 认证方式枚举
**/
public enum AuthModeEnum {
/**
* 按次调用
*/
POWER_CALL_MODE("按次调用"),
/**
* 按时间调用'
*/
RECORD_TIME_MODE("按时间调用"),
/**
* 永久有效'
*/
PERMANENT_TIME_MODE("永久有效");
private String text;
AuthModeEnum(String text) {
this.text = text;
}
public String getText() {
return text;
}
}
package com.jz.common.enums.auth;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums.auth
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthTypeEnum
* @DATE: 2020-12-26/23:47
* @DAY_NAME_SHORT: 周六
* @Description: 授权认证枚举类
**/
public enum AuthTypeEnum {
/**
* 数据银行
*/
DATA_BANK_AUTH("数据银行授权"),
/**
* dmp授权'
*/
DMP_AUTH("DMP授权");
private String text;
AuthTypeEnum(String text) {
this.text = text;
}
public String getText() {
return text;
}
}
...@@ -348,4 +348,30 @@ public class DateUtils { ...@@ -348,4 +348,30 @@ public class DateUtils {
e.printStackTrace(); e.printStackTrace();
} }
} }
//获取一年后时间
public static Date getAfterYear(Date now) {
Calendar cal = Calendar.getInstance();
cal.setTime(now);
cal.add(Calendar.YEAR, 1);
return cal.getTime();
}
// 获取一月后的时间
public static Date getAfterMonth(Date now) {
Calendar cal = Calendar.getInstance();
cal.setTime(now);
cal.add(Calendar.MONTH, 1);
return cal.getTime();
}
// 获取一季后的时间
public static Date getAfterSeason(Date now) {
Calendar cal = Calendar.getInstance();
cal.setTime(now);
cal.add(Calendar.MONTH, 3);
return cal.getTime();
}
} }
package com.jz.common.utils;
import java.util.Calendar;
import java.util.Random;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
public class NumberUtils {
// 制作订单编号
public static String getOrderNumber(String userId) {
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);
return format1 + getRandomString(4)+format2 +userId+ format3;
}
//制作交易流水编号
public static String getDealNum() {
Calendar ca = Calendar.getInstance();
int year = ca.get(Calendar.YEAR);
int month = ca.get(Calendar.MONTH) + 1;
int day = ca.get(Calendar.DAY_OF_MONTH);
int hour = ca.get(Calendar.HOUR);//小时
int minute = ca.get(Calendar.MINUTE);//分
int second = ca.get(Calendar.SECOND);//秒
// String format1 = String.format("%02d", year);
String format1 = String.format("%02d", month);
String format2 = String.format("%02d", day);
String format3 = String.format("%02d", minute);
String format4 = String.format("%02d", hour);
String format5 = String.format("%02d", second);
return year+format1+format2+format3+ getRandomString(8)+ format4+format5;
}
public static String getRandomString(int length) {
String str = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(62);
sb.append(str.charAt(number));
}
return sb.toString();
}
/**
* 随机获取英文+数字(用户名)
*
* @param engCode 小写英文的数量
* @param numCode 数字的数量
* @return
*/
public static String verifyUserName(int engCode, int numCode) {
//声明一个StringBuffer存储随机数
StringBuffer sb = new StringBuffer();
char[] englishCodeArray = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
char[] numCodeArray = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
Random random = new Random();
//获取英文
for (int i = 0; i < engCode; i++) {
char num = englishCodeArray[random.nextInt(englishCodeArray.length)];
sb.append(num);
}
//获取数字
for (int i = 0; i < numCode; i++) {
char num = numCodeArray[random.nextInt(numCodeArray.length)];
sb.append(num);
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println(getOrderNumber("00001"));
System.out.println(getDealNum());
}
}
\ No newline at end of file
...@@ -211,7 +211,7 @@ public final class WebUtils { ...@@ -211,7 +211,7 @@ public final class WebUtils {
String readContent = null; String readContent = null;
try { try {
method.addHeader("Content-type", "application/json; charset=ISO-8859-1"); method.addHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
//method.setHeader("Accept", "application/xml"); //method.setHeader("Accept", "application/xml");
method.setEntity(new StringEntity(data.toString(), Charset.forName("utf-8"))); method.setEntity(new StringEntity(data.toString(), Charset.forName("utf-8")));
HttpResponse response = httpClient.execute(method, HttpClientContext.create()); HttpResponse response = httpClient.execute(method, HttpClientContext.create());
......
...@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.controller.goods.bean.dto; ...@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.controller.goods.bean.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -13,6 +14,7 @@ import java.math.BigDecimal; ...@@ -13,6 +14,7 @@ import java.math.BigDecimal;
* @Version: * @Version:
*/ */
@ApiModel(value = "数据详情") @ApiModel(value = "数据详情")
@Data
public class DataDetailsDto implements Serializable { public class DataDetailsDto implements Serializable {
@ApiModelProperty(value = "供应商名称") @ApiModelProperty(value = "供应商名称")
...@@ -24,6 +26,12 @@ public class DataDetailsDto implements Serializable { ...@@ -24,6 +26,12 @@ public class DataDetailsDto implements Serializable {
@ApiModelProperty(value = "价格类型") @ApiModelProperty(value = "价格类型")
private String priceType; private String priceType;
@ApiModelProperty(value = "数据商品图片")
private String dataPicture;
@ApiModelProperty(value = "数据描述")
private String dataDesc;
/** /**
* 请求类型(方式) * 请求类型(方式)
*/ */
...@@ -61,91 +69,5 @@ public class DataDetailsDto implements Serializable { ...@@ -61,91 +69,5 @@ public class DataDetailsDto implements Serializable {
@ApiModelProperty(value = "次(元)") @ApiModelProperty(value = "次(元)")
private BigDecimal secondType; private BigDecimal secondType;
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getApiMethod() {
return apiMethod;
}
public void setApiMethod(String apiMethod) {
this.apiMethod = apiMethod;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public BigDecimal getYearType() {
return yearType;
}
public void setYearType(BigDecimal yearType) {
this.yearType = yearType;
}
public BigDecimal getSeasonType() {
return seasonType;
}
public void setSeasonType(BigDecimal seasonType) {
this.seasonType = seasonType;
}
public BigDecimal getMonthType() {
return monthType;
}
public void setMonthType(BigDecimal monthType) {
this.monthType = monthType;
}
public BigDecimal getSecondType() {
return secondType;
}
public void setSecondType(BigDecimal secondType) {
this.secondType = secondType;
}
} }
...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.jz.common.entity.DataGoodsApiParams; import com.jz.common.entity.DataGoodsApiParams;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -17,6 +18,7 @@ import java.util.List; ...@@ -17,6 +18,7 @@ import java.util.List;
* @Version: * @Version:
*/ */
@ApiModel(value = "商品详情--商品详情参数对象", description = "商品详情参数对象") @ApiModel(value = "商品详情--商品详情参数对象", description = "商品详情参数对象")
@Data
public class DataGoodsApiDto implements Serializable { public class DataGoodsApiDto implements Serializable {
/** /**
...@@ -165,219 +167,11 @@ public class DataGoodsApiDto implements Serializable { ...@@ -165,219 +167,11 @@ public class DataGoodsApiDto implements Serializable {
private String paramsDiffNum; private String paramsDiffNum;
public Long getGoodsApi() { @ApiModelProperty(value = "数据商品图片")
return goodsApi; private String dataPicture;
}
public void setGoodsApi(Long goodsApi) { @ApiModelProperty(value = "数据描述")
this.goodsApi = goodsApi; private String dataDesc;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getApiMethod() {
return apiMethod;
}
public void setApiMethod(String apiMethod) {
this.apiMethod = apiMethod;
}
public String getApiProtocl() {
return apiProtocl;
}
public void setApiProtocl(String apiProtocl) {
this.apiProtocl = apiProtocl;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public Long getApiParamsId() {
return apiParamsId;
}
public void setApiParamsId(Long apiParamsId) {
this.apiParamsId = apiParamsId;
}
public String getParamsDiff() {
return paramsDiff;
}
public void setParamsDiff(String paramsDiff) {
this.paramsDiff = paramsDiff;
}
public String getParamsName() {
return paramsName;
}
public void setParamsName(String paramsName) {
this.paramsName = paramsName;
}
public String getParamsTYpe() {
return paramsTYpe;
}
public void setParamsTYpe(String paramsTYpe) {
this.paramsTYpe = paramsTYpe;
}
public String getParamsDesc() {
return paramsDesc;
}
public void setParamsDesc(String paramsDesc) {
this.paramsDesc = paramsDesc;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public String getIfRequird() {
return ifRequird;
}
public void setIfRequird(String ifRequird) {
this.ifRequird = ifRequird;
}
public String getReturnDataExample() {
return returnDataExample;
}
public void setReturnDataExample(String returnDataExample) {
this.returnDataExample = returnDataExample;
}
public String getRequestExample() {
return requestExample;
}
public void setRequestExample(String requestExample) {
this.requestExample = requestExample;
}
public BigDecimal getYearType() {
return yearType;
}
public void setYearType(BigDecimal yearType) {
this.yearType = yearType;
}
public BigDecimal getSeasonType() {
return seasonType;
}
public void setSeasonType(BigDecimal seasonType) {
this.seasonType = seasonType;
}
public BigDecimal getMonthType() {
return monthType;
}
public void setMonthType(BigDecimal monthType) {
this.monthType = monthType;
}
public BigDecimal getSecondType() {
return secondType;
}
public void setSecondType(BigDecimal secondType) {
this.secondType = secondType;
}
public String getParamsDiffNum() {
return paramsDiffNum;
}
public void setParamsDiffNum(String paramsDiffNum) {
this.paramsDiffNum = paramsDiffNum;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
} }
...@@ -5,6 +5,7 @@ import com.jz.common.constant.Constants; ...@@ -5,6 +5,7 @@ import com.jz.common.constant.Constants;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest; import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
import com.jz.dm.mall.moduls.service.OrderService; import com.jz.dm.mall.moduls.service.OrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -94,4 +95,6 @@ public class OrderController { ...@@ -94,4 +95,6 @@ public class OrderController {
result.setData(dataGoodsApi); result.setData(dataGoodsApi);
return result; return result;
} }
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.order.dto;
import com.jz.common.enums.auth.AuthModeEnum;
import com.jz.common.enums.auth.AuthTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
@Data
public class PayDto implements Serializable {
@ApiModelProperty(value = "商城用户id")
private Long customerId;
@ApiModelProperty(value = "商品id")
private Long dataGoodsId;
@ApiModelProperty(value = "企业id")
private Long departmentId;
@ApiModelProperty(value = "资产账户id")
private String assetsId;
@ApiModelProperty(value = "商品金额")
private BigDecimal dataPrice;
@ApiModelProperty(value = "价格类型")
private String priceType;
@ApiModelProperty(value = "年(元)")
private String purchaseMethod;
// /**
// * getway需要
// */
// @ApiModelProperty(value = "apiKey唯一标识", required = true)
// @NotNull(message = "apiKey唯一标识不能为空")
// private String apiKey;
//
// @ApiModelProperty(value = "组织类型: INT 内部, OUT 外部", required = true)
// @NotNull(message = "组织类型不能为空")
// private String orgType;
//
// @ApiModelProperty(value = "组织编码", required = true)
// @NotNull(message = "组织编码不能为空")
// private String orgCode;
//
// @ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权", required = true)
// @NotNull(message = "授权类型不能为空")
// private AuthTypeEnum authType;
//
// @ApiModelProperty(value = "授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效", required = true)
// @NotNull(message = "授权方式不能为空")
// private AuthModeEnum authMode;
//
// @ApiModelProperty(value = "开始时间", required = false)
// private String validStartTime;
// @ApiModelProperty(value = "结束时间", required = false)
// private String validEndTime;
//
// @ApiModelProperty(value = "备注", required = false)
// private String remark;
}
package com.jz.dm.mall.moduls.controller.pay;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
import com.jz.dm.mall.moduls.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @ClassName: 支付controller
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
@RestController
@RequestMapping("/pay")
@Api(tags = "支付controller")
public class PayController {
@Autowired
private PayService payService;
@PostMapping("/payment")
@ApiOperation(value = "支付功能")
public Result payController(@RequestBody PayDto payDto) throws Exception {
Result result = new Result();
try{
result = payService.goodsPay(payDto);
}catch (Exception e) {
e.printStackTrace();
result = new Result(false, "支付失败!");
}
return result;
}
}
package com.jz.dm.mall.moduls.controller.pay.req;
import com.jz.common.enums.auth.AuthModeEnum;
import com.jz.common.enums.auth.AuthTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
@Data
@ApiModel("商城用户API认证")
public class AuthMallUserApiReq implements Serializable {
@ApiModelProperty(value = "apiKey唯一标识", required = true)
@NotNull(message = "apiKey唯一标识不能为空")
private String apiKey;
@ApiModelProperty(value = "组织类型: INT 内部, OUT 外部", required = true)
@NotNull(message = "组织类型不能为空")
private String orgType;
@ApiModelProperty(value = "用户id", required = false)
private String userId;
@ApiModelProperty(value = "组织编码", required = true)
@NotNull(message = "组织编码不能为空")
private String orgCode;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权", required = true)
@NotNull(message = "授权类型不能为空")
private AuthTypeEnum authType;
@ApiModelProperty(value = "授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用,PERMANENT_TIME_MODE 永久有效", required = true)
@NotNull(message = "授权方式不能为空")
private AuthModeEnum authMode;
@ApiModelProperty(value = "开始时间", required = false)
private String validStartTime;
@ApiModelProperty(value = "结束时间", required = false)
private String validEndTime;
@ApiModelProperty(value = "备注", required = false)
private String remark;
}
...@@ -24,6 +24,8 @@ public class FinanceTradeFlow implements Serializable { ...@@ -24,6 +24,8 @@ public class FinanceTradeFlow implements Serializable {
*/ */
@TableId(value = "trade_flow_id",type = IdType.AUTO) @TableId(value = "trade_flow_id",type = IdType.AUTO)
private Long tradeFlowId; private Long tradeFlowId;
private Long AssetsId;
/** /**
* 订单id * 订单id
*/ */
...@@ -61,6 +63,13 @@ public class FinanceTradeFlow implements Serializable { ...@@ -61,6 +63,13 @@ public class FinanceTradeFlow implements Serializable {
*/ */
private String delFlag; private String delFlag;
public Long getAssetsId() {
return AssetsId;
}
public void setAssetsId(Long assetsId) {
AssetsId = assetsId;
}
public Long getTradeFlowId() { public Long getTradeFlowId() {
return tradeFlowId; return tradeFlowId;
......
...@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.entity; ...@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -15,6 +16,7 @@ import java.util.Date; ...@@ -15,6 +16,7 @@ import java.util.Date;
*/ */
@TableName("t_order_payment") @TableName("t_order_payment")
@ApiModel @ApiModel
@Data
public class OrderPayment implements Serializable { public class OrderPayment implements Serializable {
private static final long serialVersionUID = -14423507905800987L; private static final long serialVersionUID = -14423507905800987L;
/** /**
...@@ -57,98 +59,16 @@ public class OrderPayment implements Serializable { ...@@ -57,98 +59,16 @@ public class OrderPayment implements Serializable {
* 创建时间 * 创建时间
*/ */
private Date creTime; private Date creTime;
/**
* 创建人
*/
private String crePerson;
/** /**
* 删除标识 * 删除标识
*/ */
private String delFlag; private String delFlag;
public Long getPaymentId() {
return paymentId;
}
public void setPaymentId(Long paymentId) {
this.paymentId = paymentId;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Long getSellerId() {
return sellerId;
}
public void setSellerId(Long sellerId) {
this.sellerId = sellerId;
}
public BigDecimal getPaymentMoney() {
return paymentMoney;
}
public void setPaymentMoney(BigDecimal paymentMoney) {
this.paymentMoney = paymentMoney;
}
public Date getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(Date paymentTime) {
this.paymentTime = paymentTime;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public BigDecimal getDistrictMoney() {
return districtMoney;
}
public void setDistrictMoney(BigDecimal districtMoney) {
this.districtMoney = districtMoney;
}
public String getPaymentStatus() {
return paymentStatus;
}
public void setPaymentStatus(String paymentStatus) {
this.paymentStatus = paymentStatus;
}
public String getPurchaseMethod() {
return purchaseMethod;
}
public void setPurchaseMethod(String purchaseMethod) {
this.purchaseMethod = purchaseMethod;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
} }
\ No newline at end of file
...@@ -23,4 +23,8 @@ public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAsse ...@@ -23,4 +23,8 @@ public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAsse
* @return * @return
*/ */
int insertFinanceCustome(@Param("finance") FinanceCustomerAssets finance); int insertFinanceCustome(@Param("finance") FinanceCustomerAssets finance);
FinanceCustomerAssets findById(@Param("assetsId")Long assetsId);
void addAssets(FinanceCustomerAssets assets);
} }
\ No newline at end of file
...@@ -30,4 +30,6 @@ public interface FinanceTradeFlowDao extends BaseMapper<FinanceTradeFlow> { ...@@ -30,4 +30,6 @@ public interface FinanceTradeFlowDao extends BaseMapper<FinanceTradeFlow> {
List<FinanceTradeFlowDto> findListScTradeFlow(Map param) throws Exception; List<FinanceTradeFlowDto> findListScTradeFlow(Map param) throws Exception;
List<EveryTradeFlowDto> findListEveryDayScInfo(Map param) throws Exception; List<EveryTradeFlowDto> findListEveryDayScInfo(Map param) throws Exception;
void addFlow(FinanceTradeFlow flow);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.jz.common.base.BaseMapper; ...@@ -4,6 +4,7 @@ import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiDto; import com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiDto;
import com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiParamsDto; import com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiParamsDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
import com.jz.dm.mall.moduls.entity.Order; import com.jz.dm.mall.moduls.entity.Order;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -28,4 +29,6 @@ public interface OrderDao extends BaseMapper<Order> { ...@@ -28,4 +29,6 @@ public interface OrderDao extends BaseMapper<Order> {
List<DataGoodsApiDto> getApiInterface(Map params) throws Exception; List<DataGoodsApiDto> getApiInterface(Map params) throws Exception;
List<DataGoodsApiParamsDto> getApiParamsInfo(@Param("goodsApi") Long goodsApi); List<DataGoodsApiParamsDto> getApiParamsInfo(@Param("goodsApi") Long goodsApi);
void addOrder(Order order);
} }
\ No newline at end of file
...@@ -12,4 +12,5 @@ import com.jz.dm.mall.moduls.entity.OrderGoodsInfo; ...@@ -12,4 +12,5 @@ import com.jz.dm.mall.moduls.entity.OrderGoodsInfo;
public interface OrderGoodsInfoDao extends BaseMapper<OrderGoodsInfo> { public interface OrderGoodsInfoDao extends BaseMapper<OrderGoodsInfo> {
void addGoodsInfo(OrderGoodsInfo goodsInfo);
} }
\ No newline at end of file
...@@ -12,5 +12,5 @@ import com.jz.dm.mall.moduls.entity.OrderPayment; ...@@ -12,5 +12,5 @@ import com.jz.dm.mall.moduls.entity.OrderPayment;
public interface OrderPaymentDao extends BaseMapper<OrderPayment> { public interface OrderPaymentDao extends BaseMapper<OrderPayment> {
void addOrderPayment(OrderPayment orderPayment);
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.service; package com.jz.dm.mall.moduls.service;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest; import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map; import java.util.Map;
...@@ -21,4 +23,6 @@ public interface OrderService { ...@@ -21,4 +23,6 @@ public interface OrderService {
OrderDto getOrderDetail(String orderId) throws Exception; OrderDto getOrderDetail(String orderId) throws Exception;
Map getApiInterfaceDetail(Map params) throws Exception; Map getApiInterfaceDetail(Map params) throws Exception;
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
public interface PayService {
/**
* 商品购买
* @param payDto
* @return
*/
Result goodsPay(PayDto payDto) throws Exception;
}
...@@ -79,6 +79,8 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService { ...@@ -79,6 +79,8 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
data.setApiMethod(goods.getApiMethod()); data.setApiMethod(goods.getApiMethod());
data.setRequestType(goods.getRequestType()); data.setRequestType(goods.getRequestType());
data.setReturnType(goods.getReturnType()); data.setReturnType(goods.getReturnType());
data.setDataPicture(goods.getDataPicture());
data.setDataDesc(goods.getDataDesc());
map.put("dataInfo", data); map.put("dataInfo", data);
// 商品参数 // 商品参数
......
...@@ -6,7 +6,10 @@ import com.jz.common.bean.PageInfoResponse; ...@@ -6,7 +6,10 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.common.utils.DateUtils; import com.jz.common.utils.DateUtils;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.*; import com.jz.dm.mall.moduls.controller.order.bean.*;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
import com.jz.dm.mall.moduls.entity.Order;
import com.jz.dm.mall.moduls.mapper.OrderDao; import com.jz.dm.mall.moduls.mapper.OrderDao;
import com.jz.dm.mall.moduls.service.OrderService; import com.jz.dm.mall.moduls.service.OrderService;
...@@ -101,4 +104,6 @@ public class OrderServiceImpl implements OrderService { ...@@ -101,4 +104,6 @@ public class OrderServiceImpl implements OrderService {
return returnMap; return returnMap;
} }
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.NumberUtils;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.dto.PayDto;
import com.jz.dm.mall.moduls.entity.*;
import com.jz.dm.mall.moduls.mapper.*;
import com.jz.dm.mall.moduls.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
@Service("payService")
public class PayServiceImpl implements PayService {
@Autowired
private OrderDao orderDao;
@Autowired
private OrderPaymentDao orderPaymentDao;
@Autowired
private OrderGoodsInfoDao goodsInfoDao;
@Autowired
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Autowired
private FinanceTradeFlowDao financeTradeFlowDao;
/**
* 新增订单
*
* @param payDto
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result goodsPay(PayDto payDto) throws Exception{
// 新增订单主表
Order order = new Order();
order.setOrderNumber(NumberUtils.getOrderNumber(payDto.getCustomerId() + ""));
order.setCustomerId(payDto.getCustomerId());
order.setOrderMoney(payDto.getDataPrice());
order.setOrderStatus("02");
order.setPaymentMoney(payDto.getDataPrice());
order.setOrderTime(DateUtils.getToday());
order.setPaymentTime(order.getOrderTime());
order.setPaymentMethod("01");
// order.setSellerId();
// order.setDistrictMoney();
order.setTakeEffectTime(order.getOrderTime());
//处理生效期
Date time = getTime(payDto);
if (time != null) {
order.setInvalidTime(time);
}
order.setPurchaseMethod(payDto.getPurchaseMethod());
order.setPriceType(payDto.getPriceType());
order.setCrePerson(payDto.getCustomerId() + "");
order.setCreTime(DateUtils.getToday());
orderDao.addOrder(order);
// 新增订单支付表/订单商品表
Long orderId = order.getOrderId();
if (orderId != null) {
OrderPayment orderPayment = new OrderPayment();
// orderPayment.setSellerId();
orderPayment.setPaymentMoney(payDto.getDataPrice());
orderPayment.setPaymentTime(DateUtils.getToday());
orderPayment.setPaymentMethod("01");
// orderPayment.setDistrictMoney();
orderPayment.setPaymentStatus(order.getOrderStatus());
orderPayment.setPurchaseMethod(payDto.getPurchaseMethod());
orderPayment.setCreTime(DateUtils.getToday());
orderPayment.setCrePerson(payDto.getCustomerId()+"");
// 订单商品表
OrderGoodsInfo goodsInfo = new OrderGoodsInfo();
goodsInfo.setOrderId(orderId);
goodsInfo.setDataGoodsId(payDto.getDataGoodsId());
goodsInfo.setCreTime(DateUtils.getToday());
goodsInfo.setCrePerson(payDto.getCustomerId()+"");
// 新增
orderPaymentDao.addOrderPayment(orderPayment);
goodsInfoDao.addGoodsInfo(goodsInfo);
}
// 获取企业资产信息
// payDto.getAssetsId()
FinanceCustomerAssets assets = financeCustomerAssetsDao.findById(Long.valueOf("34"));
// 可用金额减去支付金额
BigDecimal bigDecimal = new BigDecimal(assets.getUseMoney()+ "");
BigDecimal bigDecima2 = new BigDecimal(payDto.getDataPrice()+ "");
if (bigDecimal.compareTo(bigDecima2) == -1){
return Result.error("金额不足!请充值!");
}
BigDecimal subtract = bigDecimal.subtract(bigDecima2);
assets.setUseMoney(subtract);
assets.setTotalMoney(subtract);
assets.setCreTime(DateUtils.getToday());
assets.setCrePerson(payDto.getCustomerId()+ "");
financeCustomerAssetsDao.addAssets(assets);
// 新增记录表
Long assetsId = assets.getAssetsId();
if (assetsId!= null) {
FinanceTradeFlow flow = new FinanceTradeFlow();
flow.setAssetsId(assetsId);
flow.setOrderId(orderId);
// flow.setTradeFlowNumber();// 交易流水编号
flow.setTradeMoney(payDto.getDataPrice());
flow.setTradeType("03");
flow.setCreTime(DateUtils.getToday());
flow.setCrePerson(payDto.getCustomerId() + "");
flow.setTradeFlowNumber(NumberUtils.getDealNum());
financeTradeFlowDao.addFlow(flow);
}
return Result.of_success(ResultMsg.SUCCESS, ResultCode.SUCCESS);
}
/**
* 制作有效时间
* @param payDto
* @return
*/
public static Date getTime(PayDto payDto) {
String purchaseMethod = payDto.getPurchaseMethod();
Date now = DateUtils.getToday();
if ("01".equals(purchaseMethod)) {
Date nowAddYear = DateUtils.getAfterYear(now);
return nowAddYear;
}else if ("02".equals(purchaseMethod)){
Date nowAddSeason = DateUtils.getAfterSeason(now);
return nowAddSeason;
}else if("03".equals(purchaseMethod)) {
Date nowAddMonth = DateUtils.getAfterMonth(now);
return nowAddMonth;
}else {
return null;
}
}
}
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
t1.upt_time AS uptTime, t1.upt_time AS uptTime,
t1.return_data_example AS returnDataExample, t1.return_data_example AS returnDataExample,
t1.request_example AS requestExample, t1.request_example AS requestExample,
t2.data_picture as dataPicture,
t3.supplier_name AS supplierName, t3.supplier_name AS supplierName,
t4.api_params_id AS apiParamsId, t4.api_params_id AS apiParamsId,
t4.params_name AS paramsName, t4.params_name AS paramsName,
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
t2.season_type as seasonType, t2.season_type as seasonType,
t2.month_type as monthType, t2.month_type as monthType,
t2.second_type as secondType, t2.second_type as secondType,
t2.data_desc as dataDesc,
t4.params_diff as paramsDiffNum, t4.params_diff as paramsDiffNum,
t5.category_name as categoryName, t5.category_name as categoryName,
( CASE WHEN t2.data_type = '01' THEN 'api' WHEN t2.data_type = '02' THEN '数据包' END ) AS dataType, ( CASE WHEN t2.data_type = '01' THEN 'api' WHEN t2.data_type = '02' THEN '数据包' END ) AS dataType,
......
...@@ -162,4 +162,16 @@ ...@@ -162,4 +162,16 @@
(#{finance.departmentId},NOW(),#{finance.crePerson}) (#{finance.departmentId},NOW(),#{finance.crePerson})
</insert> </insert>
<select id="findById" resultMap="TFinanceCustomerAssetsMap">
select
assets_id, department_id, use_money, frozen_money, total_money, cre_time, cre_person, upt_time, upt_person, del_flag
from t_finance_customer_assets
where assets_id = #{assetsId}
</select>
<insert id="addAssets" keyProperty="assetsId" useGeneratedKeys="true">
INSERT INTO t_finance_customer_assets ( department_id, use_money, total_money, cre_time, cre_person)
VALUES
(#{departmentId}, #{useMoney}, #{totalMoney}, #{creTime}, #{crePerson})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -87,4 +87,10 @@ ...@@ -87,4 +87,10 @@
<if test="creTime != null">and date_format(t.cre_time,'%Y-%m-%d')= #{creTime}</if> <if test="creTime != null">and date_format(t.cre_time,'%Y-%m-%d')= #{creTime}</if>
</select> </select>
<insert id="addFlow" keyProperty="tradeFlowId" useGeneratedKeys="true">
INSERT INTO t_finance_trade_flow (
assets_id, order_id, trade_flow_number, trade_money, trade_type,cre_time, cre_person,del_flag)
VALUES
(#{assetsId}, #{orderId},#{tradeFlowNumber}, #{tradeMoney},#{tradeType},#{creTime}, #{crePerson},#{delFlag})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -371,4 +371,24 @@ ...@@ -371,4 +371,24 @@
<if test="goodsApi != null">and t4.goods_api = #{goodsApi}</if> <if test="goodsApi != null">and t4.goods_api = #{goodsApi}</if>
</select> </select>
<insert id="addOrder" keyProperty="orderId" useGeneratedKeys="true">
INSERT INTO t_order (
order_number,
customer_id,
order_status,
order_money,
order_time,
payment_money,
payment_time,
payment_method,
purchase_method,
take_effect_time,
invalid_time,
price_type,
cre_person,
cre_time
)
VALUES
(#{orderNumber}, #{customerId}, #{orderStatus},#{orderMoney}, #{orderTime}, #{paymentMoney}, #{paymentTime}, #{paymentMethod}, #{purchaseMethod}, #{takeEffectTime} ,#{invalidTime}, #{priceType}, #{crePerson}, #{creTime})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -96,4 +96,9 @@ ...@@ -96,4 +96,9 @@
delete from t_order_goods_info where order_goods_info_id = #{orderGoodsInfoId} delete from t_order_goods_info where order_goods_info_id = #{orderGoodsInfoId}
</delete> </delete>
<insert id="addGoodsInfo" keyProperty="orderGoodsInfoId" useGeneratedKeys="true">
INSERT INTO t_order_goods_info ( order_id, data_goods_id, cre_time, cre_person)
VALUES
(#{orderId}, #{dataGoodsId}, #{creTime}, #{crePerson})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -135,4 +135,9 @@ ...@@ -135,4 +135,9 @@
delete from t_order_payment where payment_id = #{paymentId} delete from t_order_payment where payment_id = #{paymentId}
</delete> </delete>
<insert id="addOrderPayment" keyProperty="paymentId" useGeneratedKeys="true">
INSERT INTO t_order_payment ( order_id, payment_money, payment_time, payment_method, payment_status, purchase_method, cre_time,cre_person)
VALUES
(#{orderId}, #{paymentMoney}, #{paymentTime}, #{paymentMethod}, #{paymentStatus}, #{purchaseMethod}, #{creTime},#{crePerson})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -129,4 +129,17 @@ public class DataGoodsController extends BaseController { ...@@ -129,4 +129,17 @@ public class DataGoodsController extends BaseController {
} }
@PostMapping("/editStatus/{goodsId}/{statusId}")
@ApiOperation(value = "商品上下架")
public Result editStatus(@PathVariable(value = "goodsId") Long goodsId,
@PathVariable(value = "statusId") Long statusId) {
Result result = null;
try {
result = dataGoodsService.editStatus(goodsId, statusId);
}catch (Exception e) {
e.printStackTrace();
result = new Result(false, "操作失败!");
}
return result;
}
} }
\ No newline at end of file
...@@ -66,4 +66,5 @@ public interface DataGoodsService { ...@@ -66,4 +66,5 @@ public interface DataGoodsService {
*/ */
public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)throws Exception; public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)throws Exception;
Result editStatus(Long goodsId, Long statusId);
} }
\ 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.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.jz.common.base.CurrentUser;
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.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.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.entity.DataGoods;
import com.jz.common.utils.DateUtils; import com.jz.common.utils.DateUtils;
import com.jz.common.utils.HttpClientUtils;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.common.utils.WebUtils; 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;
...@@ -192,6 +191,42 @@ public class DataGoodsServiceImpl implements DataGoodsService { ...@@ -192,6 +191,42 @@ public class DataGoodsServiceImpl implements DataGoodsService {
return baseResponse; return baseResponse;
} }
/**
* 商品上下架
* @param goodsId
* @param statusId
*/
@Override
public Result editStatus(Long goodsId, Long statusId) {
// 获取用户信息
SysUserDto sysUserDto = (SysUserDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
// 获取商品的信息
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("data_goods_id", goodsId);
DataGoods dataGoods = dataGoodsDao.selectOne(queryWrapper);
// 上架
if ("01".equals(statusId)) {
dataGoods.setDataStatus("04");
queryWrapper.eq("data_status", dataGoods.getDataStatus());
queryWrapper.eq("upt_time", DateUtils.getToday());
queryWrapper.eq("upt_person", sysUserDto.getUserId());
dataGoodsDao.update(dataGoods, queryWrapper);
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
// 下架
if ("02".equals(statusId)) {
dataGoods.setDataStatus("03");
queryWrapper.eq("data_status", dataGoods.getDataStatus());
queryWrapper.eq("upt_time", DateUtils.getToday());
queryWrapper.eq("upt_person", sysUserDto.getUserId());
dataGoodsDao.update(dataGoods, queryWrapper);
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
return Result.of_error(ResultMsg.UPDATE_FAIL);
}
/** /**
* 自营数据-上传api * 自营数据-上传api
...@@ -280,7 +315,6 @@ public class DataGoodsServiceImpl implements DataGoodsService { ...@@ -280,7 +315,6 @@ public class DataGoodsServiceImpl implements DataGoodsService {
try { try {
String url= "http://192.168.1.114:8088/api/producer/addDataBankApiInfo"; String url= "http://192.168.1.114:8088/api/producer/addDataBankApiInfo";
// HttpClientUtils.doPost("", );
WebUtils.postJSON(url, apiReq); WebUtils.postJSON(url, apiReq);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
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