提交代码

dev
胡锐 4 months ago
parent a72c96ff56
commit c520f8e2e3
  1. 185
      bweb/src/main/java/com/bweb/controller/BsGasOrderController.java
  2. 33
      bweb/src/main/java/com/bweb/controller/BsMerchantAccountController.java
  3. 30
      service/src/main/java/com/hfkj/dao/BsMerchantAccountMapperExt.java
  4. 126
      service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java
  5. 8
      service/src/main/java/com/hfkj/service/merchant/BsMerchantAccountService.java
  6. 5
      service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantAccountServiceImpl.java
  7. 6
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  8. 4
      service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java
  9. 15
      service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java

@ -1,5 +1,7 @@
package com.bweb.controller;
import com.alibaba.excel.EasyExcel;
import com.bweb.config.SysConst;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
@ -7,17 +9,23 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsOrderSettle;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.model.order.ExportGasOrderModel;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.MerchantSourceTypeEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.gas.OrderOilStatus;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
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;
@ -27,8 +35,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
@Controller
@RequestMapping(value = "/gasOrder")
@ -97,8 +106,10 @@ public class BsGasOrderController {
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) {
param.put("agentId", sessionObject.getAccount().getObjectId());
param.put("agentStaffId", agentStaffId);
param.put("merName", merName);
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) {
param.put("agentStaffId", sessionObject.getAccount().getObjectId());
param.put("merName", merName);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
@ -166,8 +177,10 @@ public class BsGasOrderController {
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) {
param.put("agentId", sessionObject.getAccount().getObjectId());
param.put("agentStaffId", agentStaffId);
param.put("merName", merName);
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) {
param.put("agentStaffId", sessionObject.getAccount().getObjectId());
param.put("merName", merName);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
@ -181,6 +194,174 @@ public class BsGasOrderController {
}
}
@RequestMapping(value="/exportOilOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出加油订单")
public ResponseData exportOilOrder(@RequestParam(name = "merId", required = false) Long merId,
@RequestParam(name = "merName", required = false) String merName,
@RequestParam(name = "userPhone", required = false) String userPhone,
@RequestParam(name = "gasStaffName", required = false) String gasStaffName,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "payType", required = false) String payType,
@RequestParam(name = "paySerialNo", required = false) String paySerialNo,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE,
@RequestParam(name = "gasOilNo", required = false) String gasOilNo,
@RequestParam(name = "gasClassGroupId", required = false) Long gasClassGroupId,
@RequestParam(name = "gasClassGroupTaskId", required = false) Long gasClassGroupTaskId,
@RequestParam(name = "agentId", required = false) Long agentId,
@RequestParam(name = "agentStaffId", required = false) Long agentStaffId) {
try {
SecUserSessionObject sessionObject = userCenter.getSessionModel(SecUserSessionObject.class);
Map<String,Object> param = new HashMap<>();
param.put("orderNo", orderNo);
param.put("payType", payType);
param.put("paySerialNo", paySerialNo);
param.put("userPhone", userPhone);
param.put("status", status);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
param.put("refundTimeS", refundTimeS);
param.put("refundTimeE", refundTimeE);
param.put("gasClassGroupId", gasClassGroupId);
param.put("gasClassGroupTaskId", gasClassGroupTaskId);
param.put("gasStaffName", gasStaffName);
param.put("gasOilNo", gasOilNo);
if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
param.put("merName", merName);
param.put("agentId", agentId);
param.put("agentStaffId", agentStaffId);
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
param.put("merId", sessionObject.getMerchant().getId());
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) {
param.put("gasStaffId", sessionObject.getAccount().getObjectId());
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) {
param.put("agentId", sessionObject.getAccount().getObjectId());
param.put("agentStaffId", agentStaffId);
param.put("merName", merName);
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) {
param.put("agentStaffId", sessionObject.getAccount().getObjectId());
param.put("merName", merName);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
// 数据
List<BsGasOrder> gasOrderList = gasOrderService.getGasOrderList(param);
List<ExportGasOrderModel> dataList = new ArrayList<>();
ExportGasOrderModel model;
for (BsGasOrder gasOrder : gasOrderList) {
model = new ExportGasOrderModel();
model.setAgentName(StringUtils.isBlank(gasOrder.getAgentName())?"无":gasOrder.getAgentName());
model.setAgentStaffName(StringUtils.isBlank(gasOrder.getAgentStaffName())?"无":gasOrder.getAgentStaffName());
model.setChannelTypeName(MerchantSourceTypeEnum.getNameByType(gasOrder.getChannelType()));
model.setOrderNo(gasOrder.getOrderNo());
model.setUserPhone(StringUtils.isBlank(gasOrder.getUserPhone())?"无":gasOrder.getUserPhone());
model.setMerName(gasOrder.getMerName());
model.setGasStaffName(gasOrder.getGasStaffName());
model.setGasRefuelPrice(gasOrder.getGasRefuelPrice());
model.setGasOilLiters(gasOrder.getGasOilLiters());
model.setGasDiscount(gasOrder.getGasDiscount().compareTo(new BigDecimal("1")) != 0?gasOrder.getGasDiscount().multiply(new BigDecimal("100")).setScale(2).toString():"无");
model.setGasOilNo(gasOrder.getGasOilNo() + "#");
model.setGasGunNo(gasOrder.getGasGunNo() + "号枪");
model.setGasPricePlatform(gasOrder.getGasPricePlatform());
model.setGasPriceGun(gasOrder.getGasPriceGun());
model.setGasPriceOfficial(gasOrder.getGasPriceOfficial());
model.setPayTypeName(gasOrder.getPayType()!=null? OrderPayTypeEnum.getDataByType(gasOrder.getPayType()).getName():"未支付");
model.setTotalDeductionPrice(gasOrder.getTotalDeductionPrice());
model.setDeductionCouponPrice(gasOrder.getDeductionCouponPrice());
model.setDeductionOilPrice(gasOrder.getDeductionOilPrice());
model.setPayablePrice(gasOrder.getPayablePrice());
model.setPayIntegral(gasOrder.getPayIntegral()==null?new BigDecimal("0"):new BigDecimal(""+gasOrder.getPayIntegral()).divide(new BigDecimal("100")));
model.setPayPrice(gasOrder.getActualPayPrice()!=null?gasOrder.getActualPayPrice().toString():"未支付");
model.setStatus(OrderOilStatus.getNameByType(gasOrder.getStatus()));
model.setCreateTime(gasOrder.getCreateTime());
model.setPayTime(gasOrder.getPayTime());
model.setRefundTime(gasOrder.getRefundTime());
model.setCancelTime(gasOrder.getCancelTime());
dataList.add(model);
}
String fileUrl = CommonSysConst.getSysConfig().getFilesystem() + "/temporary/";
String pathName = System.currentTimeMillis()+".xlsx";
File file = new File(fileUrl);
if (!file.exists()) {
file.mkdirs();
}
Set<String> includeColumnFiledNames = new HashSet<String>();
includeColumnFiledNames.add("orderNo");
includeColumnFiledNames.add("gasRefuelPrice");
includeColumnFiledNames.add("gasOilLiters");
includeColumnFiledNames.add("gasOilNo");
includeColumnFiledNames.add("gasGunNo");
includeColumnFiledNames.add("gasDiscount");
includeColumnFiledNames.add("gasPricePlatform");
includeColumnFiledNames.add("gasPriceGun");
includeColumnFiledNames.add("gasPriceOfficial");
includeColumnFiledNames.add("payTypeName");
includeColumnFiledNames.add("totalDeductionPrice");
includeColumnFiledNames.add("deductionCouponPrice");
includeColumnFiledNames.add("deductionOilPrice");
includeColumnFiledNames.add("payablePrice");
includeColumnFiledNames.add("payIntegral");
includeColumnFiledNames.add("payPrice");
includeColumnFiledNames.add("status");
includeColumnFiledNames.add("createTime");
includeColumnFiledNames.add("payTime");
includeColumnFiledNames.add("refundTime");
includeColumnFiledNames.add("cancelTime");
if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
includeColumnFiledNames.add("agentName");
includeColumnFiledNames.add("agentStaffName");
includeColumnFiledNames.add("merName");
includeColumnFiledNames.add("gasStaffName");
includeColumnFiledNames.add("channelTypeName");
includeColumnFiledNames.add("userPhone");
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) ) {
includeColumnFiledNames.add("userPhone");
includeColumnFiledNames.add("gasStaffName");
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()) ) {
includeColumnFiledNames.add("userPhone");
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode()) ) {
includeColumnFiledNames.add("agentStaffName");
includeColumnFiledNames.add("merName");
includeColumnFiledNames.add("channelTypeName");
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode()) ) {
includeColumnFiledNames.add("merName");
includeColumnFiledNames.add("channelTypeName");
}
EasyExcel.write(fileUrl+pathName)
.head(ExportGasOrderModel.class)
.includeColumnFiledNames(includeColumnFiledNames)
.sheet("加油订单")
.doWrite(dataList);
return ResponseMsgUtil.success(pathName);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryOilOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询加油订单详情")

