Browse Source

股东大盘分红增加日志打印
广电电渠报备增加查询列表接口

mac 2 years ago
parent
commit
ee3ba6dd99

+ 31 - 0
kxs-product/kxs-product-api/src/main/java/com/kxs/product/api/req/gd/GdCommonReq.java

@@ -0,0 +1,31 @@
+package com.kxs.product.api.req.gd;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+/**
+ * 查询开卡订单数据
+ *
+ * @author 没秃顶的码农
+ * @date 2024-04-23
+ */
+@Data
+@SuperBuilder
+public class GdCommonReq {
+
+    /**
+     * 签名
+     */
+    private String sign;
+
+    /**
+     * 机构号
+     */
+    private String brhNo;
+
+    /**
+     * 时间戳
+     */
+    private Long timestamp;
+}

+ 5 - 11
kxs-product/kxs-product-api/src/main/java/com/kxs/product/api/req/gd/GdQueryCardOrderReq.java

@@ -2,6 +2,8 @@ package com.kxs.product.api.req.gd;
 
 
 import lombok.Builder;
 import lombok.Builder;
 import lombok.Data;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.SuperBuilder;
 
 
 /**
 /**
  * 查询开卡订单数据
  * 查询开卡订单数据
@@ -9,14 +11,11 @@ import lombok.Data;
  * @author 没秃顶的码农
  * @author 没秃顶的码农
  * @date 2024-04-23
  * @date 2024-04-23
  */
  */
+@EqualsAndHashCode(callSuper = true)
 @Data
 @Data
-@Builder
-public class GdQueryCardOrderReq {
+@SuperBuilder
+public class GdQueryCardOrderReq extends GdCommonReq{
 
 
-    /**
-     * 签名
-     */
-    private String sign;
     /**
     /**
      * 查询开始时间
      * 查询开始时间
      */
      */
@@ -27,9 +26,4 @@ public class GdQueryCardOrderReq {
     private String queryEndTime;
     private String queryEndTime;
     private String pageNo;
     private String pageNo;
     private String pageSize;
     private String pageSize;
-    /**
-     * 机构号
-     */
-    private String brhNo;
-    private String timestamp;
 }
 }

+ 21 - 0
kxs-product/kxs-product-api/src/main/java/com/kxs/product/api/req/gd/GdSimOrderReq.java

@@ -0,0 +1,21 @@
+package com.kxs.product.api.req.gd;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.SuperBuilder;
+
+import java.util.List;
+
+/**
+ * 查询开卡订单数据
+ *
+ * @author 没秃顶的码农
+ * @date 2024-04-23
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@SuperBuilder
+public class GdSimOrderReq extends GdCommonReq{
+
+    private String orderNos;
+}

+ 39 - 0
kxs-product/kxs-product-api/src/main/java/com/kxs/product/api/res/gd/GdSimOrderRes.java

@@ -0,0 +1,39 @@
+package com.kxs.product.api.res.gd;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 查询开卡订单数据
+ *
+ * @author 没秃顶的码农
+ * @date 2024-04-23
+ */
+@Data
+@Builder
+public class GdSimOrderRes{
+
+    private String orderNo;
+    private String mobile;
+    private String productName;
+    private String status;
+    private String actualAmount;
+    private String province;
+    private String city;
+    private String brhNo;
+    private String logisticsCompany;
+    private String iccid;
+    private String firstRechargeAmount;
+    private String logisticsNo;
+    private String offerName;
+    private String userName;
+    private String idcardNo;
+    private String receiveName;
+    private String receiveMobile;
+    private String receiveAddress;
+    private String receiveAddressDetail;
+    private String createTime;
+    private String updateTime;
+
+
+}

+ 12 - 1
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/controller/admin/SysGdController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.kxs.common.core.util.R;
 import com.kxs.common.core.util.R;
 import com.kxs.common.idempotent.annotation.Idempotent;
 import com.kxs.common.idempotent.annotation.Idempotent;
+import com.kxs.common.security.annotation.Inner;
 import com.kxs.product.api.model.KxsGdReport;
 import com.kxs.product.api.model.KxsGdReport;
 import com.kxs.product.biz.constant.enums.GdReportEnum;
 import com.kxs.product.biz.constant.enums.GdReportEnum;
 import com.kxs.product.biz.service.KxsGdReportService;
 import com.kxs.product.biz.service.KxsGdReportService;
@@ -12,6 +13,8 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
+
 /**
 /**
  * 产品模块(SysGd)控制层
  * 产品模块(SysGd)控制层
  *
  *
@@ -79,8 +82,16 @@ public class SysGdController {
         return kxsGdReportService.checkGdData(startTime, endTime);
         return kxsGdReportService.checkGdData(startTime, endTime);
     }
     }
 
 
+    /**
+     * 广电报备-查询电渠订单接口
+     *
+     */
+    @PostMapping("/onlineSimOrder")
+    public R onlineSimOrder(@RequestBody List<String> orderNos) {
 
 
-
+        kxsGdReportService.onlineSimOrder(orderNos);
+        return R.ok();
+    }
 
 
 
 
 }
 }

