开发完成

master
胡锐 2 months ago
parent 058d13bb98
commit aecf86062c
  1. 1
      bweb/src/main/java/com/bweb/config/AuthConfig.java
  2. 138
      bweb/src/main/java/com/bweb/controller/BsAgentApiAccountController.java
  3. 80
      bweb/src/main/java/com/bweb/controller/BsAgentApiParamController.java
  4. 26
      bweb/src/main/java/com/bweb/controller/BsAgentPriceController.java
  5. 14
      bweb/src/main/java/com/bweb/controller/BsGasOrderController.java
  6. 11
      bweb/src/main/java/com/bweb/controller/BsMerchantController.java
  7. 59
      bweb/src/main/java/com/bweb/controller/TestController.java
  8. 7
      bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.java
  9. 74
      bweb/src/main/java/com/bweb/controller/notify/TestNotify.java
  10. 72
      openapi/src/main/java/com/openapi/controller/BsAccountController.java
  11. 14
      openapi/src/main/java/com/openapi/controller/BsGasController.java
  12. 6
      openapi/src/main/java/com/openapi/controller/BsGasOrderController.java
  13. 7
      service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
  14. 16
      service/src/main/java/com/hfkj/dao/BsAgentApiParamMapperExt.java
  15. 6
      service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java
  16. 13
      service/src/main/java/com/hfkj/model/SecUserSessionObject.java
  17. 4
      service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java
  18. 22
      service/src/main/java/com/hfkj/openapi/model/request/RequestAmountModel.java
  19. 20
      service/src/main/java/com/hfkj/openapi/model/response/ResponseAmountModel.java
  20. 86
      service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java
  21. 21
      service/src/main/java/com/hfkj/openapi/utils/SignatureUtil.java
  22. 8
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountRecordServiceImpl.java
  23. 10
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java
  24. 2
      service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java
  25. 8
      service/src/main/java/com/hfkj/service/order/BsOrderRefundService.java
  26. 35
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  27. 11
      service/src/main/java/com/hfkj/service/sec/impl/SecUserServiceImpl.java

