提交修改

dev-discount
袁野 3 years ago
parent f30f0f92bf
commit 082837dff1
  1. 33
      hai-bweb/src/main/java/com/bweb/controller/CommonController.java
  2. 46
      hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
  3. 15
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  4. 83
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  5. 15
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
  6. 39
      hai-service/src/main/java/com/hai/model/OrderCountModel.java
  7. 21
      hai-service/src/main/java/com/hai/service/CommonService.java
  8. 3
      hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
  9. 32
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  10. 12
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  11. 27
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  12. 16
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  13. 22
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  14. 10
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -1,5 +1,6 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.SecConfig; import com.hai.entity.SecConfig;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
@ -184,4 +185,36 @@ public class CommonController {
} }
} }
@RequestMapping(value="/getHLTBalance",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通余额")
public ResponseData getHLTBalance(
@RequestParam(name = "codeType", required = true) String codeType,
@RequestParam(name = "codeName", required = true) String codeName
) {
try {
return ResponseMsgUtil.success(commonService.getHLTBalance(codeType , codeName));
} catch (Exception e) {
log.error("CommonController --> getIdAndNameByCodeType() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/addHLTBalance",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增余额")
public ResponseData addHLTBalance(@RequestBody JSONObject object) {
try {
commonService.addHLTBalance(object.getString("codeType") , object.getString("codeName") , object.getLong("price"));
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("CommonController --> getIdAndNameByCodeType() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -756,5 +756,51 @@ public class HighOrderController {
} }
@RequestMapping(value = "/orderByIndex", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单首页统计")
public ResponseData orderByIndex(
@RequestParam(name = "code", required = true) Integer code) {
try {
return ResponseMsgUtil.success(highOrderService.orderByIndex(code));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/HLTOrderByIndex", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "工会卡预支付首页统计")
public ResponseData HLTOrderByIndex(
@RequestParam(name = "code", required = true) Integer code) {
try {
return ResponseMsgUtil.success(highOrderService.HLTOrderByIndex(code));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/HLTOrderByList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "工会卡预支付查询列表")
public ResponseData HLTOrderByList(
@RequestParam(name = "code", required = true) Integer code) {
try {
return ResponseMsgUtil.success(highOrderService.HLTOrderByList(code));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -501,4 +501,19 @@ public class OutRechargeOrderController {
} }
} }
@RequestMapping(value = "/rechargeOrderByIndex", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "充值订单首页统计")
public ResponseData rechargeOrderByIndex(
@RequestParam(name = "code", required = true) Integer code) {
try {
return ResponseMsgUtil.success(outRechargeOrderService.rechargeOrderByIndex(code));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -4,6 +4,7 @@ import com.hai.entity.HighOrder;
import com.hai.model.HighOrderData; import com.hai.model.HighOrderData;
import com.hai.model.HighOrderModel; import com.hai.model.HighOrderModel;
import com.hai.model.HighOrderPreModel; import com.hai.model.HighOrderPreModel;
import com.hai.model.OrderCountModel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Results;
@ -625,7 +626,7 @@ public interface HighOrderMapperExt {
@Select({"<script>" + @Select({"<script>" +
" SELECT" + " SELECT" +
" (select mer.merchant_name from high_merchant mer where EXISTS (select 1 from high_coupon cou where cou.id = a.goods_id and mer.id = cou.merchant_id)) merchantName," + " (select mer.merchant_name from high_merchant mer where EXISTS (select 1 from high_coupon cou where cou.id = a.goods_id and mer.id = cou.merchant_id)) merchantName," +
" case a.goods_type when 1 then '卡券' when 2 then '金币充值' when 3 then '加油缴费' when 4 then 'KFC' when 5 then '电影票' when 6 then '话费充值' when 7 then '优惠券包' end goodsType, " + " case a.goods_type when 1 then '卡券' when 2 then '金币充值' when 3 then '加油缴费' when 4 then 'KFC' when 5 then '电影票' when 6 then '话费充值' when 7 then '优惠券包' when 8 then '汇联通充值' end goodsType, " +
" a.goods_name goodsName, " + " a.goods_name goodsName, " +
" a.goods_type goodsTypeId," + " a.goods_type goodsTypeId," +
" case a.giveaway_type when 1 then '赠送' when 0 then '购买' end giveawayType," + " case a.giveaway_type when 1 then '赠送' when 0 then '购买' end giveawayType," +
@ -675,4 +676,84 @@ public interface HighOrderMapperExt {
"</script>"}) "</script>"})
List<HighOrderModel> selectDiscountPackageOrderList(@Param("map") Map<String,Object> map); List<HighOrderModel> selectDiscountPackageOrderList(@Param("map") Map<String,Object> map);
@Select(value = {
"<script>",
"select sum(total_price) orderPrice, sum(pay_real_price) payRealPrice , count(*) count ",
"from high_order where order_status in (2,3) and pay_type = 4 and Identification_code = #{code} ",
"</script>"
})
@Results({
@Result(column="payPrice", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="orderPrice", property="orderPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="count", property="count", jdbcType=JdbcType.BIGINT),
})
OrderCountModel orderByIndex(Integer code);
@Select(value = {
"<script>",
"select sum(total_price) orderPrice, sum(pay_real_price) payRealPrice , count(*) count ",
"from high_order where order_status in (2,3) and pay_type in (1,2,3,5) and Identification_code = #{code} ",
"</script>"
})
@Results({
@Result(column="payPrice", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="orderPrice", property="orderPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="count", property="count", jdbcType=JdbcType.BIGINT),
})
OrderCountModel HLTOrderByIndex(Integer code);
@Select({"<script>" +
" SELECT" +
" (select mer.merchant_name from high_merchant mer where EXISTS (select 1 from high_coupon cou where cou.id = a.goods_id and mer.id = cou.merchant_id)) merchantName," +
" case a.goods_type when 1 then '卡券' when 2 then '金币充值' when 3 then '加油缴费' when 4 then 'KFC' when 5 then '电影票' when 6 then '话费充值' when 7 then '优惠券包' when 8 then '汇联通充值' end goodsType, " +
" a.goods_name goodsName, " +
" a.goods_type goodsTypeId," +
" case a.giveaway_type when 1 then '赠送' when 0 then '购买' end giveawayType," +
" b.order_no orderNo," +
" b.mem_name memName," +
" b.mem_phone memPhone," +
" case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " +
" case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' when 4 then '工会卡' when 5 then '银联' end payType," +
" b.pay_serial_no paySerialNo," +
" case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," +
" b.mem_discount_name memDiscountName," +
" b.deduction_price deductionPrice," +
" case a.giveaway_type when 0 then case when b.pay_gold is null then 0 else pay_gold end when 1 then 0 end payGold," +
" case a.giveaway_type when 0 then b.pay_price when 1 then 0 end payPrice," +
" case a.giveaway_type when 0 then case when b.pay_gold is not null then convert(b.pay_gold / 100,decimal(10,2)) else b.pay_real_price end when 1 then 0 end payRealPrice," +
" case b.order_status when 1 then '待支付' when 2 then '已支付' when 3 then '已完成' when 4 then '已退款' when 5 then '已取消' when 6 then '退款中' when 7 then '退款失败' end orderStatus, " +
" b.order_status orderStatusId," +
" b.create_time createTime," +
" b.pay_time payTime," +
" b.cancel_time cancelTime," +
" b.refund_time refundTime," +
" b.refund_content refundContent," +
" b.refusal_refund_content refusalRefundContent" +
" FROM" +
" high_child_order a," +
" high_order b" +
" WHERE" +
" a.order_id = b.id" +
" and a.giveaway_type = 0" +
" and b.Identification_code = #{map.identificationCode}" +
" and b.pay_type in (1,2,3,5)" +
" and b.order_status in (2,3)" +
" <if test='map.orderNo != null'> and b.order_no = #{map.orderNo} </if>" +
" <if test='map.paySerialNo != null'> and b.pay_serial_no = #{map.paySerialNo} </if>" +
" <if test='map.payModel != null'> and b.pay_model = #{map.payModel} </if>" +
" <if test='map.memDiscountName != null'> and a.goods_name = #{map.memDiscountName} </if>" +
" <if test='map.memPhone != null'> and b.mem_phone = #{map.memPhone} </if>" +
" <if test='map.memPhone != null'> and b.mem_phone = #{map.memPhone} </if> " +
" <if test='map.createTimeS != null'> <![CDATA[ and b.create_time >= #{map.createTimeS} ]]> </if>" +
" <if test='map.createTimeE != null'> <![CDATA[ and b.create_time <= #{map.createTimeE} ]]> </if>" +
" <if test='map.payTimeS != null'> <![CDATA[ and b.pay_time >= #{map.payTimeS} ]]> </if>" +
" <if test='map.payTimeE != null'> <![CDATA[ and b.pay_time <= #{map.payTimeE} ]]> </if>" +
" GROUP BY a.id" +
" ORDER BY b.create_time desc" +
"</script>"})
List<HighOrderModel> selectOrderList(@Param("map") Map<String,Object> map);
} }

@ -3,6 +3,7 @@ package com.hai.dao;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel; import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel; import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel; import com.hai.model.OutUserOrderModel;
@ -139,4 +140,18 @@ public interface OutRechargeOrderMapperExt {
@Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT) @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT)
}) })
List<OutRechargeOrder> getCloseOrder(); List<OutRechargeOrder> getCloseOrder();
@Select(value = {
"<script>",
"select sum(order_price) orderPrice, sum(pay_real_price) payRealPrice , count(*) count ",
"from out_recharge_order where status in (2,3) and Identification_code = #{code}",
"</script>"
})
@Results({
@Result(column="payPrice", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="orderPrice", property="orderPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="count", property="count", jdbcType=JdbcType.BIGINT),
})
OrderCountModel rechargeOrderByIndex(Integer code);
} }

@ -0,0 +1,39 @@
package com.hai.model;
import java.math.BigDecimal;
public class OrderCountModel {
// 订单金额
private BigDecimal orderPrice;
// 实际支付金额
private BigDecimal payRealPrice;
// 订单数量
private Long count;
public BigDecimal getOrderPrice() {
return orderPrice;
}
public void setOrderPrice(BigDecimal orderPrice) {
this.orderPrice = orderPrice;
}
public BigDecimal getPayRealPrice() {
return payRealPrice;
}
public void setPayRealPrice(BigDecimal payRealPrice) {
this.payRealPrice = payRealPrice;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}

@ -183,4 +183,25 @@ public interface CommonService {
void updateDictionary(SecDictionary secDictionary); void updateDictionary(SecDictionary secDictionary);
/**
* @Author Sum1Dream
* @name getHLTBalance.java
* @Description // 查询汇联通余额
* @Date 11:40 上午 2022/1/10
* @Param [java.lang.String, java.lang.String]
* @return java.lang.Long
*/
Long getHLTBalance(String codeType, String codeName);
/**
* @Author Sum1Dream
* @name addHLTBalance.java
* @Description // 充值余额
* @Date 11:40 上午 2022/1/10
* @Param [java.lang.String, java.lang.String, java.lang.Long]
* @return void
*/
void addHLTBalance(String codeType, String codeName , Long price);
} }

@ -87,7 +87,7 @@ public interface HighDiscountPackageService {
* @Param [com.hai.entity.HighDiscountPackage] * @Param [com.hai.entity.HighDiscountPackage]
* @return void * @return void
*/ */
void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num); void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num) throws Exception;
/** /**
* @Author Sum1Dream * @Author Sum1Dream
@ -99,4 +99,5 @@ public interface HighDiscountPackageService {
*/ */
void freeUserDiscountPackage(Map<String , Object> map) throws Exception; void freeUserDiscountPackage(Map<String , Object> map) throws Exception;
} }

@ -4,6 +4,7 @@ import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.model.HighOrderData; import com.hai.model.HighOrderData;
import com.hai.model.HighOrderModel; import com.hai.model.HighOrderModel;
import com.hai.model.OrderCountModel;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -252,4 +253,35 @@ public interface HighOrderService {
*/ */
List<HighOrderModel> selectDiscountPackageOrderList(Map<String,Object> map) throws Exception; List<HighOrderModel> selectDiscountPackageOrderList(Map<String,Object> map) throws Exception;
/**
* @Author Sum1Dream
* @name orderByIndex.java
* @Description // 查询卡券统计
* @Date 3:57 下午 2022/1/10
* @Param [java.lang.Integer]
* @return com.hai.model.OrderCountModel
*/
OrderCountModel orderByIndex(Integer code);
/**
* @Author Sum1Dream
* @name orderByIndex.java
* @Description // 查询汇联通统计
* @Date 3:57 下午 2022/1/10
* @Param [java.lang.Integer]
* @return com.hai.model.OrderCountModel
*/
OrderCountModel HLTOrderByIndex(Integer code);
/**
* @Author Sum1Dream
* @name HLTOrderByList.java
* @Description // 工会卡预支付查询列表
* @Date 5:28 下午 2022/1/10
* @Param [Integer]
* @return java.util.List<com.hai.model.HighOrderModel>
*/
List<HighOrderModel> HLTOrderByList(Integer code) throws Exception;
} }

@ -1,6 +1,7 @@
package com.hai.service; package com.hai.service;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel; import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel; import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel; import com.hai.model.OutUserOrderModel;
@ -131,4 +132,15 @@ public interface OutRechargeOrderService {
*/ */
List<OutRechargeOrder> getOutRechargeOrderList(); List<OutRechargeOrder> getOutRechargeOrderList();
/**
* @Author Sum1Dream
* @name rechargeOrderByIndex.java
* @Description // 话费订单统计
* @Date 4:25 下午 2022/1/10
* @Param [java.lang.Integer]
* @return com.hai.model.OrderCountModel
*/
OrderCountModel rechargeOrderByIndex(Integer code);
} }

@ -428,5 +428,32 @@ public class CommonServiceImpl implements CommonService {
dicMapper.updateByPrimaryKeySelective(secDictionary); dicMapper.updateByPrimaryKeySelective(secDictionary);
} }
@Override
public Long getHLTBalance(String codeType, String codeName) {
SecDictionaryExample example = new SecDictionaryExample();
example.createCriteria().andCodeTypeEqualTo(codeType).andCodeNameEqualTo(codeName);
SecDictionary dictionary = dicMapper.selectByExample(example).get(0);
if (dictionary == null) {
return 0L;
}
return Long.valueOf(dictionary.getCodeValue());
}
@Override
public void addHLTBalance(String codeType, String codeName, Long price) {
SecDictionaryExample example = new SecDictionaryExample();
example.createCriteria().andCodeTypeEqualTo(codeType).andCodeNameEqualTo(codeName);
SecDictionary dictionary = dicMapper.selectByExample(example).get(0);
Long balance = Long.valueOf(dictionary.getCodeValue());
dictionary.setCodeValue(String.valueOf(balance + price));
dicMapper.updateByPrimaryKey(dictionary);
}
} }

