提交代码

dev-discount
胡锐 3 years ago
parent d1526b291b
commit aca391e3a8
  1. 53
      hai-bweb/src/main/java/com/bweb/config/msg/MerStoreAccountChgHandler.java
  2. 86
      hai-bweb/src/main/java/com/bweb/controller/HighGasController.java
  3. 3
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilGunNoController.java
  4. 8
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceController.java
  5. 67
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  6. 23
      hai-service/src/main/java/com/hai/dao/HighGasOilGunNoMapper.java
  7. 14
      hai-service/src/main/java/com/hai/dao/HighGasOilGunNoSqlProvider.java
  8. 9
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  9. 16
      hai-service/src/main/java/com/hai/entity/HighGasOilGunNo.java
  10. 60
      hai-service/src/main/java/com/hai/entity/HighGasOilGunNoExample.java
  11. 156
      hai-service/src/main/java/com/hai/model/GasOrderModel.java
  12. 17
      hai-service/src/main/java/com/hai/msg/entity/MsgTopic.java
  13. 7
      hai-service/src/main/java/com/hai/service/HighGasOilGunNoService.java
  14. 21
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  15. 9
      hai-service/src/main/java/com/hai/service/impl/HighGasOilGunNoServiceImpl.java
  16. 2
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java
  17. 77
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  18. 23
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -0,0 +1,53 @@
package com.bweb.config.msg;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.HighMerchantStoreAccountService;
import com.hai.service.HighOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
@Component
public class MerStoreAccountChgHandler {
private static Logger logger = LoggerFactory.getLogger(MerStoreAccountChgHandler.class);
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Resource
private HighMerchantStoreAccountService merchantStoreAccountService;
@Resource
private HighOrderService orderService;
@PostConstruct
public void init() {
new Thread(() -> {
{
//消息处理
while (true){
try {
//构建的队列为左进右出
Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName());
if (o != null) {
//处理消息
logger.info("消息通道:"+o);
} else {
Thread.sleep(1000);
}
}catch (Exception e){
logger.error("监听订单状态变更错误",e);
}
}
}
}).start();
}
}

