提交代码

yy_dev
胡锐 1 year ago
parent 2b87cb6d5e
commit 29e7bcf627
  1. 14
      bweb/src/main/java/com/bweb/controller/TestController.java
  2. 51
      cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java
  3. 8
      open-api/src/main/java/com/api/controller/v1/TradeController.java
  4. 6
      service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java
  5. 23
      service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java
  6. 14
      service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java
  7. 2
      service/src/main/java/com/hfkj/dao/OpenApiTradeOrderMapper.java
  8. 16
      service/src/main/java/com/hfkj/entity/BsTradeOrder.java
  9. 70
      service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java
  10. 1
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradePreorderModel.java
  11. 7
      service/src/main/java/com/hfkj/openapi/v1/utils/SignatureUtil.java
  12. 4
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java

@ -91,6 +91,20 @@ public class TestController {
@Resource
private LaKaLaTradeService laKaLaTradeService;
@RequestMapping(value="/preorder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "preorder")
public ResponseData preorder(@RequestParam(value = "tradeNo", required = true) String tradeNo) {
try {
return ResponseMsgUtil.success(laKaLaTradeService.preorder(tradeNo));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/brushOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "saasUpdateFee")

@ -283,6 +283,7 @@ public class BsTradeOrderController {
param.put("qrCodeId", payQrCode.getId());
param.put("payMode", body.getString("payMode"));
param.put("payUserId", body.getString("payUserId"));
param.put("transType", "JSAPI");
// 创建交易订单
return ResponseMsgUtil.success(tradeOrderService.createOrder(
@ -300,56 +301,6 @@ public class BsTradeOrderController {
}
}
@RequestMapping(value="/createOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建交易订单")
public ResponseData createOrder(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (body == null
|| body.getLong("storeNo") == null
|| body.getBigDecimal("totalAmount") == null
) {
log.error("configStore error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (body.getBigDecimal("totalAmount").compareTo(new BigDecimal("0.01")) == -1) {
log.error("configStore error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付金额不能小于0.01");
}
// 查询门店
BsStore store = storeService.getStoreByStoreNo(body.getLong("storeNo"));
if (store == null) {
log.error("configStore error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的门店");
}
if (!store.getStatus().equals(StoreStatusEnum.status1.getNumber())) {
log.error("configStore error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "创建交易失败!门店状态异常");
}
// 商户
BsMer mer = merService.getMer(store.getMerId());
if (mer == null) {
log.error("configStore error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户");
}
if (!mer.getMerStatus().equals(MerStatusEnum.status1.getNumber())) {
log.error("configStore error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "创建交易失败!商户状态异常");
}
// 创建交易订单
return ResponseMsgUtil.success(tradeOrderService.createOrder(store.getId(), body.getBigDecimal("totalAmount"), null, null,null,new HashMap<>(),request));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getOrderByOutTradeOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据交易订单号 查询订单信息")

@ -24,6 +24,7 @@ import com.hfkj.service.BsMerService;
import com.hfkj.sysenum.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -33,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -65,9 +67,12 @@ public class TradeController {
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
if (!body.getTransType().equals("JSAPI")) {
if (!body.getTransType().equals("JSAPI") && !body.getTransType().equals("NATIVE")) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "接入方式错误");
}
if (body.getTransType().equals("JSAPI") && StringUtils.isBlank(body.getUserId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "用户标识必填项");
}
// 查询支付方式
TradeOrderPayModeEnum payMode = TradeOrderPayModeEnum.getNameByCode(body.getPayMode());
if (payMode == null) {
@ -88,6 +93,7 @@ public class TradeController {
}
BsTradeOrder tradeOrder = new BsTradeOrder();
tradeOrder.setTransType(body.getTransType());
tradeOrder.setCompanyId(mer.getCompanyId());
tradeOrder.setAgentId(mer.getAgentId());
tradeOrder.setSalesmanId(mer.getSalesmanId());

@ -212,7 +212,7 @@ public class LaKaLaTradeService {
map.put("term_no", merPlatformTerm.getTermNo());
map.put("out_trade_no", order.getOutTradeNo());
map.put("account_type", order.getPayMode());
map.put("trans_type", 51);
map.put("trans_type", order.getTransType().equals("JSAPI")?51:41);
map.put("total_amount", order.getTradeActualAmount().multiply(new BigDecimal("100")).intValue());
map.put("settle_type", order.getProfitSharingStatus()==true?1:0);
if (StringUtils.isNotBlank(order.getSubject())) {
@ -226,7 +226,11 @@ public class LaKaLaTradeService {
map.put("notify_url", CommonSysConst.getSysConfig().getLkl_micro_pay_ret_url());
}
Map<String, Object> locationInfo = new HashMap<>();
if (StringUtils.isNotBlank(order.getRequestIp())) {
locationInfo.put("request_ip", order.getRequestIp());
} else {
locationInfo.put("request_ip", "0.0.0.0");
}
map.put("location_info", locationInfo);
Map<String, Object> accBusiFieldsMap = new HashMap<>();

@ -70,10 +70,10 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"subject, pay_notify_url, ",
"attach, special_field, ",
"refund_type, refund_price, ",
"create_type, create_time, ",
"cancel_time, update_time, ",
"request_ip, ext_1, ",
"ext_2, ext_3)",
"create_type, trans_type, ",
"create_time, cancel_time, ",
"update_time, request_ip, ",
"ext_1, ext_2, ext_3)",
"values (#{companyId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{salesmanId,jdbcType=BIGINT}, #{salesmanName,jdbcType=VARCHAR}, ",
"#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{merAbbreviate,jdbcType=VARCHAR}, ",
@ -105,10 +105,10 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"#{subject,jdbcType=VARCHAR}, #{payNotifyUrl,jdbcType=VARCHAR}, ",
"#{attach,jdbcType=VARCHAR}, #{specialField,jdbcType=VARCHAR}, ",
"#{refundType,jdbcType=INTEGER}, #{refundPrice,jdbcType=DECIMAL}, ",
"#{createType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{cancelTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{requestIp,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{createType,jdbcType=INTEGER}, #{transType,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{requestIp,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsTradeOrder record);
@ -185,6 +185,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
@Result(column="refund_type", property="refundType", jdbcType=JdbcType.INTEGER),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="trans_type", property="transType", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -209,8 +210,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"acc_settle_amount, acc_mdiscount_amount, acc_discount_amount, shd_fee_amt, fee_rate, ",
"settle_amount, settle_date, acc_payment_code, card_type, `status`, profit_sharing_status, ",
"pay_time, timeout_express, subject, pay_notify_url, attach, special_field, refund_type, ",
"refund_price, create_type, create_time, cancel_time, update_time, request_ip, ",
"ext_1, ext_2, ext_3",
"refund_price, create_type, trans_type, create_time, cancel_time, update_time, ",
"request_ip, ext_1, ext_2, ext_3",
"from bs_trade_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -281,6 +282,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
@Result(column="refund_type", property="refundType", jdbcType=JdbcType.INTEGER),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="trans_type", property="transType", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -367,6 +369,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"refund_type = #{refundType,jdbcType=INTEGER},",
"refund_price = #{refundPrice,jdbcType=DECIMAL},",
"create_type = #{createType,jdbcType=INTEGER},",
"trans_type = #{transType,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"cancel_time = #{cancelTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",

@ -288,6 +288,10 @@ public class BsTradeOrderSqlProvider {
sql.VALUES("create_type", "#{createType,jdbcType=INTEGER}");
}
if (record.getTransType() != null) {
sql.VALUES("trans_type", "#{transType,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -391,6 +395,7 @@ public class BsTradeOrderSqlProvider {
sql.SELECT("refund_type");
sql.SELECT("refund_price");
sql.SELECT("create_type");
sql.SELECT("trans_type");
sql.SELECT("create_time");
sql.SELECT("cancel_time");
sql.SELECT("update_time");
@ -679,6 +684,10 @@ public class BsTradeOrderSqlProvider {
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
}
if (record.getTransType() != null) {
sql.SET("trans_type = #{record.transType,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -781,6 +790,7 @@ public class BsTradeOrderSqlProvider {
sql.SET("refund_type = #{record.refundType,jdbcType=INTEGER}");
sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}");
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
sql.SET("trans_type = #{record.transType,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
@ -1058,6 +1068,10 @@ public class BsTradeOrderSqlProvider {
sql.SET("create_type = #{createType,jdbcType=INTEGER}");
}
if (record.getTransType() != null) {
sql.SET("trans_type = #{transType,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -24,7 +24,7 @@ public interface OpenApiTradeOrderMapper {
" a.acc_trade_no accTradeNo," +
" a.out_trade_no outTradeNo, " +
" a.pay_user_id payUserId, " +
" \"JSAPI\" as tradeType," +
" a.trans_type tradeType," +
" case a.pay_mode" +
" when \"WECHAT\" then '微信'" +
" when \"ALIPAY\" then '支付宝'" +

@ -348,6 +348,11 @@ public class BsTradeOrder implements Serializable {
*/
private Integer createType;
/**
* 接入方式 JSAPINATIVE
*/
private String transType;
/**
* 创建时间
*/
@ -904,6 +909,14 @@ public class BsTradeOrder implements Serializable {
this.createType = createType;
}
public String getTransType() {
return transType;
}
public void setTransType(String transType) {
this.transType = transType;
}
public Date getCreateTime() {
return createTime;
}
@ -1038,6 +1051,7 @@ public class BsTradeOrder implements Serializable {
&& (this.getRefundType() == null ? other.getRefundType() == null : this.getRefundType().equals(other.getRefundType()))
&& (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice()))
&& (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType()))
&& (this.getTransType() == null ? other.getTransType() == null : this.getTransType().equals(other.getTransType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
@ -1117,6 +1131,7 @@ public class BsTradeOrder implements Serializable {
result = prime * result + ((getRefundType() == null) ? 0 : getRefundType().hashCode());
result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode());
result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().hashCode());
result = prime * result + ((getTransType() == null) ? 0 : getTransType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
@ -1199,6 +1214,7 @@ public class BsTradeOrder implements Serializable {
sb.append(", refundType=").append(refundType);
sb.append(", refundPrice=").append(refundPrice);
sb.append(", createType=").append(createType);
sb.append(", transType=").append(transType);
sb.append(", createTime=").append(createTime);
sb.append(", cancelTime=").append(cancelTime);
sb.append(", updateTime=").append(updateTime);

@ -4363,6 +4363,76 @@ public class BsTradeOrderExample {
return (Criteria) this;
}
public Criteria andTransTypeIsNull() {
addCriterion("trans_type is null");
return (Criteria) this;
}
public Criteria andTransTypeIsNotNull() {
addCriterion("trans_type is not null");
return (Criteria) this;
}
public Criteria andTransTypeEqualTo(String value) {
addCriterion("trans_type =", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeNotEqualTo(String value) {
addCriterion("trans_type <>", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeGreaterThan(String value) {
addCriterion("trans_type >", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeGreaterThanOrEqualTo(String value) {
addCriterion("trans_type >=", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeLessThan(String value) {
addCriterion("trans_type <", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeLessThanOrEqualTo(String value) {
addCriterion("trans_type <=", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeLike(String value) {
addCriterion("trans_type like", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeNotLike(String value) {
addCriterion("trans_type not like", value, "transType");
return (Criteria) this;
}
public Criteria andTransTypeIn(List<String> values) {
addCriterion("trans_type in", values, "transType");
return (Criteria) this;
}
public Criteria andTransTypeNotIn(List<String> values) {
addCriterion("trans_type not in", values, "transType");
return (Criteria) this;
}
public Criteria andTransTypeBetween(String value1, String value2) {
addCriterion("trans_type between", value1, value2, "transType");
return (Criteria) this;
}
public Criteria andTransTypeNotBetween(String value1, String value2) {
addCriterion("trans_type not between", value1, value2, "transType");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

@ -64,7 +64,6 @@ public class RequestTradePreorderModel {
/**
* 用户id
*/
@NotBlank(message = "用户标识必填项")
private String userId;
/**

@ -83,11 +83,10 @@ public class SignatureUtil {
public static void main(String[] args) throws Exception {
String paramStr = "{\n" +
" \"merchantNo\": \"2023041916292112804\",\n" +
" \"outTradeNo\": \"ZF1130202305051459532538970007\",\n" +
" \"payMode\": \"WECHAT\",\n" +
" \"outTradeNo\": \"ZF1130202305051459532538970009\",\n" +
" \"payMode\": \"UQRCODEPAY\",\n" +
" \"totalAmount\": 0.01,\n" +
" \"transType\": \"JSAPI\",\n" +
" \"userId\": \"od8qG06bHnTsDWklsB2VsssLZYcQ\",\n" +
" \"transType\": \"NATIVE\",\n" +
" \"profitSharing\": 0,\n" +
" \"specialField\": \"测试\"" +
"}";

@ -205,6 +205,10 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
tradeOrder.setQrCodeId(MapUtils.getLong(param, "qrCodeId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "transType"))) {
tradeOrder.setTransType(MapUtils.getString(param, "transType"));
}
editOrder(tradeOrder);
Map<String, Object> returnParam = new HashMap<>();

Loading…
Cancel
Save