提交代码

yy_dev
胡锐 2 years ago
parent f1c44be035
commit 6fc542f739
  1. 43
      bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java
  2. 2
      bweb/src/main/java/com/bweb/excel/listener/ImportDeviceListener.java
  3. 70
      bweb/src/main/java/com/bweb/excel/model/ExportTradeOrderModel.java
  4. 14
      cweb/src/main/java/com/cweb/controller/BsStoreDiscountActivityPartakeUserController.java
  5. 3
      service/src/main/java/com/hfkj/service/impl/BsDeviceOrderServiceImpl.java
  6. 2
      service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java
  7. 10
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java
  8. 11
      service/src/main/java/com/hfkj/sysenum/TradeOrderStatusEnum.java

@ -1,17 +1,26 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.excel.EasyExcel;
import com.bweb.config.SysConst;
import com.bweb.excel.model.ExportTradeOrderModel;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.EasyExcelUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsPayQrCode;
import com.hfkj.entity.BsTradeOrder; import com.hfkj.entity.BsTradeOrder;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.UserInfoModel; import com.hfkj.model.UserInfoModel;
import com.hfkj.service.*; import com.hfkj.service.*;
import com.hfkj.sysenum.PayQrCodeStatusEnum;
import com.hfkj.sysenum.SecUserTypeEnum; import com.hfkj.sysenum.SecUserTypeEnum;
import com.hfkj.sysenum.TradeOrderPayModeEnum;
import com.hfkj.sysenum.TradeOrderStatusEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -20,6 +29,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -118,10 +129,10 @@ public class BsTradeOrderController {
} }
} }
@RequestMapping(value="/exportOrderList",method = RequestMethod.GET) @RequestMapping(value="/exportTradeOrder",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询订单列表") @ApiOperation(value = "查询订单列表")
public ResponseData exportOrderList(@RequestParam(value = "salesmanId" , required = false) Long salesmanId, public ResponseData exportTradeOrder(@RequestParam(value = "salesmanId" , required = false) Long salesmanId,
@RequestParam(value = "merId" , required = false) Long merId, @RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "merName" , required = false) String merName, @RequestParam(value = "merName" , required = false) String merName,
@RequestParam(value = "companyId" , required = false) Long companyId, @RequestParam(value = "companyId" , required = false) Long companyId,
@ -184,9 +195,35 @@ public class BsTradeOrderController {
param.put("payTimeS", payTimeS); param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE); param.put("payTimeE", payTimeE);
param.put("status", status); param.put("status", status);
List<ExportTradeOrderModel> dataList = new ArrayList<>();
ExportTradeOrderModel data;
List<BsTradeOrder> tradeOrderList = tradeOrderService.getTradeOrderList(param); List<BsTradeOrder> tradeOrderList = tradeOrderService.getTradeOrderList(param);
for (BsTradeOrder tradeOrder : tradeOrderList) {
data = new ExportTradeOrderModel();
data.setMerName(tradeOrder.getMerName());
data.setStoreName(tradeOrder.getStoreName());
data.setOutTradeNo(tradeOrder.getOutTradeNo());
data.setPayMode(TradeOrderPayModeEnum.getNameByCode(tradeOrder.getPayMode()).getName());
data.setTradeAmount(tradeOrder.getTradeAmount());
data.setStoreDiscountActualPrice(tradeOrder.getStoreDiscountActualPrice());
data.setUserDiscountActualPrice(tradeOrder.getUserDiscountActualPrice());
data.setTradeActualAmount(tradeOrder.getTradeActualAmount());
data.setStatus(TradeOrderStatusEnum.getNameByNumber(tradeOrder.getStatus()).getName());
data.setCreateTime(tradeOrder.getCreateTime());
data.setPayTime(tradeOrder.getPayTime());
data.setPlatformMerNo(tradeOrder.getPlatformMerNo());
data.setSalesmanName(tradeOrder.getSalesmanName());
dataList.add(data);
}
return ResponseMsgUtil.success(""); String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx";
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + fileName, ExportTradeOrderModel.class)
.sheet("交易订单")
.doWrite(dataList);
return ResponseMsgUtil.success(fileName);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);

@ -61,7 +61,7 @@ public class ImportDeviceListener extends AnalysisEventListener<ImportDeviceMode
device.setDeviceImsi(deviceModel.getDeviceImsi()); device.setDeviceImsi(deviceModel.getDeviceImsi());
device.setOpUserId(userInfoModel.getSecUser().getId()); device.setOpUserId(userInfoModel.getSecUser().getId());
device.setOpUserName(userInfoModel.getSecUser().getUserName()); device.setOpUserName(userInfoModel.getSecUser().getUserName());
device.setBindStatus(false);
successData.add(device); successData.add(device);
allDeviceList.add(device); allDeviceList.add(device);
} }

