提交代码

dev-discount
胡锐 2 years ago
parent 6120d54e1d
commit abb4fc1f57
  1. 129
      hai-bweb/src/main/java/com/bweb/controller/HighFleetOilCardController.java
  2. 10
      hai-bweb/src/main/java/com/bweb/controller/HighOilCardController.java
  3. 2
      hai-bweb/src/main/resources/dev/application.yml
  4. 50
      hai-cweb/src/main/java/com/cweb/controller/HighFleetOilCardController.java
  5. 20
      hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java
  6. 127
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  7. 2
      hai-cweb/src/main/resources/dev/application.yml
  8. 2
      hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java
  9. 73
      hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java
  10. 14
      hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java
  11. 74
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardMapperExt.java
  12. 18
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardRecordMapper.java
  13. 14
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardRecordSqlProvider.java
  14. 7
      hai-service/src/main/java/com/hai/dao/HighOilCardMapperExt.java
  15. 16
      hai-service/src/main/java/com/hai/entity/HighChildOrder.java
  16. 70
      hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java
  17. 16
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardRecord.java
  18. 60
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardRecordExample.java
  19. 29
      hai-service/src/main/java/com/hai/entity/HighUserCard.java
  20. 9
      hai-service/src/main/java/com/hai/model/OilCardOrderModel.java
  21. 14
      hai-service/src/main/java/com/hai/service/HighFleetOilCardRecordService.java
  22. 3
      hai-service/src/main/java/com/hai/service/HighFleetOilCardService.java
  23. 8
      hai-service/src/main/java/com/hai/service/HighFleetOilCardUserService.java
  24. 9
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  25. 63
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardRecordServiceImpl.java
  26. 193
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardServiceImpl.java
  27. 18
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardUserServiceImpl.java
  28. 261
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -20,6 +20,7 @@ import com.hai.model.OilCardOrderModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCompanyTwoPwdService;
import com.hai.service.HighFleetOilCardRecordService;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighOilCardService;
import io.swagger.annotations.Api;
@ -50,6 +51,9 @@ public class HighFleetOilCardController {
@Resource
private HighFleetOilCardService fleetOilCardService;
@Resource
private HighFleetOilCardRecordService fleetOilCardRecordService;
@Resource
private HighCompanyTwoPwdService companyTwoPwdService;
@ -255,94 +259,31 @@ public class HighFleetOilCardController {
}
}
@RequestMapping(value = "/exportCard", method = RequestMethod.GET)
@RequestMapping(value = "/getRecordList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出油卡")
public ResponseData exportCard(@RequestParam(name = "orgId", required = false) Long orgId,
@RequestParam(name = "cardNo", required = false) String cardNo,
@RequestParam(name = "contactName", required = false) String contactName,
@RequestParam(name = "contactPhone", required = false) String contactPhone,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "bindTimeS", required = false) Long bindTimeS,
@RequestParam(name = "bindTimeE", required = false) Long bindTimeE,
@RequestParam(name = "isConfigContact", required = false) Boolean isConfigContact,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "bindStatus", required = false) Integer bindStatus) {
@ApiOperation(value = "查询油卡记录列表")
public ResponseData getRecordList(@RequestParam(name = "fleetOilCardNo", required = false) String fleetOilCardNo,
@RequestParam(name = "type", required = false) Integer type,
@RequestParam(name = "sourceType", required = false) Integer sourceType,
@RequestParam(name = "sourceOrderNo", required = false) String sourceOrderNo,
@RequestParam(name = "opUserType", required = false) Integer opUserType,
@RequestParam(name = "opUserPhone", required = false) String opUserPhone,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
Map<String, Object> param = new HashMap<>();
param.put("companyId", userModel.getBsCompany().getId());
if (userModel.getSecUser().getAdminFlag() != 1) {
param.put("orgId", userModel.getBsOrganization().getId());
} else {
param.put("orgId", orgId);
}
param.put("cardNo", cardNo);
param.put("contactName", contactName);
param.put("contactPhone", contactPhone);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("bindTimeS", bindTimeS);
param.put("bindTimeE", bindTimeE);
param.put("isConfigContact", isConfigContact);
param.put("status", status);
param.put("bindStatus", bindStatus);
List<HighFleetOilCard> cardList = fleetOilCardService.getFleetOilCardList(param);
List<String> headList = new ArrayList<>();
headList.add("卡号");
headList.add("余额");
headList.add("消费金额");
headList.add("联系人");
headList.add("联系电话");
headList.add("状态");
List<List<Object>> dataList = new ArrayList<>();
List<Object> data;
param.put("fleetOilCardNo", fleetOilCardNo);
param.put("type", type);
param.put("sourceType", sourceType);
param.put("sourceOrderNo", sourceOrderNo);
param.put("opUserType", opUserType);
param.put("opUserPhone", opUserPhone);
for (HighFleetOilCard card: cardList) {
data = new ArrayList<>();
data.add(card.getCardNo());
data.add(card.getAmount());
data.add(card.getAmountConsume());
if (StringUtils.isNotBlank(card.getContactName())) {
data.add(card.getContactName());
} else {
data.add("未设置");
}
if (StringUtils.isNotBlank(card.getContactPhone())) {
data.add(card.getContactName());
} else {
data.add("未设置");
}
if (card.getStatus().equals(OilCardStatusEnum.status1.getStatus())) {
data.add("正常");
} else if (card.getStatus().equals(OilCardStatusEnum.status2.getStatus())) {
data.add("禁用");
}
dataList.add(data);
}
String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/";
String pathName = System.currentTimeMillis()+".xlsx";
File file = new File(fileUrl);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName).head(generationHead(headList)).sheet("油卡").doWrite(dataList);
return ResponseMsgUtil.success(pathName);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(fleetOilCardRecordService.getRecordList(param)));
} catch (Exception e) {
log.error("HighOilCardController --> exportCard() error!", e);
log.error("HighOilCardController --> getRecordList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@ -353,6 +294,8 @@ public class HighFleetOilCardController {
public ResponseData getCardOrderList(@RequestParam(name = "orgId", required = false) Long orgId,
@RequestParam(name = "cardNo", required = false) String cardNo,
@RequestParam(name = "goodsName", required = false) String goodsName,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "carLicensePlate", required = false) String carLicensePlate,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "payTimeS", required = false) String payTimeS,
@RequestParam(name = "payTimeE", required = false) String payTimeE,
@ -373,6 +316,8 @@ public class HighFleetOilCardController {
param.put("status", status);
param.put("cardNo", cardNo);
param.put("goodsName", goodsName);
param.put("memPhone", memPhone);
param.put("carLicensePlate", carLicensePlate);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
@ -391,6 +336,8 @@ public class HighFleetOilCardController {
public ResponseData exportCardOrder(@RequestParam(name = "orgId", required = false) Long orgId,
@RequestParam(name = "cardNo", required = false) String cardNo,
@RequestParam(name = "goodsName", required = false) String goodsName,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "carLicensePlate", required = false) String carLicensePlate,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "payTimeS", required = false) String payTimeS,
@RequestParam(name = "payTimeE", required = false) String payTimeE,
@ -411,6 +358,8 @@ public class HighFleetOilCardController {
param.put("status", status);
param.put("cardNo", cardNo);
param.put("goodsName", goodsName);
param.put("carLicensePlate", carLicensePlate);
param.put("memPhone", memPhone);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
@ -419,20 +368,20 @@ public class HighFleetOilCardController {
if (userModel.getSecUser().getAdminFlag() == 1) {
headList.add("所属部门");
headList.add("用户手机号");
}
headList.add("客户电话");
headList.add("油卡卡号");
headList.add("平台订单号");
headList.add("团油订单号");
headList.add("交易单号");
// headList.add("团油订单号");
headList.add("加油金额");
headList.add("优惠金额");
headList.add("实付金额");
headList.add("加油站");
headList.add("油号");
headList.add("油枪号");
headList.add("团油油枪价");
headList.add("平台枪价");
headList.add("订单状态");
headList.add("油站枪价");
headList.add("平台枪价");
headList.add("交易状态");
headList.add("创建时间");
headList.add("支付时间");
headList.add("退款时间");
@ -444,11 +393,11 @@ public class HighFleetOilCardController {
data = new ArrayList<>();
if (userModel.getSecUser().getAdminFlag() == 1) {
data.add(cardOrder.getOrgName());
data.add(cardOrder.getMerPhone());
}
data.add(cardOrder.getMerPhone());
data.add(cardOrder.getMemCardNo());
data.add(cardOrder.getOrderNo());
data.add(cardOrder.getGasOrderNo());
// data.add(cardOrder.getGasOrderNo());
data.add(cardOrder.getTotalPrice());
data.add(cardOrder.getDeductionPrice());
data.add(cardOrder.getPayRealPrice());

@ -15,10 +15,8 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighCompanyTwoPwd;
import com.hai.entity.HighOilCard;
import com.hai.enum_type.OilCardStatusEnum;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.OilCardOrderModel;
import com.hai.model.ResponseData;
import com.hai.model.TyOrderModel;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCompanyTwoPwdService;
import com.hai.service.HighOilCardService;
@ -423,15 +421,15 @@ public class HighOilCardController {
}
headList.add("油卡卡号");
headList.add("平台订单号");
headList.add("团油订单号");
/* headList.add("团油订单号");*/
headList.add("加油金额");
headList.add("优惠金额");
headList.add("实付金额");
headList.add("加油站");
headList.add("油号");
headList.add("油枪号");
headList.add("团油油枪价");
headList.add("平台枪价");
headList.add("油站枪价");
headList.add("平台枪价");
headList.add("订单状态");
headList.add("创建时间");
headList.add("支付时间");
@ -448,7 +446,7 @@ public class HighOilCardController {
}
data.add(cardOrder.getMemCardNo());
data.add(cardOrder.getOrderNo());
data.add(cardOrder.getGasOrderNo());
/* data.add(cardOrder.getGasOrderNo());*/
data.add(cardOrder.getTotalPrice());
data.add(cardOrder.getDeductionPrice());
data.add(cardOrder.getPayRealPrice());

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -0,0 +1,50 @@
package com.cweb.controller;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.model.ResponseData;
import com.hai.service.HighFleetOilCardCarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
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;
@Controller
@RequestMapping(value = "/fleetOilCard")
@Api(value = "车队油卡")
public class HighFleetOilCardController {
private static Logger log = LoggerFactory.getLogger(HighFleetOilCardController.class);
@Resource
private UserCenter userCenter;
@Resource
private HighFleetOilCardCarService fleetOilCardCarService;
@RequestMapping(value = "/getCardListByCardNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询车辆列表")
public ResponseData getCardListByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) {
try {
Map<String, Object> param = new HashMap<>();
param.put("fleetOilCardNo", cardNo);
return ResponseMsgUtil.success(fleetOilCardCarService.getCarList(param));
} catch (Exception e) {
log.error("HighFleetOilCardController --> getCardListByCardNo() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -10,11 +10,13 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserCard;
import com.hai.enum_type.UserCardType;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighUserCardService;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
@Controller
@ -53,6 +56,9 @@ public class HighUserCardController {
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource
private HighFleetOilCardService fleetOilCardService;
@RequestMapping(value = "/bindCard", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "绑卡")
@ -121,7 +127,19 @@ public class HighUserCardController {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
return ResponseMsgUtil.success(highUserCardService.getListByUser(userInfoModel.getHighUser().getId(),type));
List<HighUserCard> list = highUserCardService.getListByUser(userInfoModel.getHighUser().getId(), type);
for (HighUserCard card : list) {
card.setBalance(new BigDecimal("0"));
if (card.getType().equals(UserCardType.type3.getType())) {
HighFleetOilCard fleetOilCard = fleetOilCardService.getFleetOilCardByCardNo(card.getCardNo());
if (fleetOilCard != null) {
card.setBalance(fleetOilCard.getAmount());
card.setContactName(StringUtils.isNotBlank(fleetOilCard.getContactName())?fleetOilCard.getContactName():"未设置");
}
}
}
return ResponseMsgUtil.success(list);
} catch (Exception e) {
log.error("HighUserCardController --> getUserCardList() error!", e);
return ResponseMsgUtil.exception(e);

@ -598,6 +598,133 @@ public class OrderController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/fleetOilCardPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "车队油卡支付")
public ResponseData fleetOilCardPay(@RequestBody String reqBodyStr,HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
String cardNo = jsonObject.getString("cardNo");
Long orderId = jsonObject.getLong("orderId");
String password = jsonObject.getString("password");
String carLicensePlate = jsonObject.getString("carLicensePlate");
if (StringUtils.isBlank(cardNo) || orderId == null) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId());
if (userPayPassword == null) {
log.error("orderToPay error!", "未设置支付密码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (StringUtils.isBlank(password)) {
log.error("orderToPay error!", "未输入支付密码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 校验支付密码是否一直
if (!AESEncodeUtil.aesEncrypt(password).equals(userPayPassword.getPassword())) {
log.error("orderToPay error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, "");
}
// 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo);
if (userCard == null) {
log.error("OrderController --> orderToPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
HighOrder order = highOrderService.getOrderById(orderId);
if(order == null) {
log.error("OrderController --> orderToPay() ERROR", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
//校验订单状态 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
if(order.getOrderStatus() != 1) {
log.error("OrderController --> orderToPay() ERROR", "订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
}
// 商品类型 1:卡卷 2:金币充值
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGoodsType() == 3) {
if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// 查询加油站
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId());
if (store == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(2)) {
// 查询账号余额
JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD();
JSONArray result = accountInfo2JD.getJSONArray("result");
for (Object accountObject : result) {
JSONObject account = (JSONObject)accountObject;
// 1:汽油:2:柴油;3:天然气
if (account.getInteger("energyType") == childOrder.getGasOilType()) {
// 支付金额 大于 团油账号余额
if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){
log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服");
}
}
}
}
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) {
BigDecimal account = new BigDecimal("0");
// 查询账号余额
HighMerchantAccount merAccount = merchantAccountService.getMerAccountDetail(store.getMerchantId());
if (merAccount != null) {
account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId()));
}
// 客户加油金额 大于 商户账号余额
if(order.getTotalPrice().compareTo(account) == 1) {
log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服");
}
}
}
}
highOrderService.fleetOilCardPayOrder(userCard.getId(), order.getId(), carLicensePlate);
new Thread(() -> {
// 查询订单信息
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
HighUser highUser = highUserService.findByUserId(order.getMemId());
HighChildOrder presentation = highOrderService.getChildOrderByPresentation(order.getId());
WxMsgConfig.pushOneUser(
presentation.getGoodsName() + "(" + GoodsType.getNameByType(presentation.getGoodsType()) + ")",
String.valueOf(order.getPayPrice()),
order.getOrderNo(),
order.getPayTime(),
PayType.getNameByType(order.getPayType()), order.getId(),
highUser.getOpenId());
}).start();
return ResponseMsgUtil.success("支付成功");
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/hltUnionCardPay",method = RequestMethod.POST)
@ResponseBody

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -64,7 +64,7 @@ public class AESEncodeUtil {
public static void main(String[] args) throws Exception{
long currentTimeMillis = System.currentTimeMillis();
System.out.println(AESEncodeUtil.aesDecrypt("A7dwzn2tpXzDPqcDvMdrxQ=="));
System.out.println(AESEncodeUtil.aesDecrypt("tRBALej59oZtrFBUDwf+Ow=="));
System.out.println(AESEncodeUtil.aesDecrypt(URLDecoder.decode("mL4laIILGps4E58w8sbseQ%3D%3D", "UTF-8")));
/* String content = "{\"create_time\":1573544092110,\"order_serial_no\":\"40280e816db49c0b016db4a2c31f0004\",\"product_code\":\"8a9e80045cf85e54015cf8809fcd\",\"product_name\":\"平安发票贷\",\"uscc\":\"91370781687233838E\"}";

@ -48,22 +48,22 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"goods_actual_price, sale_count, ",
"total_price, giveaway_type, ",
"child_orde_status, praise_status, ",
"gas_oil_no, gas_gun_no, ",
"gas_oil_type, gas_order_no, ",
"gas_price_platform, gas_price_gun, ",
"gas_price_vip, gas_price_official, ",
"gas_price_cost, gas_price_cost_total, ",
"gas_price_channel_pay, gas_oil_liters, ",
"gas_discount, gas_oil_subsidy, ",
"gas_liters_preferences, gas_price_preferences, ",
"gas_class_group_id, gas_class_group_name, ",
"gas_class_group_task_id, gas_staff_id, ",
"gas_staff_name, gas_salesman_id, ",
"gas_salesman_name, gas_agent_id, ",
"gas_agent_name, gas_org_id, ",
"gas_org_name, ext_1, ",
"ext_2, ext_3, ext_4, ",
"ext_5, ext_6)",
"gas_car_license_plate, gas_oil_no, ",
"gas_gun_no, gas_oil_type, ",
"gas_order_no, gas_price_platform, ",
"gas_price_gun, gas_price_vip, ",
"gas_price_official, gas_price_cost, ",
"gas_price_cost_total, gas_price_channel_pay, ",
"gas_oil_liters, gas_discount, ",
"gas_oil_subsidy, gas_liters_preferences, ",
"gas_price_preferences, gas_class_group_id, ",
"gas_class_group_name, gas_class_group_task_id, ",
"gas_staff_id, gas_staff_name, ",
"gas_salesman_id, gas_salesman_name, ",
"gas_agent_id, gas_agent_name, ",
"gas_org_id, gas_org_name, ",
"ext_1, ext_2, ext_3, ",
"ext_4, ext_5, ext_6)",
"values (#{orderId,jdbcType=BIGINT}, #{memId,jdbcType=BIGINT}, ",
"#{storeId,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ",
"#{storeAddress,jdbcType=VARCHAR}, #{goodsType,jdbcType=INTEGER}, ",
@ -73,22 +73,22 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"#{goodsActualPrice,jdbcType=DECIMAL}, #{saleCount,jdbcType=INTEGER}, ",
"#{totalPrice,jdbcType=DECIMAL}, #{giveawayType,jdbcType=BIT}, ",
"#{childOrdeStatus,jdbcType=INTEGER}, #{praiseStatus,jdbcType=INTEGER}, ",
"#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ",
"#{gasOilType,jdbcType=INTEGER}, #{gasOrderNo,jdbcType=VARCHAR}, ",
"#{gasPricePlatform,jdbcType=DECIMAL}, #{gasPriceGun,jdbcType=DECIMAL}, ",
"#{gasPriceVip,jdbcType=DECIMAL}, #{gasPriceOfficial,jdbcType=DECIMAL}, ",
"#{gasPriceCost,jdbcType=DECIMAL}, #{gasPriceCostTotal,jdbcType=DECIMAL}, ",
"#{gasPriceChannelPay,jdbcType=DECIMAL}, #{gasOilLiters,jdbcType=DECIMAL}, ",
"#{gasDiscount,jdbcType=DECIMAL}, #{gasOilSubsidy,jdbcType=DECIMAL}, ",
"#{gasLitersPreferences,jdbcType=DECIMAL}, #{gasPricePreferences,jdbcType=DECIMAL}, ",
"#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ",
"#{gasClassGroupTaskId,jdbcType=BIGINT}, #{gasStaffId,jdbcType=BIGINT}, ",
"#{gasStaffName,jdbcType=VARCHAR}, #{gasSalesmanId,jdbcType=BIGINT}, ",
"#{gasSalesmanName,jdbcType=VARCHAR}, #{gasAgentId,jdbcType=BIGINT}, ",
"#{gasAgentName,jdbcType=VARCHAR}, #{gasOrgId,jdbcType=BIGINT}, ",
"#{gasOrgName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ",
"#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})"
"#{gasCarLicensePlate,jdbcType=VARCHAR}, #{gasOilNo,jdbcType=VARCHAR}, ",
"#{gasGunNo,jdbcType=VARCHAR}, #{gasOilType,jdbcType=INTEGER}, ",
"#{gasOrderNo,jdbcType=VARCHAR}, #{gasPricePlatform,jdbcType=DECIMAL}, ",
"#{gasPriceGun,jdbcType=DECIMAL}, #{gasPriceVip,jdbcType=DECIMAL}, ",
"#{gasPriceOfficial,jdbcType=DECIMAL}, #{gasPriceCost,jdbcType=DECIMAL}, ",
"#{gasPriceCostTotal,jdbcType=DECIMAL}, #{gasPriceChannelPay,jdbcType=DECIMAL}, ",
"#{gasOilLiters,jdbcType=DECIMAL}, #{gasDiscount,jdbcType=DECIMAL}, ",
"#{gasOilSubsidy,jdbcType=DECIMAL}, #{gasLitersPreferences,jdbcType=DECIMAL}, ",
"#{gasPricePreferences,jdbcType=DECIMAL}, #{gasClassGroupId,jdbcType=BIGINT}, ",
"#{gasClassGroupName,jdbcType=VARCHAR}, #{gasClassGroupTaskId,jdbcType=BIGINT}, ",
"#{gasStaffId,jdbcType=BIGINT}, #{gasStaffName,jdbcType=VARCHAR}, ",
"#{gasSalesmanId,jdbcType=BIGINT}, #{gasSalesmanName,jdbcType=VARCHAR}, ",
"#{gasAgentId,jdbcType=BIGINT}, #{gasAgentName,jdbcType=VARCHAR}, ",
"#{gasOrgId,jdbcType=BIGINT}, #{gasOrgName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ",
"#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighChildOrder record);
@ -118,6 +118,7 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
@Result(column="giveaway_type", property="giveawayType", jdbcType=JdbcType.BIT),
@Result(column="child_orde_status", property="childOrdeStatus", jdbcType=JdbcType.INTEGER),
@Result(column="praise_status", property="praiseStatus", jdbcType=JdbcType.INTEGER),
@Result(column="gas_car_license_plate", property="gasCarLicensePlate", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER),
@ -158,9 +159,9 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"select",
"id, order_id, mem_id, store_id, store_name, store_address, goods_type, goods_id, ",
"goods_name, goods_desc, goods_img, goods_spec_name, goods_price, goods_actual_price, ",
"sale_count, total_price, giveaway_type, child_orde_status, praise_status, gas_oil_no, ",
"gas_gun_no, gas_oil_type, gas_order_no, gas_price_platform, gas_price_gun, gas_price_vip, ",
"gas_price_official, gas_price_cost, gas_price_cost_total, gas_price_channel_pay, ",
"sale_count, total_price, giveaway_type, child_orde_status, praise_status, gas_car_license_plate, ",
"gas_oil_no, gas_gun_no, gas_oil_type, gas_order_no, gas_price_platform, gas_price_gun, ",
"gas_price_vip, gas_price_official, gas_price_cost, gas_price_cost_total, gas_price_channel_pay, ",
"gas_oil_liters, gas_discount, gas_oil_subsidy, gas_liters_preferences, gas_price_preferences, ",
"gas_class_group_id, gas_class_group_name, gas_class_group_task_id, gas_staff_id, ",
"gas_staff_name, gas_salesman_id, gas_salesman_name, gas_agent_id, gas_agent_name, ",
@ -188,6 +189,7 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
@Result(column="giveaway_type", property="giveawayType", jdbcType=JdbcType.BIT),
@Result(column="child_orde_status", property="childOrdeStatus", jdbcType=JdbcType.INTEGER),
@Result(column="praise_status", property="praiseStatus", jdbcType=JdbcType.INTEGER),
@Result(column="gas_car_license_plate", property="gasCarLicensePlate", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER),
@ -253,6 +255,7 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"giveaway_type = #{giveawayType,jdbcType=BIT},",
"child_orde_status = #{childOrdeStatus,jdbcType=INTEGER},",
"praise_status = #{praiseStatus,jdbcType=INTEGER},",
"gas_car_license_plate = #{gasCarLicensePlate,jdbcType=VARCHAR},",
"gas_oil_no = #{gasOilNo,jdbcType=VARCHAR},",
"gas_gun_no = #{gasGunNo,jdbcType=VARCHAR},",
"gas_oil_type = #{gasOilType,jdbcType=INTEGER},",

@ -100,6 +100,10 @@ public class HighChildOrderSqlProvider {
sql.VALUES("praise_status", "#{praiseStatus,jdbcType=INTEGER}");
}
if (record.getGasCarLicensePlate() != null) {
sql.VALUES("gas_car_license_plate", "#{gasCarLicensePlate,jdbcType=VARCHAR}");
}
if (record.getGasOilNo() != null) {
sql.VALUES("gas_oil_no", "#{gasOilNo,jdbcType=VARCHAR}");
}
@ -260,6 +264,7 @@ public class HighChildOrderSqlProvider {
sql.SELECT("giveaway_type");
sql.SELECT("child_orde_status");
sql.SELECT("praise_status");
sql.SELECT("gas_car_license_plate");
sql.SELECT("gas_oil_no");
sql.SELECT("gas_gun_no");
sql.SELECT("gas_oil_type");
@ -386,6 +391,10 @@ public class HighChildOrderSqlProvider {
sql.SET("praise_status = #{record.praiseStatus,jdbcType=INTEGER}");
}
if (record.getGasCarLicensePlate() != null) {
sql.SET("gas_car_license_plate = #{record.gasCarLicensePlate,jdbcType=VARCHAR}");
}
if (record.getGasOilNo() != null) {
sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}");
}
@ -545,6 +554,7 @@ public class HighChildOrderSqlProvider {
sql.SET("giveaway_type = #{record.giveawayType,jdbcType=BIT}");
sql.SET("child_orde_status = #{record.childOrdeStatus,jdbcType=INTEGER}");
sql.SET("praise_status = #{record.praiseStatus,jdbcType=INTEGER}");
sql.SET("gas_car_license_plate = #{record.gasCarLicensePlate,jdbcType=VARCHAR}");
sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}");
sql.SET("gas_gun_no = #{record.gasGunNo,jdbcType=VARCHAR}");
sql.SET("gas_oil_type = #{record.gasOilType,jdbcType=INTEGER}");
@ -660,6 +670,10 @@ public class HighChildOrderSqlProvider {
sql.SET("praise_status = #{praiseStatus,jdbcType=INTEGER}");
}
if (record.getGasCarLicensePlate() != null) {
sql.SET("gas_car_license_plate = #{gasCarLicensePlate,jdbcType=VARCHAR}");
}
if (record.getGasOilNo() != null) {
sql.SET("gas_oil_no = #{gasOilNo,jdbcType=VARCHAR}");
}

@ -1,7 +1,79 @@
package com.hai.dao;
import com.hai.model.OilCardOrderModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface HighFleetOilCardMapperExt {
}
@Select("<script>" +
" SELECT" +
" (select org_name from high_oil_card oc where oc.card_no = b.mem_card_no) orgName," +
" b.mem_phone merPhone," +
" a.gas_car_license_plate carLicensePlate," +
" b.order_no orderNo," +
" a.gas_order_no gasOrderNo," +
" b.pay_type payType," +
" CASE" +
" b.pay_type " +
" WHEN 1 THEN '支付' " +
" WHEN 2 THEN '微信'" +
" WHEN 3 THEN '金币'" +
" WHEN 4 THEN '汇联通'" +
" WHEN 5 THEN '银联'" +
" WHEN 6 THEN '银联分期'" +
" WHEN 7 THEN '嗨森逛油卡'" +
" ELSE '未知' " +
" END payTypeName," +
" b.mem_card_no memCardNo," +
" b.total_price totalPrice," +
" b.deduction_price deductionPrice," +
" b.pay_real_price payRealPrice," +
" a.goods_name goodsName," +
" a.gas_oil_no gasOilNo," +
" a.gas_gun_no gasGunNo," +
" a.gas_price_gun gasPriceGun," +
" a.ext_1 platformPriceGun," +
" b.order_status status," +
" CASE" +
" b.order_status " +
" WHEN 1 THEN '待支付' " +
" WHEN 2 THEN '已支付'" +
" WHEN 3 THEN '已完成'" +
" WHEN 4 THEN '已退款'" +
" WHEN 5 THEN '已取消'" +
" WHEN 6 THEN '退款中'" +
" WHEN 6 THEN '退款失败'" +
" ELSE '未知' " +
" END statusName," +
" b.create_time createTime," +
" b.pay_time payTime," +
" b.refund_time refundTime" +
" FROM" +
" high_child_order a," +
" high_order b" +
" WHERE" +
" a.order_id = b.id " +
" AND a.goods_type = 3 " +
" AND b.order_status in (2,3,4,6,7) " +
" <if test='param.memPhone != null'> AND b.mem_phone like concat('%',#{param.memPhone},'%') </if>" +
" <if test='param.carLicensePlate != null'> AND a.gas_car_license_plate like concat('%',#{param.carLicensePlate},'%') </if>" +
" <if test='param.cardNo != null'> AND b.mem_card_no like concat('%',#{param.cardNo},'%') </if>" +
" <if test='param.goodsName != null'> AND b.goods_name like concat('%',#{param.goodsName},'%') </if>" +
" <if test='param.payTimeS != null'> <![CDATA[ AND b.pay_time >= #{param.payTimeS} ]]> </if> " +
" <if test='param.payTimeE != null'> <![CDATA[ AND b.pay_time <= #{param.payTimeE} ]]> </if> " +
" <if test='param.status != null'> and b.order_status = #{param.status} </if> " +
" AND EXISTS (select 1 from high_fleet_oil_card c where c.company_id = #{param.companyId} " +
" <if test='param.orgId != null'> and c.org_id = #{param.orgId} </if> " +
" and b.mem_card_no = c.card_no)" +
" ORDER BY" +
" b.pay_time DESC" +
"</script>")
List<OilCardOrderModel> selectOilCardOrderList(@Param(value = "param") Map<String, Object> param);
}

@ -45,18 +45,18 @@ public interface HighFleetOilCardRecordMapper extends HighFleetOilCardRecordMapp
"source_type, source_id, ",
"source_order_no, source_content, ",
"`status`, create_time, ",
"op_user_id, op_user_name, ",
"op_user_phone, ext_1, ",
"ext_2, ext_3)",
"op_user_type, op_user_id, ",
"op_user_name, op_user_phone, ",
"ext_1, ext_2, ext_3)",
"values (#{fleetOilCardId,jdbcType=BIGINT}, #{fleetOilCardNo,jdbcType=VARCHAR}, ",
"#{type,jdbcType=INTEGER}, #{transactionAmount,jdbcType=DECIMAL}, ",
"#{beforeAmount,jdbcType=DECIMAL}, #{afterAmount,jdbcType=DECIMAL}, ",
"#{sourceType,jdbcType=INTEGER}, #{sourceId,jdbcType=BIGINT}, ",
"#{sourceOrderNo,jdbcType=VARCHAR}, #{sourceContent,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{opUserId,jdbcType=BIGINT}, #{opUserName,jdbcType=VARCHAR}, ",
"#{opUserPhone,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{opUserType,jdbcType=INTEGER}, #{opUserId,jdbcType=BIGINT}, ",
"#{opUserName,jdbcType=VARCHAR}, #{opUserPhone,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighFleetOilCardRecord record);
@ -80,6 +80,7 @@ public interface HighFleetOilCardRecordMapper extends HighFleetOilCardRecordMapp
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="op_user_phone", property="opUserPhone", jdbcType=JdbcType.VARCHAR),
@ -93,7 +94,8 @@ public interface HighFleetOilCardRecordMapper extends HighFleetOilCardRecordMapp
"select",
"id, fleet_oil_card_id, fleet_oil_card_no, `type`, transaction_amount, before_amount, ",
"after_amount, source_type, source_id, source_order_no, source_content, `status`, ",
"create_time, op_user_id, op_user_name, op_user_phone, ext_1, ext_2, ext_3",
"create_time, op_user_type, op_user_id, op_user_name, op_user_phone, ext_1, ext_2, ",
"ext_3",
"from high_fleet_oil_card_record",
"where id = #{id,jdbcType=BIGINT}"
})
@ -111,6 +113,7 @@ public interface HighFleetOilCardRecordMapper extends HighFleetOilCardRecordMapp
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="op_user_phone", property="opUserPhone", jdbcType=JdbcType.VARCHAR),
@ -143,6 +146,7 @@ public interface HighFleetOilCardRecordMapper extends HighFleetOilCardRecordMapp
"source_content = #{sourceContent,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"op_user_type = #{opUserType,jdbcType=INTEGER},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",
"op_user_name = #{opUserName,jdbcType=VARCHAR},",
"op_user_phone = #{opUserPhone,jdbcType=VARCHAR},",

@ -76,6 +76,10 @@ public class HighFleetOilCardRecordSqlProvider {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.VALUES("op_user_type", "#{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}");
}
@ -122,6 +126,7 @@ public class HighFleetOilCardRecordSqlProvider {
sql.SELECT("source_content");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("op_user_type");
sql.SELECT("op_user_id");
sql.SELECT("op_user_name");
sql.SELECT("op_user_phone");
@ -197,6 +202,10 @@ public class HighFleetOilCardRecordSqlProvider {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
}
@ -242,6 +251,7 @@ public class HighFleetOilCardRecordSqlProvider {
sql.SET("source_content = #{record.sourceContent,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
sql.SET("op_user_phone = #{record.opUserPhone,jdbcType=VARCHAR}");
@ -306,6 +316,10 @@ public class HighFleetOilCardRecordSqlProvider {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}");
}

@ -115,9 +115,10 @@ public interface HighOilCardMapperExt {
" <if test='param.payTimeS != null'> <![CDATA[ AND b.pay_time >= #{param.payTimeS} ]]> </if> " +
" <if test='param.payTimeE != null'> <![CDATA[ AND b.pay_time <= #{param.payTimeE} ]]> </if> " +
" <if test='param.status != null'> and b.order_status = #{param.status} </if> " +
" AND EXISTS (select 1 from high_oil_card c where c.company_id = #{param.companyId} " +
" <if test='param.orgId != null'> and c.org_id = #{param.orgId} </if> " +
" and b.mem_card_no = c.card_no)" +
" AND b.mem_card_no in " +
" (SELECT card_no FROM high_oil_card c WHERE c.company_id = #{param.companyId} <if test='param.orgId != null'> and c.org_id = #{param.orgId} </if> " +
" UNION " +
" SELECT card_no FROM high_fleet_oil_card c WHERE c.company_id = #{param.companyId} <if test='param.orgId != null'> and c.org_id = #{param.orgId} </if>) " +
" ORDER BY" +
" b.pay_time DESC" +
"</script>")

@ -108,6 +108,11 @@ public class HighChildOrder implements Serializable {
*/
private Integer praiseStatus;
/**
* 加油站车牌
*/
private String gasCarLicensePlate;
/**
* 加油站油号
*/
@ -409,6 +414,14 @@ public class HighChildOrder implements Serializable {
this.praiseStatus = praiseStatus;
}
public String getGasCarLicensePlate() {
return gasCarLicensePlate;
}
public void setGasCarLicensePlate(String gasCarLicensePlate) {
this.gasCarLicensePlate = gasCarLicensePlate;
}
public String getGasOilNo() {
return gasOilNo;
}
@ -704,6 +717,7 @@ public class HighChildOrder implements Serializable {
&& (this.getGiveawayType() == null ? other.getGiveawayType() == null : this.getGiveawayType().equals(other.getGiveawayType()))
&& (this.getChildOrdeStatus() == null ? other.getChildOrdeStatus() == null : this.getChildOrdeStatus().equals(other.getChildOrdeStatus()))
&& (this.getPraiseStatus() == null ? other.getPraiseStatus() == null : this.getPraiseStatus().equals(other.getPraiseStatus()))
&& (this.getGasCarLicensePlate() == null ? other.getGasCarLicensePlate() == null : this.getGasCarLicensePlate().equals(other.getGasCarLicensePlate()))
&& (this.getGasOilNo() == null ? other.getGasOilNo() == null : this.getGasOilNo().equals(other.getGasOilNo()))
&& (this.getGasGunNo() == null ? other.getGasGunNo() == null : this.getGasGunNo().equals(other.getGasGunNo()))
&& (this.getGasOilType() == null ? other.getGasOilType() == null : this.getGasOilType().equals(other.getGasOilType()))
@ -762,6 +776,7 @@ public class HighChildOrder implements Serializable {
result = prime * result + ((getGiveawayType() == null) ? 0 : getGiveawayType().hashCode());
result = prime * result + ((getChildOrdeStatus() == null) ? 0 : getChildOrdeStatus().hashCode());
result = prime * result + ((getPraiseStatus() == null) ? 0 : getPraiseStatus().hashCode());
result = prime * result + ((getGasCarLicensePlate() == null) ? 0 : getGasCarLicensePlate().hashCode());
result = prime * result + ((getGasOilNo() == null) ? 0 : getGasOilNo().hashCode());
result = prime * result + ((getGasGunNo() == null) ? 0 : getGasGunNo().hashCode());
result = prime * result + ((getGasOilType() == null) ? 0 : getGasOilType().hashCode());
@ -823,6 +838,7 @@ public class HighChildOrder implements Serializable {
sb.append(", giveawayType=").append(giveawayType);
sb.append(", childOrdeStatus=").append(childOrdeStatus);
sb.append(", praiseStatus=").append(praiseStatus);
sb.append(", gasCarLicensePlate=").append(gasCarLicensePlate);
sb.append(", gasOilNo=").append(gasOilNo);
sb.append(", gasGunNo=").append(gasGunNo);
sb.append(", gasOilType=").append(gasOilType);

@ -1325,6 +1325,76 @@ public class HighChildOrderExample {
return (Criteria) this;
}
public Criteria andGasCarLicensePlateIsNull() {
addCriterion("gas_car_license_plate is null");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateIsNotNull() {
addCriterion("gas_car_license_plate is not null");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateEqualTo(String value) {
addCriterion("gas_car_license_plate =", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotEqualTo(String value) {
addCriterion("gas_car_license_plate <>", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateGreaterThan(String value) {
addCriterion("gas_car_license_plate >", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateGreaterThanOrEqualTo(String value) {
addCriterion("gas_car_license_plate >=", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateLessThan(String value) {
addCriterion("gas_car_license_plate <", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateLessThanOrEqualTo(String value) {
addCriterion("gas_car_license_plate <=", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateLike(String value) {
addCriterion("gas_car_license_plate like", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotLike(String value) {
addCriterion("gas_car_license_plate not like", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateIn(List<String> values) {
addCriterion("gas_car_license_plate in", values, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotIn(List<String> values) {
addCriterion("gas_car_license_plate not in", values, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateBetween(String value1, String value2) {
addCriterion("gas_car_license_plate between", value1, value2, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotBetween(String value1, String value2) {
addCriterion("gas_car_license_plate not between", value1, value2, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasOilNoIsNull() {
addCriterion("gas_oil_no is null");
return (Criteria) this;

@ -76,6 +76,11 @@ public class HighFleetOilCardRecord implements Serializable {
*/
private Date createTime;
/**
* 操作人类型 1管理员 2客户
*/
private Integer opUserType;
/**
* 操作人id
*/
@ -203,6 +208,14 @@ public class HighFleetOilCardRecord implements Serializable {
this.createTime = createTime;
}
public Integer getOpUserType() {
return opUserType;
}
public void setOpUserType(Integer opUserType) {
this.opUserType = opUserType;
}
public Long getOpUserId() {
return opUserId;
}
@ -276,6 +289,7 @@ public class HighFleetOilCardRecord implements Serializable {
&& (this.getSourceContent() == null ? other.getSourceContent() == null : this.getSourceContent().equals(other.getSourceContent()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getOpUserType() == null ? other.getOpUserType() == null : this.getOpUserType().equals(other.getOpUserType()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName()))
&& (this.getOpUserPhone() == null ? other.getOpUserPhone() == null : this.getOpUserPhone().equals(other.getOpUserPhone()))
@ -301,6 +315,7 @@ public class HighFleetOilCardRecord implements Serializable {
result = prime * result + ((getSourceContent() == null) ? 0 : getSourceContent().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getOpUserType() == null) ? 0 : getOpUserType().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode());
result = prime * result + ((getOpUserPhone() == null) ? 0 : getOpUserPhone().hashCode());
@ -329,6 +344,7 @@ public class HighFleetOilCardRecord implements Serializable {
sb.append(", sourceContent=").append(sourceContent);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", opUserType=").append(opUserType);
sb.append(", opUserId=").append(opUserId);
sb.append(", opUserName=").append(opUserName);
sb.append(", opUserPhone=").append(opUserPhone);

@ -936,6 +936,66 @@ public class HighFleetOilCardRecordExample {
return (Criteria) this;
}
public Criteria andOpUserTypeIsNull() {
addCriterion("op_user_type is null");
return (Criteria) this;
}
public Criteria andOpUserTypeIsNotNull() {
addCriterion("op_user_type is not null");
return (Criteria) this;
}
public Criteria andOpUserTypeEqualTo(Integer value) {
addCriterion("op_user_type =", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeNotEqualTo(Integer value) {
addCriterion("op_user_type <>", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeGreaterThan(Integer value) {
addCriterion("op_user_type >", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("op_user_type >=", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeLessThan(Integer value) {
addCriterion("op_user_type <", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeLessThanOrEqualTo(Integer value) {
addCriterion("op_user_type <=", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeIn(List<Integer> values) {
addCriterion("op_user_type in", values, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeNotIn(List<Integer> values) {
addCriterion("op_user_type not in", values, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeBetween(Integer value1, Integer value2) {
addCriterion("op_user_type between", value1, value2, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeNotBetween(Integer value1, Integer value2) {
addCriterion("op_user_type not between", value1, value2, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserIdIsNull() {
addCriterion("op_user_id is null");
return (Criteria) this;

@ -1,6 +1,7 @@
package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -56,6 +57,32 @@ public class HighUserCard implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 余额
*/
private BigDecimal balance;
/**
* 联系人
*/
private String contactName;
public BigDecimal getBalance() {
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public Long getId() {
return id;
}
@ -197,4 +224,4 @@ public class HighUserCard implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -11,6 +11,7 @@ public class OilCardOrderModel {
private String orgName;
private String merPhone;
private String carLicensePlate;
private String orderNo;
private String gasOrderNo;
private Integer payType;
@ -30,6 +31,14 @@ public class OilCardOrderModel {
private Date payTime;
private Date refundTime;
public String getCarLicensePlate() {
return carLicensePlate;
}
public void setCarLicensePlate(String carLicensePlate) {
this.carLicensePlate = carLicensePlate;
}
public String getOrgName() {
return orgName;
}

@ -2,6 +2,9 @@ package com.hai.service;
import com.hai.entity.HighFleetOilCardRecord;
import java.util.List;
import java.util.Map;
/**
* @className: HighFleetOilCardRecordService
* @author: HuRui
@ -9,7 +12,16 @@ import com.hai.entity.HighFleetOilCardRecord;
**/
public interface HighFleetOilCardRecordService {
/**
* 增加记录
* @param fleetOilCardRecord
*/
void insertRecord(HighFleetOilCardRecord fleetOilCardRecord);
/**
* 查询记录列表
* @param param
* @return
*/
List<HighFleetOilCardRecord> getRecordList(Map<String,Object> param);
}

@ -45,10 +45,11 @@ public interface HighFleetOilCardService {
/**
* 油卡消费
* @param fleetCardNo 车队油卡卡号
* @param contactPhone 使用人电话
* @param amount 充值金额
* @param otherParam 其他参数
*/
void consume(String fleetCardNo, BigDecimal amount, Map<String, Object> otherParam);
void consume(String fleetCardNo, String contactPhone,BigDecimal amount, Map<String, Object> otherParam);
/**
* 订单退款

@ -51,4 +51,12 @@ public interface HighFleetOilCardUserService {
* @return
*/
List<HighFleetOilCardUser> getUserListByCard(Long cardId);
/**
* 获取油卡用户
* @param fleetCardNo
* @param contactPhone
* @return
*/
HighFleetOilCardUser getCardUser(String fleetCardNo, String contactPhone);
}

@ -48,6 +48,15 @@ public interface HighOrderService {
*/
void oilCardPayOrder(Long userCardId, Long orderId) throws Exception;
/**
* 油卡支付订单
* @param userCardId 用户与卡号关系
* @param orderId 订单id
* @param carLicensePlate 车牌
* @throws Exception
*/
void fleetOilCardPayOrder(Long userCardId, Long orderId, String carLicensePlate) throws Exception;
/**
* 汇联通工会卡支付
* @param userCardId

@ -1,12 +1,20 @@
package com.hai.service.impl;
import com.hai.common.security.UserCenter;
import com.hai.dao.HighFleetOilCardRecordMapper;
import com.hai.entity.HighFleetOilCardRecord;
import com.hai.entity.HighFleetOilCardRecordExample;
import com.hai.model.HighUserModel;
import com.hai.model.UserInfoModel;
import com.hai.service.HighFleetOilCardRecordService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: HighFleetOilCardRecordServiceImpl
@ -19,10 +27,65 @@ public class HighFleetOilCardRecordServiceImpl implements HighFleetOilCardRecord
@Resource
private HighFleetOilCardRecordMapper fleetOilCardRecordMapper;
@Resource
private UserCenter userCenter;
@Override
public void insertRecord(HighFleetOilCardRecord fleetOilCardRecord) {
fleetOilCardRecord.setOpUserType(0);
fleetOilCardRecord.setOpUserId(0L);
fleetOilCardRecord.setOpUserName("未知");
fleetOilCardRecord.setOpUserPhone("未知");
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel != null) {
fleetOilCardRecord.setOpUserType(1);
fleetOilCardRecord.setOpUserId(userInfoModel.getSecUser().getId());
fleetOilCardRecord.setOpUserName(userInfoModel.getSecUser().getUserName());
fleetOilCardRecord.setOpUserPhone(userInfoModel.getSecUser().getTelephone());
}
HighUserModel userModel = userCenter.getSessionModel(HighUserModel.class);
if (userModel != null) {
fleetOilCardRecord.setOpUserType(2);
fleetOilCardRecord.setOpUserId(userModel.getHighUser().getId());
fleetOilCardRecord.setOpUserName(userModel.getHighUser().getName());
fleetOilCardRecord.setOpUserPhone(userModel.getHighUser().getPhone());
}
fleetOilCardRecord.setCreateTime(new Date());
fleetOilCardRecord.setStatus(1);
fleetOilCardRecordMapper.insert(fleetOilCardRecord);
}
@Override
public List<HighFleetOilCardRecord> getRecordList(Map<String, Object> param) {
HighFleetOilCardRecordExample example = new HighFleetOilCardRecordExample();
HighFleetOilCardRecordExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (StringUtils.isNotBlank(MapUtils.getString(param, "fleetOilCardNo"))) {
criteria.andFleetOilCardNoLike("%"+MapUtils.getString(param, "fleetOilCardNo")+"%");
}
if (MapUtils.getInteger(param, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(param, "type"));
}
if (MapUtils.getInteger(param, "sourceType") != null) {
criteria.andSourceTypeEqualTo(MapUtils.getInteger(param, "sourceType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "sourceOrderNo"))) {
criteria.andSourceOrderNoEqualTo("%"+MapUtils.getString(param, "sourceOrderNo")+"%");
}
if (MapUtils.getInteger(param, "opUserType") != null) {
criteria.andOpUserTypeEqualTo(MapUtils.getInteger(param, "opUserType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "opUserPhone"))) {
criteria.andOpUserPhoneLike("%"+MapUtils.getString(param, "opUserPhone")+"%");
}
example.setOrderByClause("create_time desc");
return fleetOilCardRecordMapper.selectByExample(example);
}
}

@ -17,6 +17,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -37,6 +39,9 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
@Resource
private HighFleetOilCardRecordService fleetOilCardRecordService;
@Resource
private HighFleetOilCardUserService fleetOilCardUserService;
@Resource
private HighCompanyAccountService companyAccountService;
@ -46,6 +51,9 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
@Resource
private BsOrganizationService organizationService;
@Resource
private HighOrderService orderService;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@ -67,7 +75,9 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void recharge(String fleetCardNo, BigDecimal price, Long orgId) {
// 查询车队油卡
HighFleetOilCard oilCard = getFleetOilCardByCardNo(fleetCardNo);
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡卡号错误");
@ -78,11 +88,15 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(LOCK_KEY+fleetCardNo, "");
if (!lock) {
Thread.sleep(300);
try {
Thread.sleep(100);
} catch (Exception e) {
e.printStackTrace();
}
recharge(fleetCardNo, price, orgId);
}
try {
//获取锁成功
// 获取锁成功
// 账户扣款
Map<String, Object> consumeType = new HashMap<>();
consumeType.put("sourceType", CompanyAmountSourceTypeEnum.type4.getType());
@ -110,19 +124,71 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
record.setSourceOrderNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
} catch (Exception e) {
e.printStackTrace();
};
}
record.setSourceContent("充值油卡金额:" + record.getTransactionAmount());
fleetOilCardRecordService.insertRecord(record);
} finally {
redisTemplate.delete(LOCK_KEY+fleetCardNo);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void recycleAmount(String fleetCardNo) {
// 查询车队油卡
HighFleetOilCard oilCard = getFleetOilCardByCardNo(fleetCardNo);
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡卡号错误");
}
if (!oilCard.getStatus().equals(OilCardStatusEnum.status1.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡不处于正常状态");
}
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(LOCK_KEY+fleetCardNo, "");
if (!lock) {
try {
Thread.sleep(100);
} catch (Exception e) {
e.printStackTrace();
}
recycleAmount(fleetCardNo);
}
try {
// 账户进账
Map<String, Object> rechargeType = new HashMap<>();
rechargeType.put("sourceType", CompanyAmountSourceTypeEnum.type3.getType());
rechargeType.put("sourceId", oilCard.getId());
rechargeType.put("sourceContent", "油卡:" + oilCard.getCardNo() + ",回收余额:¥" + oilCard.getAmount());
companyAccountService.recharge(oilCard.getOrgId(), oilCard.getAmount(), rechargeType);
// 变更前金额
BigDecimal beforeAmount = oilCard.getAmount();
BigDecimal price = oilCard.getAmount();
// 计算金额
oilCard.setAmount(new BigDecimal("0"));
editData(oilCard);
// 变更后金额
BigDecimal afterAmount = oilCard.getAmount();
HighFleetOilCardRecord record = new HighFleetOilCardRecord();
record.setFleetOilCardId(oilCard.getId());
record.setFleetOilCardNo(oilCard.getCardNo());
record.setType(OilCardRecordTypeEnum.type2.getType());
record.setTransactionAmount(price);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(OilCardRecordSourceTypeEnum.type4.getType());
try {
record.setSourceOrderNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
} catch (Exception e) {
e.printStackTrace();
}
record.setSourceContent("回收油卡余额:" + price);
fleetOilCardRecordService.insertRecord(record);
} finally {
redisTemplate.delete(LOCK_KEY+fleetCardNo);
}
}
@Override
@ -137,13 +203,121 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
}
@Override
public void consume(String fleetCardNo, BigDecimal amount, Map<String, Object> otherParam) {
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void consume(String fleetCardNo,String contactPhone, BigDecimal amount, Map<String, Object> otherParam) {
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(LOCK_KEY+fleetCardNo, "");
if (!lock) {
try {
Thread.sleep(100);
} catch (Exception e) {
e.printStackTrace();
}
consume(fleetCardNo, contactPhone, amount, otherParam);
}
try {
// 查询车队油卡
HighFleetOilCard oilCard = getFleetOilCardByCardNo(fleetCardNo);
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡卡号错误");
}
if (!oilCard.getStatus().equals(OilCardStatusEnum.status1.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态异常,暂无法消费");
}
// 油卡余额 是否小于 消费余额
if (oilCard.getAmount().compareTo(amount) == -1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡余额不足");
}
// 油卡用户
HighFleetOilCardUser cardUser = fleetOilCardUserService.getCardUser(oilCard.getCardNo(), contactPhone);
if (cardUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡未绑定" + contactPhone+"手机号");
}
cardUser.setAmountConsume(cardUser.getAmountConsume().add(amount));
cardUser.setLatelyConsumeTime(new Date());
fleetOilCardUserService.editUser(cardUser);
// 变更前金额
BigDecimal beforeAmount = oilCard.getAmount();
// 计算消费后金额
oilCard.setAmount(oilCard.getAmount().subtract(amount));
// 累积消费金额
oilCard.setAmountConsume(oilCard.getAmountConsume().add(amount));
editData(oilCard);
// 变更后金额
BigDecimal afterAmount = oilCard.getAmount();
HighFleetOilCardRecord record = new HighFleetOilCardRecord();
record.setFleetOilCardId(oilCard.getId());
record.setFleetOilCardNo(oilCard.getCardNo());
record.setType(OilCardRecordTypeEnum.type2.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MapUtils.getInteger(otherParam, "sourceType"));
record.setSourceId(MapUtils.getLong(otherParam, "sourceId"));
record.setSourceOrderNo(MapUtils.getString(otherParam, "sourceOrderNo"));
record.setSourceContent(MapUtils.getString(otherParam, "sourceContent"));
fleetOilCardRecordService.insertRecord(record);
} finally {
redisTemplate.delete(LOCK_KEY+fleetCardNo);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void refund(String orderNo) {
HighOrder order = orderService.getOrderByOrderNo(orderNo);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的的订单");
}
if (!order.getPayType().equals(OrderPayTypeEnum.type7.getType())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式,不是油卡");
}
if (StringUtils.isBlank(order.getMemCardNo())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡卡号");
}
// 查询油卡卡号
HighFleetOilCard oilCard = getFleetOilCardByCardNo(order.getMemCardNo());
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡卡号");
}
// 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
if (order.getOrderStatus() == 2 || order.getOrderStatus() == 3 || order.getOrderStatus() == 6 || order.getOrderStatus() == 7) {
order.setOrderStatus(4);
order.setRefundTime(new Date());
order.setRefundPrice(order.getPayRealPrice());
orderService.updateOrderDetail(order);
// 变更前金额
BigDecimal beforeAmount = oilCard.getAmount();
// 计算金额
oilCard.setAmount(oilCard.getAmount().add(order.getPayRealPrice()));
oilCard.setAmountConsume(oilCard.getAmountConsume().subtract(order.getPayRealPrice()));
editData(oilCard);
// 变更后金额
BigDecimal afterAmount = oilCard.getAmount();
HighFleetOilCardRecord record = new HighFleetOilCardRecord();
record.setFleetOilCardId(oilCard.getId());
record.setFleetOilCardNo(oilCard.getCardNo());
record.setType(OilCardRecordTypeEnum.type1.getType());
record.setTransactionAmount(order.getPayRealPrice());
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(OilCardRecordSourceTypeEnum.type3.getType());
record.setSourceId(order.getId());
try {
record.setSourceOrderNo(orderNo);
} catch (Exception e) {
e.printStackTrace();
}
record.setSourceContent("订单号:" + orderNo + ",退款金额:" + order.getPayRealPrice());
fleetOilCardRecordService.insertRecord(record);
return;
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态异常");
}
@Override
@ -258,6 +432,13 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
@Override
public List<OilCardOrderModel> getFleetOilCardOrderList(Map<String, Object> param) throws Exception {
return null;
if (MapUtils.getLong(param, "payTimeS") != null) {
param.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeS")), "yyyy-MM-dd HH:mm:ss"));
}
if (MapUtils.getLong(param, "payTimeE") != null) {
param.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeE")), "yyyy-MM-dd HH:mm:ss"));
}
return fleetOilCardMapper.selectOilCardOrderList(param);
}
}

@ -68,8 +68,8 @@ public class HighFleetOilCardUserServiceImpl implements HighFleetOilCardUserServ
HighUser user = userService.findByPhone(fleetOilCardUser.getContactPhone());
if (user == null) {
user = new HighUser();
user.setName(fleetOilCard.getContactName());
user.setPhone(fleetOilCard.getContactPhone());
user.setName(fleetOilCardUser.getContactName());
user.setPhone(fleetOilCardUser.getContactPhone());
user.setRegTime(new Date());
user.setGold(0);
user.setStatus(1);
@ -144,4 +144,18 @@ public class HighFleetOilCardUserServiceImpl implements HighFleetOilCardUserServ
example.setOrderByClause("create_time desc");
return fleetOilCardUserMapper.selectByExample(example);
}
@Override
public HighFleetOilCardUser getCardUser(String fleetCardNo, String contactPhone) {
HighFleetOilCardUserExample example = new HighFleetOilCardUserExample();
example.createCriteria()
.andFleetOilCardNoEqualTo(fleetCardNo)
.andContactPhoneEqualTo(contactPhone)
.andStatusNotEqualTo(0);
List<HighFleetOilCardUser> list = fleetOilCardUserMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
}

@ -135,6 +135,9 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource
private HighOilCardService oilCardService;
@Resource
private HighFleetOilCardService fleetOilCardService;
@Resource
private RedisTemplate redisTemplate;
@ -882,6 +885,264 @@ public class HighOrderServiceImpl implements HighOrderService {
}).start();
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void fleetOilCardPayOrder(Long userCardId, Long orderId, String carLicensePlate) throws Exception {
HighUserCard userCard = highUserCardService.getDetailById(userCardId);
if (userCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户绑定的卡号信息");
}
if (!userCard.getType().equals(UserCardType.type3.getType())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡片类型错误");
}
// 查询订单信息
HighOrder order = getOrderById(orderId);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
if (!order.getOrderStatus().equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单不处于待支付状态");
}
// 油卡扣款
Map<String, Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", OilCardRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", order.getId());
consumeMap.put("sourceOrderNo", order.getOrderNo());
consumeMap.put("sourceContent", "订单号:" + order.getOrderNo() + ",消费:¥" + order.getPayPrice());
fleetOilCardService.consume(userCard.getCardNo(), order.getMemPhone(), order.getPayPrice(), consumeMap);
order.setMemCardType(userCard.getType());
order.setMemCardId(userCard.getId());
order.setMemCardNo(userCard.getCardNo());
order.setPayTime(new Date()); // 支付时间
order.setPayModel(OrderPayModelEnum.type4.getType()); // 支付模式:1 金币,2 第三方平台,3 混合
order.setPayType(OrderPayTypeEnum.type7.getType()); // 支付方式: 1:支付宝 2:微信 3:金币
order.setPayRealPrice(order.getPayPrice());
order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 查询用户
HighUser highUser = highUserService.findByUserId(order.getMemId());
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {
if (!highChildOrder.getGoodsType().equals(1) && !highChildOrder.getGoodsType().equals(3)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不支持支付该商品");
}
// 商品类型 商品类型 1:卡卷 2:金币充值
if (highChildOrder.getGoodsType() == 1) {
highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId());
// 是否预约
if (coupon.getReserveStatus() == true) {
HighOrderPre orderPre = new HighOrderPre();
orderPre.setCompanyId(coupon.getCompanyId());
orderPre.setMerchantId(coupon.getMerchantId());
orderPre.setMerchantStoreId(highChildOrder.getStoreId());
orderPre.setPreOrderNo(System.currentTimeMillis() + "");
orderPre.setOrderId(order.getId());
orderPre.setOrderNo(order.getOrderNo());
orderPre.setChildOrderId(highChildOrder.getId());
orderPre.setPayRealPrice(order.getPayRealPrice());
orderPre.setGoodsType(1);
orderPre.setGoodsName(coupon.getCouponName());
orderPre.setGoodsId(coupon.getId());
orderPre.setPreUserId(order.getMemId());
orderPre.setPreUserName(order.getMemName());
orderPre.setPreUserPhone(order.getMemPhone());
orderPre.setPreUserRemark(order.getRemarks());
orderPre.setStatus(1);
highOrderPreService.insertOrderPre(orderPre);
}
// 贵州中石化
if (coupon.getCouponSource() == 4) {
Map<String,Object> push = new HashMap<>();
push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", highUser.getPhone());
push.put("thirdUserId", highUser.getUnionId());
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(highChildOrder.getExt2());
if (returnParam != null && returnParam.getString("respCode").equals("0000")) {
// 解密
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data"));
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class);
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(1);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
} else {
HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId());
code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
code.setReceiveTime(new Date());
highCouponCodeService.updateCouponCode(code);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(code.getMerchantId());
highUserCoupon.setCouponId(code.getCouponId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCouponCodeId(code.getId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(code.getExt1());
// 计算使用有效期
Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, coupon.getRecycleDay());
if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) {
highUserCoupon.setUseEndTime(code.getUseEndTime());
} else {
highUserCoupon.setUseEndTime(userEndTime.getTime());
}
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
// 查询卡券是否有活动
Map<String, Object> activity = highActivityInfoService.getNewActivityByCouponId(coupon.getId());
if (activity != null && MapUtils.getLong(activity, "id") != null) {
highActivityUserLotteryNumService.addLotteryNum(MapUtils.getLong(activity, "id"), order.getMemId(), 1);
}
}
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setGasCarLicensePlate(carLicensePlate);
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) {
// 推送加好油
shellGroupService.gasSyncPayment(order.getOrderNo(),
store.getStoreKey(),
order.getPayTime(),
highChildOrder.getTotalPrice(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasGunNo(),
order.getPayablePrice(),
order.getDeductionPrice()
);
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) {
// 推送金猪加油
jinZhuJiaYouService.payOrder(order.getOrderNo(), highChildOrder.getGasPriceChannelPay());
}
}
}
updateOrder(order);
new Thread(() -> {
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
printGasOrder(order.getHighChildOrderList().get(0).getGoodsId(), order, false);
Map<String, Object> pushMsg = new HashMap<>();
pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId());
Map<String, Object> msgContent = new HashMap<>();
msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo()));
msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + ",收款:" + order.getTotalPrice() + "元"));
pushMsg.put("message", JSONObject.toJSONString(msgContent));
HttpsUtils.doPost("http://127.0.0.1:9901/msg/websocket/websocket", pushMsg, new HashMap<>());
}
}).start();
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void hltUnionCardPay(Long userCardId, Long orderId) throws Exception {

Loading…
Cancel
Save