From 9a60f1f5613fbc0862b2f8ddee705a19abc117df Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Thu, 13 Jan 2022 17:16:37 +0800 Subject: [PATCH] 1 --- .../com/bweb/controller/CommonController.java | 77 ++++++- .../bweb/controller/HighOrderController.java | 18 ++ .../bweb/controller/HighTestController.java | 2 +- .../bweb/controller/HighUserController.java | 3 +- .../src/main/resources/pre/application.yml | 2 +- .../controller/pay/CzOrderController.java | 15 +- .../config/HuiLianTongUnionCardConfig.java | 20 +- .../dao/HighDiscountAgentCodeMapperExt.java | 2 + .../java/com/hai/dao/HighOrderMapper.java | 4 +- .../java/com/hai/dao/HighOrderMapperExt.java | 194 +++++++++++++++++- .../java/com/hai/model/DateCountModel.java | 29 +++ .../java/com/hai/model/IndexCountModel.java | 61 ++++++ .../java/com/hai/model/LineCountModel.java | 56 +++++ .../com/hai/model/LineCountReturnModel.java | 67 ++++++ .../java/com/hai/model/OrderSumModel.java | 30 +++ .../java/com/hai/service/CommonService.java | 29 ++- .../hai/service/HighCouponCodeService.java | 2 +- .../service/HighDiscountAgentCodeService.java | 1 + .../HighDiscountPackageRecordService.java | 2 + .../com/hai/service/HighOrderService.java | 94 ++++++++- .../java/com/hai/service/HighUserService.java | 2 + .../hai/service/impl/CommonServiceImpl.java | 80 ++++++-- .../HighDiscountAgentCodeServiceImpl.java | 4 + .../HighDiscountPackageRecordServiceImpl.java | 13 ++ .../impl/HighDiscountPackageServiceImpl.java | 10 +- .../service/impl/HighOrderServiceImpl.java | 51 +++++ .../hai/service/impl/HighUserServiceImpl.java | 6 + .../impl/HltUnionCardVipServiceImpl.java | 14 +- .../impl/OutRechargeOrderServiceImpl.java | 4 +- .../pay/impl/RechargeOrderServiceImpl.java | 9 + .../resources/dev/commonConfig.properties | 4 +- 31 files changed, 844 insertions(+), 61 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/model/DateCountModel.java create mode 100644 hai-service/src/main/java/com/hai/model/IndexCountModel.java create mode 100644 hai-service/src/main/java/com/hai/model/LineCountModel.java create mode 100644 hai-service/src/main/java/com/hai/model/LineCountReturnModel.java create mode 100644 hai-service/src/main/java/com/hai/model/OrderSumModel.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 8acd23c5..d254c492 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java @@ -1,9 +1,10 @@ package com.bweb.controller; import com.alibaba.fastjson.JSONObject; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.SecConfig; -import com.hai.model.ResponseData; +import com.hai.model.*; import com.hai.service.CommonService; import com.hai.service.SecConfigService; import io.swagger.annotations.Api; @@ -13,6 +14,9 @@ import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; @RestController @@ -77,8 +81,6 @@ public class CommonController { } } - - @RequestMapping(value="/getDictionaryByCodeType",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据 码值类型 查询数据字典") @@ -190,12 +192,11 @@ public class CommonController { @ResponseBody @ApiOperation(value = "查询汇联通余额") public ResponseData getHLTBalance( - @RequestParam(name = "codeType", required = true) String codeType, - @RequestParam(name = "codeName", required = true) String codeName + @RequestParam(name = "codeType", required = true) String codeType ) { try { - return ResponseMsgUtil.success(commonService.getHLTBalance(codeType , codeName)); + return ResponseMsgUtil.success(commonService.getHLTBalance(codeType)); } catch (Exception e) { log.error("CommonController --> getIdAndNameByCodeType() error!", e); @@ -208,7 +209,7 @@ public class CommonController { @ApiOperation(value = "新增余额") public ResponseData addHLTBalance(@RequestBody JSONObject object) { try { - commonService.addHLTBalance(object.getString("codeType") , object.getString("codeName") , object.getLong("price")); + commonService.addHLTBalance(object.getString("codeType") , object.getBigDecimal("price")); return ResponseMsgUtil.success("修改成功"); } catch (Exception e) { @@ -217,4 +218,66 @@ public class CommonController { } } + @RequestMapping(value="/getIndexCount",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询统计") + public ResponseData getIndexCount() { + try { + return ResponseMsgUtil.success(commonService.getIndexCount()); + + } catch (Exception e) { + log.error("CommonController --> getIdAndNameByCodeType() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getLineCount",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询折线图统计数据") + public ResponseData getLineCount() { + try { + LineCountModel lineCountModel = commonService.getLineCount(); + + LineCountReturnModel lineCountReturnModel = new LineCountReturnModel(); + + lineCountReturnModel.setDate(conversionData(lineCountModel.getOrderPriceSum())); + lineCountReturnModel.setUserCount(conversionCountData(lineCountModel.getUserCount())); + lineCountReturnModel.setOrderCount(conversionCountData(lineCountModel.getOrderCount())); + lineCountReturnModel.setOrderRechargeCount(conversionCountData(lineCountModel.getOrderRechargeCount())); + lineCountReturnModel.setOrderRechargePriceSum(conversionSumData(lineCountModel.getOrderRechargePriceSum())); + lineCountReturnModel.setOrderPriceSum(conversionSumData(lineCountModel.getOrderPriceSum())); + + return ResponseMsgUtil.success(lineCountReturnModel); + + } catch (Exception e) { + log.error("CommonController --> getIdAndNameByCodeType() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + private BigDecimal[] conversionSumData(List list) { + BigDecimal[] data = new BigDecimal[7]; + for (int i = 0; i list) throws Exception { + String[] data = new String[7]; + for (int i = 0; i list) { + Long[] data = new Long[7]; + for (int i = 0; i list = highOrderService.HLTOrderByList(code); + String fileName = SysConst.getSysConfig().getFileUrl() + name; + EasyExcel.write(fileName, ExportHighOrderModel.class).sheet("商品订单").doWrite(list); + return ResponseMsgUtil.success(name); + + } catch (Exception e) { + log.error("HighOrderController --> exportGoodsOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index ed309457..092d5d5e 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ -package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HltUnionCardVipService hltUnionCardVipService; @Resource private HighTestService highTestService; // @RequestMapping(value = "/getBackendToken", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "获取访问令牌backendToken") // public ResponseData getBackendToken() { // try { // return ResponseMsgUtil.success(null); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // // @RequestMapping(value = "/TCheckEMsgUnionCardVipRights", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "请求会员体系") // public ResponseData TCheckEMsgUnionCardVipRights(@RequestParam(name = "phone", required = true) String phone) { // try { // JSONObject consumptionRecord = HuiLianTongUnionCardConfig.TCheckEMsgUnionCardVipRights(phone); // JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")); // return ResponseMsgUtil.success(cardInfoObject); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // // // @RequestMapping(value = "/GetMembershipLevel", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "请求会员体系") // public ResponseData GetMembershipLevel(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "regionId", required = true) String regionId ) { // try { // return ResponseMsgUtil.success(hltUnionCardVipService.GetMembershipLevel(phone , regionId)); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // // // @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "解析") // public ResponseData resolveResponse( // @RequestParam(name = "data", required = false) String data // ) { // try { // JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); // return ResponseMsgUtil.success(cardInfoObject); // // } catch (Exception e) { // log.error("getUserByTelephone",e); // return ResponseMsgUtil.exception(e); // } // } // // @RequestMapping(value="/getReadFile",method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "存入用户信息") // public ResponseData getReadFile() { // try { // highTestService.getReadFile(); // return ResponseMsgUtil.success(null); // } catch (Exception e) { // log.error("getUserByTelephone",e); // return ResponseMsgUtil.exception(e); // } // } // @RequestMapping(value="/getUserDiscount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "赠送优惠券") public ResponseData getUserDiscount(@RequestParam(name = "id", required = true) Long id) { try { highTestService.getUserDiscount(id); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HltUnionCardVipService hltUnionCardVipService; @Resource private HighTestService highTestService; @RequestMapping(value = "/getBackendToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取访问令牌backendToken") public ResponseData getBackendToken() { try { return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/GetMembershipLevel", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求会员体系") public ResponseData GetMembershipLevel(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "regionId", required = true) String regionId ) { try { return ResponseMsgUtil.success(hltUnionCardVipService.GetMembershipLevel(phone , regionId)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/submitSms", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求短信") public ResponseData submitSms(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "sms", required = true) String sms ) { try { return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.submitSms(phone , sms)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getReadFile",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "存入用户信息") public ResponseData getReadFile() { try { highTestService.getReadFile(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getUserDiscount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "赠送优惠券") public ResponseData getUserDiscount(@RequestParam(name = "id", required = true) Long id) { try { highTestService.getUserDiscount(id); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java index f513b868..c696e724 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java @@ -157,7 +157,8 @@ public class HighUserController { public ResponseData TCheckEMsgUnionCardVipRights(@RequestParam(name = "phone", required = true) String phone) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.TCheckEMsgUnionCardVipRights(phone); - return ResponseMsgUtil.success(consumptionRecord); + JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponseMembership(consumptionRecord.getString("data")); + return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); diff --git a/hai-bweb/src/main/resources/pre/application.yml b/hai-bweb/src/main/resources/pre/application.yml index 60261c21..f945f8c0 100644 --- a/hai-bweb/src/main/resources/pre/application.yml +++ b/hai-bweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java index 3405c176..54bd94e6 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java @@ -39,21 +39,24 @@ public class CzOrderController { @Resource private OutRechargeOrderService outRechargeOrderService; + + @RequestMapping(value = "/orderRefundNotify", method = RequestMethod.POST) - @ApiOperation(value = "充值回调") + @ApiOperation(value = "退款回调") @ResponseBody public void orderRefundNotify(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) { try { - log.info(reqBodyStr); - HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund(); - highGasOrderRefund.setCreateTime(new Date()); - highGasOrderRefund.setReturnContent(reqBodyStr); - highGasOrderRefundMapper.insert(highGasOrderRefund); + JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); String dataStr = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(dataObject.getString("data")), CommonSysConst.getSysConfig().getTuanYouAppSecret()); JSONObject object = JSONObject.parseObject(dataStr); + HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund(); + highGasOrderRefund.setCreateTime(new Date()); + highGasOrderRefund.setReturnContent(String.valueOf(object)); + highGasOrderRefundMapper.insert(highGasOrderRefund); + // 查询订单 OutRechargeOrder order = outRechargeOrderService.findByOrderNo(object.getString("orderNumber")); diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java index 5b0f4d55..999a4c1d 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java @@ -49,6 +49,24 @@ public class HuiLianTongUnionCardConfig { return request("qgk/queryCardInfo", dataMap); } + /** + * @Author Sum1Dream + * @name submitSms.java + * @Description // 请求汇联通短信接口 + * @Date 10:08 上午 2022/1/13 + * @Param [java.lang.String] + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject submitSms(String mobile , String sms) throws Exception { + Map dataMap = new HashMap<>(); + dataMap.put("smsTypeCode", "NOTIFY_SMS"); + dataMap.put("senderId", "905c602647a74ad895d586364cb307a2"); + dataMap.put("channelCode", "HiSen"); + dataMap.put("mobile", mobile); + dataMap.put("sms", sms); + return request("hltsms/submitSms", dataMap); + } + /** * 查询余额 * @param cardNo 工会卡号 @@ -114,7 +132,7 @@ public class HuiLianTongUnionCardConfig { dataMap.put("appId", signCode); // Md5加密 dataMap.put("sign", WxUtils.generateSignature(map, "chg;l;l23e2!~%^&22ovndfgf*@11212ouower=@=HSG!Business#Controller!" , WXPayConstants.SignType.MD5)); - return requestMembership("etcextra/checkEMsgUnionCardVipRights" , dataMap); + return requestMembership("tetcextra/TCheckEMsgUnionCardVipRights" , dataMap); } catch (Exception e) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_TIMED_OUT, ""); diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java index ebf5c663..c2152114 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java @@ -89,4 +89,6 @@ public interface HighDiscountAgentCodeMapperExt { ""}) List> getDiscountUseConditionList(@Param("param") Map param); + @Select(" select * from high_discount_agent_code where discount_agent_id = #{discountAgentId} and status = 1 limit #{num} " ) + List getDiscountAgentCodByLimit(@Param("discountAgentId") Long discountAgentId ,@Param("num") Long num); } diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index a3d8489a..99cefb59 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -210,4 +210,6 @@ public interface HighOrderMapper extends HighOrderMapperExt { "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(HighOrder record); -} \ No newline at end of file + + +} 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 46880691..fdba5f3e 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1,16 +1,14 @@ package com.hai.dao; 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 com.hai.model.*; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.type.JdbcType; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -754,6 +752,194 @@ public interface HighOrderMapperExt { ""}) List selectOrderList(@Param("map") Map map); + @Select(value = { + ""}) + BigDecimal orderPriceTotal(@Param("map") Map map); + + @Select(value = { + "" + }) + BigDecimal rechargePriceTotal(@Param("map") Map map); + + @Select(value = { + "" + }) + Long orderPriceCount(@Param("map") Map map); + + @Select(value = { + "" + }) + Long rechargePriceCount(@Param("map") Map map); + + @Select(value = { + "" + }) + List getOrderSumOrderByDate(); + @Select(value = { + "" + }) + List getOrderSumRechargeByDate(); + + @Select(value = { + "" + }) + List getDateCountByOrder(); + + @Select(value = { + "" + }) + List getDateCountByRecharge(); + + @Select(value = { + "" + }) + List getDateCountByUser(); } diff --git a/hai-service/src/main/java/com/hai/model/DateCountModel.java b/hai-service/src/main/java/com/hai/model/DateCountModel.java new file mode 100644 index 00000000..b99beaad --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/DateCountModel.java @@ -0,0 +1,29 @@ +package com.hai.model; + +import java.util.Date; + +public class DateCountModel { + /** + * 时间 + */ + private Date datetime; + + // 金额 + private Long num; + + public Date getDatetime() { + return datetime; + } + + public void setDatetime(Date datetime) { + this.datetime = datetime; + } + + public Long getNum() { + return num; + } + + public void setNum(Long num) { + this.num = num; + } +} diff --git a/hai-service/src/main/java/com/hai/model/IndexCountModel.java b/hai-service/src/main/java/com/hai/model/IndexCountModel.java new file mode 100644 index 00000000..7092b601 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/IndexCountModel.java @@ -0,0 +1,61 @@ +package com.hai.model; + +import java.math.BigDecimal; + +public class IndexCountModel { + + // 注册人数 + private Long registrantNum; + + // 总交易金额 + private BigDecimal transactionNum; + + // 当天交易金额 + private BigDecimal transactionToday; + + // 总交易订单 + private Long transactionOrder; + + // 当天交易订单 + private Long transactionOrderToday; + + public Long getRegistrantNum() { + return registrantNum; + } + + public void setRegistrantNum(Long registrantNum) { + this.registrantNum = registrantNum; + } + + public BigDecimal getTransactionNum() { + return transactionNum; + } + + public void setTransactionNum(BigDecimal transactionNum) { + this.transactionNum = transactionNum; + } + + public BigDecimal getTransactionToday() { + return transactionToday; + } + + public void setTransactionToday(BigDecimal transactionToday) { + this.transactionToday = transactionToday; + } + + public Long getTransactionOrder() { + return transactionOrder; + } + + public void setTransactionOrder(Long transactionOrder) { + this.transactionOrder = transactionOrder; + } + + public Long getTransactionOrderToday() { + return transactionOrderToday; + } + + public void setTransactionOrderToday(Long transactionOrderToday) { + this.transactionOrderToday = transactionOrderToday; + } +} diff --git a/hai-service/src/main/java/com/hai/model/LineCountModel.java b/hai-service/src/main/java/com/hai/model/LineCountModel.java new file mode 100644 index 00000000..38b1d8a6 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/LineCountModel.java @@ -0,0 +1,56 @@ +package com.hai.model; + +import java.util.List; + +public class LineCountModel { + //最近七天订单金额 + private List orderPriceSum; + //最近七天话费订单金额 + private List orderRechargePriceSum; + //最近七天订单数量 + private List orderCount; + //最近七天话费订单数量 + private List orderRechargeCount; + //最近七天注册人数 + private List userCount; + + public List getOrderPriceSum() { + return orderPriceSum; + } + + public void setOrderPriceSum(List orderPriceSum) { + this.orderPriceSum = orderPriceSum; + } + + public List getOrderRechargePriceSum() { + return orderRechargePriceSum; + } + + public void setOrderRechargePriceSum(List orderRechargePriceSum) { + this.orderRechargePriceSum = orderRechargePriceSum; + } + + public List getOrderCount() { + return orderCount; + } + + public void setOrderCount(List orderCount) { + this.orderCount = orderCount; + } + + public List getOrderRechargeCount() { + return orderRechargeCount; + } + + public void setOrderRechargeCount(List orderRechargeCount) { + this.orderRechargeCount = orderRechargeCount; + } + + public List getUserCount() { + return userCount; + } + + public void setUserCount(List userCount) { + this.userCount = userCount; + } +} diff --git a/hai-service/src/main/java/com/hai/model/LineCountReturnModel.java b/hai-service/src/main/java/com/hai/model/LineCountReturnModel.java new file mode 100644 index 00000000..dd9b4707 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/LineCountReturnModel.java @@ -0,0 +1,67 @@ +package com.hai.model; + +import java.math.BigDecimal; +import java.util.Date; + +public class LineCountReturnModel { + // 订单金额 + private BigDecimal[] orderPriceSum; + // 话费订单金额 + private BigDecimal[] orderRechargePriceSum; + // 订单数量 + private Long[] orderCount; + // 话费订单数量 + private Long[] orderRechargeCount; + // 用户数量 + private Long[] userCount; + // 时间 + private String[] date; + + public BigDecimal[] getOrderPriceSum() { + return orderPriceSum; + } + + public void setOrderPriceSum(BigDecimal[] orderPriceSum) { + this.orderPriceSum = orderPriceSum; + } + + public BigDecimal[] getOrderRechargePriceSum() { + return orderRechargePriceSum; + } + + public void setOrderRechargePriceSum(BigDecimal[] orderRechargePriceSum) { + this.orderRechargePriceSum = orderRechargePriceSum; + } + + public Long[] getOrderCount() { + return orderCount; + } + + public void setOrderCount(Long[] orderCount) { + this.orderCount = orderCount; + } + + public Long[] getOrderRechargeCount() { + return orderRechargeCount; + } + + public void setOrderRechargeCount(Long[] orderRechargeCount) { + this.orderRechargeCount = orderRechargeCount; + } + + public Long[] getUserCount() { + return userCount; + } + + public void setUserCount(Long[] userCount) { + this.userCount = userCount; + } + + public String[] getDate() { + return date; + } + + public void setDate(String[] date) { + this.date = date; + } +} diff --git a/hai-service/src/main/java/com/hai/model/OrderSumModel.java b/hai-service/src/main/java/com/hai/model/OrderSumModel.java new file mode 100644 index 00000000..f4b3c748 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/OrderSumModel.java @@ -0,0 +1,30 @@ +package com.hai.model; + +import java.math.BigDecimal; +import java.util.Date; + +public class OrderSumModel { + /** + * 时间 + */ + private Date datetime; + + // 金额 + private BigDecimal price; + + public Date getDatetime() { + return datetime; + } + + public void setDatetime(Date datetime) { + this.datetime = datetime; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } +} 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 99d66834..bf5c2cba 100644 --- a/hai-service/src/main/java/com/hai/service/CommonService.java +++ b/hai-service/src/main/java/com/hai/service/CommonService.java @@ -10,7 +10,13 @@ package com.hai.service; import com.alibaba.fastjson.JSONObject; import com.hai.entity.SecDictionary; import com.hai.entity.SecRegion; +import com.hai.model.IndexCountModel; +import com.hai.model.LineCountModel; +import com.hai.model.OrderCountModel; +import com.hai.model.OrderSumModel; +import org.apache.ibatis.type.BigDecimalTypeHandler; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -191,7 +197,7 @@ public interface CommonService { * @Param [java.lang.String, java.lang.String] * @return java.lang.Long */ - Long getHLTBalance(String codeType, String codeName); + BigDecimal getHLTBalance(String codeType); /** * @Author Sum1Dream @@ -201,7 +207,26 @@ public interface CommonService { * @Param [java.lang.String, java.lang.String, java.lang.Long] * @return void */ - void addHLTBalance(String codeType, String codeName , Long price); + void addHLTBalance(String codeType, BigDecimal price); + /** + * @Author Sum1Dream + * @name getIndexCount.java + * @Description // 获取首页统计数据 + * @Date 5:00 下午 2022/1/11 + * @Param [] + * @return com.hai.model.IndexCountModel + */ + IndexCountModel getIndexCount(); + + /** + * @Author Sum1Dream + * @name getLineCount.java + * @Description // 查询折线图数据 + * @Date 2:38 下午 2022/1/13 + * @Param [] + * @return com.hai.model.LineCountModel + */ + LineCountModel getLineCount(); } diff --git a/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java b/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java index c4624960..4b7e4e4b 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java @@ -2,6 +2,7 @@ package com.hai.service; import com.hai.entity.HighCoupon; import com.hai.entity.HighCouponCode; +import com.hai.model.OrderSumModel; import com.hai.model.UserInfoModel; import java.util.Date; @@ -110,5 +111,4 @@ public interface HighCouponCodeService { **/ List getCouponCodeList(Map map); - } diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java b/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java index 2d0c4197..b5e79ad0 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java @@ -93,4 +93,5 @@ public interface HighDiscountAgentCodeService { */ Integer getSalesDiscount(Long discountAgentId); + List getDiscountAgentCodByLimit(Long discountAgentId , Long num); } diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountPackageRecordService.java b/hai-service/src/main/java/com/hai/service/HighDiscountPackageRecordService.java index 3190b732..783b81af 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountPackageRecordService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountPackageRecordService.java @@ -30,4 +30,6 @@ public interface HighDiscountPackageRecordService { */ void insertRecord(HighDiscountPackageRecord record); + Boolean isGive(Long userId); + } 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 68ad9566..0e1c1c52 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -2,10 +2,9 @@ package com.hai.service; 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 com.hai.model.*; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -283,5 +282,94 @@ public interface HighOrderService { */ List HLTOrderByList(Integer code) throws Exception; + /** + * @Author Sum1Dream + * @name orderPriceTotal.java + * @Description // 获取支付订单总金额 + * @Date 2:09 下午 2022/1/12 + * @Param [] + * @return java.math.BigDecimal + */ + BigDecimal orderPriceTotal(Map map); + + /** + * @Author Sum1Dream + * @name rechargePriceTotal.java + * @Description // 获取话费订单总金额 + * @Date 2:09 下午 2022/1/12 + * @Param [] + * @return java.math.BigDecimal + */ + BigDecimal rechargePriceTotal(Map map); + + /** + * @Author Sum1Dream + * @name orderPriceCount.java + * @Description // 获取支付订单数量 + * @Date 2:09 下午 2022/1/12 + * @Param [] + * @return java.lang.Long + */ + Long orderPriceCount(Map map); + + /** + * @Author Sum1Dream + * @name rechargePriceCount.java + * @Description // 获取话费订单数量 + * @Date 2:10 下午 2022/1/12 + * @Param [] + * @return java.lang.Long + */ + Long rechargePriceCount(Map map); + + /** + * @Author Sum1Dream + * @name getOrderSumOrderByDate.java + * @Description // 查询订单最近七天订单金额 + * @Date 11:48 上午 2022/1/13 + * @Param [] + * @return java.util.List + */ + List getOrderSumOrderByDate(); + + /** + * @Author Sum1Dream + * @name getOrderSumRechargeByDate.java + * @Description // 查询话费订单最近七天订单金额 + * @Date 11:49 上午 2022/1/13 + * @Param [] + * @return java.util.List + */ + List getOrderSumRechargeByDate(); + + /** + * @Author Sum1Dream + * @name getDateCountByUser.java + * @Description // 查询最近七天注册用户数量 + * @Date 11:49 上午 2022/1/13 + * @Param [] + * @return java.util.List + */ + List getDateCountByUser(); + + /** + * @Author Sum1Dream + * @name getDateCountByOrder.java + * @Description // 查询最近七天订单数量 + * @Date 11:50 上午 2022/1/13 + * @Param [] + * @return java.util.List + */ + List getDateCountByOrder(); + + /** + * @Author Sum1Dream + * @name getDateCountByRecharge.java + * @Description //查询最近七天话费订单数量 + * @Date 11:51 上午 2022/1/13 + * @Param [] + * @return java.util.List + */ + List getDateCountByRecharge(); } diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 8a4510cd..eed2dcf3 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -108,4 +108,6 @@ public interface HighUserService { **/ void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId); + Long countUser(); + } 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 485c60a8..2a1956eb 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 @@ -7,15 +7,18 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.dao.SecDictionaryMapper; import com.hai.dao.SecRegionMapper; -import com.hai.entity.SecDictionary; -import com.hai.entity.SecDictionaryExample; -import com.hai.entity.SecRegion; -import com.hai.entity.SecRegionExample; +import com.hai.entity.*; +import com.hai.model.IndexCountModel; +import com.hai.model.LineCountModel; import com.hai.service.CommonService; +import com.hai.service.HighOrderService; +import com.hai.service.HighUserService; +import com.hai.service.SecConfigService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.*; import java.util.concurrent.locks.ReentrantLock; @@ -38,6 +41,15 @@ public class CommonServiceImpl implements CommonService { @Resource private SecDictionaryMapper dicMapper; + + @Resource + private SecConfigService secConfigService; + + @Resource + private HighUserService highUserService; + + @Resource + private HighOrderService highOrderService; private Map> dicCache = new HashMap>(); @@ -429,31 +441,57 @@ public class CommonServiceImpl implements CommonService { } @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; - } + public BigDecimal getHLTBalance(String codeType) { - return Long.valueOf(dictionary.getCodeValue()); + SecConfig secConfig = secConfigService.findByCodeType(codeType); + return new BigDecimal(secConfig.getCodeValue()); } @Override - public void addHLTBalance(String codeType, String codeName, Long price) { - SecDictionaryExample example = new SecDictionaryExample(); - example.createCriteria().andCodeTypeEqualTo(codeType).andCodeNameEqualTo(codeName); + public void addHLTBalance(String codeType , BigDecimal price) { + SecConfig secConfig = secConfigService.findByCodeType(codeType); + + BigDecimal balance = new BigDecimal(secConfig.getCodeValue()); - SecDictionary dictionary = dicMapper.selectByExample(example).get(0); + secConfig.setCodeValue(String.valueOf(price.add(balance))); + + secConfigService.updateSecConfig(secConfig); + } - Long balance = Long.valueOf(dictionary.getCodeValue()); + @Override + public IndexCountModel getIndexCount() { + + Map map = new HashMap<>(); + Map mapToDay = new HashMap<>(); + + mapToDay.put("today" , "1"); + + IndexCountModel countModel = new IndexCountModel(); + + // 获取注册总人数 + countModel.setRegistrantNum(highUserService.countUser()); + // 获取订单总金额 + countModel.setTransactionNum(highOrderService.orderPriceTotal(map).add(highOrderService.rechargePriceTotal(map))); + // 获取当天订单总金额 + countModel.setTransactionToday(highOrderService.orderPriceTotal(mapToDay).add(highOrderService.rechargePriceTotal(mapToDay))); + // 获取订单数量 + countModel.setTransactionOrder(highOrderService.orderPriceCount(map) + highOrderService.rechargePriceCount(map)); + //获取订单当天数量 + countModel.setTransactionOrderToday(highOrderService.orderPriceCount(mapToDay) + highOrderService.rechargePriceCount(mapToDay)); + return countModel; + } + + @Override + public LineCountModel getLineCount() { - dictionary.setCodeValue(String.valueOf(balance + price)); + LineCountModel lineCount = new LineCountModel(); - dicMapper.updateByPrimaryKey(dictionary); + lineCount.setOrderPriceSum(highOrderService.getOrderSumOrderByDate()); + lineCount.setOrderRechargePriceSum(highOrderService.getOrderSumRechargeByDate()); + lineCount.setOrderCount(highOrderService.getDateCountByOrder()); + lineCount.setOrderRechargeCount(highOrderService.getDateCountByRecharge()); + lineCount.setUserCount(highOrderService.getDateCountByUser()); + return lineCount; } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java index 3a7b0d35..7c56120a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java @@ -154,4 +154,8 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe return highDiscountAgentCodeMapper.selectByExample(example).size(); } + @Override + public List getDiscountAgentCodByLimit(Long discountAgentId, Long num) { + return highDiscountAgentCodeMapper.getDiscountAgentCodByLimit(discountAgentId,num); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageRecordServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageRecordServiceImpl.java index b502f7a0..116c203b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageRecordServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageRecordServiceImpl.java @@ -63,4 +63,17 @@ public class HighDiscountPackageRecordServiceImpl implements HighDiscountPackage record.setStatus(1); highDiscountPackageRecordMapper.insert(record); } + + @Override + public Boolean isGive(Long userId) { + + HighDiscountPackageRecordExample example = new HighDiscountPackageRecordExample(); + HighDiscountPackageRecordExample.Criteria criteria = example.createCriteria(); + + criteria.andUserIdEqualTo(userId.intValue()).andStatusEqualTo(1); + + List list = discountPackageRecordMapper.selectByExample(example); + + return list.size() > 0; + } } 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 0aaef5be..c82fc1a2 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 @@ -178,9 +178,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic @Override @Transactional(propagation = Propagation.REQUIRES_NEW) 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()); @@ -203,14 +200,14 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic for (HighDiscountPackageDetails detailsList : discountPackageDetailsList) { // 查询代理商与优惠券关系 列表 HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelByDiscountAgent(detailsList.getDiscountId().longValue(), detailsList.getAgentId()); - List discountAgentCodeList = highDiscountAgentCodeService.getDiscountCodeByStatus(discountAgentRel.getId() , 1); + List discountAgentCodeList = highDiscountAgentCodeService.getDiscountAgentCodByLimit(discountAgentRel.getId() , detailsList.getNum().longValue()); if (discountAgentCodeList.size() < detailsList.getNum()) { throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , detailsList.getDiscountName() +"优惠券库存不足"); } // 优惠券 - for (HighDiscountAgentCode discountAgentCode : discountAgentCodeList.subList(0, detailsList.getNum())) { + for (HighDiscountAgentCode discountAgentCode : discountAgentCodeList) { HighDiscountPackageDiscountActual discountPackageDiscountActual = new HighDiscountPackageDiscountActual(); discountPackageDiscountActual.setDiscountPackageId(highDiscountPackage.getId()); discountPackageDiscountActual.setDiscountPackageActualId(discountPackageActual.getId()); @@ -256,8 +253,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic // 设置库存 highDiscountPackage.setTotalStock(totalStock + num); highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage); - stopwatch.stop(); - System.out.println(stopwatch.getTotalTimeSeconds()); + } 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 168712e7..2108b4b8 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 @@ -1149,4 +1149,55 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapper.selectOrderList(map); } + + @Override + public BigDecimal orderPriceTotal(Map map) { + if (highOrderMapper.orderPriceTotal(map) == null) { + return new BigDecimal(0); + } + return highOrderMapper.orderPriceTotal(map); + } + + @Override + public BigDecimal rechargePriceTotal(Map map) { + if (highOrderMapper.rechargePriceTotal(map) == null) { + return new BigDecimal(0); + } + return highOrderMapper.rechargePriceTotal(map); + } + + @Override + public Long orderPriceCount(Map map) { + return highOrderMapper.orderPriceCount(map); + } + + @Override + public Long rechargePriceCount(Map map) { + return highOrderMapper.rechargePriceCount(map); + } + + @Override + public List getOrderSumOrderByDate() { + return highOrderMapper.getOrderSumOrderByDate(); + } + + @Override + public List getOrderSumRechargeByDate() { + return highOrderMapper.getOrderSumRechargeByDate(); + } + + @Override + public List getDateCountByUser() { + return highOrderMapper.getDateCountByUser(); + } + + @Override + public List getDateCountByOrder() { + return highOrderMapper.getDateCountByOrder(); + } + + @Override + public List getDateCountByRecharge() { + return highOrderMapper.getDateCountByRecharge(); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index a50755da..4aea00bf 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -218,4 +218,10 @@ public class HighUserServiceImpl implements HighUserService { highGoldRec.setResId(resId); highGoldRecService.insertGoldRec(highGoldRec); } + + @Override + public Long countUser() { + HighUserExample example = new HighUserExample(); + return highUserMapper.countByExample(example); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java index 735e832b..d1668bdf 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java @@ -53,6 +53,9 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService { @Resource private HighDiscountPackageActualService discountPackageActualService; + @Resource + private HighDiscountPackageRecordService discountPackageRecordService; + @Resource private HighDiscountPackageDiscountActualService discountPackageDiscountActualService; @@ -76,6 +79,7 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService { } boolean isVip = false; + boolean isFree = false; // 1: 1-E信通会员权益,2-工会卡会员权益 int equityLevel = 0; @@ -88,6 +92,10 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService { } else if (d.getInteger("level").equals(2)) { isVip = true; equityLevel = 2; + } else if (d.getInteger("level").equals(3)) { + isVip = true; + isFree = true; + equityLevel = 1; } } @@ -101,6 +109,10 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户当月已赠送"); } else { + if (isFree && discountPackageRecordService.isGive(highUser.getId())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "免费用户已赠送"); + } + Map map = new HashMap<>(); map.put("companyId", bsCompany.getId()); map.put("usingAttribution", equityLevel); @@ -110,7 +122,7 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService { // 查询话费专属优惠券包 List highDiscountPackages = highDiscountPackageService.getDiscountPackageList(map); - if (highDiscountPackages.size() == 0) { + if (highDiscountPackages.size() == 0) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未配置专属优惠券包"); } 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 93486dad..7380832c 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 @@ -296,7 +296,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { dataMap.put("tranDesc", tranDesc); HighGasOrderPush payPush = new HighGasOrderPush(); payPush.setType(OrderPushType.type5.getType()); - payPush.setOrderNo(userCard.getCardNo()); + payPush.setOrderNo(order.getOrderNo()); payPush.setCreateTime(new Date()); payPush.setCode(consumption.getString("respCode")); payPush.setRequestContent(JSON.toJSONString(dataMap)); @@ -307,7 +307,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); - if (consumptionResult.getBoolean("success") != true) { + if (!consumptionResult.getBoolean("success")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号 diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java index 6e452805..02bb007b 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java @@ -76,6 +76,15 @@ public class RechargeOrderServiceImpl implements PayService { order.setPayTime(new Date()); // 支付时间 order.setStatus(2); // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 outRechargeOrderService.updateOrder(order); + + // 推送订单记录 + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type2.getType()); + highGasOrderPush.setOrderNo(order.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(order.getOrderNo()); + highGasOrderPush.setReturnContent(String.valueOf(map)); + highGasOrderPushMapper.insert(highGasOrderPush); } } } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 6add75f1..04beb40e 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -23,8 +23,8 @@ HuiLianTongUnionCardUrl=http://hltgz.com:4010/api/v2/execute.json HuiLianTongUnionCardAccessCode=6FCAE1470CEF465988351BB65ABAA8AE HuiLianTongUnionCardSignCode=F8E91A3C -HltMembershipLevelAccessCode = 9766699A55D640BB97FD8674CF13CCB4 -HltMembershipLevelSignCode = C9B28C9A +HltMembershipLevelAccessCode = 19741F626EE446939CE6D448B0FB0EE8 +HltMembershipLevelSignCode = 7854B96C