he2802 2 tahun lalu
induk
melakukan
1a9bdc0932
19 mengubah file dengan 241 tambahan dan 11 penghapusan
  1. 47 0
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java
  2. 1 0
      zhongzheng-admin-saas/src/main/resources/application-dev.yml
  3. 2 1
      zhongzheng-admin-saas/src/main/resources/application-pre.yml
  4. 2 1
      zhongzheng-admin-saas/src/main/resources/application-prod.yml
  5. 13 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java
  6. 3 2
      zhongzheng-admin/src/main/resources/application-dev.yml
  7. 2 1
      zhongzheng-admin/src/main/resources/application-pre.yml
  8. 1 0
      zhongzheng-admin/src/main/resources/application-prod.yml
  9. 1 0
      zhongzheng-admin/src/main/resources/application-trial.yml
  10. 1 0
      zhongzheng-api/src/main/resources/application-dev.yml
  11. 2 1
      zhongzheng-api/src/main/resources/application-pre.yml
  12. 2 1
      zhongzheng-api/src/main/resources/application-prod.yml
  13. 8 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/aspectj/LogAspect.java
  14. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodService.java
  15. 52 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java
  16. 23 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/SyncUserChapterExport.java
  17. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/domain/TopNuoMplatformLog.java
  18. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/service/ITopNuoMplatformLogService.java
  19. 72 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/service/impl/TopNuoMplatformLogServiceImpl.java

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