+ 8 - 0
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/KxsGdReportService.java

@@ -13,6 +13,7 @@ import com.kxs.product.api.vo.kxsapp.gd.GdDqDotNumVO;
 import com.kxs.product.api.vo.kxsapp.gd.GdReportListVO;
 import com.kxs.product.api.vo.kxsapp.gd.GdReportListVO;
 import com.kxs.product.api.vo.kxsapp.machine.MachineUnBindListVO;
 import com.kxs.product.api.vo.kxsapp.machine.MachineUnBindListVO;
 
 
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -120,5 +121,12 @@ public interface KxsGdReportService extends IService<KxsGdReport> {
      * @param param 参数
      * @param param 参数
      */
      */
     void acceptActData(Map<String, Object> param);
     void acceptActData(Map<String, Object> param);
+
+    /**
+     * 广电报备-查询电渠订单接口
+     *
+     * @param orderNos 订单号
+     */
+    void onlineSimOrder(List<String> orderNos);
 }
 }
 
 

+ 9 - 1
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/KxsGdService.java

@@ -1,5 +1,6 @@
 package com.kxs.product.biz.service;
 package com.kxs.product.biz.service;
 
 
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -25,5 +26,12 @@ public interface KxsGdService {
      *
      *
      * @param param 订单数据
      * @param param 订单数据
      */
      */
-    void checkGdAsyncData(Map<String, Object> param);
+    void acceptGdActData(Map<String, Object> param);
+
+    /**
+     * 查询电渠订单接口
+     *
+     * @param orderNos 订单号
+     */
+    void onlineSimOrder(List<String> orderNos);
 }
 }

+ 8 - 1
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/impl/KxsGdReportServiceImpl.java

@@ -39,6 +39,7 @@ import org.springframework.stereotype.Service;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Optional;
@@ -235,10 +236,16 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
     public void acceptActData(Map<String, Object> param) {
     public void acceptActData(Map<String, Object> param) {
 
 
         log.info("接收到广电交易数据:{}", JSON.toJSONString(param));
         log.info("接收到广电交易数据:{}", JSON.toJSONString(param));
-        kxsGdService.checkGdAsyncData(param);
+        kxsGdService.acceptGdActData(param);
 
 
     }
     }
 
 
+    @Override
+    public void onlineSimOrder(List<String> orderNos) {
+
+        kxsGdService.onlineSimOrder(orderNos);
+    }
+
 
 
 }
 }
 
 

+ 72 - 26
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/impl/KxsGdServiceImpl.java

@@ -16,10 +16,13 @@ import com.kxs.common.core.exception.GlobalCustomerException;
 import com.kxs.common.mq.handlers.IMQSender;
 import com.kxs.common.mq.handlers.IMQSender;
 import com.kxs.product.api.model.KxsGdOrder;
 import com.kxs.product.api.model.KxsGdOrder;
 import com.kxs.product.api.model.KxsGdReport;
 import com.kxs.product.api.model.KxsGdReport;
+import com.kxs.product.api.req.gd.GdCommonReq;
 import com.kxs.product.api.req.gd.GdQueryCardOrderReq;
 import com.kxs.product.api.req.gd.GdQueryCardOrderReq;
