提交代码

dev-discount
胡锐 2 years ago
parent 8bb1e466c9
commit 6120d54e1d
  1. 142
      hai-bweb/src/main/java/com/bweb/controller/HighFleetOilCardCarController.java
  2. 504
      hai-bweb/src/main/java/com/bweb/controller/HighFleetOilCardController.java
  3. 177
      hai-bweb/src/main/java/com/bweb/controller/HighFleetOilCardUserController.java
  4. 79
      hai-bweb/src/main/java/com/bweb/excelListener/ImportFleetOilCardCarListener.java
  5. 108
      hai-bweb/src/main/java/com/bweb/excelListener/ImportFleetOilCardUserListener.java
  6. 26
      hai-bweb/src/main/java/com/bweb/model/ImportFleetOilCardCarModel.java
  7. 23
      hai-bweb/src/main/java/com/bweb/model/ImportFleetOilCardUserModel.java
  8. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  9. 2
      hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java
  10. 8
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardCarMapper.java
  11. 8
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardCarSqlProvider.java
  12. 16
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardMapper.java
  13. 28
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardSqlProvider.java
  14. 23
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardUserMapper.java
  15. 36
      hai-service/src/main/java/com/hai/dao/HighFleetOilCardUserSqlProvider.java
  16. 32
      hai-service/src/main/java/com/hai/entity/HighFleetOilCard.java
  17. 6
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardCar.java
  18. 30
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardCarExample.java
  19. 120
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardExample.java
  20. 41
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardUser.java
  21. 151
      hai-service/src/main/java/com/hai/entity/HighFleetOilCardUserExample.java
  22. 5
      hai-service/src/main/java/com/hai/enum_type/CompanyAmountSourceTypeEnum.java
  23. 36
      hai-service/src/main/java/com/hai/enum_type/FleetOilCardStatusEnum.java
  24. 3
      hai-service/src/main/java/com/hai/enum_type/UserCardType.java
  25. 41
      hai-service/src/main/java/com/hai/service/HighFleetOilCardCarService.java
  26. 15
      hai-service/src/main/java/com/hai/service/HighFleetOilCardRecordService.java
  27. 100
      hai-service/src/main/java/com/hai/service/HighFleetOilCardService.java
  28. 54
      hai-service/src/main/java/com/hai/service/HighFleetOilCardUserService.java
  29. 84
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardCarServiceImpl.java
  30. 28
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardRecordServiceImpl.java
  31. 263
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardServiceImpl.java
  32. 147
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardUserServiceImpl.java
  33. 15
      hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java