@@ -0,0 +1,47 @@
+package com.zhongzheng.controller.schedule;
+
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.framework.web.service.AsyncService;
+import com.zhongzheng.framework.web.service.WxLoginService;
+import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
+import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
+import com.zhongzheng.modules.schedule.service.IScheduleService;
+import com.zhongzheng.modules.sdk.service.ITopNuoMplatformLogService;
+import com.zhongzheng.modules.user.bo.UserQueryBo;
+import com.zhongzheng.modules.user.bo.UserWxFollowQueryBo;
+import com.zhongzheng.modules.wx.bo.WxLoginBody;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 定时任务
+ *
+ * @author ruoyi
+ * @date 2021-11-10
+ */
+@Api(value = "定时任务", tags = {"定时任务管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/sys/common")
+public class ScheduleController extends BaseController {
+
+    private final ITopNuoMplatformLogService iTopNuoMplatformLogService;
+
+    @ApiOperation("发票开票结果更新")
+    @GetMapping("/distributionRebate")
+    public AjaxResult distributionRebate(UserQueryBo bo){
+        iTopNuoMplatformLogService.updateByBatch();
+        return AjaxResult.success();
+    }
+}

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

@@ -167,6 +167,7 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: http://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan

+ 2 - 1
zhongzheng-admin-saas/src/main/resources/application-pre.yml

@@ -167,6 +167,7 @@ oldStudySys:
     classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
@@ -179,4 +180,4 @@ distributionOldPay:
 
 handouts:
     savePath: https://attach.xyyxt.net/course/handouts/save
-    updatePath: https://attach.xyyxt.net/course/handouts/edit
+    updatePath: https://attach.xyyxt.net/course/handouts/edit

+ 2 - 1
zhongzheng-admin-saas/src/main/resources/application-prod.yml

@@ -167,6 +167,7 @@ oldStudySys:
     classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
@@ -179,4 +180,4 @@ distributionOldPay:
 
 handouts:
     savePath: https://attach.xyyxt.net/course/handouts/save
-    updatePath: https://attach.xyyxt.net/course/handouts/edit
+    updatePath: https://attach.xyyxt.net/course/handouts/edit

+ 13 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -20,6 +20,8 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
 import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
+import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.service.*;
 import com.zhongzheng.modules.grade.vo.*;
@@ -75,6 +77,8 @@ public class ClassGradeController extends BaseController {
 
     private final RedisCache redisCache;
 
+    private final IGoodsService iGoodsService;
+
     /**
      * 查询班级列表
      */
@@ -681,5 +685,14 @@ public class ClassGradeController extends BaseController {
         return AjaxResult.success(iClassGradeService.queryOfficialGradeCount(bo));
     }
 
+    @ApiOperation("导出商品的课程结构")
+    @GetMapping("/exportGoodsMenuExcel")
+    public AjaxResult<List<ClassNpUserInfoVo>> exportGoodsMenuExcel(UserPeriodEditBo bo) {
+        GoodsVo goodsVo = iGoodsService.queryById(bo.getGoodsId());
+        List<SyncUserChapterExport> list = iUserPeriodService.exportGoodsMenuExcel(bo);
+        List<SyncUserChapterExport> exportVos = list.stream().map(item -> BeanUtil.toBean(item,SyncUserChapterExport.class)).collect(Collectors.toList());
+        ExcelUtil<SyncUserChapterExport> util = new ExcelUtil<SyncUserChapterExport>(SyncUserChapterExport.class);
+        return util.exportExcel(exportVos, goodsVo.getGoodsName());
+    }
 
 }

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

@@ -10,7 +10,7 @@ spring:
             connection-init-sql: set names utf8mb4
         #动态数据源配置
         dynamic:
-            primary: slave #设置默认的数据源或者数据源组,默认值即为master
+            primary: master #设置默认的数据源或者数据源组,默认值即为master
             strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候会抛出异常,不启动则使用默认数据源.
             datasource:
                 #数据源
@@ -167,6 +167,7 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
@@ -180,4 +181,4 @@ distributionOldPay:
 
 handouts:
     savePath: http://192.168.1.7:9090/course/handouts/save
-    updatePath: http://192.168.1.7:9090/course/handouts/edit
+    updatePath: http://192.168.1.7:9090/course/handouts/edit

+ 2 - 1
zhongzheng-admin/src/main/resources/application-pre.yml

@@ -167,6 +167,7 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
@@ -179,4 +180,4 @@ distributionOldPay:
 
 handouts:
     savePath: https://attach.xyyxt.net/course/handouts/save
-    updatePath: https://attach.xyyxt.net/course/handouts/edit
+    updatePath: https://attach.xyyxt.net/course/handouts/edit

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

@@ -167,6 +167,7 @@ oldStudySys:
     classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan

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

@@ -142,6 +142,7 @@ oldStudySys:
     classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
     salePassword: http:///www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan

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

@@ -171,6 +171,7 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan

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

@@ -142,6 +142,7 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
@@ -154,4 +155,4 @@ distributionOldPay:
 
 handouts:
     savePath: https://attach.xyyxt.net/course/handouts/save
-    updatePath: https://attach.xyyxt.net/course/handouts/edit
+    updatePath: https://attach.xyyxt.net/course/handouts/edit

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

@@ -179,6 +179,7 @@ oldStudySys:
     classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
@@ -191,4 +192,4 @@ distributionOldPay:
 
 handouts:
     savePath: https://attach.xyyxt.net/course/handouts/save
-    updatePath: https://attach.xyyxt.net/course/handouts/edit
+    updatePath: https://attach.xyyxt.net/course/handouts/edit

+ 8 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/aspectj/LogAspect.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.framework.aspectj;
 
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.useragent.UserAgent;
 import cn.hutool.http.useragent.UserAgentUtil;
@@ -149,7 +150,10 @@ public class LogAspect
             String className = joinPoint.getTarget().getClass().getName();
             String methodName = joinPoint.getSignature().getName();
             operLog.setMethod(className + "." + methodName + "()");
-            operLog.setTenantId(Long.parseLong(ServletUtils.getRequest().getHeader("TenantId")));
+            String TenantId = ServletUtils.getRequest().getHeader("TenantId");
+            if(Validator.isNotEmpty(TenantId)){
+                operLog.setTenantId(Long.parseLong(TenantId));
+            }
             // 设置请求方式
             operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
             // 处理设置注解上的参数
@@ -183,7 +187,9 @@ public class LogAspect
         operLog.setOperatorType(log.operatorType().ordinal());
         // 设置浏览器
         UserAgent userAgent = UserAgentUtil.parse(ServletUtils.getRequest().getHeader("User-Agent"));
-        operLog.setBrowser(userAgent.getBrowser().getName());
+        if(Validator.isNotEmpty(userAgent)){
+            operLog.setBrowser(userAgent.getBrowser().getName());
+        }
         // 是否需要保存request,参数和值
         if (log.isSaveRequestData())
         {

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.grade.service;
 
 import com.zhongzheng.modules.grade.domain.UserPeriod;
+import com.zhongzheng.modules.grade.vo.SyncUserChapterExport;
 import com.zhongzheng.modules.grade.vo.SyncUserCourseStudyRec;
 import com.zhongzheng.modules.grade.vo.UserPeriodVo;
 import com.zhongzheng.modules.grade.bo.UserPeriodQueryBo;
@@ -69,4 +70,6 @@ public interface IUserPeriodService extends IService<UserPeriod> {
 	Long todayStudySectionNum(UserPeriodQueryBo bo);
 
 	boolean syncStudyLogToOld(UserPeriodEditBo bo);
+
+	List<SyncUserChapterExport> exportGoodsMenuExcel(UserPeriodEditBo bo);
 }

+ 52 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -21,11 +21,13 @@ import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.base.service.ICertificateTpService;
 import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
+import com.zhongzheng.modules.course.bo.CourseChapterSectionQueryBo;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
 import com.zhongzheng.modules.course.domain.CourseEducationType;
 import com.zhongzheng.modules.course.domain.CourseProjectType;
 import com.zhongzheng.modules.course.service.*;
+import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseMenuVo;
 import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
@@ -57,6 +59,7 @@ import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.system.domain.SysOldOrg;
 import com.zhongzheng.modules.system.service.ISysOldOrgService;
+import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
@@ -71,6 +74,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
+import java.text.DecimalFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -164,6 +168,9 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     @Autowired
     private ICourseProjectTypeService iCourseProjectTypeService;
 
+    @Autowired
+    private ICourseChapterSectionService iCourseChapterSectionService;
+
     @Value("${oldStudySys.syncPath}")
     private String SYNC_PATH;
 
@@ -847,6 +854,51 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
         return true;
     }
 
+    @Override
+    public List<SyncUserChapterExport> exportGoodsMenuExcel(UserPeriodEditBo bo) {
+        List<SyncUserChapterExport> ChapterList = new ArrayList<>();
+        GoodsCourseQueryBo goodsCourseQueryBo = new GoodsCourseQueryBo();
+        goodsCourseQueryBo.setGoodsId(bo.getGoodsId());
+        List<CourseVo> courseVoList = iGoodsCourseService.selectList(goodsCourseQueryBo);
+        int NO = 1;
+        Long time = 0L;
+        for(CourseVo courseVo : courseVoList){
+            CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
+            menuQueryBo.setCourseId(courseVo.getCourseId());
+            List<CourseMenuVo> courseMenuVoList = iCourseMenuService.selectList(menuQueryBo);
+            for(CourseMenuVo courseMenuVo:courseMenuVoList){
+                if(courseMenuVo.getType()==1){
+                    //获取章信息
+                    List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
+
+                    for(CourseModuleChapterVo courseModuleChapterVo:courseModuleChapterVoList){
+                        SyncUserChapterExport chapterExport = new SyncUserChapterExport();
+                        time = 0L;
+                        chapterExport.setChapterName(courseModuleChapterVo.getName());
+                        chapterExport.setNo(NO);
+                        NO++;
+                        List<CourseChapterSectionVo> sList = iCourseChapterSectionService.getListById(courseModuleChapterVo.getChapterId());
+                        for(CourseChapterSectionVo sectionVo : sList){
+                            time+=sectionVo.getDurationTime();
+
+                        }
+                        int min = 0;
+                        String classHour = "0";
+                        if(time.intValue()>0){
+                            min = (int)Math.ceil(time.intValue()/60);
+                            DecimalFormat df=new DecimalFormat("0.0");//设置保留位数
+                            classHour = df.format((float)min/45);
+                        }
+                        chapterExport.setTime(min);
+                        chapterExport.setClassHour(classHour);
+                        ChapterList.add(chapterExport);
+                    };
+                }
+            };
+        }
+        return ChapterList;
+    }
+
     /**
      * 打回操作
      *

+ 23 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/SyncUserChapterExport.java

@@ -0,0 +1,23 @@
+package com.zhongzheng.modules.grade.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import org.apache.poi.hpsf.Decimal;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class SyncUserChapterExport {
+    private static final long serialVersionUID = 1L;
+    @Excel(name = "序号")
+    private Integer no;
+    @Excel(name = "课件名称")
+    private String ChapterName;
+    @Excel(name = "时长(分钟)")
+    private Integer time;
+    @Excel(name = "学时数量(个)")
+    private String classHour;
+
+
+}

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/domain/TopNuoMplatformLog.java

@@ -57,4 +57,9 @@ private static final long serialVersionUID=1L;
     private String failCause;
     private String tenantId;
     private String orderNoList;
+    /** 推送老系统时间 */
+    private Long pushTime;
+    /** 推送结果 */
+    private String pushResult;
+    private Integer pushStatus;
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/service/ITopNuoMplatformLogService.java

@@ -52,5 +52,5 @@ public interface ITopNuoMplatformLogService extends IService<TopNuoMplatformLog>
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
-	Boolean updateByBatch(TopNuoMplatformLogEditBo bo);
+	Boolean updateByBatch();
 }