+import com.kxs.product.api.req.gd.GdSimOrderReq;
 import com.kxs.product.api.res.gd.GdCommRes;
 import com.kxs.product.api.res.gd.GdCommRes;
 import com.kxs.product.api.res.gd.GdQueryOrderRes;
 import com.kxs.product.api.res.gd.GdQueryOrderRes;
 import com.kxs.product.api.amqp.rabbit.RabbitGdActQueueMQ;
 import com.kxs.product.api.amqp.rabbit.RabbitGdActQueueMQ;
+import com.kxs.product.api.res.gd.GdSimOrderRes;
 import com.kxs.product.biz.config.RsaProperties;
 import com.kxs.product.biz.config.RsaProperties;
 import com.kxs.product.biz.constant.enums.GdReportEnum;
 import com.kxs.product.biz.constant.enums.GdReportEnum;
 import com.kxs.product.biz.mapper.KxsGdReportMapper;
 import com.kxs.product.biz.mapper.KxsGdReportMapper;
@@ -32,12 +35,8 @@ import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Optional;
@@ -68,7 +67,17 @@ public class KxsGdServiceImpl implements KxsGdService {
         int pageSize = 50;
         int pageSize = 50;
 
 
         do {
         do {
-            List<GdQueryOrderRes.GdQueryOrder> list = this.queryCardOrders(startTime, endTime, pageNo, pageSize);
+            GdQueryCardOrderReq req = GdQueryCardOrderReq.builder()
+                    .queryBeginTime(startTime)
+                    .queryEndTime(endTime)
+                    .pageNo(String.valueOf(pageNo))
+                    .pageSize(String.valueOf(pageSize)).build();
+            String response = sendToGd("/ycsim-business/openapi/query_card_order_info", req);
+            GdCommRes<GdQueryOrderRes> commRes = JSONUtil.toBean(response, new TypeReference<>() {}, true);
+            if(commRes.getResultCode() != 1){
+                throw new GlobalCustomerException(commRes.getErrorDesc());
+            }
+            List<GdQueryOrderRes.GdQueryOrder> list = commRes.getData().getRecords();
             if (list.isEmpty()) {
             if (list.isEmpty()) {
                 pageNo = -1;
                 pageNo = -1;
             } else {
             } else {
@@ -100,9 +109,57 @@ public class KxsGdServiceImpl implements KxsGdService {
 
 
     }
     }
 
 
+
+    @Override
+    public void onlineSimOrder(List<String> orderNos) {
+        GdSimOrderReq req = GdSimOrderReq.builder()
+                .orderNos(JSON.toJSONString(orderNos))
+                .build();
+        String response = sendToGd("/ycsim-agent-service/openapi/online_sim_order/get_order_info", req);
+        GdCommRes<List<GdSimOrderRes>> commRes = JSONUtil.toBean(response, new TypeReference<GdCommRes<List<GdSimOrderRes>>>() {}, true);
+        if(commRes.getResultCode() != 1){
+            throw new GlobalCustomerException(commRes.getErrorDesc());
+        }
+        List<GdSimOrderRes> list = commRes.getData();
+        for (GdSimOrderRes res : list) {
+            KxsGdOrder kxsGdOrder = gdOrderService.getOne(Wrappers.<KxsGdOrder>lambdaQuery().eq(KxsGdOrder::getOrderNo, res.getOrderNo()));
+            if(kxsGdOrder == null){
+                kxsGdOrder = new KxsGdOrder();
+            }
+            kxsGdOrder.setIccid(res.getIccid());
+            kxsGdOrder.setFirstRechargeAmount(new BigDecimal(res.getFirstRechargeAmount()));
+            kxsGdOrder.setProductName(res.getProductName());
+            kxsGdOrder.setProvince(res.getProvince());
+            kxsGdOrder.setCity(res.getCity());
+            kxsGdOrder.setUserName(res.getUserName());
+            kxsGdOrder.setGdMobile(res.getMobile());
+            kxsGdOrder.setOrderNo(res.getOrderNo());
+            kxsGdOrder.setStatus(Integer.valueOf(res.getStatus()));
+            kxsGdOrder.setIdcardNo(res.getIdcardNo());
+            kxsGdOrder.setReceiveName(res.getReceiveName());
+            kxsGdOrder.setReceiveMobile(res.getReceiveMobile());
+            kxsGdOrder.setAddress(res.getReceiveAddress());
+            kxsGdOrder.setAddressDetail(res.getReceiveAddressDetail());
+            kxsGdOrder.setCreateTime(LocalDateTimeUtil.parse(res.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
+            gdOrderService.saveOrUpdate(kxsGdOrder);
+            if("6".equals(res.getStatus())){
+                KxsGdReport kxsGdReport = kxsGdReportMapper.selectOne(Wrappers.<KxsGdReport>lambdaQuery()
+                        .eq(KxsGdReport::getStatus, GdReportEnum.REPORT.getType())
+                        .eq(KxsGdReport::getIsCheck, GdReportEnum.CHECK_NO.getType())
+                        .eq(KxsGdReport::getGdMobile, kxsGdOrder.getGdMobile()));
+                if (kxsGdReport == null) {
+                    return;
+                }
+                kxsGdReport.setIsCheck(GdReportEnum.CHECK_SUC.getType());
+                kxsGdReportMapper.updateById(kxsGdReport);
+                toSendMq(kxsGdOrder, kxsGdReport.getGdSn());
+            }
+        }
+    }
+
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public void checkGdAsyncData(Map<String, Object> param) {
+    public void acceptGdActData(Map<String, Object> param) {
 
 
         JSONArray dataList = JSON.parseArray(param.get("data").toString());
         JSONArray dataList = JSON.parseArray(param.get("data").toString());
         if(dataList.isEmpty()){
         if(dataList.isEmpty()){
@@ -178,6 +235,7 @@ public class KxsGdServiceImpl implements KxsGdService {
         }
         }
     }
     }
 
 
+
     private void toSendMq(KxsGdOrder order, String sn){
     private void toSendMq(KxsGdOrder order, String sn){
         RabbitGdActQueueMQ.MsgEntity msgEntity = new RabbitGdActQueueMQ.MsgEntity();
         RabbitGdActQueueMQ.MsgEntity msgEntity = new RabbitGdActQueueMQ.MsgEntity();
         msgEntity.setPosSn(sn);
         msgEntity.setPosSn(sn);
@@ -197,38 +255,26 @@ public class KxsGdServiceImpl implements KxsGdService {
                 + "," + order.getGdMobile());
                 + "," + order.getGdMobile());
     }
     }
 
 
-
-    public List<GdQueryOrderRes.GdQueryOrder> queryCardOrders(String startTime, String endTime, int pageNo, int pageSize) {
-
+    private  String sendToGd(String uri, GdCommonReq req){
         try {
         try {
-            String url = "https://" + rsaProperties.getGd().getUrl() + "/ycsim-business/openapi/query_card_order_info";
+
+            String url = "https://" + rsaProperties.getGd().getUrl() + uri;
 
 
             long timestamp = System.currentTimeMillis() / 1000;
             long timestamp = System.currentTimeMillis() / 1000;
+            req.setTimestamp(timestamp);
+            req.setBrhNo(rsaProperties.getGd().getBrhNo());
 
 
-            GdQueryCardOrderReq req = GdQueryCardOrderReq.builder()
-                    .queryBeginTime(startTime)
-                    .queryEndTime(endTime)
-                    .brhNo(rsaProperties.getGd().getBrhNo())
-                    .pageNo(String.valueOf(pageNo))
-                    .pageSize(String.valueOf(pageSize))
-                    .timestamp(String.valueOf(timestamp)).build();
             String sign = GdRsaUtils.rsa256Sign(BeanUtil.beanToMap(req), rsaProperties.getGd().getPrivateKey());
             String sign = GdRsaUtils.rsa256Sign(BeanUtil.beanToMap(req), rsaProperties.getGd().getPrivateKey());
             req.setSign(sign);
             req.setSign(sign);
-            boolean b = GdRsaUtils.checkSign(BeanUtil.beanToMap(req), rsaProperties.getGd().getPublicKey());
-            String body = JSONUtil.toJsonStr(req);
+            String body = JSON.toJSONString(req);
             String response = HttpRequest.post(url)
             String response = HttpRequest.post(url)
                     .header(Header.CONTENT_TYPE, "application/json")
                     .header(Header.CONTENT_TYPE, "application/json")
                     .body(body)
                     .body(body)
                     .timeout(50000)//超时,毫秒
                     .timeout(50000)//超时,毫秒
                     .execute().body();
                     .execute().body();
             Optional.ofNullable(response).orElseThrow(() -> new GlobalCustomerException("调用接口失败"));
             Optional.ofNullable(response).orElseThrow(() -> new GlobalCustomerException("调用接口失败"));
-            GdCommRes<GdQueryOrderRes> commRes = JSONUtil.toBean(response, new TypeReference<GdCommRes<GdQueryOrderRes>>() {
-            }, true);
-            if (commRes.getResultCode() == 1) {
-                return commRes.getData().getRecords();
-            } else {
-                throw new GlobalCustomerException(commRes.getErrorDesc());
-            }
+
+            return response;
 
 
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("请求广电接口报错:{}", e.getLocalizedMessage());
             log.error("请求广电接口报错:{}", e.getLocalizedMessage());

+ 5 - 0
kxs-user/kxs-user-biz/src/main/java/com/kxs/user/biz/service/impl/KxsShdScoreServiceImpl.java

@@ -3,6 +3,7 @@ package com.kxs.user.biz.service.impl;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -19,6 +20,7 @@ import com.kxs.user.biz.mapper.KxsUserMapper;
 import com.kxs.user.biz.mapper.KxsUserRealLevelMapper;
 import com.kxs.user.biz.mapper.KxsUserRealLevelMapper;
 import com.kxs.user.biz.service.KxsShdScoreService;
 import com.kxs.user.biz.service.KxsShdScoreService;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
@@ -34,6 +36,7 @@ import java.util.List;
  */
  */
 @Service("kxsShdScoreService")
 @Service("kxsShdScoreService")
 @RequiredArgsConstructor
 @RequiredArgsConstructor
+@Slf4j
 public class KxsShdScoreServiceImpl extends ServiceImpl<KxsShdScoreMapper, KxsShdScore> implements KxsShdScoreService {
 public class KxsShdScoreServiceImpl extends ServiceImpl<KxsShdScoreMapper, KxsShdScore> implements KxsShdScoreService {
     private final KxsShdScoreMapper kxsShdScoreMapper;
     private final KxsShdScoreMapper kxsShdScoreMapper;
     private final KxsUserMapper kxsUserMapper;
     private final KxsUserMapper kxsUserMapper;
@@ -124,6 +127,7 @@ public class KxsShdScoreServiceImpl extends ServiceImpl<KxsShdScoreMapper, KxsSh
                 }else{
                 }else{
                     kxsShdScoreMapper.updateById(kxsShdScore);
                     kxsShdScoreMapper.updateById(kxsShdScore);
                 }
                 }
+                log.info("创客:{},给他上级:{},增加创客积分,原始数据:{}", integralStatDTO.getUserId(), kxsUser.getId(), JSON.toJSONString(kxsShdScore));
             }else {
             }else {
 
 
                 //存在数据则根据条件增加
                 //存在数据则根据条件增加
@@ -140,6 +144,7 @@ public class KxsShdScoreServiceImpl extends ServiceImpl<KxsShdScoreMapper, KxsSh
                 kxsShdScore.setUpdateTime(now);
                 kxsShdScore.setUpdateTime(now);
                 kxsShdScore.setVersion(integralStatDTO.getVersion());
                 kxsShdScore.setVersion(integralStatDTO.getVersion());
                 kxsShdScoreMapper.updateById(kxsShdScore);
                 kxsShdScoreMapper.updateById(kxsShdScore);
+                log.info("创客:{},给他上级:{},增加创客积分,积分数据:{}", integralStatDTO.getUserId(), kxsUser.getId(), JSON.toJSONString(kxsShdScore));
             }
             }
         }
         }
 //        //初级积分
 //        //初级积分