@ -80,29 +80,34 @@ public class BsMerchantAccountController {
}
}
@RequestMapping(value = "/consume", method = RequestMethod.POST)
@RequestMapping(value = "/getMerList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "consume")
public ResponseData consume(@RequestBody JSONObject body) {
@ApiOperation(value = "查询商户列表")
public ResponseData getMerList(@RequestParam(value = "merNo", required = false) Long merNo,
@RequestParam(value = "merName", required = false) Long merName,
@RequestParam(value = "provinceCode", required = false) Long provinceCode,
@RequestParam(value = "cityCode", required = false) Long cityCode,
@RequestParam(value = "areaCode", required = false) Long areaCode,
@RequestParam(value = "pageNum", required = true) Integer pageNum,
@RequestParam(value = "pageSize", required = true) Integer pageSize) {
try {
if (body == null
|| StringUtils.isBlank(body.getString("merNo"))
|| body.getBigDecimal("amount") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 账户充值
merchantAccountService.consume(body.getString("merNo"), body.getBigDecimal("amount"), new HashMap<>());
return ResponseMsgUtil.success("操作成功");
Map<String,Object> param = new HashMap<>();
param.put("merNo", merNo);
param.put("merName", merName);
param.put("provinceCode", provinceCode);
param.put("cityCode", cityCode);
param.put("areaCode", areaCode);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(merchantAccountService.getMerList(param)));
} catch (Exception e) {
log.error("BsMerchantAccountController --> recharge() error!", e);
log.error("BsMerchantAccountController --> getRecordList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getRecordList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "记录列表")

@ -1,7 +1,35 @@
package com.hfkj.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface BsMerchantAccountMapperExt {
}
@Select("<script>" +
" SELECT" +
" b.province_name provinceName," +
" b.city_name cityName," +
" b.area_name areaName," +
" b.mer_no merNo," +
" b.mer_name merName," +
" b.address," +
" a.amount " +
" FROM" +
" bs_merchant_account a" +
" LEFT JOIN bs_merchant b ON a.mer_no = b.mer_no" +
" where 1 = 1" +
" <if test='param.provinceCode != null'> and b.province_code = #{param.provinceCode} </if>" +
" <if test='param.cityCode != null'> and b.city_code = #{param.cityCode} </if>" +
" <if test='param.areaCode != null'> and b.area_code = #{param.areaCode} </if>" +
" <if test='param.merNo != null'> and b.mer_no like concat('%',#{param.merNo},'%') </if>" +
" <if test='param.merName != null'> and b.mer_name like concat('%',#{param.merName},'%') </if>" +
" ORDER BY a.amount asc" +
"</script>")
List<Map<String,Object>> selectMerList(@Param("param") Map<String,Object> param);
}

@ -0,0 +1,126 @@
package com.hfkj.model.order;
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: ExportGasOrderModel
* @author: HuRui
* @date: 2022/9/20
**/
@Data
public class ExportGasOrderModel {
@ColumnWidth(20)
@ExcelProperty("代理商")
private String agentName;
@ColumnWidth(20)
@ExcelProperty("业务员")
private String agentStaffName;
@ColumnWidth(25)
@ExcelProperty("交易单号")
private String orderNo;
@ColumnWidth(15)
@ExcelProperty("客户电话")
private String userPhone;
@ColumnWidth(25)
@ExcelProperty("加油站")
private String merName;
@ColumnWidth(15)
@ExcelProperty("加油员")
private String gasStaffName;
@ColumnWidth(15)
@ExcelProperty({ "加油信息", "加油金额"})
private BigDecimal gasRefuelPrice;
@ColumnWidth(15)
@ExcelProperty({ "加油信息", "加油升数"})
private BigDecimal gasOilLiters;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "油号"})
private String gasOilNo;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "油枪号"})
private String gasGunNo;
@ColumnWidth(15)
@ExcelProperty({ "加油信息", "平台折扣"})
private String gasDiscount;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "平台价"})
private BigDecimal gasPricePlatform;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "油站价"})
private BigDecimal gasPriceGun;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "国标价"})
private BigDecimal gasPriceOfficial;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "总优惠"})
private BigDecimal totalDeductionPrice;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "优惠券优惠"})
private BigDecimal deductionCouponPrice;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "加油优惠"})
private BigDecimal deductionOilPrice;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "应付金额"})
private BigDecimal payablePrice;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "积分抵扣"})
private BigDecimal payIntegral;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "实付金额"})
private String payPrice;
@ColumnWidth(15)
@ExcelProperty({ "支付信息", "支付方式"})
private String payTypeName;
@ColumnWidth(15)
@ExcelProperty("交易状态")
private String status;
@ColumnWidth(22)
@ExcelProperty("创建时间")
private Date createTime;
@ColumnWidth(22)
@ExcelProperty("支付时间")
private Date payTime;
@ColumnWidth(22)
@ExcelProperty("退款时间")
private Date refundTime;
@ColumnWidth(22)
@ExcelProperty("取消时间")
private Date cancelTime;
@ColumnWidth(22)
@ExcelProperty("渠道")
private String channelTypeName;
}

