提交代码

dev
胡锐 4 months ago
parent d9afec0a59
commit f09e488857
  1. 67
      bweb/src/main/java/com/bweb/controller/BsAgentPriceController.java
  2. 2
      service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java
  3. 7
      service/src/main/java/com/hfkj/service/agent/BsAgentMerService.java
  4. 5
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java
  5. 7
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceServiceImpl.java
  6. 7
      service/src/main/java/com/hfkj/service/impl/BsMerchantServiceImpl.java
  7. 17
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java

@ -97,14 +97,16 @@ public class BsAgentPriceController {
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type4.getCode())) {
type = AgentPriceTypeEnum.type2.getCode();
agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type2,body.getString("merNo"), body.getString("oilNo"));
agentMer = agentMerService.getDetailByAgent(userSession.getAccount().getObjectId(), body.getString("merNo"));
if (agentMer != null) {
agentPrice = agentPriceService.getDetail(agentMer.getId(), body.getString("oilNo"));
}
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type5.getCode())) {
type = AgentPriceTypeEnum.type3.getCode();
agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type3,body.getString("merNo"), body.getString("oilNo"));
agentMer = agentMerService.getDetailByAgentStaff(userSession.getAccount().getObjectId(), body.getString("merNo"));
if (agentMer != null) {
agentPrice = agentPriceService.getDetail(agentMer.getId(), body.getString("oilNo"));
}
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的角色");
}
@ -114,8 +116,6 @@ public class BsAgentPriceController {
if (oilNo == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油号");
}
// 查询油站
if (agentPrice == null) {
agentPrice = new BsAgentPrice();
@ -154,7 +154,7 @@ public class BsAgentPriceController {
}
if (body.getJSONArray("merNoList") == null
|| body.getInteger("oilNo") == null
|| StringUtils.isBlank(body.getString("oilNo"))
|| body.getBigDecimal("priceRate") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
@ -175,17 +175,23 @@ public class BsAgentPriceController {
BsAgentMer agentMer = null;
if (accountObjectType.equals(SecUserObjectTypeEnum.type1.getCode())) {
type = AgentPriceTypeEnum.type1.getCode();
agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1,mer.getString("merNo"), body.getString("oilNo"));
agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1, merchant.getMerNo(), body.getString("oilNo"));
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type4.getCode())) {
type = AgentPriceTypeEnum.type2.getCode();
agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type2,mer.getString("merNo"), body.getString("oilNo"));
agentMer = agentMerService.getDetailByAgent(userSession.getAccount().getObjectId(), body.getString("merNo"));
agentMer = agentMerService.getDetailByAgent(userSession.getAccount().getObjectId(), merchant.getMerNo());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未分配此油站");
}
agentPrice = agentPriceService.getDetail(agentMer.getId(), body.getString("oilNo"));
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type5.getCode())) {
type = AgentPriceTypeEnum.type3.getCode();
agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type3,mer.getString("merNo"), body.getString("oilNo"));
agentMer = agentMerService.getDetailByAgentStaff(userSession.getAccount().getObjectId(), body.getString("merNo"));
agentMer = agentMerService.getDetailByAgentStaff(userSession.getAccount().getObjectId(), merchant.getMerNo());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未分配此油站");
}
agentPrice = agentPriceService.getDetail(agentMer.getId(), body.getString("oilNo"));
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的角色");
@ -235,16 +241,6 @@ public class BsAgentPriceController {
}
Integer accountObjectType = userSession.getAccount().getObjectType();
AgentPriceTypeEnum type = null;
if (accountObjectType.equals(SecUserObjectTypeEnum.type1.getCode())) {
type = AgentPriceTypeEnum.type1;
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type4.getCode())) {
type = AgentPriceTypeEnum.type2;
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type5.getCode())) {
type = AgentPriceTypeEnum.type3;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的角色");
}
// 查询商户
BsMerchant merchant = merchantService.getMerchant(merNo);
@ -252,6 +248,13 @@ public class BsAgentPriceController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户");
}
BsAgentMer agentMer = null;
if (accountObjectType.equals(SecUserObjectTypeEnum.type4.getCode())) {
agentMer = agentMerService.getDetailByAgent(userSession.getAccount().getObjectId(), merNo);
} else if (accountObjectType.equals(SecUserObjectTypeEnum.type5.getCode())) {
agentMer = agentMerService.getDetailByAgentStaff(userSession.getAccount().getObjectId(), merNo);
}
List<Map<String, Object>> oilPriceMapList = new ArrayList<>();
Map<String, Object> oilPriceMap;
@ -265,12 +268,22 @@ public class BsAgentPriceController {
oilPriceMap.put("oilNo", price.getOilNo());
oilPriceMap.put("oilNoName", price.getOilNoName());
oilPriceMap.put("status", price.getStatus());
// 价格
BsAgentPrice priceRate = agentPriceService.getDetail(type, merchant.getMerNo(), price.getOilNo());
if (priceRate == null) {
oilPriceMap.put("priceRate", 100L);
oilPriceMap.put("priceRate", 100L);
if (accountObjectType.equals(SecUserObjectTypeEnum.type1.getCode())) {
// 价格
BsAgentPrice priceRate = agentPriceService.getDetail(AgentPriceTypeEnum.type1, merchant.getMerNo(), price.getOilNo());
if (priceRate != null) {
oilPriceMap.put("priceRate", priceRate.getPriceRate());
}
} else {
oilPriceMap.put("priceRate", priceRate.getPriceRate());
if (agentMer != null) {
// 价格
BsAgentPrice priceRate = agentPriceService.getDetail(agentMer.getId(), price.getOilNo());
if (priceRate != null) {
oilPriceMap.put("priceRate", priceRate.getPriceRate());
}
}
}
oilPriceMapList.add(oilPriceMap);
}

@ -67,7 +67,7 @@ public interface BsAgentMerMapperExt {
" LEFT JOIN bs_agent_mer b on b.mer_id = a.id and b.`status` <![CDATA[ <> ]]> 0" +
" <if test='param.agentId != null'> and b.agent_id = #{param.agentId} </if>" +
" where 1 = 1" +
" <if test='param.isAgentStaffAllot != null and param.isAgentStaffAllot == true'> and b.agent_staff_id is null and b.mer_id in (select mer_id from bs_agent_mer where agent_staff_id = #{param.agentStaffId} and `status` <![CDATA[ <> ]]> 0) </if>" +
" <if test='param.isAgentStaffAllot != null and param.isAgentStaffAllot == true'> and b.agent_staff_id is not null and b.mer_id in (select mer_id from bs_agent_mer where agent_staff_id = #{param.agentStaffId} and `status` <![CDATA[ <> ]]> 0) </if>" +
" <if test='param.isAgentStaffAllot != null and param.isAgentStaffAllot == false'> and b.agent_staff_id is null and b.mer_id not in (select mer_id from bs_agent_mer where agent_staff_id = #{param.agentStaffId} and `status` <![CDATA[ <> ]]> 0) </if>" +
") a where 1 = 1" +
" <if test='param.provinceCode != null'> and a.provinceCode = #{param.provinceCode} </if>" +

@ -61,6 +61,13 @@ public interface BsAgentMerService {
*/
BsAgentMer getDetailByAgent(Long agentId,String merNo);
/**
* 查询下详情
* @param id
* @return
*/
BsAgentMer getDetail(Long id);
/**
* 查询详情
* @param agentStaffId

@ -148,6 +148,11 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
return null;
}
@Override
public BsAgentMer getDetail(Long id) {
return agentMerMapper.selectByPrimaryKey(id);
}
@Override
public BsAgentMer getDetailByAgentStaff(Long agentStaffId, String merNo) {
BsAgentMerExample example = new BsAgentMerExample();

@ -4,8 +4,10 @@ import com.hfkj.common.utils.RedisUtil;
import com.hfkj.dao.BsGasOilPriceMapper;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.BsGasOilPriceExample;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.sysenum.gas.GasOilPriceStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -31,6 +33,8 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService {
@Resource
private BsGasOilGunNoService gasOilGunNoService;
@Resource
private BsGasService gasService;
@Resource
private RedisUtil redisUtil;
private final static String GAS_OIL_PRICE_KEY = "GAS_OIL_PRICE_KEY:";
@ -53,6 +57,9 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService {
// 加入缓存
redisUtil.set(GAS_OIL_PRICE_KEY + data.getId(), data);
// 清除油站缓存
gasService.clean(data.getMerNo());
}
@Override

@ -11,6 +11,7 @@ import com.hfkj.entity.BsMerchantExample;
import com.hfkj.entity.SecUser;
import com.hfkj.service.BsMerchantQrCodeService;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.sec.SecUserService;
import com.hfkj.sysenum.MerchantStatusEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
@ -40,6 +41,8 @@ public class BsMerchantServiceImpl implements BsMerchantService {
private BsMerchantQrCodeService merchantQrCodeService;
@Resource
private RedisUtil redisUtil;
@Resource
private BsGasService gasService;
private final static String CACHE_MER_KEY = "MERCHANT:";
@Override
@ -87,8 +90,10 @@ public class BsMerchantServiceImpl implements BsMerchantService {
@Override
public void updateMerchant(BsMerchant merchant) {
editData(merchant);
// 清除商户信息缓存
redisUtil.set(CACHE_MER_KEY + merchant.getMerNo(), merchant);
// 清除油站缓存
gasService.clean(merchant.getMerNo());
}
@Override

@ -8,6 +8,7 @@ import com.hfkj.entity.*;
import com.hfkj.model.GasPayPriceModel;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
@ -44,6 +45,8 @@ public class OrderCreateService {
@Resource
private BsGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private BsAgentMerService agentMerService;
@Resource
private BsGasStaffService gasStaffService;
/**
@ -67,6 +70,7 @@ public class OrderCreateService {
if (!merchant.getStatus().equals(MerchantStatusEnum.status1.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前油站暂停交易");
}
// 计算价格
GasPayPriceModel priceModel = gasService.refuelPriceCompute(orderChild.getProductPrice(), merchant.getMerNo(), orderChild.getGasOilNo(), orderChild.getAgentMerId());
@ -102,6 +106,19 @@ public class OrderCreateService {
gasOrder.setGasLitersPreferences(priceModel.getLitersPreferences());
gasOrder.setGasPricePreferences(priceModel.getPricePreferences());
// 代理、业务员
if (orderChild.getAgentMerId() != null) {
// 查询代理
BsAgentMer agentMer = agentMerService.getDetail(orderChild.getAgentMerId());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的代理");
}
gasOrder.setAgentId(agentMer.getAgentId());
gasOrder.setAgentName(agentMer.getAgentName());
gasOrder.setAgentStaffId(agentMer.getAgentStaffId());
gasOrder.setAgentStaffName(agentMer.getAgentStaffName());
}
// 加油员
if (orderChild.getGasStaffId() != null) {
// 查询员工

Loading…
Cancel
Save