@ -1,5 +1,6 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.google.common.base.Stopwatch;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -175,7 +177,10 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel, Integer num) { public void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel, Integer num) throws Exception {
StopWatch stopwatch = new StopWatch();
stopwatch.start();
Thread.sleep(1000);
Map<String, Object> mapRule = new HashMap<>(); Map<String, Object> mapRule = new HashMap<>();
mapRule.put("discountPackageId", highDiscountPackage.getId()); mapRule.put("discountPackageId", highDiscountPackage.getId());
@ -204,7 +209,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , detailsList.getDiscountName() +"优惠券库存不足"); throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , detailsList.getDiscountName() +"优惠券库存不足");
} }
// 赠送优惠券 // 优惠券
for (HighDiscountAgentCode discountAgentCode : discountAgentCodeList.subList(0, detailsList.getNum())) { for (HighDiscountAgentCode discountAgentCode : discountAgentCodeList.subList(0, detailsList.getNum())) {
HighDiscountPackageDiscountActual discountPackageDiscountActual = new HighDiscountPackageDiscountActual(); HighDiscountPackageDiscountActual discountPackageDiscountActual = new HighDiscountPackageDiscountActual();
discountPackageDiscountActual.setDiscountPackageId(highDiscountPackage.getId()); discountPackageDiscountActual.setDiscountPackageId(highDiscountPackage.getId());
@ -247,6 +252,12 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
// 设置库存 // 设置库存
highDiscountPackage.setTotalStock(totalStock + num); highDiscountPackage.setTotalStock(totalStock + num);
highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage); highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage);
// 设置库存
highDiscountPackage.setTotalStock(totalStock + num);
highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage);
stopwatch.stop();
System.out.println(stopwatch.getTotalTimeSeconds());
} }
@ -257,7 +268,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId")); HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId"));
// 查询优惠券包实际库存 // 查询优惠券包实际库存
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0); HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);