@ -0,0 +1,70 @@
package com.bweb.excel.model;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @className: exportTradeOrderModel
* @author: HuRui
* @date: 2023/3/30
**/
@Data
public class ExportTradeOrderModel {
@ColumnWidth(25)
@ExcelProperty(value = "商户名称")
private String merName;
@ColumnWidth(25)
@ExcelProperty(value = "门店名称")
private String storeName;
@ColumnWidth(30)
@ExcelProperty(value = "交易单号")
private String outTradeNo;
@ColumnWidth(25)
@ExcelProperty(value = "支付方式")
private String payMode;
@ColumnWidth(25)
@ExcelProperty(value = "交易金额")
private BigDecimal tradeAmount;
@ColumnWidth(25)
@ExcelProperty(value = "门店优惠")
private BigDecimal storeDiscountActualPrice;
@ColumnWidth(25)
@ExcelProperty(value = "优惠券优惠")
private BigDecimal userDiscountActualPrice;
@ColumnWidth(25)
@ExcelProperty(value = "实付金额")
private BigDecimal tradeActualAmount;
@ColumnWidth(20)
@ExcelProperty(value = "交易状态")
private String status;
@ColumnWidth(25)
@ExcelProperty(value = "创建时间")
private Date createTime;
@ColumnWidth(25)
@ExcelProperty(value = "支付时间")
private Date payTime;
@ColumnWidth(25)
@ExcelProperty(value = "入账商户号")
private String platformMerNo;
@ColumnWidth(25)
@ExcelProperty(value = "业务员")
private String salesmanName;
}