@ -4,6 +4,7 @@ import com.hfkj.entity.BsMerchantAccount;
import com.hfkj.entity.BsOrderRefund;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
@ -47,5 +48,12 @@ public interface BsMerchantAccountService {
* @param orderRefund
*/
void refund(String merNo, BigDecimal amount, BsOrderRefund orderRefund) throws Exception;
/**
* 查询商户列表
* @param param
* @return
*/
List<Map<String,Object>> getMerList(Map<String,Object> param);
}

@ -210,5 +210,10 @@ public class BsMerchantAccountServiceImpl implements BsMerchantAccountService {
}
}
@Override
public List<Map<String,Object>> getMerList(Map<String, Object> param) {
return merchantAccountMapper.selectMerList(param);
}
}

@ -221,10 +221,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral());
orderChild.setStatus(orderChild.getSurplusRefundCount()==0? OrderChildStatusEnum.status4.getCode():orderChild.getStatus());
orderChildService.editData(orderChild);
}
// 处理退款业务
OrderRefundBusiness.gasOrder(orderRefund);
// 处理退款业务
OrderRefundBusiness.gasOrder(orderRefund);
}
// 删除缓存
orderService.cacheDelete(order.getOrderNo());

@ -23,10 +23,10 @@ public enum MerchantSourceTypeEnum {
this.name = name;
}
public static MerchantSourceTypeEnum getNameByType(Integer type) {
public static String getNameByType(Integer type) {
for (MerchantSourceTypeEnum ele : values()) {
if (Objects.equals(type,ele.getNumber())) {
return ele;
return ele.getName();
}
}
return null;

@ -2,6 +2,8 @@ package com.hfkj.sysenum.order;
import lombok.Getter;
import java.util.Objects;
/**
* 交易支付类型
* @className: OrderPayModelEnum
@ -32,4 +34,17 @@ public enum OrderPayTypeEnum {
this.code = code;
this.name = name;
}
/**
* 根据类型查询数据
* @param type
* @return
*/
public static OrderPayTypeEnum getDataByType(Integer type) {
for (OrderPayTypeEnum ele : values()) {
if (Objects.equals(type, ele.getCode())) return ele;
}
return null;
}
}

Loading…
Cancel
Save