提交代码

dev
胡锐 6 days ago
parent e18cef61b0
commit 2f64415c6e
  1. 2
      bweb/src/main/java/com/bweb/controller/BsAgentController.java
  2. 4
      service/src/main/java/com/hfkj/model/order/OrderChildModel.java
  3. 18
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentServiceImpl.java
  4. 29
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  5. 4
      service/src/main/java/com/hfkj/sysenum/agent/AgentTypeEnum.java

@ -187,7 +187,7 @@ public class BsAgentController {
@RequestMapping(value = "/queryAgentList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询代理商列表")
public ResponseData queryAgentList(@RequestParam(name = "type", required = false) Integer type,
public ResponseData queryAgentList(@RequestParam(name = "type", required = false) String type,
@RequestParam(name = "agentNo", required = false) String agentNo,
@RequestParam(name = "agentName", required = false) String agentName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,

@ -31,4 +31,8 @@ public class OrderChildModel extends BsOrderChild {
* 油站代理
*/
private Long agentMerId;
/**
* 代理商appid
*/
private String agentAppId;
}

@ -24,10 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* @className: BsAgentServiceImpl
@ -85,6 +84,10 @@ public class BsAgentServiceImpl implements BsAgentService {
// 生成代理api接入参数
agentApiParamService.create(agent.getId());
}else if (AgentTypeEnum.type3.getCode().equals(agent.getType())) {
secUser.setRoleId(9L);
// 生成代理api接入参数
agentApiParamService.create(agent.getId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的代理类型");
}
@ -176,8 +179,11 @@ public class BsAgentServiceImpl implements BsAgentService {
BsAgentExample example = new BsAgentExample();
BsAgentExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getInteger(param, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(param, "type"));
if (StringUtils.isNotBlank(MapUtils.getString(param, "type"))) {
List<Integer> type = Arrays.stream(MapUtils.getString(param, "type").split(","))
.flatMapToInt(num -> IntStream.of(Integer.parseInt(num))).boxed()
.collect(Collectors.toList());
criteria.andTypeIn(type);
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "agentNo"))) {

@ -7,7 +7,9 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.entity.*;
import com.hfkj.model.GasPayPriceModel;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentMerAccountService;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.discount.BsDiscountUseMerService;
import com.hfkj.service.gas.*;
import com.hfkj.service.merchant.BsMerchantPayConfigService;
@ -15,6 +17,7 @@ import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.sec.SecDictionaryService;
import com.hfkj.service.spread.BsUserSpreadRelService;
import com.hfkj.sysenum.agent.AgentStatusEnum;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantStatusEnum;
@ -63,6 +66,10 @@ public class OrderCreateService {
private BsGasChannelConfigService gasChannelConfigService;
@Resource
private BsGasOrderSpreadService gasOrderSpreadService;
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsAgentService agentService;
/**
* 加油业务
* @param order 订单
@ -151,6 +158,28 @@ public class OrderCreateService {
);
gasOrder.setGasSettlePrice(gasSettlePrice);
// 代理商appid
if (orderChild.getAgentAppId() != null) {
// 代理商参数
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(orderChild.getAgentAppId());
if (apiParam == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理参数接入错误");
}
if (!apiParam.getStatus().equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理参数接入错误");
}
// 代理商
BsAgent agent = agentService.getAgentById(apiParam.getAgentId());
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理参数接入错误");
}
if (!agent.getStatus().equals(AgentStatusEnum.status1.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理处于异常状态");
}
gasOrder.setAgentId(agent.getId());
gasOrder.setAgentName(agent.getName());
}
// 代理、业务员
if (orderChild.getAgentMerId() != null) {
// 查询代理

@ -20,6 +20,10 @@ public enum AgentTypeEnum {
* API代理
*/
type2(2 , "API代理"),
/**
* 推广代理
*/
type3(3 , "推广代理"),
;
private Integer code;

Loading…
Cancel
Save