@ -65,6 +65,8 @@ public class BsStoreDiscountActivityPartakeUserController {
@RequestParam(value = "type" , required = true) Integer type, @RequestParam(value = "type" , required = true) Integer type,
@RequestParam(value = "systemType" , required = true) Integer systemType) { @RequestParam(value = "systemType" , required = true) Integer systemType) {
try { try {
System.out.println("outTradeNo="+outTradeNo+"&qrCodeSn="+"&type="+type+"&systemType="+systemType);
JSONObject response = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHsg_domain_name() + "/v1/wxMsg/getWxToken"); JSONObject response = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHsg_domain_name() + "/v1/wxMsg/getWxToken");
if (StringUtils.isBlank(response.getString("return_data"))) { if (StringUtils.isBlank(response.getString("return_data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败");
@ -84,20 +86,20 @@ public class BsStoreDiscountActivityPartakeUserController {
// 生成支付二维码 // 生成支付二维码
QRCodeGenerator.generateQRCodeImage( QRCodeGenerator.generateQRCodeImage(
weChatQrcodeUtils.generateQrCodeImgUrl(response.getString("return_data"), WeChatQrCodeTypeEnum.PAYMENT_SUCCESS, param, WeChatQrCodeActionNameEnum.actionName1), weChatQrcodeUtils.generateQrCodeImgUrl(response.getString("return_data"), WeChatQrCodeTypeEnum.PAYMENT_SUCCESS, param, WeChatQrCodeActionNameEnum.actionName1),
180, 260,
180, 260,
CommonSysConst.getSysConfig().getFilesystem() + fileUrl CommonSysConst.getSysConfig().getFilesystem() + fileUrl
); );
QRCodeGenerator.overlapImage(fileUrl, "/template/qrCodeBackdrop1_1.png",96,32); QRCodeGenerator.overlapImage(fileUrl, "/template/qrCodeBackdrop1_1.png",740,110);
} else if (systemType == 2) { } else if (systemType == 2) {
// 生成支付二维码 // 生成支付二维码
QRCodeGenerator.generateQRCodeImage( QRCodeGenerator.generateQRCodeImage(
weChatQrcodeUtils.generateQrCodeImgUrl(response.getString("return_data"), WeChatQrCodeTypeEnum.PAYMENT_SUCCESS, param, WeChatQrCodeActionNameEnum.actionName1), weChatQrcodeUtils.generateQrCodeImgUrl(response.getString("return_data"), WeChatQrCodeTypeEnum.PAYMENT_SUCCESS, param, WeChatQrCodeActionNameEnum.actionName1),
180, 260,
180, 260,
CommonSysConst.getSysConfig().getFilesystem() + fileUrl CommonSysConst.getSysConfig().getFilesystem() + fileUrl
); );
QRCodeGenerator.overlapImage(fileUrl, "/template/qrCodeBackdrop1_2.png",96,32); QRCodeGenerator.overlapImage(fileUrl, "/template/qrCodeBackdrop1_2.png",740,110);
} }
} else if (type == 2) { } else if (type == 2) {

@ -241,7 +241,7 @@ public class BsDeviceOrderServiceImpl implements BsDeviceOrderService {
} }
if (deviceOrder.getDeviceType().equals(DeviceTypeEnum.type1.getNumber()) && deviceOrder.getOrderType().equals(DeviceOrderTypeEnum.type1.getNumber())) { if (deviceOrder.getDeviceType().equals(DeviceTypeEnum.type1.getNumber()) && deviceOrder.getOrderType().equals(DeviceOrderTypeEnum.type1.getNumber())) {
// 退款条件 // 退款条件
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未满足退款条件,暂时无法退款");
} }
// 查询订单 // 查询订单
BsDeviceOrder order = getDetailOrder(deviceOrder.getOrderNo()); BsDeviceOrder order = getDetailOrder(deviceOrder.getOrderNo());
@ -251,6 +251,7 @@ public class BsDeviceOrderServiceImpl implements BsDeviceOrderService {
if (order.getStatus().equals(DeviceOrderStatusEnum.status2.getNumber())) { if (order.getStatus().equals(DeviceOrderStatusEnum.status2.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态不处于已支付,无法退款"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态不处于已支付,无法退款");
} }
// 退款 // 退款
OrderRefundModel refund = WxOrderService.orderToRefund(order.getEntryPlatformMerNo(), order.getPaySerialNo(), order.getPayPrice(), deviceOrder.getDeviceActualPrice()); OrderRefundModel refund = WxOrderService.orderToRefund(order.getEntryPlatformMerNo(), order.getPaySerialNo(), order.getPayPrice(), deviceOrder.getDeviceActualPrice());
if (!refund.getResult_code().equals("SUCCESS")) { if (!refund.getResult_code().equals("SUCCESS")) {

@ -293,7 +293,7 @@ public class BsDeviceServiceImpl implements BsDeviceService {
@Override @Override
public BsDevice getDetailByNo(String deviceNo) { public BsDevice getDetailByNo(String deviceNo) {
BsDeviceExample example = new BsDeviceExample(); BsDeviceExample example = new BsDeviceExample();
example.createCriteria().andDeviceNoEqualTo(deviceNo); example.createCriteria().andDeviceNoEqualTo(deviceNo).andStatusNotEqualTo(DeviceStatusEnum.status0.getNumber());
List<BsDevice> list = deviceMapper.selectByExample(example); List<BsDevice> list = deviceMapper.selectByExample(example);
if (list.size() > 0) { if (list.size() > 0) {
return list.get(0); return list.get(0);

@ -115,7 +115,7 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
tradeOrder.setStoreDiscountPrice(storeDiscount.getDiscountPrice()); tradeOrder.setStoreDiscountPrice(storeDiscount.getDiscountPrice());
if (storeDiscount.getDiscountType().equals(StoreDiscountActivityTypeEnum.type1.getNumber())) { if (storeDiscount.getDiscountType().equals(StoreDiscountActivityTypeEnum.type1.getNumber())) {
// 未达到满减门槛 // 未达到满减门槛
if (tradeOrder.getTradeAmount().compareTo(storeDiscount.getDiscountCondition()) == -1) { if (userDiscount.getDiscountCondition().compareTo(tradeOrder.getTradeAmount()) >= 0) {
tradeOrder.setStoreDiscountActualPrice(new BigDecimal(0)); tradeOrder.setStoreDiscountActualPrice(new BigDecimal(0));
} else { } else {
tradeOrder.setStoreDiscountSatisfy(true); tradeOrder.setStoreDiscountSatisfy(true);
@ -144,8 +144,8 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
tradeOrder.setUserDiscountPrice(userDiscount.getDiscountPrice()); tradeOrder.setUserDiscountPrice(userDiscount.getDiscountPrice());
if (userDiscount.getDiscountType().equals(UserDiscountTypeEnum.type1.getNumber())) { if (userDiscount.getDiscountType().equals(UserDiscountTypeEnum.type1.getNumber())) {
if (userDiscount.getDiscountCondition().compareTo(tradeOrder.getTradeAmount()) == -1) { if (userDiscount.getDiscountCondition().compareTo(tradeOrder.getTradeAmount()) > 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未达到满减门槛"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未达到满减门槛");
} }
tradeOrder.setUserDiscountActualPrice(userDiscount.getDiscountPrice()); tradeOrder.setUserDiscountActualPrice(userDiscount.getDiscountPrice());
tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getUserDiscountActualPrice())); tradeOrder.setTradeActualAmount(tradeOrder.getTradeActualAmount().subtract(tradeOrder.getUserDiscountActualPrice()));
@ -196,6 +196,10 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
return returnParam; return returnParam;
} }
public static void main(String[] args) {
System.out.println(new BigDecimal("10").compareTo(new BigDecimal("10")));
}
@Override @Override
public void paySuccess(String outTradeNo, String transactionId, PlatformTypeEnum platformType, TradeOrderPayModeEnum tradeOrderPayMode, BigDecimal tradeActualAmount, String subMchId) { public void paySuccess(String outTradeNo, String transactionId, PlatformTypeEnum platformType, TradeOrderPayModeEnum tradeOrderPayMode, BigDecimal tradeActualAmount, String subMchId) {
// 查询订单 // 查询订单

@ -1,5 +1,7 @@
package com.hfkj.sysenum; package com.hfkj.sysenum;
import java.util.Objects;
/** /**
* 交易订单状态 * 交易订单状态
* @author hurui * @author hurui
@ -22,6 +24,15 @@ public enum TradeOrderStatusEnum {
this.name = name; this.name = name;
} }
public static TradeOrderStatusEnum getNameByNumber(Integer number) {
for (TradeOrderStatusEnum ele : values()) {
if (Objects.equals(number,ele.getNumber())) {
return ele;
}
}
return null;
}
public Integer getNumber() { public Integer getNumber() {
return number; return number;
} }

Loading…
Cancel
Save