+ 72 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/service/impl/TopNuoMplatformLogServiceImpl.java

@@ -3,11 +3,17 @@ package com.zhongzheng.modules.sdk.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ToolsUtils;
+import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
+import com.zhongzheng.modules.grade.service.impl.UserPeriodServiceImpl;
+import com.zhongzheng.modules.order.domain.OrderGoodsRefund;
 import com.zhongzheng.modules.sdk.bo.TopNuoMplatformLogAddBo;
 import com.zhongzheng.modules.sdk.bo.TopNuoMplatformLogEditBo;
 import com.zhongzheng.modules.sdk.bo.TopNuoMplatformLogQueryBo;
@@ -16,13 +22,17 @@ import com.zhongzheng.modules.sdk.mapper.TopNuoMplatformLogMapper;
 import com.zhongzheng.modules.sdk.service.ITopNuoMplatformLogService;
 import com.zhongzheng.modules.sdk.service.NuonuoService;
 import com.zhongzheng.modules.sdk.vo.TopNuoMplatformLogVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
 
+import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -35,8 +45,12 @@ import java.util.stream.Collectors;
 @Service
 public class TopNuoMplatformLogServiceImpl extends ServiceImpl<TopNuoMplatformLogMapper, TopNuoMplatformLog> implements ITopNuoMplatformLogService {
 
+    private static Logger log = LoggerFactory.getLogger(TopNuoMplatformLogServiceImpl.class);
+
     @Autowired
     private NuonuoService nuonuoService;
+    @Value("${oldStudySys.updateInvoicePath}")
+    private String UpdateInvoice_PATH;
 
     @Override
     public TopNuoMplatformLogVo queryById(Long id){
@@ -158,7 +172,7 @@ public class TopNuoMplatformLogServiceImpl extends ServiceImpl<TopNuoMplatformLo
     }
 
     @Override
-    public Boolean updateByBatch(TopNuoMplatformLogEditBo bo) {
+    public Boolean updateByBatch() {
         TopNuoMplatformLogQueryBo queryBo = new TopNuoMplatformLogQueryBo();
         queryBo.setStatus(1);
         List<TopNuoMplatformLogVo> list = queryList(queryBo);
@@ -168,6 +182,63 @@ public class TopNuoMplatformLogServiceImpl extends ServiceImpl<TopNuoMplatformLo
             snList.add(vo.getInvoiceSerialNum());
             if(snList.size()==10||i==(list.size()-1)){
                 String result = nuonuoService.queryInvoiceResult(snList);
+                System.out.println(result);
+                JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
+                String code = String.valueOf(jsonObject.get("code"));
+                JSONArray josnList = jsonObject.getJSONArray("result");
+                LambdaUpdateWrapper<TopNuoMplatformLog> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                if("E0000".equals(code)){
+                    for(int j=0;j<josnList.size();j++) {
+                        JSONObject itemObject =josnList.getJSONObject(j);
+                        String serialNo = String.valueOf(itemObject.get("serialNo"));
+                        String orderNo = String.valueOf(itemObject.get("orderNo"));
+                        String status = String.valueOf(itemObject.get("status"));
+                        String pdfUrl = String.valueOf(itemObject.get("pdfUrl"));
+                        String failCause = String.valueOf(itemObject.get("failCause"));
+                        String oldStatus = "1";
+                        objectLambdaUpdateWrapper.eq(TopNuoMplatformLog::getInvoiceSerialNum, serialNo);
+                        //开单完成状态
+                        if("2".equals(status)){
+                            oldStatus = "1";
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPdfUrl, pdfUrl);
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getStatus, 2);
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getUpdateTime,DateUtils.getNowTime());
+                        }else{
+                            //失败
+                            oldStatus = "2";
+                            pdfUrl = "";
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getStatus, Integer.parseInt(status));
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getFailCause, failCause);
+                        }
+                        Map<String, String> params = new HashMap<>();
+                        Long nowTime = DateUtils.getNowTime();
+                        String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
+                        params.put("stamp", nowTime.toString());
+                        params.put("sign", sign);
+                        params.put("status", oldStatus);
+                        params.put("orderno", orderNo);
+                        params.put("pdfurl", pdfUrl);
+                        String respone = "";
+                        log.info("发票推送系统"+params,"");
+                        try {
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushStatus, 1);
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushTime, DateUtils.getNowTime());
+                            respone = HttpUtils.postFormBody(UpdateInvoice_PATH, params);
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushResult, respone);
+                            if (!respone.contains("\"Status\":true")) {
+                                objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushStatus, -1);
+                                this.update(null, objectLambdaUpdateWrapper);
+                                throw new CustomException("同步请求错误"+respone);
+                            }
+                        } catch (IOException e) {
+                            objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushStatus, -1);
+                            this.update(null, objectLambdaUpdateWrapper);
+                            throw new CustomException("同步请求错误"+e.getMessage());
+                        }
+                        this.update(null, objectLambdaUpdateWrapper);
+                    }
+                }
+                snList.clear();
             }
         }
         return null;