he2802 1 year ago
parent
commit
397a7496fe

+ 1 - 0
zhongzheng-admin-saas/src/main/resources/application-dev.yml

@@ -168,6 +168,7 @@ oldOrder:
     refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
     updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
     getResitTimes: http://gdxypx.xy.com/System/BussinessApi/GetResitTimes
+    classEndSaleTipMsg: http://gdxypx.xy.com/WitSystem/BussinessApi/ClassEndSaleTipMsg
 oldSys:
     host: http://gdxypx.xy.com
     goods: http://gdxypx.xy.com/WitSystem/BussinessApi/NewYxtLogin

+ 7 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -493,4 +493,11 @@ public class ScheduleController extends BaseController {
         iScheduleService.orderCourseNum();
         return AjaxResult.success();
     }
+
+    @ApiOperation("班级过期提示")
+    @GetMapping("/class/expiration/reminder")
+    public AjaxResult classExpirationReminder(){
+        iScheduleService.classExpirationReminder();
+        return AjaxResult.success();
+    }
 }

+ 1 - 0
zhongzheng-admin/src/main/resources/application-dev.yml

@@ -169,6 +169,7 @@ oldOrder:
     refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
     updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
     getResitTimes: http://gdxypx.xy.com/System/BussinessApi/GetResitTimes
+    classEndSaleTipMsg: http://gdxypx.xy.com/WitSystem/BussinessApi/ClassEndSaleTipMsg
 
 oldSys:
     host: http://gdxypx.xy.com

+ 2 - 2
zhongzheng-api/src/main/resources/application-dev.yml

@@ -137,7 +137,7 @@ oldStudySys:
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
-    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
+    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass0
 
 officialPush:
     infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
@@ -171,7 +171,7 @@ oldOrder:
     refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
     updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
     getResitTimes: http://gdxypx.xy.com/System/BussinessApi/GetResitTimes
-
+    classEndSaleTipMsg: http://gdxypx.xy.com/WitSystem/BussinessApi/ClassEndSaleTipMsg
 oldSys:
     host: http://gdxypx.xy.com
     goods: http://gdxypx.xy.com/System/BussinessApi/NewYxtLogin

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassExpirationBo.java

@@ -0,0 +1,20 @@
+package com.zhongzheng.modules.grade.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2024年06月18日 14:09
+ */
+@Data
+public class ClassExpirationBo implements Serializable {
+
+    private String sign;
+
+    private Long stamp;
+
+    private List<ClassExpirationListBo> list;
+}

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassExpirationListBo.java

@@ -0,0 +1,20 @@
+package com.zhongzheng.modules.grade.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2024年06月18日 14:09
+ */
+@Data
+public class ClassExpirationListBo implements Serializable {
+
+    private String orderNo;
+
+    private String name;
+
+    private String remark;
+
+}

+ 19 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassExpirationUserBo.java

@@ -0,0 +1,19 @@
+package com.zhongzheng.modules.grade.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2024年06月18日 14:09
+ */
+@Data
+public class ClassExpirationUserBo implements Serializable {
+
+    private String inputOrderSn;
+
+    private Long gradeId;
+
+}

+ 25 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassExpirationVo.java

@@ -0,0 +1,25 @@
+package com.zhongzheng.modules.grade.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2024年06月18日 10:54
+ */
+@Data
+public class ClassExpirationVo implements Serializable {
+
+    private Long gradeId;
+
+    private String className;
+
+    private Long classStartTime;
+
+    private Long classEndTime;
+
+    private String orderSn;
+
+    private String inputOrderSn;
+}

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/polyv/mapper/PolyvVideoMapper.java

@@ -1,6 +1,8 @@
 package com.zhongzheng.modules.polyv.mapper;
 
 import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
+import com.zhongzheng.modules.grade.bo.ClassExpirationUserBo;
+import com.zhongzheng.modules.grade.vo.ClassExpirationVo;
 import com.zhongzheng.modules.polyv.domain.PolyvVideo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.polyv.vo.PolyvVideoVo;