@ -95,6 +95,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/newLinkNotify/*")
.excludePathPatterns("/merchantPayConfig/editConfig")
.excludePathPatterns("/test/*")
.excludePathPatterns("/testNotify/*")
.excludePathPatterns("/merchantChainBrand/*")
.excludePathPatterns("/merchantChainBrandAccount")
;

@ -0,0 +1,138 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.agent.BsAgentApiAccountRecordService;
import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.service.agent.BsAgentDiscountService;
import com.hfkj.service.discount.BsDiscountPkService;
import com.hfkj.service.discount.BsDiscountService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
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.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value = "/agentApiAccount")
@Api(value = "优惠券管理")
public class BsAgentApiAccountController {
private static Logger log = LoggerFactory.getLogger(BsAgentApiAccountController.class);
@Resource
private BsAgentApiAccountService agentApiAccountService;
@Resource
private BsAgentApiAccountRecordService agentApiAccountRecordService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/getAccount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询账户")
public ResponseData getAccount(@RequestParam(value = "agentId", required = false) Long agentId) {
try {
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (SecUserObjectTypeEnum.type1.getCode() == userSession.getAccount().getObjectType()) {
} else if (SecUserObjectTypeEnum.type4.getCode() == userSession.getAccount().getObjectType()) {
agentId = userSession.getAccount().getObjectId();;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
// 查询账户
return ResponseMsgUtil.success(agentApiAccountService.getAccount(agentId));
} catch (Exception e) {
log.error("agentApiAccount --> getAccount() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/recharge", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "充值")
public ResponseData recharge(@RequestBody JSONObject body) {
try {
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (SecUserObjectTypeEnum.type1.getCode() != userSession.getAccount().getObjectType()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
if (body == null || body.getLong("agentId") == null || body.getBigDecimal("amount") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 账户充值
agentApiAccountService.recharge(body.getLong("agentId"), body.getBigDecimal("amount"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("agentApiAccount --> recharge() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getRecordList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "记录列表")
public ResponseData getRecordList(@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "sourceType", required = false) Integer sourceType,
@RequestParam(value = "sourceOrderNo", required = false) String sourceOrderNo,
@RequestParam(value = "createTimeS", required = false) Long createTimeS,
@RequestParam(value = "createTimeE", required = false) Long createTimeE,
@RequestParam(value = "pageNum", required = true) Integer pageNum,
@RequestParam(value = "pageSize", required = true) Integer pageSize) {
try {
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (SecUserObjectTypeEnum.type1.getCode() == userSession.getAccount().getObjectType()) {
} else if (SecUserObjectTypeEnum.type4.getCode() == userSession.getAccount().getObjectType()) {
agentId = userSession.getAccount().getObjectId();;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
// 查询账户
BsAgentApiAccount account = agentApiAccountService.getAccount(agentId);
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到账户");
}
Map<String,Object> param = new HashMap<>();
param.put("agentApiAccountId", account.getId());
param.put("type", type);
param.put("sourceType", sourceType);
param.put("sourceOrderNo", sourceOrderNo);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(agentApiAccountRecordService.getList(param)));
} catch (Exception e) {
log.error("agentApiAccount --> getRecordList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,80 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentApiAccount;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.agent.BsAgentApiAccountRecordService;
import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
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 javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/agentApiParam")
@Api(value = "代理商API参数")
public class BsAgentApiParamController {
private static Logger log = LoggerFactory.getLogger(BsAgentApiParamController.class);
@Resource
private BsAgentApiParamService agentApiParamService;
@RequestMapping(value = "/getApiParam", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询参数")
public ResponseData getApiParam(@RequestParam(value = "agentId", required = true) Long agentId) {
try {
// 查询账户
return ResponseMsgUtil.success(agentApiParamService.getParam(agentId));
} catch (Exception e) {
log.error("BsAgentApiParamController --> getApiParam() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改参数")
public ResponseData update(@RequestBody JSONObject body) {
try {
if (body == null || body.getLong("agentId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 代理商API参数
BsAgentApiParam apiParam = agentApiParamService.getParam(body.getLong("agentId"));
if (apiParam == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到API参数");
}
apiParam.setMerInfoNotify(body.getString("merInfoNotify"));
apiParam.setOrderRefundNotify(body.getString("orderRefundNotify"));
agentApiParamService.update(apiParam);
// 查询账户
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsAgentApiParamController --> getApiParam() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -9,18 +9,17 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.entity.BsAgentPrice;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.agent.BsAgentPriceService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.agent.AgentPriceTypeEnum;
import com.hfkj.sysenum.agent.AgentTypeEnum;
import com.hfkj.sysenum.gas.GasOilNoEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -47,7 +46,8 @@ import java.util.Map;
public class BsAgentPriceController {
private static Logger log = LoggerFactory.getLogger(BsAgentPriceController.class);
@Resource
private BsAgentService agentService;
@Resource
private BsAgentPriceService agentPriceService;
@Resource
@ -101,6 +101,14 @@ public class BsAgentPriceController {
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type4.getCode())) {
type = AgentPriceTypeEnum.type2.getCode();
// 查询代理商
BsAgent agent = agentService.getAgentById(userSession.getAccount().getObjectId());
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
if (agent.getType().equals(AgentTypeEnum.type1.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
agentMer = agentMerService.getDetailByAgent(userSession.getAccount().getObjectId(), body.getString("merNo"));
if (agentMer != null) {
agentPrice = agentPriceService.getDetail(agentMer.getId(), body.getString("oilNo"));
@ -186,6 +194,14 @@ public class BsAgentPriceController {
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type4.getCode())) {
type = AgentPriceTypeEnum.type2.getCode();
// 查询代理商
BsAgent agent = agentService.getAgentById(userSession.getAccount().getObjectId());
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
if (agent.getType().equals(AgentTypeEnum.type1.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
agentMer = agentMerService.getDetailByAgent(userSession.getAccount().getObjectId(), merchant.getMerNo());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未分配此油站");

@ -10,13 +10,16 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsAgent;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.order.ExportGasOrderModel;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.gas.OrderOilStatus;
@ -44,6 +47,8 @@ public class BsGasOrderController {
@Resource
private BsGasOrderService gasOrderService;
@Resource
private BsAgentService agentService;
@Resource
private BsOrderService orderService;
@Resource
private BsDeviceService deviceService;
@ -254,6 +259,7 @@ public class BsGasOrderController {
param.put("gasOilNo", gasOilNo);
param.put("abnormal", abnormal);
BsAgent agent = null;
if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
param.put("merName", merName);
@ -267,6 +273,8 @@ public class BsGasOrderController {
param.put("agentId", sessionObject.getAccount().getObjectId());
param.put("agentStaffId", agentStaffId);
param.put("merName", merName);
// 查询代理商
agent = agentService.getAgentById(sessionObject.getAccount().getObjectId());
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) {
param.put("agentStaffId", sessionObject.getAccount().getObjectId());
param.put("merName", merName);
@ -298,8 +306,8 @@ public class BsGasOrderController {
model.setGasDiscount(gasOrder.getGasDiscount().compareTo(new BigDecimal("1")) != 0?gasOrder.getGasDiscount().multiply(new BigDecimal("100")).setScale(2).toString():"无");
model.setGasOilNo(gasOrder.getGasOilNo() + "#");
model.setGasGunNo(gasOrder.getGasGunNo() + "号枪");
model.setGasPricePlatform(gasOrder.getGasPricePlatform());
model.setGasPriceVip(gasOrder.getGasPriceVip());
model.setGasPricePlatform(gasOrder.getCreateType().equals(GasOrderCreateType.TYPE1.getNumber())?gasOrder.getGasPricePlatform().toString():"无");
model.setGasPriceVip(gasOrder.getCreateType().equals(GasOrderCreateType.TYPE1.getNumber())?gasOrder.getGasPriceVip().toString():"无");
model.setGasPriceGun(gasOrder.getGasPriceGun());
model.setGasPriceOfficial(gasOrder.getGasPriceOfficial());
model.setGasSettlePrice(gasOrder.getGasSettlePrice());
@ -377,6 +385,8 @@ public class BsGasOrderController {
} else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode()) ) {
includeColumnFiledNames.add("agentStaffName");
includeColumnFiledNames.add("merName");
includeColumnFiledNames.add("channelType");

@ -11,6 +11,7 @@ import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.service.*;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.merchant.BsMerchantChainBrandService;
@ -44,6 +45,8 @@ public class BsMerchantController {
@Resource
private BsGasOilPriceService gasOilPriceService;
@Resource
private BsAgentMerService agentMerService;
@Resource
private BsGasOilGunNoService gasOilGunNoService;
@Resource
private BsMerchantChainBrandService merchantChainBrandService;
@ -143,6 +146,8 @@ public class BsMerchantController {
merchantService.createMerchant(merchant);
} else {
merchantService.updateMerchant(merchant);
// 通知代理
agentMerService.agentNotify(merchant.getMerNo());
}
return ResponseMsgUtil.success("操作成功");
@ -164,6 +169,9 @@ public class BsMerchantController {
merchantService.updateMerStatus(body.getString("merNo"), MerchantStatusEnum.status1);
// 通知代理
agentMerService.agentNotify(body.getString("merNo"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsMerchantController --> restoreMer() error!", e);
@ -206,6 +214,9 @@ public class BsMerchantController {
merchantService.updateMerStatus(body.getString("merNo"), MerchantStatusEnum.status2);
// 通知代理
agentMerService.agentNotify(body.getString("merNo"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsMerchantController --> disableMer() error!", e);

@ -15,16 +15,15 @@ import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.MqttProviderConfig;
import com.hfkj.dao.SecRegionMapper;
import com.hfkj.device.sanmisen.PrinterTemplate;
import com.hfkj.entity.BsGasClassGroupTask;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.SecRegion;
import com.hfkj.entity.SecUser;
import com.hfkj.entity.*;
import com.hfkj.model.GasClassGroupTaskDataCount;
import com.hfkj.model.ResponseData;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.CommonService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.sec.SecUserLoginLogService;
import com.hfkj.service.sec.SecUserService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
@ -57,54 +56,22 @@ public class TestController {
@Resource
private BsGasOrderService gasOrderService;
@Resource
private BsMerchantService merchantService;
@Resource
private BsGasService gasService;
@Resource
private CommonService commonService;
@RequestMapping(value="test",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "test")
@ApiOperation(value = "加油站全量缓存")
public ResponseData test() {
try {
List<Map<String,Object>> list = new ArrayList<>();
// 省
List<SecRegion> cities = commonService.getCities();
for (SecRegion province : cities) {
Map<String,Object> provinceMap = new LinkedHashMap<>();
provinceMap.put("value", province.getRegionId());
provinceMap.put("label", province.getRegionName());
// 市
List<SecRegion> regions = commonService.getRegionsByParentId(province.getRegionId());
if (!regions.isEmpty()) {
List<Map<String,Object>> cityList = new ArrayList<>();
for (SecRegion city : regions) {
Map<String, Object> cityMap = new LinkedHashMap<>();
cityMap.put("value", city.getRegionId());
cityMap.put("label", city.getRegionName());
// 区/县
List<SecRegion> areas = commonService.getRegionsByParentId(city.getRegionId());
if (!areas.isEmpty()) {
List<Map<String,Object>> areasList = new ArrayList<>();
for (SecRegion area : areas) {
Map<String, Object> areaMap = new LinkedHashMap<>();
areaMap.put("value", area.getRegionId());
areaMap.put("label", area.getRegionName());
areaMap.put("isLeaf", true);
areasList.add(areaMap);
}
cityMap.put("children", areasList);
}
cityList.add(cityMap);
}
provinceMap.put("children", cityList);
}
list.add(provinceMap);
}
new ObjectMapper().writeValue(new File("D:\\output.json"), list);
List<BsMerchant> merchantList = merchantService.getMerchantList(new HashMap<>());
for (BsMerchant merchant : merchantList) {
// 缓存
gasService.getGasDetail(merchant.getMerNo());
}
return ResponseMsgUtil.success("");
} catch (Exception e) {

@ -79,12 +79,15 @@ public class NewLinkNotify {
if (gasOrder != null) {
if (gasOrder.getCreateType().equals(GasOrderCreateType.TYPE1.getNumber())) {
// 退款
orderRefundService.tradeOrderChildRefund(gasOrder.getChannelOrderNo(), false,1, data.getString("refundFailReason"));
orderRefundService.refundMoney(orderRefundService.getRefundByChildOrderNo(gasOrder.getOrderChildNo()));
} else if (gasOrder.getCreateType().equals(GasOrderCreateType.TYPE2.getNumber())) {
// 退款
RequestOrderRefundModel requestOrderRefund = new RequestOrderRefundModel();
requestOrderRefund.setOrderNo(gasOrder.getOrderNo());
apiGasOrderService.refundOrder(requestOrderRefund);
apiGasOrderService.refundOrder(gasOrder.getAgentId(), requestOrderRefund);
data.getString("refundFailReason");
}
}
}

@ -0,0 +1,74 @@
package com.bweb.controller.notify;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkGasService;
import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.common.security.AESEncodeUtil;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.openapi.model.request.RequestOrderRefundModel;
import com.hfkj.openapi.service.ApiGasOrderService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* @className: NewLinkNotify
* @author: HuRui
* @date: 2024/7/26
**/
@Controller
@RequestMapping(value = "/testNotify")
@Api(value = "测试通知")
public class TestNotify {
@Resource
private NewLinkGasService newLinkGasService;
@Resource
private BsOrderRefundService orderRefundService;
@Resource
private BsGasOrderService gasOrderService;
@Resource
private ApiGasOrderService apiGasOrderService;
@RequestMapping(value="/merChange",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "商户变更")
public String merChange(@RequestBody JSONObject body) {
try {
System.out.println("================测试商户变更通知==================");
System.out.println("参数"+body);
} catch (Exception e) {
System.out.println("变更异常:" + e.getMessage());
} finally {
System.out.println("================测试商户变更通知==================");
}
return "success";
}
@RequestMapping(value="/orderRefund",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "订单退款")
public String orderRefund(@RequestBody JSONObject body) {
try {
System.out.println("================测试订单退款通知==================");
System.out.println("参数"+body);
} catch (Exception e) {
System.out.println("变更异常:" + e.getMessage());
} finally {
System.out.println("================测试订单退款通知==================");
}
return "success";
}
}