@ -1,10 +1,13 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
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.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.CoordCommonUtil;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.ResponseMsgUtil;
@ -14,6 +17,7 @@ import com.hai.entity.HighGasOilPrice;
import com.hai.entity.HighOrder;
import com.hai.enum_type.GasOilPriceStatusEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighGasOilPriceService;
import com.hai.service.HighOrderService;
import io.swagger.annotations.Api;
@ -21,6 +25,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -41,6 +46,87 @@ public class HighGasController {
@Resource
private HighOrderService highOrderService;
@Autowired
private UserCenter userCenter;
@RequestMapping(value="/getGasStatistical",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询油站统计")
public ResponseData getGasStatistical() {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null || userInfoModel.getMerchantStore() == null) {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> param = new HashMap<>();;
param.put("gasName", userInfoModel.getMerchantStore().getStoreName());
Map<String, Object> today = new HashMap<>();
Map<String, Object> incometObject = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7");
today.put("incomePrice", incometObject.get("price"));
today.put("incomeCount", incometObject.get("count"));
Map<String, Object> refundObject = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "4");
today.put("refundPrice", refundObject.get("price"));
today.put("refundCount", refundObject.get("count"));
param.put("today", today);
return ResponseMsgUtil.success(param);
} catch (Exception e) {
log.error("HighGasController -> getGasStatistical() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGasOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油站订单列表")
public ResponseData getGasOrderList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "status", required = false) Integer status, // 1:已支付 2:退款
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null || userInfoModel.getMerchantStore() == null) {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> param = new HashMap<>();;
param.put("storeId", userInfoModel.getMerchantStore().getId());
param.put("orderNo", orderNo);
if (status != null && status.equals(1)) {
param.put("status", "2,3,6,7");
} else if (status != null && status.equals(2)) {
param.put("status", "4");
}
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highOrderService.getGasOrderList(param)));
} catch (Exception e) {
log.error("HighGasController -> getGasOrderList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGasOrderDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油站订单详情")
public ResponseData getGasOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
return ResponseMsgUtil.success(highOrderService.getGasOrderDetail(orderNo));
} catch (Exception e) {
log.error("HighGasController -> getGasOrderDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/disabledOil",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "禁用油品")

@ -55,10 +55,11 @@ public class HighGasOilGunNoController {
HighGasOilPrice oilPrice = gasOilPriceService.getGasOilPriceById(body.getLong("oilPriceId"));
if (oilPrice == null) {
log.error("HighGasDiscountOilPriceController -> editGasOilPrice() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油品价格");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格");
}
HighGasOilGunNo gasOilGunNo = new HighGasOilGunNo();
gasOilGunNo.setGasOilPriceId(body.getLong("oilPriceId"));
gasOilGunNo.setStoreId(oilPrice.getMerchantStoreId());
gasOilGunNo.setOilNo(oilPrice.getOilNo());
gasOilGunNo.setOilNoName(oilPrice.getOilNoName());
gasOilGunNo.setOilType(oilPrice.getOilType());

@ -60,6 +60,14 @@ public class HighGasOilPriceController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (body.getBigDecimal("preferentialMargin").compareTo(body.getBigDecimal("priceGun")) == 0) {
log.error("HighGasDiscountOilPriceController -> editGasOilPrice() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "优惠幅度不能与油枪价相同");
}
if (body.getBigDecimal("preferentialMargin").compareTo(body.getBigDecimal("priceGun")) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "优惠幅度不能大于枪价");
}
// 查询门店详情
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(body.getLong("storeId"));
if (store == null) {

@ -62,6 +62,12 @@ public class HighGasController {
@Resource
private HighMerchantStoreService merchantStoreService;
@Resource
private HighGasOilPriceService gasOilPriceService;
@Resource
private HighGasOilGunNoService gasOilGunNoService;
@Resource
private HighGasDiscountOilPriceService gasDiscountOilPriceService;
@ -206,7 +212,63 @@ public class HighGasController {
if (store == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站");
}
if (!store.getType().equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站");
}
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
Map<String, Object> param = new HashMap<>();
param.put("provinceName", null);
param.put("provinceCode", null);
param.put("cityCode", null);
param.put("cityName", null);
param.put("countyCode", null);
param.put("countyName", null);
param.put("gasId", store.getStoreKey());
param.put("gasName", store.getStoreName());
param.put("gasAddress", store.getAddress());
param.put("gasLogoBig", store.getStoreLogo());
param.put("gasLogoSmall", store.getStoreLogo());
param.put("gasAddressLatitude", store.getLatitude());
param.put("gasAddressLongitude", store.getLatitude());
// 距离
double distance = CoordCommonUtil.getDistance(Double.valueOf(param.get("gasAddressLatitude").toString()), Double.valueOf(param.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude));
param.put("distance", Math.round(distance/100d)/10d);
// 查询油枪
List<Map<String, Object>> gasGunMapList = new ArrayList<>();
Map<String, Object> gasGunMap;
List<HighGasOilGunNo> oilGunNoList = gasOilGunNoService.getGunNoListByOilPrice(store.getId());
for (HighGasOilGunNo oilGunNo : oilGunNoList) {
gasGunMap = new HashMap<>();
gasGunMap.put("gunNo", oilGunNo.getGunNo());
gasGunMap.put("oilNo", oilGunNo.getOilNo());
gasGunMap.put("oilNoName", oilGunNo.getOilNoName());
gasGunMapList.add(gasGunMap);
}
param.put("gasGunList", gasGunMapList);
// 查询油品
List<Map<String, Object>> oilPriceMapList = new ArrayList<>();
Map<String, Object> oilPriceMap;
List<HighGasOilPrice> oilPriceList = gasOilPriceService.getGasOilPriceByStore(store.getId());
for (HighGasOilPrice oilPrice : oilPriceList) {
oilPriceMap = new HashMap<>();
oilPriceMap.put("oilType", oilPrice.getOilType());
oilPriceMap.put("oilTypeName", oilPrice.getOilTypeName());
oilPriceMap.put("oilNo", oilPrice.getOilNo());
oilPriceMap.put("oilNoName", oilPrice.getOilNoName());
oilPriceMap.put("priceVip", oilPrice.getPriceVip());
oilPriceMap.put("priceGun", oilPrice.getPriceGun());
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial());
oilPriceMapList.add(oilPriceMap);
}
param.put("oilPriceList", oilPriceMapList);
return ResponseMsgUtil.success(param);
} else if (store.getSourceType().equals(2)) {
JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey);
if (jsonObject != null && jsonObject.getString("code").equals("200")) {
JSONObject result = jsonObject.getJSONObject("result");
@ -263,6 +325,9 @@ public class HighGasController {
return ResponseMsgUtil.success(jsonObject.get("result"));
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message"));
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站");
} catch (Exception e) {
log.error("HighGasController -> getGasDetailByStoreKey() error!",e);

@ -39,15 +39,15 @@ public interface HighGasOilGunNoMapper extends HighGasOilGunNoMapperExt {
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_gas_oil_gun_no (gas_oil_price_id, oil_no, ",
"oil_no_name, oil_type, ",
"oil_type_name, gun_no, ",
"`status`, create_time, ",
"insert into high_gas_oil_gun_no (gas_oil_price_id, store_id, ",
"oil_no, oil_no_name, ",
"oil_type, oil_type_name, ",
"gun_no, `status`, create_time, ",
"ext_1, ext_2, ext_3)",
"values (#{gasOilPriceId,jdbcType=BIGINT}, #{oilNo,jdbcType=INTEGER}, ",
"#{oilNoName,jdbcType=VARCHAR}, #{oilType,jdbcType=INTEGER}, ",
"#{oilTypeName,jdbcType=VARCHAR}, #{gunNo,jdbcType=INTEGER}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"values (#{gasOilPriceId,jdbcType=BIGINT}, #{storeId,jdbcType=BIGINT}, ",
"#{oilNo,jdbcType=INTEGER}, #{oilNoName,jdbcType=VARCHAR}, ",
"#{oilType,jdbcType=INTEGER}, #{oilTypeName,jdbcType=VARCHAR}, ",
"#{gunNo,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
@ -61,6 +61,7 @@ public interface HighGasOilGunNoMapper extends HighGasOilGunNoMapperExt {
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="gas_oil_price_id", property="gasOilPriceId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@ -76,14 +77,15 @@ public interface HighGasOilGunNoMapper extends HighGasOilGunNoMapperExt {
@Select({
"select",
"id, gas_oil_price_id, oil_no, oil_no_name, oil_type, oil_type_name, gun_no, ",
"`status`, create_time, ext_1, ext_2, ext_3",
"id, gas_oil_price_id, store_id, oil_no, oil_no_name, oil_type, oil_type_name, ",
"gun_no, `status`, create_time, ext_1, ext_2, ext_3",
"from high_gas_oil_gun_no",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="gas_oil_price_id", property="gasOilPriceId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@ -109,6 +111,7 @@ public interface HighGasOilGunNoMapper extends HighGasOilGunNoMapperExt {
@Update({
"update high_gas_oil_gun_no",
"set gas_oil_price_id = #{gasOilPriceId,jdbcType=BIGINT},",
"store_id = #{storeId,jdbcType=BIGINT},",
"oil_no = #{oilNo,jdbcType=INTEGER},",
"oil_no_name = #{oilNoName,jdbcType=VARCHAR},",
"oil_type = #{oilType,jdbcType=INTEGER},",

@ -32,6 +32,10 @@ public class HighGasOilGunNoSqlProvider {
sql.VALUES("gas_oil_price_id", "#{gasOilPriceId,jdbcType=BIGINT}");
}
if (record.getStoreId() != null) {
sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}");
}
if (record.getOilNo() != null) {
sql.VALUES("oil_no", "#{oilNo,jdbcType=INTEGER}");
}
@ -83,6 +87,7 @@ public class HighGasOilGunNoSqlProvider {
sql.SELECT("id");
}
sql.SELECT("gas_oil_price_id");
sql.SELECT("store_id");
sql.SELECT("oil_no");
sql.SELECT("oil_no_name");
sql.SELECT("oil_type");
@ -118,6 +123,10 @@ public class HighGasOilGunNoSqlProvider {
sql.SET("gas_oil_price_id = #{record.gasOilPriceId,jdbcType=BIGINT}");
}
if (record.getStoreId() != null) {
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
}
if (record.getOilNo() != null) {
sql.SET("oil_no = #{record.oilNo,jdbcType=INTEGER}");
}
@ -168,6 +177,7 @@ public class HighGasOilGunNoSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("gas_oil_price_id = #{record.gasOilPriceId,jdbcType=BIGINT}");
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
sql.SET("oil_no = #{record.oilNo,jdbcType=INTEGER}");
sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}");
sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
@ -192,6 +202,10 @@ public class HighGasOilGunNoSqlProvider {
sql.SET("gas_oil_price_id = #{gasOilPriceId,jdbcType=BIGINT}");
}
if (record.getStoreId() != null) {
sql.SET("store_id = #{storeId,jdbcType=BIGINT}");
}
if (record.getOilNo() != null) {
sql.SET("oil_no = #{oilNo,jdbcType=INTEGER}");
}

@ -1071,4 +1071,13 @@ public interface HighOrderMapperExt {
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
})
List<TyOrderGorpModel> TyOrderNumGroupByGasOilNo(@Param("map") Map<String,Object> map);
@Select({" select" +
" case when SUM(b.total_price) is null then 0 else SUM(b.total_price) end price," +
" count(1) count" +
" from high_child_order a,high_order b " +
" where a.order_id = b.id and goods_type = 3 and goods_id = #{storeId} and b.order_status in (${storeId}) " +
" and to_days(pay_time) = to_days(now())"})
Map<String, Object> selectGasTheDayOrderCount(@Param("storeId") Long storeId, @Param("status") String status);
}

@ -23,6 +23,11 @@ public class HighGasOilGunNo implements Serializable {
*/
private Long gasOilPriceId;
/**
* 门店id
*/
private Long storeId;
/**
* 油号
*/
@ -82,6 +87,14 @@ public class HighGasOilGunNo implements Serializable {
this.gasOilPriceId = gasOilPriceId;
}
public Long getStoreId() {
return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public Integer getOilNo() {
return oilNo;
}
@ -176,6 +189,7 @@ public class HighGasOilGunNo implements Serializable {
HighGasOilGunNo other = (HighGasOilGunNo) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getGasOilPriceId() == null ? other.getGasOilPriceId() == null : this.getGasOilPriceId().equals(other.getGasOilPriceId()))
&& (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
&& (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo()))
&& (this.getOilNoName() == null ? other.getOilNoName() == null : this.getOilNoName().equals(other.getOilNoName()))
&& (this.getOilType() == null ? other.getOilType() == null : this.getOilType().equals(other.getOilType()))
@ -194,6 +208,7 @@ public class HighGasOilGunNo implements Serializable {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getGasOilPriceId() == null) ? 0 : getGasOilPriceId().hashCode());
result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode());
result = prime * result + ((getOilNoName() == null) ? 0 : getOilNoName().hashCode());
result = prime * result + ((getOilType() == null) ? 0 : getOilType().hashCode());
@ -215,6 +230,7 @@ public class HighGasOilGunNo implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", gasOilPriceId=").append(gasOilPriceId);
sb.append(", storeId=").append(storeId);
sb.append(", oilNo=").append(oilNo);
sb.append(", oilNoName=").append(oilNoName);
sb.append(", oilType=").append(oilType);

@ -245,6 +245,66 @@ public class HighGasOilGunNoExample {
return (Criteria) this;
}
public Criteria andStoreIdIsNull() {
addCriterion("store_id is null");
return (Criteria) this;
}
public Criteria andStoreIdIsNotNull() {
addCriterion("store_id is not null");
return (Criteria) this;
}
public Criteria andStoreIdEqualTo(Long value) {
addCriterion("store_id =", value, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdNotEqualTo(Long value) {
addCriterion("store_id <>", value, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdGreaterThan(Long value) {
addCriterion("store_id >", value, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdGreaterThanOrEqualTo(Long value) {
addCriterion("store_id >=", value, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdLessThan(Long value) {
addCriterion("store_id <", value, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdLessThanOrEqualTo(Long value) {
addCriterion("store_id <=", value, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdIn(List<Long> values) {
addCriterion("store_id in", values, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdNotIn(List<Long> values) {
addCriterion("store_id not in", values, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdBetween(Long value1, Long value2) {
addCriterion("store_id between", value1, value2, "storeId");
return (Criteria) this;
}
public Criteria andStoreIdNotBetween(Long value1, Long value2) {
addCriterion("store_id not between", value1, value2, "storeId");
return (Criteria) this;
}
public Criteria andOilNoIsNull() {
addCriterion("oil_no is null");
return (Criteria) this;

@ -0,0 +1,156 @@
package com.hai.model;
import java.math.BigDecimal;
import java.util.Date;
/**
* 加油站订单
* @author hurui
*/
public class GasOrderModel {
private String orderNo;
private String gasOrderNo;
private Integer payType;
private BigDecimal totalPrice;
private BigDecimal deductionPrice;
private BigDecimal payRealPrice;
private Integer status;
private String gasName;
private String gasAddress;
private String gasOilNo;
private String gasGunNo;
private String gasOilLiters;
private String gasPriceGun;
private Date createTime;
private Date payTime;
private Date refundTime;
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getGasOrderNo() {
return gasOrderNo;
}
public void setGasOrderNo(String gasOrderNo) {
this.gasOrderNo = gasOrderNo;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public BigDecimal getDeductionPrice() {
return deductionPrice;
}
public void setDeductionPrice(BigDecimal deductionPrice) {
this.deductionPrice = deductionPrice;
}
public BigDecimal getPayRealPrice() {
return payRealPrice;
}
public void setPayRealPrice(BigDecimal payRealPrice) {
this.payRealPrice = payRealPrice;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getGasName() {
return gasName;
}
public void setGasName(String gasName) {
this.gasName = gasName;
}
public String getGasAddress() {
return gasAddress;
}
public void setGasAddress(String gasAddress) {
this.gasAddress = gasAddress;
}
public String getGasOilNo() {
return gasOilNo;
}
public void setGasOilNo(String gasOilNo) {
this.gasOilNo = gasOilNo;
}
public String getGasGunNo() {
return gasGunNo;
}
public void setGasGunNo(String gasGunNo) {
this.gasGunNo = gasGunNo;
}
public String getGasOilLiters() {
return gasOilLiters;
}
public void setGasOilLiters(String gasOilLiters) {
this.gasOilLiters = gasOilLiters;
}
public String getGasPriceGun() {
return gasPriceGun;
}
public void setGasPriceGun(String gasPriceGun) {
this.gasPriceGun = gasPriceGun;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Date getRefundTime() {
return refundTime;
}
public void setRefundTime(Date refundTime) {
this.refundTime = refundTime;
}
}

@ -0,0 +1,17 @@
package com.hai.msg.entity;
public enum MsgTopic {
// 门店账户业务员
MerStoreAccount("mer-store-account");
private String name;
MsgTopic(String name){
this.name = name;
}
public String getName(){
return name;
}
}

@ -28,4 +28,11 @@ public interface HighGasOilGunNoService {
* @return
*/
List<HighGasOilGunNo> getGunNoListByOilPrice(Long oilPriceId);
/**
* 根据门店 查询抢号列表
* @param storeId
* @return
*/
List<HighGasOilGunNo> getGunNoListByStoreId(Long storeId);
}

@ -3,6 +3,7 @@ package com.hai.service;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.model.*;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
@ -397,6 +398,26 @@ public interface HighOrderService {
*/
TyOrderCountModel TyOrderStatistics(Map<String , Object> map) throws Exception;
/**
* 查询加油站当天统计
* @param storeId
* @param status
* @return
*/
Map<String, Object> getGasTheDayOrderCount(Long storeId, String status);
/**
* 查询加油站订单列表
* @param param
* @return
*/
List<GasOrderModel> getGasOrderList(Map<String, Object> param);
/**
* 查询加油站订单列表
* @param orderNo
* @return
*/
GasOrderModel getGasOrderDetail(String orderNo);
}

@ -35,7 +35,14 @@ public class HighGasOilGunNoServiceImpl implements HighGasOilGunNoService {
@Override
public List<HighGasOilGunNo> getGunNoListByOilPrice(Long oilPriceId) {
HighGasOilGunNoExample example = new HighGasOilGunNoExample();
example.createCriteria().andGasOilPriceIdEqualTo(oilPriceId);
example.createCriteria().andGasOilPriceIdEqualTo(oilPriceId).andStatusNotEqualTo(0);;
return gasOilGunNoMapper.selectByExample(example);
}
@Override
public List<HighGasOilGunNo> getGunNoListByStoreId(Long storeId) {
HighGasOilGunNoExample example = new HighGasOilGunNoExample();
example.createCriteria().andStoreIdEqualTo(storeId).andStatusNotEqualTo(0);
return gasOilGunNoMapper.selectByExample(example);
}
}

@ -35,7 +35,7 @@ public class HighGasOilPriceServiceImpl implements HighGasOilPriceService {
@Override
public HighGasOilPrice getGasOilPriceByStoreAndOilNo(Long storeId, Integer oilNo) {
HighGasOilPriceExample example = new HighGasOilPriceExample();
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andOilNoEqualTo(oilNo);
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andOilNoEqualTo(oilNo).andStatusNotEqualTo(0);
List<HighGasOilPrice> list = highGasOilPriceMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);

@ -12,9 +12,11 @@ import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.*;
import com.hai.model.*;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
@ -108,6 +110,9 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource
private HighOilCardService oilCardService;
@Resource
private RedisTemplate redisTemplate;
@Override
@Transactional(
isolation = Isolation.SERIALIZABLE,
@ -347,8 +352,25 @@ public class HighOrderServiceImpl implements HighOrderService {
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> otherParam = new HashMap<>();
otherParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
otherParam.put("sourceId", highOrder.getId());
otherParam.put("sourceContent", "订单号:" + highOrder.getOrderNo() + ",加油金额:¥" + highOrder.getTotalPrice());
// merchantStoreAccountService.consume(store.getId(), order.getTotalPrice(), otherParam);
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("object", otherParam);
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String, Object> paramMap = new HashMap<>();
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
@ -381,6 +403,44 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
}
}
/* if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 推送团油订单
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", highOrder.getMemPhone());
paramMap.put("thirdSerialNo", highOrder.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(highOrder.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
}*/
if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId());
@ -1497,6 +1557,21 @@ public class HighOrderServiceImpl implements HighOrderService {
return tyOrderCountModel;
}
@Override
public Map<String, Object> getGasTheDayOrderCount(Long storeId, String status) {
return highOrderMapperExt.selectGasTheDayOrderCount(storeId,status);
}
@Override
public List<GasOrderModel> getGasOrderList(Map<String, Object> param) {
return null;
}
@Override
public GasOrderModel getGasOrderDetail(String orderNo) {
return null;
}
public String priceName(Integer num) {
switch (num) {

@ -18,11 +18,10 @@ import com.hai.dao.HighDiscountPackageRecordMapper;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.OrderPushType;
import com.hai.enum_type.PayType;
import com.hai.enum_type.*;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResultProfitSharing;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.*;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayService;
@ -38,6 +37,7 @@ import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -59,6 +59,9 @@ public class GoodsOrderServiceImpl implements PayService {
private static Logger log = LoggerFactory.getLogger(GoodsOrderServiceImpl.class);
@Resource
private RedisTemplate redisTemplate;
@Resource
private HighOrderService highOrderService;
@ -116,6 +119,9 @@ public class GoodsOrderServiceImpl implements PayService {
@Resource
private HuiLianTongConfig huiLianTongConfig;
@Resource
private HighMerchantStoreAccountService merchantStoreAccountService;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void paySuccess(Map<String, String> map, String payType) throws Exception {
@ -276,7 +282,16 @@ public class GoodsOrderServiceImpl implements PayService {
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> otherParam = new HashMap<>();
otherParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
otherParam.put("sourceId", order.getId());
otherParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
// merchantStoreAccountService.consume(store.getId(), order.getTotalPrice(), otherParam);
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("object", otherParam);
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
} else if (store.getSourceType().equals(2)) {
// 推送团油订单

Loading…
Cancel
Save