@@ -20,4 +22,8 @@ public interface PolyvVideoMapper extends BaseMapper<PolyvVideo> {
 
 
     Long selectGoodsPlanCount(@Param("goodsId") Long aLong,@Param("planId") Long planId);
+
+    List<ClassExpirationVo> getClassExpirationList();
+
+    List<String> getOrderUserName(ClassExpirationUserBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java

@@ -126,4 +126,6 @@ public interface IScheduleService extends IService<PolyvVideo> {
 
     void orderCourseNum();
 
+    void classExpirationReminder();
+
 }

+ 63 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -17,6 +17,7 @@ import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
@@ -63,11 +64,11 @@ import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.BankGoodsExamVo;
 import com.zhongzheng.modules.goods.vo.GoodsCourseVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
-import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
-import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
+import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.*;
 import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
 import com.zhongzheng.modules.grade.service.*;
+import com.zhongzheng.modules.grade.vo.ClassExpirationVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.grade.vo.ClassPeriodVo;
@@ -111,6 +112,7 @@ import com.zhongzheng.modules.system.service.ISysTaskService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserService;
 import com.zhongzheng.modules.system.vo.SysTenantVo;
+import com.zhongzheng.modules.top.financial.bo.CheckOrderStudentBo;
 import com.zhongzheng.modules.top.financial.bo.TopDivideOrderAddBo;
 import com.zhongzheng.modules.top.financial.bo.TopDivideOrderQueryBo;
 import com.zhongzheng.modules.top.financial.domain.TopDivideLog;
@@ -118,6 +120,10 @@ import com.zhongzheng.modules.top.financial.service.ITopDivideLogService;
 import com.zhongzheng.modules.top.financial.service.ITopDivideOrderService;
 import com.zhongzheng.modules.top.financial.vo.TopCreateUserVo;
 import com.zhongzheng.modules.top.financial.vo.TopDivideOrderVo;
+import com.zhongzheng.modules.top.goods.domain.TopOldOrder;
+import com.zhongzheng.modules.top.goods.domain.TopOldOrderGoods;
+import com.zhongzheng.modules.top.goods.service.ITopOldOrderGoodsService;
+import com.zhongzheng.modules.top.goods.service.ITopOldOrderService;
 import com.zhongzheng.modules.top.user.service.ITopSysConfigService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.*;
@@ -355,6 +361,10 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     private OssService ossService;
     @Autowired
     private ClassGradeUserMapper classGradeUserMapper;
+    @Autowired
+    private ITopOldOrderService topOldOrderService;
+    @Autowired
+    private ITopOldOrderGoodsService topOldOrderGoodsService;
 
     @Value("${aliyun.sms.OpenTheGoodsCode}")
     private String OpenTheGoodsCode;
@@ -407,6 +417,9 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Value("${aliyun.sms.classEndRemind}")
     private String classEndRemind;
 
+    @Value("${oldOrder.classEndSaleTipMsg}")
+    private String CLASS_END_SALETIP_MSG;
+
     @Autowired
     private RedisCache redisCache;
 
@@ -2204,6 +2217,54 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
 
     }
 
+    @Override
+    public void classExpirationReminder() {
+        List<ClassExpirationVo> expirationVos =  baseMapper.getClassExpirationList();
+        if (CollectionUtils.isEmpty(expirationVos)){
+            return;
+        }
+        Map<Long, List<ClassExpirationVo>> map = expirationVos.stream().collect(Collectors.groupingBy(ClassExpirationVo::getGradeId));
+        List<ClassExpirationListBo> list = new ArrayList<>();
+        map.forEach((k,v) -> {
+            String name = v.get(0).getClassName();
+            Map<String, List<ClassExpirationVo>> collect = v.stream().collect(Collectors.groupingBy(ClassExpirationVo::getInputOrderSn));
+            collect.forEach((j,h) -> {
+                TopOldOrder oldOrder = topOldOrderService.getOne(new LambdaQueryWrapper<TopOldOrder>()
+                        .eq(TopOldOrder::getInputOrderSn, j)
+                        .eq(TopOldOrder::getCheckStatus,1)
+                        .eq(TopOldOrder::getStatus,1)
+                        .last("limit 1"));
+                if (ObjectUtils.isNull(oldOrder)){
+                    return;
+                }
+                ClassExpirationListBo listBo = new ClassExpirationListBo();
+                listBo.setOrderNo(oldOrder.getOrderSn());
+                ClassExpirationUserBo userBo = new ClassExpirationUserBo();
+                userBo.setInputOrderSn(j);
+                userBo.setGradeId(k);
+                List<String> userNames = baseMapper.getOrderUserName(userBo);
+                listBo.setName(userNames.stream().collect(Collectors.joining(",")));
+                listBo.setRemark(String.format("%s还有10天过期",name));
+                list.add(listBo);
+            });
+        });
+        ClassExpirationBo bo = new ClassExpirationBo();
+        bo.setList(list);
+        Long nowTime = DateUtils.getNowTime();
+        String sign = ToolsUtils.EncoderByMd5(nowTime + "pubilc2022");
+        bo.setStamp(nowTime);
+        bo.setSign(sign);
+        String respone = "";
+        try {
+            respone = HttpUtils.sendPostHeader(CLASS_END_SALETIP_MSG, JSONObject.parseObject(JSONObject.toJSONString(bo)), new HashMap<>());
+            if (!respone.contains("\"Status\":true")) {
+                throw new CustomException("旧系统班级过期提醒接口请求错误");
+            }
+        } catch (Exception e) {
+            throw new CustomException("旧系统班级过期提醒接口请求错误");
+        }
+    }
+
 
     private String getWeeks(Long time){
         Calendar calendar = Calendar.getInstance();

+ 41 - 0
zhongzheng-system/src/main/resources/mapper/modules/polyv/PolyvVideoMapper.xml

@@ -68,4 +68,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             usr.plan_id = #{planId}
           and usr.goods_id = #{goodsId}
     </select>
+
+     <select id="getClassExpirationList" resultType="com.zhongzheng.modules.grade.vo.ClassExpirationVo">
+         SELECT
+            cg.grade_id,
+            cg.class_name,
+            cg.class_start_time,
+            cg.class_end_time,
+            o.order_sn,
+            o.input_order_sn
+         FROM
+            class_grade cg
+            LEFT JOIN order_goods og ON cg.grade_id = og.grade_id
+            LEFT JOIN `order` o ON og.order_sn = o.order_sn
+         WHERE
+            cg.`status` = 1
+            AND cg.class_status = 1
+            AND og.pay_status != 1
+            AND og.refund_status != 2
+            AND og.`status` = 1
+            AND o.`status` = 1
+            AND o.input_order_sn IS NOT NULL
+            AND cg.class_end_time <![CDATA[ <= ]]> (UNIX_TIMESTAMP() + 864000)
+            AND cg.class_end_time <![CDATA[ >= ]]> (UNIX_TIMESTAMP() + 777600)
+    </select>
+
+
+    <select id="getOrderUserName" parameterType="com.zhongzheng.modules.grade.bo.ClassExpirationUserBo" resultType="java.lang.String">
+        SELECT
+            u.realname
+        FROM
+            `order` o
+                LEFT JOIN order_goods og ON o.order_sn = og.order_sn
+                LEFT JOIN `user` u ON o.user_id = u.user_id
+        WHERE
+            o.`status` = 1
+            AND og.`status` = 1
+            AND og.pay_status != 1
+	        AND og.refund_status != 2
+	        AND o.input_order_sn = #{inputOrderSn}
+            AND og.grade_id = #{gradeId}
+    </select>
 </mapper>