@ -0,0 +1,72 @@
package com.openapi.controller;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.pay.util.SignatureUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentApiAccount;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.model.request.RequestAmountModel;
import com.hfkj.openapi.model.response.ResponseAmountModel;
import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.service.agent.BsAgentApiParamService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
@Controller
@RequestMapping(value = "/account")
@Api(value = "账户管理")
public class BsAccountController {
private static Logger log = LoggerFactory.getLogger(BsAccountController.class);
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsAgentApiAccountService agentApiAccountService;
@RequestMapping(value="/queryAmount",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询账户余额")
public ResponseData queryAmount(@Validated @RequestBody RequestAmountModel body) {
log.info("========= Start 查询账户余额 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 查询账户
BsAgentApiAccount account = agentApiAccountService.getAccount(apiParam.getAgentId());
if (account == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到账户");
}
ResponseAmountModel response = new ResponseAmountModel();
response.setAppId(body.getAppId());
response.setAmount(account.getAmount());
log.info("返回参数:" +response);
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
return exception;
} finally {
log.info("========= END 查询账户余额 END ===========");
}
}
}

@ -32,6 +32,9 @@ import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@ -61,10 +64,15 @@ public class BsGasController {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
PageHelper.startPage(body.getPageNum(), body.getPageSize());
PageInfo<ResponseQueryGasInfoModel> response = new PageInfo<>(agentMerService.getMerNoList(apiParam.getAgentId()));
for (int i = 0; i < response.getList().size();i++) {
response.getList().set(i, apiGasService.queryGasInfo(response.getList().get(i).getGasNo()));
PageInfo<ResponseQueryGasInfoModel> pageInfo = new PageInfo<>(agentMerService.getMerNoList(apiParam.getAgentId()));
for (int i = 0; i < pageInfo.getList().size();i++) {
pageInfo.getList().set(i, apiGasService.queryGasInfo(pageInfo.getList().get(i).getGasNo()));
}
Map<String,Object> response = new LinkedHashMap<>();
response.put("totalCount", pageInfo.getTotal());
response.put("totalPageNum", pageInfo.getPages());
response.put("currPageIndex", pageInfo.getPageNum());
response.put("gasInfoList", pageInfo.getList());
log.info("返回参数:" + JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);

@ -45,8 +45,6 @@ public class BsGasOrderController {
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsAgentMerService agentMerService;
@Resource
private ApiGasOrderService apiGasOrderService;
@Resource
private BsAgentApiAccountService agentApiAccountService;
@ -118,7 +116,7 @@ public class BsGasOrderController {
apiLog.setRequestUrl("gasOrder/queryOrderDetail");
apiLog.setRequestParam(JSONObject.toJSONString(body));
ResponseOrderDetailModel response = apiGasOrderService.queryOrderDetail(body);
ResponseOrderDetailModel response = apiGasOrderService.queryOrderDetail(apiParam.getAgentId(),body);
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
@ -157,7 +155,7 @@ public class BsGasOrderController {
apiLog.setRequestUrl("gasOrder/refund");
apiLog.setRequestParam(JSONObject.toJSONString(body));
String response = apiGasOrderService.refundOrder(body);
String response = apiGasOrderService.refundOrder(apiParam.getAgentId(), body);
log.info("返回参数:" + response);
apiLog.setResponseParam(response);

@ -38,14 +38,15 @@ public class SignatureUtil {
* @return
* @throws Exception
*/
public static Boolean checkSign(String checkSign,Object param, String key) throws Exception {
Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class);
public static Boolean checkSign(String checkSign,Object param, String key) {
return true;
/* Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class);
// 去除签名
map.remove("sign");
if (checkSign.equals(createSign(map, key))) {
return true;
}
return false;
return false;*/
}
/**

@ -11,13 +11,13 @@ import java.util.List;
*/
public interface BsAgentApiParamMapperExt {
@Select("select " +
"id," +
"agent_id agentId," +
"app_id appId," +
"app_secret appSecret," +
"mer_info_notify merInfoNotify," +
"order_refund_notify orderRefundNotify" +
"from bs_agent_api_param " +
"where agent_id in (select agent_id from bs_agent_mer where mer_no = #{gasNo} and `status` = 1 GROUP BY agent_id)")
" id," +
" agent_id agentId," +
" app_id appId," +
" app_secret appSecret," +
" mer_info_notify merInfoNotify," +
" order_refund_notify orderRefundNotify" +
" from bs_agent_api_param " +
" where agent_id in (select agent_id from bs_agent_mer where mer_no = #{gasNo} and `status` = 1 GROUP BY agent_id)")
List<BsAgentApiParam> selectParamListByGasNo(@Param("gasNo") String gasNo);
}

@ -81,6 +81,10 @@ public interface BsAgentMerMapperExt {
" </script> "})
List<AgentMerAllot> getAllotList(@Param("param") Map<String,Object> param);
@Select("<script> select mer_no gasNo from bs_agent_mer where agent_id = #{agentId} and agent_staff_id is null and status = 1 GROUP BY mer_no </script>")
@Select("<script> " +
" select a.mer_no gasNo from bs_agent_mer a " +
" LEFT JOIN bs_merchant b on b.id = a.mer_id" +
" where a.agent_id = #{agentId} and a.agent_staff_id is null and a.status = 1 and b.`status` = 1 GROUP BY a.mer_no" +
" </script>")
List<ResponseQueryGasInfoModel> getMerNoList(@Param("agentId") Long agentId);
}

@ -1,9 +1,6 @@
package com.hfkj.model;
import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.SecMenu;
import com.hfkj.entity.SecRole;
import com.hfkj.entity.SecUser;
import com.hfkj.entity.*;
import lombok.Data;
import java.util.List;
@ -29,6 +26,11 @@ public class SecUserSessionObject {
*/
private BsMerchant merchant;
/**
* 代理商
*/
private BsAgent agent;
/**
* 菜单
*/
@ -39,10 +41,11 @@ public class SecUserSessionObject {
*/
private List<SecMenu> button;
public SecUserSessionObject(SecUser account, SecRole role, BsMerchant merchant, List<MenuTreeModel> menuTree, List<SecMenu> button){
public SecUserSessionObject(SecUser account, SecRole role, BsMerchant merchant, BsAgent agent, List<MenuTreeModel> menuTree, List<SecMenu> button){
this.account = account;
this.role = role;
this.merchant = merchant;
this.agent = agent;
this.menuTree = menuTree;
this.button = button;
}

@ -70,11 +70,11 @@ public class ExportGasOrderModel {
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "平台价"})
private BigDecimal gasPricePlatform;
private String gasPricePlatform;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "优惠价"})
private BigDecimal gasPriceVip;
private String gasPriceVip;
@ColumnWidth(10)
@ExcelProperty({ "加油信息", "油站价"})

@ -0,0 +1,22 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class RequestAmountModel {
/**
* appid
*/
@NotBlank(message = "appId必填项")
private String appId;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,20 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
@Data
public class ResponseAmountModel {
/**
* appid
*/
private String appId;
/**
* 余额
*/
private BigDecimal amount;
}

@ -26,6 +26,7 @@ import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantAccountService;
@ -75,8 +76,6 @@ public class ApiGasOrderService {
@Resource
private BsGasService gasService;
@Resource
private BsOrderService orderService;
@Resource
private BsGasOrderService gasOrderService;
@Resource
private BsGasClassGroupTaskService gasClassGroupTaskService;
@ -88,9 +87,10 @@ public class ApiGasOrderService {
private BsAgentApiAccountService agentApiAccountService;
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsOrderRefundService orderRefundService;
@Resource
private BsGasOilPriceService gasOilPriceService;
/**
* 推送加油订单
* @param request
@ -148,33 +148,41 @@ public class ApiGasOrderService {
gasOrder.setStatus(OrderOilStatus.STATUS2.getNumber());
gasOrder.setReceiptStatus(GasOrderReceiptStatusEnum.status0.getStatus());
// 结算信息
gasOrder.setTotalDeductionPrice(new BigDecimal("0"));
gasOrder.setDeductionCouponPrice(new BigDecimal("0"));
gasOrder.setDeductionOilPrice(new BigDecimal("0"));
gasOrder.setPayablePrice(request.getRefuelingAmount());
gasOrder.setPayablePrice(request.getRefuelingAmount());
gasOrder.setGasRefuelPrice(request.getRefuelingAmount());
gasOrder.setGasSettlePrice(gasOrder.getGasRefuelPrice());
gasOrder.setGasAgentSettlePrice(gasOrder.getGasRefuelPrice());
// 油价信息
gasOrder.setGasRefuelPrice(request.getRefuelingAmount());
gasOrder.setGasOilNo(request.getOilNo());
gasOrder.setGasGunNo(request.getGunNo());
gasOrder.setGasOilType(oilPrice.getOilType());
gasOrder.setGasPriceGun(oilPrice.getPriceGun());
gasOrder.setGasPriceVip(oilPrice.getPriceGun());
gasOrder.setGasPriceVip(oilPrice.getPriceVip());
gasOrder.setGasPriceCost(oilPrice.getPriceGun());
gasOrder.setGasPriceOfficial(oilPrice.getPriceOfficial());
gasOrder.setGasPricePlatform(oilPrice.getPriceGun());
gasOrder.setGasOilLiters(gasOrder.getGasSettlePrice().divide(gasOrder.getGasPriceGun(), 2, BigDecimal.ROUND_HALF_UP));
gasOrder.setGasDiscount(new BigDecimal("0"));
gasOrder.setGasOilSubsidy(new BigDecimal("0"));
gasOrder.setGasLitersPreferences(new BigDecimal("0"));
gasOrder.setGasPricePreferences(new BigDecimal("0"));
gasOrder.setCreateType(GasOrderCreateType.TYPE2.getNumber());
gasOrder.setGasOilLiters(gasOrder.getGasRefuelPrice().divide(gasOrder.getGasPriceGun(), 2, BigDecimal.ROUND_HALF_UP));
// 结算信息
gasOrder.setTotalDeductionPrice(new BigDecimal("0"));
gasOrder.setDeductionCouponPrice(new BigDecimal("0"));
gasOrder.setDeductionOilPrice(new BigDecimal("0"));
gasOrder.setPayablePrice(request.getRefuelingAmount());
gasOrder.setGasRefuelPrice(request.getRefuelingAmount());
gasOrder.setGasServiceFeeRate(new BigDecimal("0"));
gasOrder.setGasServiceFeePrice(new BigDecimal("0"));
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
// 油站结算 公式 1. 加油升数 * (油枪价 - 优惠价) = 优惠金额 2. 加油金额 - 优惠金额 = 扣款金额
BigDecimal gasSettlePrice = gasOrder.getGasRefuelPrice().subtract(
// 优惠金额
gasOrder.getGasOilLiters().multiply(oilPrice.getPriceGun().subtract(oilPrice.getPriceVip())));
gasOrder.setGasSettlePrice(gasSettlePrice);
} else {
gasOrder.setGasSettlePrice(gasOrder.getGasRefuelPrice());
}
gasOrder.setGasAgentSettlePrice(gasOrder.getGasRefuelPrice());
// 油站是否开启班组
BsGasClassGroupTask groupTask = gasClassGroupTaskService.getCurrentTaskByMerId(gasDetail.getId());
if (groupTask != null) {
@ -211,15 +219,18 @@ public class ApiGasOrderService {
* @throws Exception
*/
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public String refundOrder(RequestOrderRefundModel request) {
public String refundOrder(Long agentId,RequestOrderRefundModel request) {
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(request.getOrderNo());
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单号");
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
if (!Objects.equals(agentId, gasOrder.getAgentId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
if (!gasOrder.getStatus().equals(OrderOilStatus.STATUS2.getNumber())
|| gasOrder.getStatus().equals(OrderOilStatus.STATUS6.getNumber())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "订单无法退款");
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "订单状态暂时无法申请退款");
}
// 创建退款订单
BsOrderRefund orderRefund = new BsOrderRefund();
@ -238,6 +249,10 @@ public class ApiGasOrderService {
orderRefund.setCreateType(GasOrderCreateType.TYPE2.getNumber());
orderRefundService.editData(orderRefund);
// 修改订单状态
gasOrder.setStatus(OrderOilStatus.STATUS5.getNumber());
gasOrderService.updateGasOrder(gasOrder);
ResponseOrderPushModel response = new ResponseOrderPushModel();
response.setOrderNo(gasOrder.getOrderNo());
response.setChannelType(gasOrder.getChannelType());
@ -245,21 +260,43 @@ public class ApiGasOrderService {
// 创建一个单线程的线程池
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
// 异步记录登录信息
// 异步处理退款
singleThreadExecutor.submit(new Runnable() {
@Override
public void run() {
if (!gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
// 团油
try {
// 请求团油渠道申请退款
JSONObject object = NewLinkRequestService.refuelingOrderRefund(gasOrder.getUserPhone(), gasOrder.getOrderNo(), orderRefund.getRefundRemark());
if (object == null || !object.getString("code").equals("200")) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("渠道申请退款失败!原因:" + object.getString("message"));
gasOrderService.updateGasOrder(gasOrder);
}
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "请求退款失败");
}
} else {
try {
// 退款
agentApiAccountService.refund(gasOrder.getAgentId(),gasOrder.getGasRefuelPrice(), orderRefund);
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
orderRefund.setFinishTime(new Date());
orderRefundService.editData(orderRefund);
gasOrder.setStatus(OrderOilStatus.STATUS4.getNumber());
gasOrder.setRefundTime(orderRefund.getFinishTime());
gasOrderService.updateGasOrder(gasOrder);
} catch (Exception e) {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode());
orderRefund.setRefundFailReason("退款失败!");
orderRefundService.editData(orderRefund);
gasOrder.setStatus(OrderOilStatus.STATUS6.getNumber());
gasOrder.setReceiptFailRemark(orderRefund.getRefundFailReason());
gasOrderService.updateGasOrder(gasOrder);
}
// 退款通知
// 代理参数
@ -273,7 +310,7 @@ public class ApiGasOrderService {
refundNotify.setRefundResult(orderRefund.getRefundStatus() == 2 ? true : false);
refundNotify.setRefundFailReason(orderRefund.getRefundFailReason());
refundNotify.setSign(SignatureUtil.createSign(refundNotify, apiParam.getAppSecret()));
HttpsUtils.doPost(apiParam.getOrderRefundNotify(), JSONObject.toJSONString(refundNotify));
HttpsUtils.doPost(apiParam.getOrderRefundNotify(), JSONObject.parseObject(JSONObject.toJSONString(refundNotify), JSONObject.class));
}
}
}
@ -287,11 +324,14 @@ public class ApiGasOrderService {
* @return
* @throws Exception
*/
public ResponseOrderDetailModel queryOrderDetail(RequestOrderDetailModel request) throws Exception {
public ResponseOrderDetailModel queryOrderDetail(Long agentId,RequestOrderDetailModel request) {
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(request.getOrderNo());
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单号");
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
if (!Objects.equals(agentId, gasOrder.getAgentId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
ResponseOrderDetailModel response = new ResponseOrderDetailModel();
response.setOrderNo(gasOrder.getOrderNo());

@ -82,14 +82,23 @@ public class SignatureUtil {
public static void main(String[] args) throws Exception {
String paramStr = "{\n" +
" \"merchantNo\": \"2023121813322612707\",\n" +
" \"outTradeNo\": \"ZF1130202312190004\",\n" +
" \"refundAmount\": \"1\",\n" +
" \"refundReason\": \"测试退款\",\n" +
" \"refundTradeNo\": \"1170202312190001\"" +
"\t\"gasNo\": \"38972\",\n" +
"\t\"gasLogo\": \"https://test-oil.dctpay.com/202410/下载 (1)1729754182694.png\",\n" +
"\t\"gasName\": \"1\",\n" +
"\t\"cityCode\": 120100,\n" +
"\t\"provinceCode\": 120000,\n" +
"\t\"gasAddress\": \"重庆市渝中区邹容路100号\",\n" +
"\t\"gasStatus\": 1,\n" +
"\t\"countyCode\": 120101,\n" +
"\t\"gasAddressLatitude\": \"29.557301\",\n" +
"\t\"cityName\": \"市辖区\",\n" +
"\t\"gasAddressLongitude\": \"106.575654\",\n" +
"\t\"provinceName\": \"天津市\",\n" +
"\t\"oilPriceList\": [],\n" +
"\t\"countyName\": \"和平区\"\n" +
"}";
String sign = createSign(JSONObject.parseObject(paramStr), "7ub4JCbyExtW4ragz6FO6bGkVnuV7cUp");
String sign = createSign(JSONObject.parseObject(paramStr), "8aef995ff71485dc19b36e35f04c4016");
System.out.println(sign);
}

@ -86,6 +86,14 @@ public class BsAgentApiAccountRecordServiceImpl implements BsAgentApiAccountReco
criteria.andSourceOrderNoEqualTo(MapUtils.getString(param, "sourceOrderNo"));
}
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")));
}
example.setOrderByClause("create_time desc");
return agentApiAccountRecordMapper.selectByExample(example);
}

@ -18,6 +18,7 @@ import com.hfkj.service.agent.*;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.sysenum.agent.AgentTypeEnum;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -110,7 +111,7 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
agentMer.setUpdateTime(new Date());
dataList.add(agentMer);
if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
if (agent.getType().equals(AgentTypeEnum.type1.getCode()) && merchant.getSourceType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
BsAgentMerAccount account = new BsAgentMerAccount();
account.setAgentId(agentId);
account.setMerId(merchant.getId());
@ -128,6 +129,11 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void unbindAgent(Long agentId, List<String> merNoArray) {
// 代理商
BsAgent agent = agentService.getAgentById(agentId);
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的代理商");
}
// 删除代理商商户
BsAgentMer agentMer = new BsAgentMer();
agentMer.setStatus(0);
@ -147,7 +153,7 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
for (String merNo : merNoArray) {
// 查询门店
BsMerchant merchant = merchantService.getMerchant(merNo);
if (merchant != null && MerchantSourceTypeEnum.type1.getNumber().equals(merchant.getSourceType())) {
if (merchant != null && AgentTypeEnum.type1.getCode().equals(agent.getType()) && MerchantSourceTypeEnum.type1.getNumber().equals(merchant.getSourceType())) {
// 删除代理商下的商户账户
BsAgentMerAccount account = agentMerAccountService.getAccount(agentId, merchant.getMerNo());
if (account != null) {

@ -114,8 +114,6 @@ public class BsMerchantServiceImpl implements BsMerchantService {
redisUtil.set(CACHE_MER_KEY + merchant.getMerNo(), merchant);
// 清除油站缓存
gasService.clean(merchant.getMerNo());
// 通知代理
agentMerService.agentNotify(merchant.getMerNo());
}
@Override

@ -48,6 +48,14 @@ public interface BsOrderRefundService {
* @return
*/
BsOrderRefund getRefund(String refundOrderNo);
/**
* 根据子订单号查询退款中的订单
* @param childOrderNo
* @return
*/
BsOrderRefund getRefundByChildOrderNo(String childOrderNo);
/**
* 查询退款列表
* @param param

@ -13,9 +13,11 @@ import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.pay.HuiPayService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.order.*;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import com.hfkj.sysenum.order.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -50,6 +52,8 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
@Resource
private BsOrderSettleService orderSettleService;
@Resource
private BsGasOrderService gasOrderService;
@Resource
private OrderRefundBusiness orderRefundBusiness;
@Resource
private BsDiscountUserService discountUserService;
@ -188,7 +192,6 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderRefund.setRefundIntegral(unitPriceIntegral.multiply(new BigDecimal("100")).longValue());
}
/* if (orderRefund.getRefundIntegral() > 0L) {
Map<String,Object> opUser = new HashMap<>();
opUser.put("opUserType", orderRefund.getOpUserType());
@ -204,7 +207,6 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
// 退款积分
userIntegralService.entry(orderRefund.getUserId(),orderRefund.getRefundIntegral(), opUser, source);
}*/
orderRefund.setRefundRemark(remark);
orderRefund.setRefundStatus(OrderRefundStatusEnum.status1.getCode());
orderRefund.setAccountMerchantNo(orderSettle.getSettleMerNo());
@ -213,8 +215,21 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
editData(orderRefund);
// 资金退款
orderRefund.setRefundStatus(refundMoney(orderRefund)?OrderRefundStatusEnum.status2.getCode():OrderRefundStatusEnum.status3.getCode());
editData(orderRefund);
if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderChildNo(orderChild.getChildOrderNo());
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油订单");
}
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())
|| gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
orderRefund.setRefundStatus(refundMoney(orderRefund)?OrderRefundStatusEnum.status2.getCode():OrderRefundStatusEnum.status3.getCode());
editData(orderRefund);
}
} else {
orderRefund.setRefundStatus(refundMoney(orderRefund)?OrderRefundStatusEnum.status2.getCode():OrderRefundStatusEnum.status3.getCode());
editData(orderRefund);
}
// 退款成功
if (orderRefund.getRefundStatus().equals(OrderRefundStatusEnum.status2.getCode())) {
@ -264,6 +279,18 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
return null;
}
@Override
public BsOrderRefund getRefundByChildOrderNo(String childOrderNo) {
BsOrderRefundExample example = new BsOrderRefundExample();
example.createCriteria().andOrderChildNoEqualTo(childOrderNo).andRefundStatusEqualTo(OrderRefundStatusEnum.status1.getCode());
example.setOrderByClause("create_time desc");
List<BsOrderRefund> list = orderRefundMapper.selectByExample(example);
if (!list.isEmpty()){
return list.get(0);
}
return null;
}
@Override
public List<BsOrderRefund> getRefundList(Map<String, Object> param) {
BsOrderRefundExample example = new BsOrderRefundExample();

@ -11,6 +11,7 @@ import com.hfkj.dao.SecUserMapper;
import com.hfkj.entity.*;
import com.hfkj.model.MenuTreeModel;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.gas.BsGasStaffService;
import com.hfkj.service.sec.SecMenuService;
@ -53,6 +54,8 @@ public class SecUserServiceImpl implements SecUserService {
@Resource
private BsMerchantService merchantService;
@Resource
private BsAgentService agentService;
@Resource
private BsGasStaffService gasStaffService;
@Override
@ -167,21 +170,23 @@ public class SecUserServiceImpl implements SecUserService {
// 获取商户信息
BsMerchant merchant = null;
BsAgent agent = null;
if (user.getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())){
merchant = merchantService.getMerchant(user.getObjectId());
} else if (user.getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())){
} else if (user.getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) {
// 查询油站员工
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(user.getObjectId());
if (gasStaff != null) {
merchant = merchantService.getMerchant(gasStaff.getMerId());
}
} else if (user.getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) {
agent = agentService.getAgentById(user.getObjectId());
}
// token 生成格式:账户id + 时间戳
String token = AESEncodeUtil.aesEncrypt(user.getId()+"_"+System.currentTimeMillis(), "O8gTZ6wIovDPjhsaz0zAoqZmm3jtjIcO");
SessionObject sessionObject = new SessionObject(token, new SecUserSessionObject(user, role, merchant, menuTree, button));
SessionObject sessionObject = new SessionObject(token, new SecUserSessionObject(user, role, merchant, agent, menuTree, button));
userCenter.save(sessionObject);
// 异步记录登录信息

Loading…
Cancel
Save