@ -0,0 +1,142 @@
package com.bweb.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.bweb.excelListener.ImportFleetOilCardCarListener;
import com.bweb.excelListener.ImportFleetOilCardUserListener;
import com.bweb.model.ImportFleetOilCardCarModel;
import com.bweb.model.ImportFleetOilCardUserModel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighFleetOilCardCar;
import com.hai.enum_type.FleetOilCardStatusEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighFleetOilCardCarService;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighFleetOilCardUserService;
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.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/fleetOilCardCar")
@Api(value = "车队油卡用户")
public class HighFleetOilCardCarController {
private static Logger log = LoggerFactory.getLogger(HighFleetOilCardCarController.class);
@Resource
private UserCenter userCenter;
@Resource
private HighFleetOilCardCarService fleetOilCardCarService;
@Resource
private HighFleetOilCardService fleetOilCardService;
@RequestMapping(value = "/importData", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "导入数据")
public ResponseData importData(@RequestParam(name = "cardNo", required = true) String cardNo,
@RequestParam(value = "file" , required = false) MultipartFile files) {
try {
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel.getBsOrganization() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足");
}
// 查询油卡
HighFleetOilCard fleetOilCard = fleetOilCardService.getFleetOilCardByCardNo(cardNo);
if (fleetOilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到车队油卡信息");
}
if (!fleetOilCard.getStatus().equals(FleetOilCardStatusEnum.status1.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态异常");
}
ImportFleetOilCardCarListener fleetOilCardCarListener = new ImportFleetOilCardCarListener();
fleetOilCardCarListener.initData(userModel, fleetOilCardCarService, fleetOilCard);
EasyExcel.read(files.getInputStream(), ImportFleetOilCardCarModel.class, fleetOilCardCarListener).sheet().doRead();
Map<String, Object> map = new HashMap<>();
map.put("errorData", fleetOilCardCarListener.getErrorData());
map.put("errorTotal", fleetOilCardCarListener.getErrorData().size());
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("HighFleetOilCardUserController --> importData() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData delete(@RequestBody JSONObject body) {
try {
if (body.getLong("id") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighFleetOilCardCar cardCar = fleetOilCardCarService.getDetailById(body.getLong("id"));
if (cardCar == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
cardCar.setStatus(0);
fleetOilCardCarService.editData(cardCar);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> delete() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getCarList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询车列表")
public ResponseData getCarList(@RequestParam(name = "fleetOilCardNo", required = false) String fleetOilCardNo,
@RequestParam(name = "carLicensePlate", required = false) String carLicensePlate,
@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 = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> param = new HashMap<>();
param.put("fleetOilCardNo", fleetOilCardNo);
param.put("carLicensePlate", carLicensePlate);
param.put("contactName", contactName);
param.put("contactPhone", contactPhone);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("status", status);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(fleetOilCardCarService.getCarList(param)));
} catch (Exception e) {
log.error("HighOilCardController --> getCardList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,504 @@
package com.bweb.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.bweb.config.SysConst;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighCompanyTwoPwd;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighOilCard;
import com.hai.enum_type.OilCardStatusEnum;
import com.hai.model.OilCardOrderModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCompanyTwoPwdService;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighOilCardService;
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;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
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 HighFleetOilCardService fleetOilCardService;
@Resource
private HighCompanyTwoPwdService companyTwoPwdService;
@RequestMapping(value = "/recharge", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "油卡充值")
public ResponseData recharge(@RequestBody JSONObject body) {
try {
if (StringUtils.isBlank(body.getString("cardNo")) ||
body.getBigDecimal("price") == null ||
StringUtils.isBlank(body.getString("twoPwd"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel.getBsOrganization() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足");
}
// 查询二级密码
HighCompanyTwoPwd pwdByOrg = companyTwoPwdService.getTwoPwdByOrg(userModel.getBsOrganization().getId());
if (pwdByOrg == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_TOW_PWD, "");
}
if (!AESEncodeUtil.aesEncrypt(body.getString("twoPwd")).equals(pwdByOrg.getPassword())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付密码错误");
}
// 充值
fleetOilCardService.recharge(body.getString("cardNo"), body.getBigDecimal("price"), userModel.getBsOrganization().getId());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> recharge() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/recycleAmount", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "回收余额")
public ResponseData recycleAmount(@RequestBody JSONObject body) {
try {
if (StringUtils.isBlank(body.getString("cardNo")) ||
StringUtils.isBlank(body.getString("twoPwd"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel.getBsOrganization() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足");
}
// 查询二级密码
HighCompanyTwoPwd pwdByOrg = companyTwoPwdService.getTwoPwdByOrg(userModel.getBsOrganization().getId());
if (pwdByOrg == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_TOW_PWD, "");
}
if (!AESEncodeUtil.aesEncrypt(body.getString("twoPwd")).equals(pwdByOrg.getPassword())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付密码错误");
}
// 充值
fleetOilCardService.recycleAmount(body.getString("cardNo"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> recharge() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/generateCard", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "生成油卡")
public ResponseData generateCard(@RequestBody JSONObject body) {
try {
if (body.getInteger("generateNum") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel.getBsOrganization() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足");
}
fleetOilCardService.generateCard(userModel.getBsOrganization().getId(), body.getInteger("generateNum"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> generateCard() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/disabled", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "禁用")
public ResponseData disabled(@RequestBody JSONObject body) {
try {
if (StringUtils.isBlank(body.getString("cardNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
fleetOilCardService.disabled(body.getString("cardNo"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> disabled() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/setContact", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "设置联系人")
public ResponseData setContact(@RequestBody JSONObject body) {
try {
if (StringUtils.isBlank(body.getString("cardNo"))
|| StringUtils.isBlank(body.getString("contactName"))
|| StringUtils.isBlank(body.getString("contactPhone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel.getBsOrganization() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足");
}
fleetOilCardService.setContact(body.getString("cardNo"),body.getString("contactName"),body.getString("contactPhone"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> setContact() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/enable", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "启用")
public ResponseData enable(@RequestBody JSONObject body) {
try {
if (StringUtils.isBlank(body.getString("cardNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
fleetOilCardService.enable(body.getString("cardNo"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> enable() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getCardList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油卡列表")
public ResponseData getCardList(@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,
@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);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(fleetOilCardService.getFleetOilCardList(param)));
} catch (Exception e) {
log.error("HighOilCardController --> getCardList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/exportCard", 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) {
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;
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);
} catch (Exception e) {
log.error("HighOilCardController --> exportCard() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getCardOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油卡订单列表")
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 = "status", required = false) Integer status,
@RequestParam(name = "payTimeS", required = false) String payTimeS,
@RequestParam(name = "payTimeE", required = false) String payTimeE,
@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("status", status);
param.put("cardNo", cardNo);
param.put("goodsName", goodsName);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(fleetOilCardService.getFleetOilCardOrderList(param)));
} catch (Exception e) {
log.error("HighOilCardController --> getCardOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/exportCardOrder", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出油卡订单")
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 = "status", required = false) Integer status,
@RequestParam(name = "payTimeS", required = false) String payTimeS,
@RequestParam(name = "payTimeE", required = false) String payTimeE,
@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("status", status);
param.put("cardNo", cardNo);
param.put("goodsName", goodsName);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
List<OilCardOrderModel> cardOrderList = fleetOilCardService.getFleetOilCardOrderList(param);
List<String> headList = new ArrayList<>();
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("退款时间");
List<List<Object>> dataList = new ArrayList<>();
List<Object> data;
for (OilCardOrderModel cardOrder: cardOrderList) {
data = new ArrayList<>();
if (userModel.getSecUser().getAdminFlag() == 1) {
data.add(cardOrder.getOrgName());
data.add(cardOrder.getMerPhone());
}
data.add(cardOrder.getMemCardNo());
data.add(cardOrder.getOrderNo());
data.add(cardOrder.getGasOrderNo());
data.add(cardOrder.getTotalPrice());
data.add(cardOrder.getDeductionPrice());
data.add(cardOrder.getPayRealPrice());
data.add(cardOrder.getGoodsName());
data.add(cardOrder.getGasOilNo());
data.add(cardOrder.getGasGunNo());
data.add(cardOrder.getGasPriceGun());
data.add(cardOrder.getPlatformPriceGun());
data.add(cardOrder.getStatusName());
data.add(DateUtil.format(cardOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
data.add(DateUtil.format(cardOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"));
if (cardOrder.getRefundTime() != null) {
data.add(DateUtil.format(cardOrder.getRefundTime(), "yyyy-MM-dd HH:mm:ss"));
} else {
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);
} catch (Exception e) {
log.error("HighOilCardController --> getCardOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
/**
* 生成头部
* @param headList
* @return
*/
private static List<List<String>> generationHead(List<String> headList) {
List<List<String>> list = new ArrayList<>();
List<String> head;
for (String headStr : headList) {
head = new ArrayList<>();
head.add(headStr);
list.add(head);
}
return list;
}
}

@ -0,0 +1,177 @@
package com.bweb.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.bweb.excelListener.ImportCouponListener;
import com.bweb.excelListener.ImportFleetOilCardUserListener;
import com.bweb.model.ImportCouponModel;
import com.bweb.model.ImportFleetOilCardUserModel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighCompanyTwoPwd;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighFleetOilCardUser;
import com.hai.enum_type.FleetOilCardStatusEnum;
import com.hai.enum_type.OilCardStatusEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCompanyTwoPwdService;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighFleetOilCardUserService;
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;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/fleetOilCardUser")
@Api(value = "车队油卡用户")
public class HighFleetOilCardUserController {
private static Logger log = LoggerFactory.getLogger(HighFleetOilCardUserController.class);
@Resource
private UserCenter userCenter;
@Resource
private HighFleetOilCardUserService fleetOilCardUserService;
@Resource
private HighFleetOilCardService fleetOilCardService;
@RequestMapping(value = "/importData", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "导入数据")
public ResponseData importData(@RequestParam(name = "cardNo", required = true) String cardNo,
@RequestParam(value = "file" , required = false) MultipartFile files) {
try {
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel.getBsOrganization() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足");
}
// 查询油卡
HighFleetOilCard fleetOilCard = fleetOilCardService.getFleetOilCardByCardNo(cardNo);
if (fleetOilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到车队油卡信息");
}
if (!fleetOilCard.getStatus().equals(FleetOilCardStatusEnum.status1.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态异常");
}
ImportFleetOilCardUserListener fleetOilCardUserListener = new ImportFleetOilCardUserListener();
fleetOilCardUserListener.initData(userModel, fleetOilCard, fleetOilCardUserService);
EasyExcel.read(files.getInputStream(), ImportFleetOilCardUserModel.class, fleetOilCardUserListener).sheet().doRead();
Map<String, Object> map = new HashMap<>();
map.put("errorData", fleetOilCardUserListener.getErrorData());
map.put("errorTotal", fleetOilCardUserListener.getErrorData().size());
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("HighFleetOilCardUserController --> importData() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData delete(@RequestBody JSONObject body) {
try {
if (body.getLong("id") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
fleetOilCardUserService.delete(body.getLong("id"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOilCardController --> delete() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUserList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询用户列表")
public ResponseData getUserList(@RequestParam(name = "fleetOilCardNo", required = false) String fleetOilCardNo,
@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 = "status", required = false) Integer status,
@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("fleetOilCardNo", fleetOilCardNo);
param.put("contactName", contactName);
param.put("contactPhone", contactPhone);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("status", status);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(fleetOilCardUserService.getUserList(param)));
} catch (Exception e) {
log.error("HighOilCardController --> getCardList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUserOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询用户订单列表")
public ResponseData getUserOrderList(@RequestParam(name = "orgId", required = false) Long orgId,
@RequestParam(name = "cardNo", required = false) String cardNo,
@RequestParam(name = "goodsName", required = false) String goodsName,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "payTimeS", required = false) String payTimeS,
@RequestParam(name = "payTimeE", required = false) String payTimeE,
@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("status", status);
param.put("cardNo", cardNo);
param.put("goodsName", goodsName);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>());
} catch (Exception e) {
log.error("HighOilCardController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,79 @@
package com.bweb.excelListener;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.bweb.model.ImportFleetOilCardCarModel;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighFleetOilCardCar;
import com.hai.model.UserInfoModel;
import com.hai.service.HighFleetOilCardCarService;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
public class ImportFleetOilCardCarListener extends AnalysisEventListener<ImportFleetOilCardCarModel> {
List<ImportFleetOilCardCarModel> errorData = new ArrayList<>();
List<HighFleetOilCardCar> successData = new ArrayList<>();
UserInfoModel userInfoModel;
HighFleetOilCard fleetOilCard;
HighFleetOilCardCar fleetOilCardCar;
private HighFleetOilCardCarService fleetOilCardCarService;
/**
* @Author 胡锐
* @Description 解析到的每一条数据都会调用此方法
* @Date 2021/3/20 21:08
**/
@Override
public void invoke(ImportFleetOilCardCarModel fleetOilCardCarModel, AnalysisContext analysisContext) {
if (StringUtils.isBlank(fleetOilCardCarModel.getContactName())
|| StringUtils.isBlank(fleetOilCardCarModel.getContactPhone())
|| StringUtils.isBlank(fleetOilCardCarModel.getCarLicensePlate())) {
fleetOilCardCarModel.setErrMsg("有必填项未填写");
errorData.add(fleetOilCardCarModel);
return;
}
fleetOilCardCar = new HighFleetOilCardCar();
fleetOilCardCar.setFleetOilCardId(fleetOilCard.getId());
fleetOilCardCar.setFleetOilCardNo(fleetOilCard.getCardNo());
fleetOilCardCar.setContactName(fleetOilCardCarModel.getContactName());
fleetOilCardCar.setContactPhone(fleetOilCardCarModel.getContactPhone());
fleetOilCardCar.setCarLicensePlate(fleetOilCardCarModel.getCarLicensePlate());
fleetOilCardCar.setOpUserId(userInfoModel.getSecUser().getId());
fleetOilCardCar.setOpUserName(userInfoModel.getSecUser().getUserName());
fleetOilCardCar.setStatus(1);
successData.add(fleetOilCardCar);
}
/**
* @Author 胡锐
* @Description 所有数据解析完成了 都会来调用此方法
* @Date 2021/3/20 21:08
**/
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
if (successData.size() > 0) {
try {
fleetOilCardCarService.batchInsert(successData);
} catch (Exception e) {
e.printStackTrace();
}
}
this.successData.clear();
}
public List<ImportFleetOilCardCarModel> getErrorData() {
return errorData;
}
public void initData(UserInfoModel userInfoModel, HighFleetOilCardCarService fleetOilCardCarService, HighFleetOilCard fleetOilCard){
this.userInfoModel = userInfoModel;
this.fleetOilCardCarService = fleetOilCardCarService;
this.fleetOilCard = fleetOilCard;
}
}

@ -0,0 +1,108 @@
package com.bweb.excelListener;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.bweb.model.ImportCouponModel;
import com.bweb.model.ImportFleetOilCardUserModel;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.MemberValidateUtil;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighFleetOilCardUser;
import com.hai.model.UserInfoModel;
import com.hai.service.HighCouponCodeService;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighFleetOilCardUserService;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 导入车队油卡客户
* @className: ImportFleetOilCardUserListener
* @author: HuRui
* @date: 2022/12/19
**/
public class ImportFleetOilCardUserListener extends AnalysisEventListener<ImportFleetOilCardUserModel> {
List<ImportFleetOilCardUserModel> errorData = new ArrayList<>();
List<HighFleetOilCardUser> successData = new ArrayList<>();
List<HighFleetOilCardUser> allData = new ArrayList<>();
UserInfoModel userInfoModel;
HighFleetOilCard fleetOilCard;
HighFleetOilCardUser fleetOilCardUser;
private HighFleetOilCardUserService fleetOilCardUserService;
/**
* @Author 胡锐
* @Description 解析到的每一条数据都会调用此方法
* @Date 2021/3/20 21:08
**/
@Override
public void invoke(ImportFleetOilCardUserModel fleetOilCardUserModel, AnalysisContext analysisContext) {
if (StringUtils.isBlank(fleetOilCardUserModel.getContactName())
|| StringUtils.isBlank(fleetOilCardUserModel.getContactPhone())) {
fleetOilCardUserModel.setErrMsg("有必填项未填写");
errorData.add(fleetOilCardUserModel);
return;
}
if (MemberValidateUtil.validatePhone(fleetOilCardUserModel.getContactPhone()) == false) {
fleetOilCardUserModel.setErrMsg("客户电话格式校验未通过");
errorData.add(fleetOilCardUserModel);
return;
}
List<HighFleetOilCardUser> userList = allData.stream()
.filter(o -> o.getContactPhone().equals(fleetOilCardUserModel.getContactPhone()))
.collect(Collectors.toList());
if (userList.size() > 0) {
fleetOilCardUserModel.setErrMsg("客户电话:" + fleetOilCardUserModel.getContactPhone() + " 已存在,请勿重复录入");
errorData.add(fleetOilCardUserModel);
return;
}
fleetOilCardUser = new HighFleetOilCardUser();
fleetOilCardUser.setContactName(fleetOilCardUserModel.getContactName());
fleetOilCardUser.setContactPhone(fleetOilCardUserModel.getContactPhone());
fleetOilCardUser.setOpUserId(userInfoModel.getSecUser().getId());
fleetOilCardUser.setOpUserName(userInfoModel.getSecUser().getUserName());
successData.add(fleetOilCardUser);
allData.add(fleetOilCardUser);
}
/**
* @Author 胡锐
* @Description 所有数据解析完成了 都会来调用此方法
* @Date 2021/3/20 21:08
**/
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
if (successData.size() > 0) {
try {
fleetOilCardUserService.importData(fleetOilCard, successData);
} catch (Exception e) {
e.printStackTrace();
}
}
this.successData.clear();
this.allData.clear();
}
public List<ImportFleetOilCardUserModel> getErrorData() {
return errorData;
}
public void initData(UserInfoModel userInfoModel,HighFleetOilCard fleetOilCard, HighFleetOilCardUserService fleetOilCardUserService){
this.userInfoModel = userInfoModel;
this.fleetOilCard = fleetOilCard;
this.fleetOilCardUserService = fleetOilCardUserService;
this.allData = this.fleetOilCardUserService.getUserListByCard(fleetOilCard.getId());
}
}

@ -0,0 +1,26 @@
package com.bweb.model;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import lombok.Data;
/**
* @className: ImportFleetOilCardUserModel
* @author: HuRui
* @date: 2022/12/19
**/
@Data
public class ImportFleetOilCardCarModel {
@ExcelProperty("车主姓名")
private String contactName;
@ExcelProperty("车主电话")
private String contactPhone;
@ExcelProperty("车牌号")
private String carLicensePlate;
// 错误消息
private String errMsg;
}

@ -0,0 +1,23 @@
package com.bweb.model;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 导入车队油卡客户
* @className: ImportFleetOilCardUserModel
* @author: HuRui
* @date: 2022/12/19
**/
@Data
public class ImportFleetOilCardUserModel {
@ExcelProperty("客户姓名")
private String contactName;
@ExcelProperty("客户电话")
private String contactPhone;
// 错误消息
private String errMsg;
}

File diff suppressed because one or more lines are too long

@ -64,6 +64,8 @@ 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(URLDecoder.decode("mL4laIILGps4E58w8sbseQ%3D%3D", "UTF-8")));
/* String content = "{\"create_time\":1573544092110,\"order_serial_no\":\"40280e816db49c0b016db4a2c31f0004\",\"product_code\":\"8a9e80045cf85e54015cf8809fcd\",\"product_name\":\"平安发票贷\",\"uscc\":\"91370781687233838E\"}";
System.out.println("加密前" + content);

@ -45,7 +45,7 @@ public interface HighFleetOilCardCarMapper extends HighFleetOilCardCarMapperExt
"create_time, update_time, ",
"op_user_id, op_user_name, ",
"ext_1, ext_2, ext_3)",
"values (#{fleetOilCardId,jdbcType=BIGINT}, #{fleetOilCardNo,jdbcType=INTEGER}, ",
"values (#{fleetOilCardId,jdbcType=BIGINT}, #{fleetOilCardNo,jdbcType=VARCHAR}, ",
"#{carLicensePlate,jdbcType=VARCHAR}, #{contactName,jdbcType=VARCHAR}, ",
"#{contactPhone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
@ -63,7 +63,7 @@ public interface HighFleetOilCardCarMapper extends HighFleetOilCardCarMapperExt
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="fleet_oil_card_id", property="fleetOilCardId", jdbcType=JdbcType.BIGINT),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.INTEGER),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="car_license_plate", property="carLicensePlate", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_name", property="contactName", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_phone", property="contactPhone", jdbcType=JdbcType.VARCHAR),
@ -89,7 +89,7 @@ public interface HighFleetOilCardCarMapper extends HighFleetOilCardCarMapperExt
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="fleet_oil_card_id", property="fleetOilCardId", jdbcType=JdbcType.BIGINT),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.INTEGER),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="car_license_plate", property="carLicensePlate", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_name", property="contactName", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_phone", property="contactPhone", jdbcType=JdbcType.VARCHAR),
@ -116,7 +116,7 @@ public interface HighFleetOilCardCarMapper extends HighFleetOilCardCarMapperExt
@Update({
"update high_fleet_oil_card_car",
"set fleet_oil_card_id = #{fleetOilCardId,jdbcType=BIGINT},",
"fleet_oil_card_no = #{fleetOilCardNo,jdbcType=INTEGER},",
"fleet_oil_card_no = #{fleetOilCardNo,jdbcType=VARCHAR},",
"car_license_plate = #{carLicensePlate,jdbcType=VARCHAR},",
"contact_name = #{contactName,jdbcType=VARCHAR},",
"contact_phone = #{contactPhone,jdbcType=VARCHAR},",

@ -33,7 +33,7 @@ public class HighFleetOilCardCarSqlProvider {
}
if (record.getFleetOilCardNo() != null) {
sql.VALUES("fleet_oil_card_no", "#{fleetOilCardNo,jdbcType=INTEGER}");
sql.VALUES("fleet_oil_card_no", "#{fleetOilCardNo,jdbcType=VARCHAR}");
}
if (record.getCarLicensePlate() != null) {
@ -129,7 +129,7 @@ public class HighFleetOilCardCarSqlProvider {
}
if (record.getFleetOilCardNo() != null) {
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=INTEGER}");
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=VARCHAR}");
}
if (record.getCarLicensePlate() != null) {
@ -186,7 +186,7 @@ public class HighFleetOilCardCarSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("fleet_oil_card_id = #{record.fleetOilCardId,jdbcType=BIGINT}");
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=INTEGER}");
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=VARCHAR}");
sql.SET("car_license_plate = #{record.carLicensePlate,jdbcType=VARCHAR}");
sql.SET("contact_name = #{record.contactName,jdbcType=VARCHAR}");
sql.SET("contact_phone = #{record.contactPhone,jdbcType=VARCHAR}");
@ -213,7 +213,7 @@ public class HighFleetOilCardCarSqlProvider {
}
if (record.getFleetOilCardNo() != null) {
sql.SET("fleet_oil_card_no = #{fleetOilCardNo,jdbcType=INTEGER}");
sql.SET("fleet_oil_card_no = #{fleetOilCardNo,jdbcType=VARCHAR}");
}
if (record.getCarLicensePlate() != null) {

@ -43,8 +43,7 @@ public interface HighFleetOilCardMapper extends HighFleetOilCardMapperExt {
"org_id, org_name, card_no, ",
"amount, amount_consume, ",
"contact_name, contact_phone, ",
"`status`, bind_status, ",
"bind_time, create_time, ",
"`status`, create_time, ",
"update_time, op_user_id, ",
"op_user_name, ext_1, ",
"ext_2, ext_3)",
@ -52,8 +51,7 @@ public interface HighFleetOilCardMapper extends HighFleetOilCardMapperExt {
"#{orgId,jdbcType=BIGINT}, #{orgName,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, ",
"#{amount,jdbcType=DECIMAL}, #{amountConsume,jdbcType=DECIMAL}, ",
"#{contactName,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{bindStatus,jdbcType=INTEGER}, ",
"#{bindTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{opUserId,jdbcType=BIGINT}, ",
"#{opUserName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
@ -78,8 +76,6 @@ public interface HighFleetOilCardMapper extends HighFleetOilCardMapperExt {
@Result(column="contact_name", property="contactName", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_phone", property="contactPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="bind_status", property="bindStatus", jdbcType=JdbcType.INTEGER),
@Result(column="bind_time", property="bindTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@ -93,8 +89,8 @@ public interface HighFleetOilCardMapper extends HighFleetOilCardMapperExt {
@Select({
"select",
"id, company_id, company_name, org_id, org_name, card_no, amount, amount_consume, ",
"contact_name, contact_phone, `status`, bind_status, bind_time, create_time, ",
"update_time, op_user_id, op_user_name, ext_1, ext_2, ext_3",
"contact_name, contact_phone, `status`, create_time, update_time, op_user_id, ",
"op_user_name, ext_1, ext_2, ext_3",
"from high_fleet_oil_card",
"where id = #{id,jdbcType=BIGINT}"
})
@ -110,8 +106,6 @@ public interface HighFleetOilCardMapper extends HighFleetOilCardMapperExt {
@Result(column="contact_name", property="contactName", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_phone", property="contactPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="bind_status", property="bindStatus", jdbcType=JdbcType.INTEGER),
@Result(column="bind_time", property="bindTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@ -143,8 +137,6 @@ public interface HighFleetOilCardMapper extends HighFleetOilCardMapperExt {
"contact_name = #{contactName,jdbcType=VARCHAR},",
"contact_phone = #{contactPhone,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"bind_status = #{bindStatus,jdbcType=INTEGER},",
"bind_time = #{bindTime,jdbcType=TIMESTAMP},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",

@ -68,14 +68,6 @@ public class HighFleetOilCardSqlProvider {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getBindStatus() != null) {
sql.VALUES("bind_status", "#{bindStatus,jdbcType=INTEGER}");
}
if (record.getBindTime() != null) {
sql.VALUES("bind_time", "#{bindTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -124,8 +116,6 @@ public class HighFleetOilCardSqlProvider {
sql.SELECT("contact_name");
sql.SELECT("contact_phone");
sql.SELECT("`status`");
sql.SELECT("bind_status");
sql.SELECT("bind_time");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("op_user_id");
@ -194,14 +184,6 @@ public class HighFleetOilCardSqlProvider {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getBindStatus() != null) {
sql.SET("bind_status = #{record.bindStatus,jdbcType=INTEGER}");
}
if (record.getBindTime() != null) {
sql.SET("bind_time = #{record.bindTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -249,8 +231,6 @@ public class HighFleetOilCardSqlProvider {
sql.SET("contact_name = #{record.contactName,jdbcType=VARCHAR}");
sql.SET("contact_phone = #{record.contactPhone,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("bind_status = #{record.bindStatus,jdbcType=INTEGER}");
sql.SET("bind_time = #{record.bindTime,jdbcType=TIMESTAMP}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
@ -308,14 +288,6 @@ public class HighFleetOilCardSqlProvider {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getBindStatus() != null) {
sql.SET("bind_status = #{bindStatus,jdbcType=INTEGER}");
}
if (record.getBindTime() != null) {
sql.SET("bind_time = #{bindTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -41,13 +41,15 @@ public interface HighFleetOilCardUserMapper extends HighFleetOilCardUserMapperEx
@Insert({
"insert into high_fleet_oil_card_user (fleet_oil_card_id, fleet_oil_card_no, ",
"contact_name, contact_phone, ",
"`status`, create_time, ",
"`status`, amount_consume, ",
"lately_consume_time, create_time, ",
"update_time, op_user_id, ",
"op_user_name, ext_1, ",
"ext_2, ext_3)",
"values (#{fleetOilCardId,jdbcType=BIGINT}, #{fleetOilCardNo,jdbcType=INTEGER}, ",
"values (#{fleetOilCardId,jdbcType=BIGINT}, #{fleetOilCardNo,jdbcType=VARCHAR}, ",
"#{contactName,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{amountConsume,jdbcType=DECIMAL}, ",
"#{latelyConsumeTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{opUserId,jdbcType=BIGINT}, ",
"#{opUserName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
@ -63,10 +65,12 @@ public interface HighFleetOilCardUserMapper extends HighFleetOilCardUserMapperEx
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="fleet_oil_card_id", property="fleetOilCardId", jdbcType=JdbcType.BIGINT),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.INTEGER),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_name", property="contactName", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_phone", property="contactPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="amount_consume", property="amountConsume", jdbcType=JdbcType.DECIMAL),
@Result(column="lately_consume_time", property="latelyConsumeTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@ -80,17 +84,20 @@ public interface HighFleetOilCardUserMapper extends HighFleetOilCardUserMapperEx
@Select({
"select",
"id, fleet_oil_card_id, fleet_oil_card_no, contact_name, contact_phone, `status`, ",
"create_time, update_time, op_user_id, op_user_name, ext_1, ext_2, ext_3",
"amount_consume, lately_consume_time, create_time, update_time, op_user_id, op_user_name, ",
"ext_1, ext_2, ext_3",
"from high_fleet_oil_card_user",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="fleet_oil_card_id", property="fleetOilCardId", jdbcType=JdbcType.BIGINT),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.INTEGER),
@Result(column="fleet_oil_card_no", property="fleetOilCardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_name", property="contactName", jdbcType=JdbcType.VARCHAR),
@Result(column="contact_phone", property="contactPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="amount_consume", property="amountConsume", jdbcType=JdbcType.DECIMAL),
@Result(column="lately_consume_time", property="latelyConsumeTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@ -113,10 +120,12 @@ public interface HighFleetOilCardUserMapper extends HighFleetOilCardUserMapperEx
@Update({
"update high_fleet_oil_card_user",
"set fleet_oil_card_id = #{fleetOilCardId,jdbcType=BIGINT},",
"fleet_oil_card_no = #{fleetOilCardNo,jdbcType=INTEGER},",
"fleet_oil_card_no = #{fleetOilCardNo,jdbcType=VARCHAR},",
"contact_name = #{contactName,jdbcType=VARCHAR},",
"contact_phone = #{contactPhone,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"amount_consume = #{amountConsume,jdbcType=DECIMAL},",
"lately_consume_time = #{latelyConsumeTime,jdbcType=TIMESTAMP},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",

@ -33,7 +33,7 @@ public class HighFleetOilCardUserSqlProvider {
}
if (record.getFleetOilCardNo() != null) {
sql.VALUES("fleet_oil_card_no", "#{fleetOilCardNo,jdbcType=INTEGER}");
sql.VALUES("fleet_oil_card_no", "#{fleetOilCardNo,jdbcType=VARCHAR}");
}
if (record.getContactName() != null) {
@ -48,6 +48,14 @@ public class HighFleetOilCardUserSqlProvider {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getAmountConsume() != null) {
sql.VALUES("amount_consume", "#{amountConsume,jdbcType=DECIMAL}");
}
if (record.getLatelyConsumeTime() != null) {
sql.VALUES("lately_consume_time", "#{latelyConsumeTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -91,6 +99,8 @@ public class HighFleetOilCardUserSqlProvider {
sql.SELECT("contact_name");
sql.SELECT("contact_phone");
sql.SELECT("`status`");
sql.SELECT("amount_consume");
sql.SELECT("lately_consume_time");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("op_user_id");
@ -124,7 +134,7 @@ public class HighFleetOilCardUserSqlProvider {
}
if (record.getFleetOilCardNo() != null) {
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=INTEGER}");
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=VARCHAR}");
}
if (record.getContactName() != null) {
@ -139,6 +149,14 @@ public class HighFleetOilCardUserSqlProvider {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getAmountConsume() != null) {
sql.SET("amount_consume = #{record.amountConsume,jdbcType=DECIMAL}");
}
if (record.getLatelyConsumeTime() != null) {
sql.SET("lately_consume_time = #{record.latelyConsumeTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -177,10 +195,12 @@ public class HighFleetOilCardUserSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("fleet_oil_card_id = #{record.fleetOilCardId,jdbcType=BIGINT}");
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=INTEGER}");
sql.SET("fleet_oil_card_no = #{record.fleetOilCardNo,jdbcType=VARCHAR}");
sql.SET("contact_name = #{record.contactName,jdbcType=VARCHAR}");
sql.SET("contact_phone = #{record.contactPhone,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("amount_consume = #{record.amountConsume,jdbcType=DECIMAL}");
sql.SET("lately_consume_time = #{record.latelyConsumeTime,jdbcType=TIMESTAMP}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
@ -203,7 +223,7 @@ public class HighFleetOilCardUserSqlProvider {
}
if (record.getFleetOilCardNo() != null) {
sql.SET("fleet_oil_card_no = #{fleetOilCardNo,jdbcType=INTEGER}");
sql.SET("fleet_oil_card_no = #{fleetOilCardNo,jdbcType=VARCHAR}");
}
if (record.getContactName() != null) {
@ -218,6 +238,14 @@ public class HighFleetOilCardUserSqlProvider {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getAmountConsume() != null) {
sql.SET("amount_consume = #{amountConsume,jdbcType=DECIMAL}");
}
if (record.getLatelyConsumeTime() != null) {
sql.SET("lately_consume_time = #{latelyConsumeTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -66,16 +66,6 @@ public class HighFleetOilCard implements Serializable {
*/
private Integer status;
/**
* 绑定状态 0未绑定 1已绑定
*/
private Integer bindStatus;
/**
* 绑定时间
*/
private Date bindTime;
/**
* 创建时间
*/
@ -192,22 +182,6 @@ public class HighFleetOilCard implements Serializable {
this.status = status;
}
public Integer getBindStatus() {
return bindStatus;
}
public void setBindStatus(Integer bindStatus) {
this.bindStatus = bindStatus;
}
public Date getBindTime() {
return bindTime;
}
public void setBindTime(Date bindTime) {
this.bindTime = bindTime;
}
public Date getCreateTime() {
return createTime;
}
@ -287,8 +261,6 @@ public class HighFleetOilCard implements Serializable {
&& (this.getContactName() == null ? other.getContactName() == null : this.getContactName().equals(other.getContactName()))
&& (this.getContactPhone() == null ? other.getContactPhone() == null : this.getContactPhone().equals(other.getContactPhone()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getBindStatus() == null ? other.getBindStatus() == null : this.getBindStatus().equals(other.getBindStatus()))
&& (this.getBindTime() == null ? other.getBindTime() == null : this.getBindTime().equals(other.getBindTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
@ -313,8 +285,6 @@ public class HighFleetOilCard implements Serializable {
result = prime * result + ((getContactName() == null) ? 0 : getContactName().hashCode());
result = prime * result + ((getContactPhone() == null) ? 0 : getContactPhone().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getBindStatus() == null) ? 0 : getBindStatus().hashCode());
result = prime * result + ((getBindTime() == null) ? 0 : getBindTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
@ -342,8 +312,6 @@ public class HighFleetOilCard implements Serializable {
sb.append(", contactName=").append(contactName);
sb.append(", contactPhone=").append(contactPhone);
sb.append(", status=").append(status);
sb.append(", bindStatus=").append(bindStatus);
sb.append(", bindTime=").append(bindTime);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", opUserId=").append(opUserId);

@ -23,7 +23,7 @@ public class HighFleetOilCardCar implements Serializable {
/**
* 车队油卡卡号
*/
private Integer fleetOilCardNo;
private String fleetOilCardNo;
/**
* 车牌
@ -89,11 +89,11 @@ public class HighFleetOilCardCar implements Serializable {
this.fleetOilCardId = fleetOilCardId;
}
public Integer getFleetOilCardNo() {
public String getFleetOilCardNo() {
return fleetOilCardNo;
}
public void setFleetOilCardNo(Integer fleetOilCardNo) {
public void setFleetOilCardNo(String fleetOilCardNo) {
this.fleetOilCardNo = fleetOilCardNo;
}

@ -255,52 +255,62 @@ public class HighFleetOilCardCarExample {
return (Criteria) this;
}
public Criteria andFleetOilCardNoEqualTo(Integer value) {
public Criteria andFleetOilCardNoEqualTo(String value) {
addCriterion("fleet_oil_card_no =", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotEqualTo(Integer value) {
public Criteria andFleetOilCardNoNotEqualTo(String value) {
addCriterion("fleet_oil_card_no <>", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoGreaterThan(Integer value) {
public Criteria andFleetOilCardNoGreaterThan(String value) {
addCriterion("fleet_oil_card_no >", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoGreaterThanOrEqualTo(Integer value) {
public Criteria andFleetOilCardNoGreaterThanOrEqualTo(String value) {
addCriterion("fleet_oil_card_no >=", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoLessThan(Integer value) {
public Criteria andFleetOilCardNoLessThan(String value) {
addCriterion("fleet_oil_card_no <", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoLessThanOrEqualTo(Integer value) {
public Criteria andFleetOilCardNoLessThanOrEqualTo(String value) {
addCriterion("fleet_oil_card_no <=", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoIn(List<Integer> values) {
public Criteria andFleetOilCardNoLike(String value) {
addCriterion("fleet_oil_card_no like", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotLike(String value) {
addCriterion("fleet_oil_card_no not like", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoIn(List<String> values) {
addCriterion("fleet_oil_card_no in", values, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotIn(List<Integer> values) {
public Criteria andFleetOilCardNoNotIn(List<String> values) {
addCriterion("fleet_oil_card_no not in", values, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoBetween(Integer value1, Integer value2) {
public Criteria andFleetOilCardNoBetween(String value1, String value2) {
addCriterion("fleet_oil_card_no between", value1, value2, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotBetween(Integer value1, Integer value2) {
public Criteria andFleetOilCardNoNotBetween(String value1, String value2) {
addCriterion("fleet_oil_card_no not between", value1, value2, "fleetOilCardNo");
return (Criteria) this;
}

@ -836,126 +836,6 @@ public class HighFleetOilCardExample {
return (Criteria) this;
}
public Criteria andBindStatusIsNull() {
addCriterion("bind_status is null");
return (Criteria) this;
}
public Criteria andBindStatusIsNotNull() {
addCriterion("bind_status is not null");
return (Criteria) this;
}
public Criteria andBindStatusEqualTo(Integer value) {
addCriterion("bind_status =", value, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusNotEqualTo(Integer value) {
addCriterion("bind_status <>", value, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusGreaterThan(Integer value) {
addCriterion("bind_status >", value, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("bind_status >=", value, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusLessThan(Integer value) {
addCriterion("bind_status <", value, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusLessThanOrEqualTo(Integer value) {
addCriterion("bind_status <=", value, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusIn(List<Integer> values) {
addCriterion("bind_status in", values, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusNotIn(List<Integer> values) {
addCriterion("bind_status not in", values, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusBetween(Integer value1, Integer value2) {
addCriterion("bind_status between", value1, value2, "bindStatus");
return (Criteria) this;
}
public Criteria andBindStatusNotBetween(Integer value1, Integer value2) {
addCriterion("bind_status not between", value1, value2, "bindStatus");
return (Criteria) this;
}
public Criteria andBindTimeIsNull() {
addCriterion("bind_time is null");
return (Criteria) this;
}
public Criteria andBindTimeIsNotNull() {
addCriterion("bind_time is not null");
return (Criteria) this;
}
public Criteria andBindTimeEqualTo(Date value) {
addCriterion("bind_time =", value, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeNotEqualTo(Date value) {
addCriterion("bind_time <>", value, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeGreaterThan(Date value) {
addCriterion("bind_time >", value, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeGreaterThanOrEqualTo(Date value) {
addCriterion("bind_time >=", value, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeLessThan(Date value) {
addCriterion("bind_time <", value, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeLessThanOrEqualTo(Date value) {
addCriterion("bind_time <=", value, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeIn(List<Date> values) {
addCriterion("bind_time in", values, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeNotIn(List<Date> values) {
addCriterion("bind_time not in", values, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeBetween(Date value1, Date value2) {
addCriterion("bind_time between", value1, value2, "bindTime");
return (Criteria) this;
}
public Criteria andBindTimeNotBetween(Date value1, Date value2) {
addCriterion("bind_time not between", value1, value2, "bindTime");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time 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;
/**
@ -23,7 +24,7 @@ public class HighFleetOilCardUser implements Serializable {
/**
* 车队油卡卡号
*/
private Integer fleetOilCardNo;
private String fleetOilCardNo;
/**
* 联系人姓名
@ -36,10 +37,20 @@ public class HighFleetOilCardUser implements Serializable {
private String contactPhone;
/**
* 状态 0删除 1正常
* 状态 0删除 1正常 2禁用
*/
private Integer status;
/**
* 消费金额
*/
private BigDecimal amountConsume;
/**
* 最近消费时间
*/
private Date latelyConsumeTime;
/**
* 创建时间
*/
@ -84,11 +95,11 @@ public class HighFleetOilCardUser implements Serializable {
this.fleetOilCardId = fleetOilCardId;
}
public Integer getFleetOilCardNo() {
public String getFleetOilCardNo() {
return fleetOilCardNo;
}
public void setFleetOilCardNo(Integer fleetOilCardNo) {
public void setFleetOilCardNo(String fleetOilCardNo) {
this.fleetOilCardNo = fleetOilCardNo;
}
@ -116,6 +127,22 @@ public class HighFleetOilCardUser implements Serializable {
this.status = status;
}
public BigDecimal getAmountConsume() {
return amountConsume;
}
public void setAmountConsume(BigDecimal amountConsume) {
this.amountConsume = amountConsume;
}
public Date getLatelyConsumeTime() {
return latelyConsumeTime;
}
public void setLatelyConsumeTime(Date latelyConsumeTime) {
this.latelyConsumeTime = latelyConsumeTime;
}
public Date getCreateTime() {
return createTime;
}
@ -190,6 +217,8 @@ public class HighFleetOilCardUser implements Serializable {
&& (this.getContactName() == null ? other.getContactName() == null : this.getContactName().equals(other.getContactName()))
&& (this.getContactPhone() == null ? other.getContactPhone() == null : this.getContactPhone().equals(other.getContactPhone()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getAmountConsume() == null ? other.getAmountConsume() == null : this.getAmountConsume().equals(other.getAmountConsume()))
&& (this.getLatelyConsumeTime() == null ? other.getLatelyConsumeTime() == null : this.getLatelyConsumeTime().equals(other.getLatelyConsumeTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
@ -209,6 +238,8 @@ public class HighFleetOilCardUser implements Serializable {
result = prime * result + ((getContactName() == null) ? 0 : getContactName().hashCode());
result = prime * result + ((getContactPhone() == null) ? 0 : getContactPhone().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getAmountConsume() == null) ? 0 : getAmountConsume().hashCode());
result = prime * result + ((getLatelyConsumeTime() == null) ? 0 : getLatelyConsumeTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
@ -231,6 +262,8 @@ public class HighFleetOilCardUser implements Serializable {
sb.append(", contactName=").append(contactName);
sb.append(", contactPhone=").append(contactPhone);
sb.append(", status=").append(status);
sb.append(", amountConsume=").append(amountConsume);
sb.append(", latelyConsumeTime=").append(latelyConsumeTime);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", opUserId=").append(opUserId);

@ -1,5 +1,6 @@
package com.hai.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -255,52 +256,62 @@ public class HighFleetOilCardUserExample {
return (Criteria) this;
}
public Criteria andFleetOilCardNoEqualTo(Integer value) {
public Criteria andFleetOilCardNoEqualTo(String value) {
addCriterion("fleet_oil_card_no =", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotEqualTo(Integer value) {
public Criteria andFleetOilCardNoNotEqualTo(String value) {
addCriterion("fleet_oil_card_no <>", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoGreaterThan(Integer value) {
public Criteria andFleetOilCardNoGreaterThan(String value) {
addCriterion("fleet_oil_card_no >", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoGreaterThanOrEqualTo(Integer value) {
public Criteria andFleetOilCardNoGreaterThanOrEqualTo(String value) {
addCriterion("fleet_oil_card_no >=", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoLessThan(Integer value) {
public Criteria andFleetOilCardNoLessThan(String value) {
addCriterion("fleet_oil_card_no <", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoLessThanOrEqualTo(Integer value) {
public Criteria andFleetOilCardNoLessThanOrEqualTo(String value) {
addCriterion("fleet_oil_card_no <=", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoIn(List<Integer> values) {
public Criteria andFleetOilCardNoLike(String value) {
addCriterion("fleet_oil_card_no like", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotLike(String value) {
addCriterion("fleet_oil_card_no not like", value, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoIn(List<String> values) {
addCriterion("fleet_oil_card_no in", values, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotIn(List<Integer> values) {
public Criteria andFleetOilCardNoNotIn(List<String> values) {
addCriterion("fleet_oil_card_no not in", values, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoBetween(Integer value1, Integer value2) {
public Criteria andFleetOilCardNoBetween(String value1, String value2) {
addCriterion("fleet_oil_card_no between", value1, value2, "fleetOilCardNo");
return (Criteria) this;
}
public Criteria andFleetOilCardNoNotBetween(Integer value1, Integer value2) {
public Criteria andFleetOilCardNoNotBetween(String value1, String value2) {
addCriterion("fleet_oil_card_no not between", value1, value2, "fleetOilCardNo");
return (Criteria) this;
}
@ -505,6 +516,126 @@ public class HighFleetOilCardUserExample {
return (Criteria) this;
}
public Criteria andAmountConsumeIsNull() {
addCriterion("amount_consume is null");
return (Criteria) this;
}
public Criteria andAmountConsumeIsNotNull() {
addCriterion("amount_consume is not null");
return (Criteria) this;
}
public Criteria andAmountConsumeEqualTo(BigDecimal value) {
addCriterion("amount_consume =", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeNotEqualTo(BigDecimal value) {
addCriterion("amount_consume <>", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeGreaterThan(BigDecimal value) {
addCriterion("amount_consume >", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("amount_consume >=", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeLessThan(BigDecimal value) {
addCriterion("amount_consume <", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeLessThanOrEqualTo(BigDecimal value) {
addCriterion("amount_consume <=", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeIn(List<BigDecimal> values) {
addCriterion("amount_consume in", values, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeNotIn(List<BigDecimal> values) {
addCriterion("amount_consume not in", values, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amount_consume between", value1, value2, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amount_consume not between", value1, value2, "amountConsume");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeIsNull() {
addCriterion("lately_consume_time is null");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeIsNotNull() {
addCriterion("lately_consume_time is not null");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeEqualTo(Date value) {
addCriterion("lately_consume_time =", value, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeNotEqualTo(Date value) {
addCriterion("lately_consume_time <>", value, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeGreaterThan(Date value) {
addCriterion("lately_consume_time >", value, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeGreaterThanOrEqualTo(Date value) {
addCriterion("lately_consume_time >=", value, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeLessThan(Date value) {
addCriterion("lately_consume_time <", value, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeLessThanOrEqualTo(Date value) {
addCriterion("lately_consume_time <=", value, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeIn(List<Date> values) {
addCriterion("lately_consume_time in", values, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeNotIn(List<Date> values) {
addCriterion("lately_consume_time not in", values, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeBetween(Date value1, Date value2) {
addCriterion("lately_consume_time between", value1, value2, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andLatelyConsumeTimeNotBetween(Date value1, Date value2) {
addCriterion("lately_consume_time not between", value1, value2, "latelyConsumeTime");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

@ -6,8 +6,9 @@ package com.hai.enum_type;
*/
public enum CompanyAmountSourceTypeEnum {
type1(1, "金额充值"),
type2(2, "油卡充值"),
type3(3, "回收余额")
type2(2, "个人油卡充值"),
type3(3, "回收余额"),
type4(4, "车队油卡充值")
;
private Integer type;

@ -0,0 +1,36 @@
package com.hai.enum_type;
/**
* 油卡状态
* @author hurui
*/
public enum FleetOilCardStatusEnum {
status0(0 , "删除"),
status1(1 , "正常"),
status2(2 , "禁用"),
;
private Integer status;
private String name;
FleetOilCardStatusEnum(int status , String name) {
this.status = status;
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -8,7 +8,8 @@ import java.util.Objects;
public enum UserCardType {
type1(1, "汇联通工会卡"),
type2(2, "嗨森逛油卡"),
type2(2, "嗨森逛个人油卡"),
type3(3, "嗨森逛车队油卡"),
;
private Integer type;

@ -0,0 +1,41 @@
package com.hai.service;
import com.hai.entity.HighFleetOilCardCar;
import java.util.List;
import java.util.Map;
/**
* @className: HighFleetOilCardCarService
* @author: HuRui
* @date: 2022/12/19
**/
public interface HighFleetOilCardCarService {
/**
* 编辑数据
* @param fleetOilCardCar
*/
void editData(HighFleetOilCardCar fleetOilCardCar);
/**
* 批量增加
* @param fleetOilCardCarList
*/
void batchInsert(List<HighFleetOilCardCar> fleetOilCardCarList);
/**
* 根据id查询详情
* @param id
* @return
*/
HighFleetOilCardCar getDetailById(Long id);
/**
* 查询车辆列表
* @param param
* @return
*/
List<HighFleetOilCardCar> getCarList(Map<String, Object> param);
}

@ -0,0 +1,15 @@
package com.hai.service;
import com.hai.entity.HighFleetOilCardRecord;
/**
* @className: HighFleetOilCardRecordService
* @author: HuRui
* @date: 2022/12/12
**/
public interface HighFleetOilCardRecordService {
void insertRecord(HighFleetOilCardRecord fleetOilCardRecord);
}

@ -0,0 +1,100 @@
package com.hai.service;
import com.hai.entity.HighFleetOilCard;
import com.hai.model.OilCardOrderModel;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 车队油卡服务
* @className: HighFleetOilCardService
* @author: HuRui
* @date: 2022/12/12
**/
public interface HighFleetOilCardService {
/**
* 编辑数据
* @param fleetOilCard
*/
void editData(HighFleetOilCard fleetOilCard);
/**
* 油卡充值
* @param fleetCardNo 车队油卡卡号
* @param price 充值金额
* @param orgId 部门id
*/
void recharge(String fleetCardNo, BigDecimal price, Long orgId);
/**
* 回收余额
* @param fleetCardNo 车队油卡卡号
*/
void recycleAmount(String fleetCardNo);
/**
* 查询车队油卡详情
* @param fleetCardNo 卡号
* @return
*/
HighFleetOilCard getFleetOilCardByCardNo(String fleetCardNo);
/**
* 油卡消费
* @param fleetCardNo 车队油卡卡号
* @param amount 充值金额
* @param otherParam 其他参数
*/
void consume(String fleetCardNo, BigDecimal amount, Map<String, Object> otherParam);
/**
* 订单退款
* @param orderNo 订单号
*/
void refund(String orderNo);
/**
* 生成油卡
* @param orgId 部门id
* @param generateNum 生成数量
*/
void generateCard(Long orgId, Integer generateNum);
/**
* 绑定联系人
* @param cardNo 卡号
* @param contactName 联系人名称
* @param contactPhone 联系人手机号
*/
void setContact(String cardNo,String contactName, String contactPhone);
/**
* 禁用
* @param fleetCardNo 车队油卡卡号
*/
void disabled(String fleetCardNo);
/**
* 启用
* @param fleetCardNo 车队油卡卡号
*/
void enable(String fleetCardNo);
/**
* 查询油卡列表
* @param param 参数
* @return
*/
List<HighFleetOilCard> getFleetOilCardList(Map<String,Object> param);
/**
* 查询油卡订单列表
* @param param
* @return
*/
List<OilCardOrderModel> getFleetOilCardOrderList(Map<String,Object> param) throws Exception;
}

@ -0,0 +1,54 @@
package com.hai.service;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighFleetOilCardUser;
import java.util.List;
import java.util.Map;
/**
* @className: HighFleetOilCardUserService
* @author: HuRui
* @date: 2022/12/12
**/
public interface HighFleetOilCardUserService {
/**
* 编辑用户
* @param fleetOilCardUser
*/
void editUser(HighFleetOilCardUser fleetOilCardUser);
/**
*
* @param fleetOilCardUserList
*/
void importData(HighFleetOilCard fleetOilCard, List<HighFleetOilCardUser> fleetOilCardUserList);
/**
* 根据iD查询详情
* @param id
* @return
*/
HighFleetOilCardUser getDetailById(Long id);
/**
* 删除
* @param id
*/
void delete(Long id);
/**
* 查询用户列表
* @param param
* @return
*/
List<HighFleetOilCardUser> getUserList(Map<String, Object> param);
/**
* 根据油卡查询用户列表
* @param cardId
* @return
*/
List<HighFleetOilCardUser> getUserListByCard(Long cardId);
}

@ -0,0 +1,84 @@
package com.hai.service.impl;
import com.hai.dao.HighFleetOilCardCarMapper;
import com.hai.entity.HighFleetOilCardCar;
import com.hai.entity.HighFleetOilCardCarExample;
import com.hai.service.HighFleetOilCardCarService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: HighFleetOilCardCarServiceImpl
* @author: HuRui
* @date: 2022/12/19
**/
@Service("fleetOilCardCarService")
public class HighFleetOilCardCarServiceImpl implements HighFleetOilCardCarService {
@Resource
private HighFleetOilCardCarMapper fleetOilCardCarMapper;
@Override
public void editData(HighFleetOilCardCar fleetOilCardCar) {
if (fleetOilCardCar.getId() == null) {
fleetOilCardCar.setCreateTime(new Date());
fleetOilCardCar.setUpdateTime(new Date());
fleetOilCardCarMapper.insert(fleetOilCardCar);
} else {
fleetOilCardCar.setUpdateTime(new Date());
fleetOilCardCarMapper.updateByPrimaryKey(fleetOilCardCar);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void batchInsert(List<HighFleetOilCardCar> fleetOilCardCarList) {
for (HighFleetOilCardCar fleetOilCardCar : fleetOilCardCarList){
editData(fleetOilCardCar);
}
}
@Override
public HighFleetOilCardCar getDetailById(Long id) {
return fleetOilCardCarMapper.selectByPrimaryKey(id);
}
@Override
public List<HighFleetOilCardCar> getCarList(Map<String, Object> param) {
HighFleetOilCardCarExample example = new HighFleetOilCardCarExample();
HighFleetOilCardCarExample.Criteria criteria = example.createCriteria()
.andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "fleetOilCardId") != null) {
criteria.andFleetOilCardIdEqualTo(MapUtils.getLong(param, "fleetOilCardId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "fleetOilCardNo"))) {
criteria.andFleetOilCardNoLike("%"+MapUtils.getString(param, "fleetOilCardNo")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "carLicensePlate"))) {
criteria.andCarLicensePlateLike("%"+MapUtils.getString(param, "carLicensePlate")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactName"))) {
criteria.andContactNameLike("%"+MapUtils.getString(param, "contactName")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactPhone"))) {
criteria.andContactPhoneLike("%"+MapUtils.getString(param, "contactPhone")+"%");
}
example.setOrderByClause("create_time desc");
return fleetOilCardCarMapper.selectByExample(example);
}
}

@ -0,0 +1,28 @@
package com.hai.service.impl;
import com.hai.dao.HighFleetOilCardRecordMapper;
import com.hai.entity.HighFleetOilCardRecord;
import com.hai.service.HighFleetOilCardRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
/**
* @className: HighFleetOilCardRecordServiceImpl
* @author: HuRui
* @date: 2022/12/12
**/
@Service("fleetOilCardRecordService")
public class HighFleetOilCardRecordServiceImpl implements HighFleetOilCardRecordService {
@Resource
private HighFleetOilCardRecordMapper fleetOilCardRecordMapper;
@Override
public void insertRecord(HighFleetOilCardRecord fleetOilCardRecord) {
fleetOilCardRecord.setCreateTime(new Date());
fleetOilCardRecord.setStatus(1);
fleetOilCardRecordMapper.insert(fleetOilCardRecord);
}
}

@ -0,0 +1,263 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.BankNumberUtil;
import com.hai.common.utils.DateUtil;
import com.hai.dao.HighFleetOilCardMapper;
import com.hai.entity.*;
import com.hai.enum_type.*;
import com.hai.model.OilCardOrderModel;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
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 javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.*;
/**
* @className: HighFleetOilCardServiceImpl
* @author: HuRui
* @date: 2022/12/12
**/
@Service("fleetOilCardService")
public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
@Resource
private HighFleetOilCardMapper fleetOilCardMapper;
@Resource
private HighFleetOilCardRecordService fleetOilCardRecordService;
@Resource
private HighCompanyAccountService companyAccountService;
@Resource
private BsCompanyService companyService;
@Resource
private BsOrganizationService organizationService;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Resource
private UserCenter userCenter;
private final String LOCK_KEY = "lock_";
@Override
public void editData(HighFleetOilCard fleetOilCard) {
if (fleetOilCard.getId() == null) {
fleetOilCard.setCreateTime(new Date());
fleetOilCard.setUpdateTime(new Date());
fleetOilCardMapper.insert(fleetOilCard);
} else {
fleetOilCard.setUpdateTime(new Date());
fleetOilCardMapper.updateByPrimaryKey(fleetOilCard);
}
}
@Override
public void recharge(String fleetCardNo, BigDecimal price, Long orgId) {
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) {
Thread.sleep(300);
recharge(fleetCardNo, price, orgId);
}
try {
//获取锁成功
// 账户扣款
Map<String, Object> consumeType = new HashMap<>();
consumeType.put("sourceType", CompanyAmountSourceTypeEnum.type4.getType());
consumeType.put("sourceId", oilCard.getId());
consumeType.put("sourceContent", "车队油卡:"+oilCard.getCardNo()+",充值:¥"+price.toString());
companyAccountService.consume(orgId, price, consumeType);
// 变更前金额
BigDecimal beforeAmount = oilCard.getAmount();
// 计算金额
oilCard.setAmount(oilCard.getAmount().add(price));
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(price);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(OilCardRecordSourceTypeEnum.type1.getType());
try {
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
public void recycleAmount(String fleetCardNo) {
}
@Override
public HighFleetOilCard getFleetOilCardByCardNo(String fleetCardNo) {
HighFleetOilCardExample example = new HighFleetOilCardExample();
example.createCriteria().andCardNoEqualTo(fleetCardNo).andStatusNotEqualTo(0);
List<HighFleetOilCard> list = fleetOilCardMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public void consume(String fleetCardNo, BigDecimal amount, Map<String, Object> otherParam) {
}
@Override
public void refund(String orderNo) {
}
@Override
public void generateCard(Long orgId, Integer generateNum) {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
// 查询部门信息
BsOrganization organization = organizationService.findById(orgId);
if (organization == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到部门");
}
BsCompany company = companyService.getCompanyById(organization.getCompanyId());
HighFleetOilCard oilCard;
for (int i = 0; i < generateNum; i++) {
oilCard = new HighFleetOilCard();
oilCard.setCompanyId(organization.getCompanyId());
oilCard.setCompanyName(company.getName());
oilCard.setOrgId(organization.getId());
oilCard.setOrgName(organization.getName());
oilCard.setAmount(new BigDecimal("0"));
oilCard.setAmountConsume(new BigDecimal("0"));
oilCard.setCardNo(BankNumberUtil.getBrankNumber("8"));
oilCard.setOpUserId(userInfoModel.getSecUser().getId());
oilCard.setOpUserName(userInfoModel.getSecUser().getUserName());
oilCard.setCreateTime(new Date());
oilCard.setUpdateTime(new Date());
oilCard.setStatus(FleetOilCardStatusEnum.status1.getStatus());
editData(oilCard);
}
}
@Override
public void setContact(String cardNo, String contactName, String contactPhone) {
// 查询油卡
HighFleetOilCard oilCard = getFleetOilCardByCardNo(cardNo);
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油卡");
}
oilCard.setContactName(contactName);
oilCard.setContactPhone(contactPhone);
editData(oilCard);
}
@Override
public void disabled(String fleetCardNo) {
// 查询油卡
HighFleetOilCard oilCard = getFleetOilCardByCardNo(fleetCardNo);
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油卡");
}
if (!oilCard.getStatus().equals(FleetOilCardStatusEnum.status1.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态错误");
}
oilCard.setStatus(FleetOilCardStatusEnum.status2.getStatus());
editData(oilCard);
}
@Override
public void enable(String fleetCardNo) {
// 查询油卡
HighFleetOilCard oilCard = getFleetOilCardByCardNo(fleetCardNo);
if (oilCard == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油卡");
}
if (!oilCard.getStatus().equals(FleetOilCardStatusEnum.status2.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态错误");
}
oilCard.setStatus(FleetOilCardStatusEnum.status1.getStatus());
editData(oilCard);
}
@Override
public List<HighFleetOilCard> getFleetOilCardList(Map<String, Object> param) {
HighFleetOilCardExample example = new HighFleetOilCardExample();
HighFleetOilCardExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(param, "companyId"));
}
if (MapUtils.getLong(param, "orgId") != null) {
criteria.andOrgIdEqualTo(MapUtils.getLong(param, "orgId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "cardNo"))) {
criteria.andCardNoLike("%" + MapUtils.getString(param, "cardNo") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactName"))) {
criteria.andContactNameLike("%" + MapUtils.getString(param, "contactName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactPhone"))) {
criteria.andContactPhoneLike("%" + MapUtils.getString(param, "contactPhone") + "%");
}
if (MapUtils.getLong(param, "createTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS")));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeE")));
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}
example.setOrderByClause("create_time desc");
return fleetOilCardMapper.selectByExample(example);
}
@Override
public List<OilCardOrderModel> getFleetOilCardOrderList(Map<String, Object> param) throws Exception {
return null;
}
}

@ -0,0 +1,147 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.dao.HighFleetOilCardUserMapper;
import com.hai.entity.*;
import com.hai.enum_type.UserCardType;
import com.hai.service.HighFleetOilCardUserService;
import com.hai.service.HighUserCardService;
import com.hai.service.HighUserService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
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;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: HighFleetOilCardUserServiceImpl
* @author: HuRui
* @date: 2022/12/12
**/
@Service("fleetOilCardUserService")
public class HighFleetOilCardUserServiceImpl implements HighFleetOilCardUserService {
@Resource
private HighFleetOilCardUserMapper fleetOilCardUserMapper;
@Resource
private HighUserService userService;
@Resource
private HighUserCardService userCardService;
@Override
public void editUser(HighFleetOilCardUser fleetOilCardUser) {
if (fleetOilCardUser.getId() == null) {
fleetOilCardUser.setCreateTime(new Date());
fleetOilCardUser.setUpdateTime(new Date());
fleetOilCardUserMapper.insert(fleetOilCardUser);
} else {
fleetOilCardUser.setUpdateTime(new Date());
fleetOilCardUserMapper.updateByPrimaryKey(fleetOilCardUser);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void importData(HighFleetOilCard fleetOilCard, List<HighFleetOilCardUser> fleetOilCardUserList) {
for (HighFleetOilCardUser fleetOilCardUser : fleetOilCardUserList) {
if (StringUtils.isBlank(fleetOilCardUser.getContactName())
|| StringUtils.isBlank(fleetOilCardUser.getContactPhone())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
fleetOilCardUser.setFleetOilCardId(fleetOilCard.getId());
fleetOilCardUser.setFleetOilCardNo(fleetOilCard.getCardNo());
fleetOilCardUser.setAmountConsume(new BigDecimal("0"));
fleetOilCardUser.setStatus(1);
editUser(fleetOilCardUser);
// 查询用户信息
HighUser user = userService.findByPhone(fleetOilCardUser.getContactPhone());
if (user == null) {
user = new HighUser();
user.setName(fleetOilCard.getContactName());
user.setPhone(fleetOilCard.getContactPhone());
user.setRegTime(new Date());
user.setGold(0);
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
userService.insertUser(user , null);
}
// 是否绑定油卡
HighUserCard userCard = userCardService.getDetailByUserCardNo(user.getId(), fleetOilCard.getCardNo());
if (userCard == null) {
userCardService.bindCard(UserCardType.type3.getType(), fleetOilCard.getCardNo(), user.getId());
}
}
}
@Override
public HighFleetOilCardUser getDetailById(Long id) {
return fleetOilCardUserMapper.selectByPrimaryKey(id);
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void delete(Long id) {
HighFleetOilCardUser detail = getDetailById(id);
if (detail == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据");
}
detail.setStatus(0);
editUser(detail);
// 查询用户信息
HighUser user = userService.findByPhone(detail.getContactPhone());
if (user != null) {
HighUserCard userCard = userCardService.getDetailByUserCardNo(user.getId(), detail.getFleetOilCardNo());
if (userCard != null) {
userCard.setStatus(0);
userCardService.editCard(userCard);
}
}
}
@Override
public List<HighFleetOilCardUser> getUserList(Map<String, Object> param) {
HighFleetOilCardUserExample example = new HighFleetOilCardUserExample();
HighFleetOilCardUserExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (StringUtils.isNotBlank(MapUtils.getString(param, "fleetOilCardNo"))) {
criteria.andFleetOilCardNoEqualTo(MapUtils.getString(param, "fleetOilCardNo"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactName"))) {
criteria.andContactNameLike("%"+MapUtils.getString(param, "contactName")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactPhone"))) {
criteria.andContactPhoneLike("%"+MapUtils.getString(param, "contactPhone")+"%");
}
example.setOrderByClause("create_time desc");
return fleetOilCardUserMapper.selectByExample(example);
}
@Override
public List<HighFleetOilCardUser> getUserListByCard(Long cardId) {
HighFleetOilCardUserExample example = new HighFleetOilCardUserExample();
example.createCriteria().andStatusNotEqualTo(0).andFleetOilCardIdEqualTo(cardId);
example.setOrderByClause("create_time desc");
return fleetOilCardUserMapper.selectByExample(example);
}
}

@ -5,12 +5,14 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.dao.HighUserCardMapper;
import com.hai.entity.HighFleetOilCard;
import com.hai.entity.HighOilCard;
import com.hai.entity.HighUserCard;
import com.hai.entity.HighUserCardExample;
import com.hai.enum_type.OilCardStatusEnum;
import com.hai.enum_type.UserCardType;
import com.hai.model.HighUserModel;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighOilCardService;
import com.hai.service.HighUserCardService;
import org.springframework.stereotype.Service;
@ -33,6 +35,9 @@ public class HighUserCardServiceImpl implements HighUserCardService {
@Resource
private HighOilCardService oilCardService;
@Resource
private HighFleetOilCardService fleetOilCardService;
@Override
public void editCard(HighUserCard highUserCard) {
if(highUserCard.getId() == null){
@ -70,6 +75,16 @@ public class HighUserCardServiceImpl implements HighUserCardService {
card.setBindTime(new Date());
card.setBindStatus(1);
oilCardService.editData(card);
} else if (type.equals(UserCardType.type3.getType())) {
// 查询卡号
HighFleetOilCard card = fleetOilCardService.getFleetOilCardByCardNo(cardNo);
if (card == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "车队油卡卡号错误");
}
if (!card.getStatus().equals(OilCardStatusEnum.status1.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "车队油卡状态异常");
}
}
}

Loading…
Cancel
Save