From 082837dff1f62cdfe2a5dc82a8b0de5a55864de5 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Tue, 11 Jan 2022 09:24:41 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/bweb/controller/CommonController.java | 33 ++++++++
.../bweb/controller/HighOrderController.java | 46 ++++++++++
.../OutRechargeOrderController.java | 15 ++++
.../java/com/hai/dao/HighOrderMapperExt.java | 83 ++++++++++++++++++-
.../hai/dao/OutRechargeOrderMapperExt.java | 15 ++++
.../java/com/hai/model/OrderCountModel.java | 39 +++++++++
.../java/com/hai/service/CommonService.java | 21 +++++
.../service/HighDiscountPackageService.java | 3 +-
.../com/hai/service/HighOrderService.java | 32 +++++++
.../hai/service/OutRechargeOrderService.java | 12 +++
.../hai/service/impl/CommonServiceImpl.java | 27 ++++++
.../impl/HighDiscountPackageServiceImpl.java | 16 +++-
.../service/impl/HighOrderServiceImpl.java | 22 +++++
.../impl/OutRechargeOrderServiceImpl.java | 10 ++-
14 files changed, 367 insertions(+), 7 deletions(-)
create mode 100644 hai-service/src/main/java/com/hai/model/OrderCountModel.java
diff --git a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java
index b23fddca..8acd23c5 100644
--- a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java
+++ b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java
@@ -1,5 +1,6 @@
package com.bweb.controller;
+import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.SecConfig;
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);
+ }
+ }
+
}
diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
index b75965ae..6b23e1bb 100644
--- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
+++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
@@ -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);
+ }
+ }
+
}
diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
index ef63b265..dba5d200 100644
--- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
+++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
@@ -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);
+ }
+ }
+
}
diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
index 09d8251a..46880691 100644
--- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
+++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
@@ -4,6 +4,7 @@ import com.hai.entity.HighOrder;
import com.hai.model.HighOrderData;
import com.hai.model.HighOrderModel;
import com.hai.model.HighOrderPreModel;
+import com.hai.model.OrderCountModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
@@ -625,7 +626,7 @@ public interface HighOrderMapperExt {
@Select({""})
List selectDiscountPackageOrderList(@Param("map") Map map);
+
+ @Select(value = {
+ ""
+ })
+ @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 = {
+ ""
+ })
+ @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({""})
+ List selectOrderList(@Param("map") Map map);
+
+
+
}
diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
index 3002b4b1..f28e72aa 100644
--- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
+++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
@@ -3,6 +3,7 @@ package com.hai.dao;
import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeOrder;
+import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel;
@@ -139,4 +140,18 @@ public interface OutRechargeOrderMapperExt {
@Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT)
})
List getCloseOrder();
+
+
+ @Select(value = {
+ ""
+ })
+ @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);
}
diff --git a/hai-service/src/main/java/com/hai/model/OrderCountModel.java b/hai-service/src/main/java/com/hai/model/OrderCountModel.java
new file mode 100644
index 00000000..26e9848a
--- /dev/null
+++ b/hai-service/src/main/java/com/hai/model/OrderCountModel.java
@@ -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;
+ }
+}
diff --git a/hai-service/src/main/java/com/hai/service/CommonService.java b/hai-service/src/main/java/com/hai/service/CommonService.java
index 89dcfa6c..99d66834 100644
--- a/hai-service/src/main/java/com/hai/service/CommonService.java
+++ b/hai-service/src/main/java/com/hai/service/CommonService.java
@@ -183,4 +183,25 @@ public interface CommonService {
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);
+
+
}
diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java b/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
index e22d3382..02597108 100644
--- a/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
+++ b/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
@@ -87,7 +87,7 @@ public interface HighDiscountPackageService {
* @Param [com.hai.entity.HighDiscountPackage]
* @return void
*/
- void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num);
+ void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num) throws Exception;
/**
* @Author Sum1Dream
@@ -99,4 +99,5 @@ public interface HighDiscountPackageService {
*/
void freeUserDiscountPackage(Map map) throws Exception;
+
}
diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java
index 127106eb..68ad9566 100644
--- a/hai-service/src/main/java/com/hai/service/HighOrderService.java
+++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java
@@ -4,6 +4,7 @@ import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.model.HighOrderData;
import com.hai.model.HighOrderModel;
+import com.hai.model.OrderCountModel;
import java.util.List;
import java.util.Map;
@@ -252,4 +253,35 @@ public interface HighOrderService {
*/
List selectDiscountPackageOrderList(Map 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
+ */
+ List HLTOrderByList(Integer code) throws Exception;
+
+
}
diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
index 2ee2d377..4a6ea9c5 100644
--- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
+++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
@@ -1,6 +1,7 @@
package com.hai.service;
import com.hai.entity.OutRechargeOrder;
+import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel;
@@ -131,4 +132,15 @@ public interface OutRechargeOrderService {
*/
List 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);
+
+
}
diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
index c830ffe4..485c60a8 100644
--- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
+++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
@@ -428,5 +428,32 @@ public class CommonServiceImpl implements CommonService {
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);
+ }
}
diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
index 5a0f38e6..0aaef5be 100644
--- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
+++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
@@ -1,5 +1,6 @@
package com.hai.service.impl;
+import com.google.common.base.Stopwatch;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
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.Propagation;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StopWatch;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -175,7 +177,10 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Override
@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 mapRule = new HashMap<>();
mapRule.put("discountPackageId", highDiscountPackage.getId());
@@ -204,7 +209,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , detailsList.getDiscountName() +"优惠券库存不足");
}
- // 赠送优惠券
+ // 优惠券
for (HighDiscountAgentCode discountAgentCode : discountAgentCodeList.subList(0, detailsList.getNum())) {
HighDiscountPackageDiscountActual discountPackageDiscountActual = new HighDiscountPackageDiscountActual();
discountPackageDiscountActual.setDiscountPackageId(highDiscountPackage.getId());
@@ -247,6 +252,12 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
// 设置库存
highDiscountPackage.setTotalStock(totalStock + num);
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"));
-
// 查询优惠券包实际库存
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);
diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
index a0d2571d..4f310cc0 100644
--- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
+++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
@@ -1127,4 +1127,26 @@ public class HighOrderServiceImpl implements HighOrderService {
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 HLTOrderByList(Integer code) throws Exception {
+
+ Map map = new HashMap<>();
+
+ map.put("identificationCode" , code);
+ map.put("orderStatus" , "2,3");
+ map.put("payType" , "1,2,3,5");
+
+ return highOrderMapper.selectOrderList(map);
+ }
}
diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
index 30396e80..da5bd436 100644
--- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
+++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
@@ -12,6 +12,7 @@ import com.hai.dao.OutRechargeOrderMapper;
import com.hai.dao.OutRechargeOrderMapperExt;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
+import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel;
@@ -136,7 +137,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void cancelOrder(Long orderId) {
OutRechargeOrder order = findByOrderId(orderId);
- if (order != null) {
+ if (order != null && order.getStatus() == 1) {
order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款
order.setCancelTime(new Date());
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"));
}
+
return outRechargeOrderMapper.selectOrderCount(map);
}
@@ -338,11 +340,15 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
order.setStatus(2);
order.setPayType(3);
order.setPayTime(new Date()); // 支付时间
- updateOrder(order);
}
@Override
public List getOutRechargeOrderList() {
return outRechargeOrderMapper.getCloseOrder();
}
+
+ @Override
+ public OrderCountModel rechargeOrderByIndex(Integer code) {
+ return outRechargeOrderMapper.rechargeOrderByIndex(code);
+ }
}