@ -1127,4 +1127,26 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapper.selectDiscountPackageOrderList(map); return highOrderMapper.selectDiscountPackageOrderList(map);
} }
@Override
public OrderCountModel orderByIndex(Integer code) {
return highOrderMapper.orderByIndex(code);
}
@Override
public OrderCountModel HLTOrderByIndex(Integer code) {
return highOrderMapper.HLTOrderByIndex(code);
}
@Override
public List<HighOrderModel> HLTOrderByList(Integer code) throws Exception {
Map<String , Object> map = new HashMap<>();
map.put("identificationCode" , code);
map.put("orderStatus" , "2,3");
map.put("payType" , "1,2,3,5");
return highOrderMapper.selectOrderList(map);
}
} }

@ -12,6 +12,7 @@ import com.hai.dao.OutRechargeOrderMapper;
import com.hai.dao.OutRechargeOrderMapperExt; import com.hai.dao.OutRechargeOrderMapperExt;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.OrderPushType; import com.hai.enum_type.OrderPushType;
import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel; import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel; import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel; import com.hai.model.OutUserOrderModel;
@ -136,7 +137,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void cancelOrder(Long orderId) { public void cancelOrder(Long orderId) {
OutRechargeOrder order = findByOrderId(orderId); OutRechargeOrder order = findByOrderId(orderId);
if (order != null) { if (order != null && order.getStatus() == 1) {
order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款
order.setCancelTime(new Date()); order.setCancelTime(new Date());
updateOrder(order); updateOrder(order);
@ -173,6 +174,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
map.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeE")), "yyyy-MM-dd HH:mm:ss")); map.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeE")), "yyyy-MM-dd HH:mm:ss"));
} }
return outRechargeOrderMapper.selectOrderCount(map); return outRechargeOrderMapper.selectOrderCount(map);
} }
@ -338,11 +340,15 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
order.setStatus(2); order.setStatus(2);
order.setPayType(3); order.setPayType(3);
order.setPayTime(new Date()); // 支付时间 order.setPayTime(new Date()); // 支付时间
updateOrder(order);
} }
@Override @Override
public List<OutRechargeOrder> getOutRechargeOrderList() { public List<OutRechargeOrder> getOutRechargeOrderList() {
return outRechargeOrderMapper.getCloseOrder(); return outRechargeOrderMapper.getCloseOrder();
} }
@Override
public OrderCountModel rechargeOrderByIndex(Integer code) {
return outRechargeOrderMapper.rechargeOrderByIndex(code);
}
} }

Loading…
Cancel
Save