renqianlong 1 tahun lalu
induk
melakukan
d86729e347

+ 23 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java

@@ -554,6 +554,29 @@ public class ExcelUtil<T>
         return sheetsList;
     }
 
+
+    public List<Map<String, Object>> exportEasyData2(List<T> list,List<T> list1)
+    {
+        List<Map<String, Object>> sheetsList = new ArrayList<>();
+        ExportParams deptExportParams = new ExportParams();
+        deptExportParams.setSheetName("表1");
+        Map<String, Object> deptExportMap = new HashMap<>();
+        deptExportMap.put("title", deptExportParams);
+        deptExportMap.put("entity", clazz);
+        // sheet中要填充得数据
+        deptExportMap.put("data", list);
+
+        ExportParams deptExportParams1 = new ExportParams();
+        deptExportParams.setSheetName("表2");
+        Map<String, Object> deptExportMap1 = new HashMap<>();
+        deptExportMap1.put("title", deptExportParams1);
+        deptExportMap1.put("entity", clazz);
+        // sheet中要填充得数据
+        deptExportMap1.put("data", list1);
+        sheetsList.add(deptExportMap);
+        sheetsList.add(deptExportMap1);
+        return sheetsList;
+    }
     public String userProfileExport(String filePath, String sheetName)
     {
         OutputStream out = null;

+ 121 - 130
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -193,10 +193,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
         classGradeQueryBo.setGradeId(gradeId);
         ClassGradeVo vo = entity2Vo(baseMapper.queryList(classGradeQueryBo)).get(0);
-        if (ObjectUtil.isNotNull(vo) && StringUtils.isNotBlank(vo.getSevenCode())){
+        if (ObjectUtil.isNotNull(vo) && StringUtils.isNotBlank(vo.getSevenCode())) {
             //七大员继教班级 获取年份
             List<String> years = baseMapper.getSevenYearByCode(vo.getSevenCode());
-            if (CollectionUtils.isNotEmpty(years)){
+            if (CollectionUtils.isNotEmpty(years)) {
                 vo.setSevenYear(years.stream().collect(Collectors.joining(",")));
             }
 
@@ -234,11 +234,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Override
     public List<ClassGradeGoodsVo> listGoodsBatch(ClassGradeQueryBo bo) {
         List<ClassGradeGoodsVo> classGradeGoodsVos = baseMapper.listGoodsBatch(bo);
-        if (CollectionUtils.isEmpty(classGradeGoodsVos)){
+        if (CollectionUtils.isEmpty(classGradeGoodsVos)) {
             return new ArrayList<>();
         }
         classGradeGoodsVos.forEach(item -> {
-            if (CollectionUtils.isNotEmpty(item.getGradeList())){
+            if (CollectionUtils.isNotEmpty(item.getGradeList())) {
                 List<ClassGradeVo> collect = item.getGradeList().stream().filter(gradeVo -> {
                     //班级人数是否满人
                     if (ObjectUtil.isNotNull(gradeVo.getSevenCode())) {
@@ -250,24 +250,24 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
 
                     //二建/二造继教班级过滤
                     String businessName = iGoodsService.getGoodsBusinessName(item.getGoodsId());
-                    if (businessName.contains("继续教育二级建造师") || businessName.contains("继续教育二级造价师")){
-                        if (Validator.isNotEmpty(gradeVo.getClassStatus())&&gradeVo.getClassStatus() == 1 &&
-                                (gradeVo.getClassStartTime() > DateUtils.getNowTime() || gradeVo.getClassEndTime() < DateUtils.getNowTime())){
+                    if (businessName.contains("继续教育二级建造师") || businessName.contains("继续教育二级造价师")) {
+                        if (Validator.isNotEmpty(gradeVo.getClassStatus()) && gradeVo.getClassStatus() == 1 &&
+                                (gradeVo.getClassStartTime() > DateUtils.getNowTime() || gradeVo.getClassEndTime() < DateUtils.getNowTime())) {
                             //过期班级
                             return false;
                         }
                         //班级人数
                         Goods goods = iGoodsService.getById(item.getGoodsId());
                         SysTenant tenant = iSysTenantService.getById(goods.getTenantId());
-                        if (tenant.getSevenClass() == 1){
+                        if (tenant.getSevenClass() == 1) {
                             Integer numAll = getClassUserNumAll(gradeVo.getGradeId());
-                            if (gradeVo.getStudentUpper() <= numAll){
+                            if (gradeVo.getStudentUpper() <= numAll) {
                                 //班级人数已满
                                 return false;
                             }
-                        }else {
+                        } else {
                             Long num = baseMapper.getClassUserNumByTenant(gradeVo.getGradeId());
-                            if (gradeVo.getStudentUpper() <= num){
+                            if (gradeVo.getStudentUpper() <= num) {
                                 //班级人数已满
                                 return false;
                             }
@@ -325,11 +325,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         List<ClassGradeInterface> list = iClassGradeInterfaceService.list(new LambdaQueryWrapper<ClassGradeInterface>()
                 .eq(ClassGradeInterface::getStatus, 1)
                 .in(ClassGradeInterface::getType, Arrays.asList(1, 3)));
-        if (CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             list.forEach(item -> {
-                if (item.getType() == 1){
+                if (item.getType() == 1) {
                     add.setInterfacePushId(item.getId());
-                }else if(item.getType() == 3){
+                } else if (item.getType() == 3) {
                     add.setInterfacePeriodId(item.getId());
                 }
             });
@@ -337,38 +337,37 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         Boolean erJfalg = false;
         Boolean ezJfalg = false;
         //七大员继教班级默认学时推送和报名推送
-        if (bo.getClassGradeGoodsAddBos() != null ) {
+        if (bo.getClassGradeGoodsAddBos() != null) {
             Long goodsId = bo.getClassGradeGoodsAddBos()[0];
             Goods goods = iGoodsService.getById(goodsId);
             String businessName = iGoodsService.getGoodsBusinessName(goodsId);
             if (businessName.contains("继续教育") && businessName.contains("施工现场专业人员")) {
                 String sevenYear = goods.getSevenYear();
-                    List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
-                            .list(new LambdaQueryWrapper<ClassGradeInterface>()
-                                    .in(ClassGradeInterface::getType, Arrays.asList(1, 3))
-                                    .eq(ClassGradeInterface::getStatus, 1));
-                    if (CollectionUtils.isNotEmpty(interfaceList)){
-                        interfaceList.forEach(item -> {
-                            if (item.getType() == 1){
-                                //官方信息推送
-                                add.setInterfacePushId(item.getId());
-                            }else if (item.getType() == 3){
-                                //学时推送
-                                add.setInterfacePeriodId(item.getId());
-                            }
-                        });
-                    }
-                if (StringUtils.isNotBlank(bo.getOfficialName()) && ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
+                List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
+                        .list(new LambdaQueryWrapper<ClassGradeInterface>()
+                                .in(ClassGradeInterface::getType, Arrays.asList(1, 3))
+                                .eq(ClassGradeInterface::getStatus, 1));
+                if (CollectionUtils.isNotEmpty(interfaceList)) {
+                    interfaceList.forEach(item -> {
+                        if (item.getType() == 1) {
+                            //官方信息推送
+                            add.setInterfacePushId(item.getId());
+                        } else if (item.getType() == 3) {
+                            //学时推送
+                            add.setInterfacePeriodId(item.getId());
+                        }
+                    });
+                }
+                if (StringUtils.isNotBlank(bo.getOfficialName()) && ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1) {
                     add.setSevenCode(ServletUtils.getEncoded("SEV"));
-                }else {
-                    String sevenCode = getSevenCode(goodsId,add.getStudentUpper());
+                } else {
+                    String sevenCode = getSevenCode(goodsId, add.getStudentUpper());
                     add.setSevenCode(sevenCode);
                 }
-            }
-            else if (("继续教育二级建造师".equals(businessName)|| ("继续教育二级造价师".equals(businessName))) && sysTenant.getShareClass() == 1){
+            } else if (("继续教育二级建造师".equals(businessName) || ("继续教育二级造价师".equals(businessName))) && sysTenant.getShareClass() == 1) {
                 erJfalg = true;
                 ezJfalg = "继续教育二级造价师".equals(businessName);
-                if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 0){
+                if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 0) {
                     //预开班
                     add.setOfficialName(ServletUtils.getEncoded("PIY"));
                 }
@@ -500,29 +499,29 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             classGradeSysService.save(classGradeSys);
         }
 
-        if (erJfalg && bo.getClassGradeGoodsAddBos() != null){
+        if (erJfalg && bo.getClassGradeGoodsAddBos() != null) {
             //二建继教班级创建,所有共享班级机构同步创建
-            synchronousCreation(add,sysTenant,bo.getClassGradeGoodsAddBos()[0]);
+            synchronousCreation(add, sysTenant, bo.getClassGradeGoodsAddBos()[0]);
             //通知旧系统
             CreateSameClassBo classBo = new CreateSameClassBo();
-            if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
+            if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1) {
                 classBo.setClassNo(add.getOfficialName());
                 classBo.setOpenclassState(1);
-                classBo.setBeginTime(DateUtils.timestampToDateFormat(add.getClassStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                classBo.setEndTime(DateUtils.timestampToDateFormat(add.getClassEndTime(),"yyyy-MM-dd HH:mm:ss"));
-            }else {
+                classBo.setBeginTime(DateUtils.timestampToDateFormat(add.getClassStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                classBo.setEndTime(DateUtils.timestampToDateFormat(add.getClassEndTime(), "yyyy-MM-dd HH:mm:ss"));
+            } else {
                 classBo.setClassNo(add.getOfficialName());
                 classBo.setOpenclassState(0);
             }
             classBo.setCategoryName(add.getClassName());
-            classBo.setPlatformId(ezJfalg?8:5);
+            classBo.setPlatformId(ezJfalg ? 8 : 5);
             Goods goods = iGoodsService.getById(bo.getClassGradeGoodsAddBos()[0]);
             Major major = iMajorService.getById(goods.getMajorId());
-            if (ObjectUtils.isNotNull(major)){
+            if (ObjectUtils.isNotNull(major)) {
                 classBo.setMajorName(major.getCategoryName());
             }
             Long nowTime = DateUtils.getNowTime();
-            String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo()+nowTime.toString() + "pubilc2022");
+            String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo() + nowTime.toString() + "pubilc2022");
             classBo.setSign(sign);
             classBo.setStamp(nowTime);
             JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(classBo));
@@ -540,14 +539,14 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         return save;
     }
 
-    public void createSameClass(){
+    public void createSameClass() {
 
     }
 
 
-    private void synchronousCreation(ClassGrade classGrade, SysTenant sysTenant,Long goodsId) {
+    private void synchronousCreation(ClassGrade classGrade, SysTenant sysTenant, Long goodsId) {
         List<SysTenant> tenantList = sysTenantService.getListNoTenant(0L);
-        if (CollectionUtils.isEmpty(tenantList)){
+        if (CollectionUtils.isEmpty(tenantList)) {
             return;
         }
         Goods goods = iGoodsService.getById(goodsId);
@@ -555,19 +554,19 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         Major major = iMajorService.getById(goods.getMajorId());
         tenantList.forEach(tenant -> {
             //是否存在对应课程商品
-            List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(businessName,major.getCategoryName(),tenant.getTenantId());
-            if (CollectionUtils.isEmpty(relGoods)){
+            List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(businessName, major.getCategoryName(), tenant.getTenantId());
+            if (CollectionUtils.isEmpty(relGoods)) {
                 return;
             }
             //班级是否存在
-            ClassGrade grade = baseMapper.getCodeNoTenant(classGrade.getOfficialName(),tenant.getTenantId());
-            if (ObjectUtils.isNotNull(grade)){
+            ClassGrade grade = baseMapper.getCodeNoTenant(classGrade.getOfficialName(), tenant.getTenantId());
+            if (ObjectUtils.isNotNull(grade)) {
                 //已经存在 过滤已经创建过班级的商品
                 List<ClassGradeGoods> classGradeGoods = iClassGradeGoodsService.listByIdNoTenant(grade.getGradeId());
                 List<Long> goodsIds = classGradeGoods.stream().map(ClassGradeGoods::getGoodsId).collect(Collectors.toList());
                 relGoods = relGoods.stream().filter(x -> !goodsIds.contains(x.getGoodsId())).collect(Collectors.toList());
             }
-            if (CollectionUtils.isEmpty(relGoods)){
+            if (CollectionUtils.isEmpty(relGoods)) {
                 return;
             }
 
@@ -589,7 +588,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         });
     }
 
-    private String getSevenCode(Long goodsId,Integer studentUpper) {
+    private String getSevenCode(Long goodsId, Integer studentUpper) {
         Goods g = iGoodsService.getById(goodsId);
         List<Goods> list = iGoodsService.list(new LambdaQueryWrapper<Goods>()
                 .eq(Goods::getEducationTypeId, g.getEducationTypeId())
@@ -600,13 +599,13 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 .eq(Goods::getStatus, 1)
                 .eq(Goods::getGoodsStatus, 1)
                 .ne(Goods::getGoodsId, goodsId));
-        if (CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             List<ClassGradeGoods> classGradeList = iClassGradeGoodsService
                     .list(new LambdaQueryWrapper<ClassGradeGoods>()
                             .in(ClassGradeGoods::getGoodsId, list.stream().map(Goods::getGoodsId).collect(Collectors.toList())));
-            if (CollectionUtils.isNotEmpty(classGradeList)){
+            if (CollectionUtils.isNotEmpty(classGradeList)) {
                 ClassGrade classGrade = baseMapper.getSevenGrade(classGradeList.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
-                if (ObjectUtils.isNotNull(classGrade)){
+                if (ObjectUtils.isNotNull(classGrade)) {
                     //判断班级人数
                     Integer locakStudentNum = baseMapper.getStudeCountByCodeNoTenant(classGrade.getSevenCode());
                     if ((studentUpper - locakStudentNum) > 0) {
@@ -626,7 +625,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
         List<ClassGradeGoods> goodsList = iClassGradeGoodsService.list(new LambdaQueryWrapper<ClassGradeGoods>().eq(ClassGradeGoods::getGradeId, update.getGradeId()));
-        for(ClassGradeGoods gradeGoods:goodsList){
+        for (ClassGradeGoods gradeGoods : goodsList) {
             if (ObjectUtils.isNull(gradeGoods)) {
                 throw new RuntimeException("班级商品信息查询失败");
             }
@@ -641,7 +640,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             businessQueryBo.setId(goods.getBusinessId());
             String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
 
-            if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName)))&& sysTenant.getShareClass() == 1) {
+            if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && sysTenant.getShareClass() == 1) {
                 if (update.getClassStatus() != null && update.getClassStatus().equals(1)) {
                     //二造和二建班级开班校验班级人数(300人)
                     if (!checkClassUserNum(goods.getBusinessId(), update.getGradeId())) {
@@ -660,7 +659,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                     }
                 }
             }
-            if(Validator.isNotEmpty(bo.getStatus())){
+            if (Validator.isNotEmpty(bo.getStatus())) {
                 if (bo.getStatus() != -1) {
            /* LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
             lqw.eq(ClassGrade::getClassName, update.getClassName());
@@ -740,10 +739,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 sendClassSMS(classGradeVo);
             }
             this.updateById(update);
-            if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") && StringUtils.isNotBlank(classGradeVo.getSevenCode())){
-                List<ClassGrade> list = baseMapper.getListNoTenant(classGradeVo.getSevenCode(),update.getGradeId());
-                if (CollectionUtils.isNotEmpty(list)){
-                    list.forEach(item ->{
+            if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") && StringUtils.isNotBlank(classGradeVo.getSevenCode())) {
+                List<ClassGrade> list = baseMapper.getListNoTenant(classGradeVo.getSevenCode(), update.getGradeId());
+                if (CollectionUtils.isNotEmpty(list)) {
+                    list.forEach(item -> {
                         update.setGradeId(item.getGradeId());
                         updateByIdNoTenant(update);
                     });
@@ -874,10 +873,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
      */
     private void validEntityBeforeSave(ClassGrade entity) {
         //TODO 做一些数据校验,如唯一约束
-        if(Validator.isNotEmpty(entity.getOfficialName())){
+        if (Validator.isNotEmpty(entity.getOfficialName())) {
             entity.setOfficialName(entity.getOfficialName().trim());
         }
-        if(Validator.isNotEmpty(entity.getPastDueDay())&&entity.getPastDueDay()<10){
+        if (Validator.isNotEmpty(entity.getPastDueDay()) && entity.getPastDueDay() < 10) {
             throw new CustomException("班级提前截止天数错误");
         }
     }
@@ -934,9 +933,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             if (Validator.isNotEmpty(classGradeStudentVo.getRebuyOrderGoodsId()) && classGradeStudentVo.getRebuyOrderGoodsId().longValue() > 0) {
                 classGradeStudentVo.setRebuy(orderMapper.getGradePeriod(classGradeStudentVo.getRebuyOrderGoodsId(), classGradeStudentVo.getUserId()));
             }
-            if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())){
+            if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())) {
                 SysTenant tenant = iSysTenantService.getById(classGradeStudentVo.getOrgId());
-                if (ObjectUtils.isNotNull(tenant)){
+                if (ObjectUtils.isNotNull(tenant)) {
                     classGradeStudentVo.setTenantName(tenant.getTenantName());
                 }
             }
@@ -947,24 +946,16 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Override
     public HashMap<String, Object> getPlush(ClassGradeUserQueryBo bo) {
         HashMap<String, Object> stringObjectHashMap = new HashMap<>();
-        if(ObjectUtils.isNotEmpty(bo.getPeriodPlush())&&bo.getPeriodPlush()!=1){
-            List<ClassGradeStudentVo> classGradeStudentVos = this.baseMapper.listGradeAll(bo);
-            stringObjectHashMap.put("notPlush",classGradeStudentVos.size());
-            stringObjectHashMap.put("plush",0);
-        }else {
-            List<ClassGradeStudentVo> classGradeStudentVos= this.baseMapper.listGradeAll(bo);
-            if (!classGradeStudentVos.isEmpty()){
-                int plush = classGradeStudentVos.stream().filter(s -> s.getPeriodPlush().equals(1)).collect(Collectors.toList()).size();
-                stringObjectHashMap.put("plush",plush);
-                if (classGradeStudentVos.size()<=plush){
-                    stringObjectHashMap.put("notPlush",0);
-                }else {
-                    stringObjectHashMap.put("notPlush",classGradeStudentVos.size()-plush);
-                }
-            }else {
-                stringObjectHashMap.put("notPlush",0);
-                stringObjectHashMap.put("plush",0);
-            }
+        if (ObjectUtils.isNotEmpty(bo.getPeriodPlush()) && bo.getPeriodPlush() != 1) {
+            Integer notPlush = this.baseMapper.getPlush(bo);
+            stringObjectHashMap.put("notPlush", notPlush);
+            stringObjectHashMap.put("plush", 0);
+        } else {
+            Integer allPlush = this.baseMapper.getPlush(bo);
+            bo.setPeriodPlush(1);
+            Integer plush = this.baseMapper.getPlush(bo);
+            stringObjectHashMap.put("plush", plush);
+            stringObjectHashMap.put("notPlush", allPlush - plush);
         }
         return stringObjectHashMap;
     }
@@ -1067,12 +1058,12 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
 
             }
 
-            List<Long> timeList = classGradeUserMapper.selectStart(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId());
+            List<Long> timeList = classGradeUserMapper.selectStart(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(), classGradeStudentVo.getOrderGoodsId());
             if (!org.springframework.util.CollectionUtils.isEmpty(timeList)) {
                 //查找开始学习时间
                 classGradeStudentVo.setStartTime(timeList.get(0));
-            }else{
-                classGradeStudentVo.setStartTime(classGradeUserMapper.selectStartNoPhoto(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId())
+            } else {
+                classGradeStudentVo.setStartTime(classGradeUserMapper.selectStartNoPhoto(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(), classGradeStudentVo.getOrderGoodsId())
                 );
             }
             //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
@@ -1085,49 +1076,49 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             /*if (Validator.isNotEmpty(classGradeStudentVo.getRebuyOrderGoodsId()) && classGradeStudentVo.getRebuyOrderGoodsId().longValue() > 0) {
                 classGradeStudentVo.setRebuy(orderMapper.getGradePeriod(classGradeStudentVo.getRebuyOrderGoodsId(), classGradeStudentVo.getUserId()));
             }*/
-            if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())){
+            if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())) {
                 SysTenant tenant = iSysTenantService.getById(classGradeStudentVo.getOrgId());
-                if (ObjectUtils.isNotNull(tenant)){
+                if (ObjectUtils.isNotNull(tenant)) {
                     classGradeStudentVo.setTenantName(tenant.getTenantName());
                 }
             }
-            ClassGradeStudentAllExportVo exportVo = BeanUtil.toBean(classGradeStudentVo,ClassGradeStudentAllExportVo.class);
-            exportVo.setHourStr((classGradeStudentVo.getRecordNum()+classGradeStudentVo.getStuAllNum())+"/"+(classGradeStudentVo.getExamNum()+classGradeStudentVo.getSecAllNum()));
-            exportVo.setServiceTimeStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getServiceStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS)+"至"+DateUtils.timestampToDateFormat(classGradeStudentVo.getServiceEndTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
-            exportVo.setVideoStr(classGradeStudentVo.getStuAllNum()+"/"+classGradeStudentVo.getSecAllNum());
-            exportVo.setExamStr(classGradeStudentVo.getRecordNum()+"/"+classGradeStudentVo.getExamNum());
-            exportVo.setStudyStartStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
-            exportVo.setStudyEndStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getEndTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
-            if(classGradeStudentVo.getPeriodStatus()==-1||classGradeStudentVo.getPeriodStatus()==0){
+            ClassGradeStudentAllExportVo exportVo = BeanUtil.toBean(classGradeStudentVo, ClassGradeStudentAllExportVo.class);
+            exportVo.setHourStr((classGradeStudentVo.getRecordNum() + classGradeStudentVo.getStuAllNum()) + "/" + (classGradeStudentVo.getExamNum() + classGradeStudentVo.getSecAllNum()));
+            exportVo.setServiceTimeStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getServiceStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS) + "至" + DateUtils.timestampToDateFormat(classGradeStudentVo.getServiceEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
+            exportVo.setVideoStr(classGradeStudentVo.getStuAllNum() + "/" + classGradeStudentVo.getSecAllNum());
+            exportVo.setExamStr(classGradeStudentVo.getRecordNum() + "/" + classGradeStudentVo.getExamNum());
+            exportVo.setStudyStartStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
+            exportVo.setStudyEndStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
+            if (classGradeStudentVo.getPeriodStatus() == -1 || classGradeStudentVo.getPeriodStatus() == 0) {
                 exportVo.setStudyStatusStr("未学完");
-            }else{
+            } else {
                 exportVo.setStudyStatusStr("已完成");
             }
-            if(Validator.isEmpty(classGradeStudentVo.getStudyCount())){
+            if (Validator.isEmpty(classGradeStudentVo.getStudyCount())) {
                 classGradeStudentVo.setStudyCount(0L);
             }
-            if(Validator.isEmpty(classGradeStudentVo.getUseStudyCount())){
+            if (Validator.isEmpty(classGradeStudentVo.getUseStudyCount())) {
                 classGradeStudentVo.setUseStudyCount(0);
             }
-            exportVo.setTotalStudyCount(classGradeStudentVo.getUseStudyCount()+classGradeStudentVo.getStudyCount().intValue());
-            if(Validator.isNotEmpty(classGradeStudentVo.getUserStatus())&&classGradeStudentVo.getUserStatus()==1){
+            exportVo.setTotalStudyCount(classGradeStudentVo.getUseStudyCount() + classGradeStudentVo.getStudyCount().intValue());
+            if (Validator.isNotEmpty(classGradeStudentVo.getUserStatus()) && classGradeStudentVo.getUserStatus() == 1) {
                 exportVo.setUserStatus("变更");
-            }else{
+            } else {
                 exportVo.setUserStatus("未变更");
             }
-            if(Validator.isNotEmpty(classGradeStudentVo.getOfficialStatus())&&classGradeStudentVo.getOfficialStatus()==1){
+            if (Validator.isNotEmpty(classGradeStudentVo.getOfficialStatus()) && classGradeStudentVo.getOfficialStatus() == 1) {
                 exportVo.setOfficialStatus("是");
-            }else{
+            } else {
                 exportVo.setOfficialStatus("否");
             }
-            if(Validator.isNotEmpty(classGradeStudentVo.getPeriodStatus())&&classGradeStudentVo.getPeriodStatus()==1){
+            if (Validator.isNotEmpty(classGradeStudentVo.getPeriodStatus()) && classGradeStudentVo.getPeriodStatus() == 1) {
                 exportVo.setPeriodStatus("通过");
-            }else{
+            } else {
                 exportVo.setPeriodStatus("未通过");
             }
-            if(Validator.isNotEmpty(classGradeStudentVo.getPeriodPlush())&&classGradeStudentVo.getPeriodPlush()==1){
+            if (Validator.isNotEmpty(classGradeStudentVo.getPeriodPlush()) && classGradeStudentVo.getPeriodPlush() == 1) {
                 exportVo.setPeriodPlush("是");
-            }else{
+            } else {
                 exportVo.setPeriodPlush("否");
             }
             eList.add(exportVo);
@@ -1304,7 +1295,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                             throw new CustomException(studyAccountStatusQueryBo.getRealname() + "学员信息为空");
                         }
                         CertInfoListItem certInfoListItem = new CertInfoListItem();
-                        if(Validator.isEmpty(personRoot.getCertInfoList())||personRoot.getCertInfoList().size()==0){
+                        if (Validator.isEmpty(personRoot.getCertInfoList()) || personRoot.getCertInfoList().size() == 0) {
                             throw new CustomException(studyAccountStatusQueryBo.getRealname() + "学员信息为空");
                         }
                         for (CertInfoListItem certInfo : personRoot.getCertInfoList()) {
@@ -1437,9 +1428,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Override
     public Integer queryOfficialGradeCount(ClassGradeQueryBo bo) {
         String tenantId = ServletUtils.getRequest().getHeader("TenantId");
-        if (ObjectUtils.isNotNull(tenantId)){
+        if (ObjectUtils.isNotNull(tenantId)) {
             SysOldOrg one = iSysOldOrgService.getOne(new LambdaQueryWrapper<SysOldOrg>().eq(SysOldOrg::getTenantId, Long.valueOf(tenantId)).last("limit 1"));
-            if (ObjectUtils.isNotNull(one)){
+            if (ObjectUtils.isNotNull(one)) {
                 bo.setClassSign(one.getShareClass());
             }
         }
@@ -1573,7 +1564,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 throw new CustomException("同步查询班级人数请求错误" + e.getMessage());
             }
             numAll = peopleNum + oldGradeNum;
-        } else if (Validator.isNotEmpty(gradeVo) && Validator.isNotEmpty(gradeVo.getSevenCode())){
+        } else if (Validator.isNotEmpty(gradeVo) && Validator.isNotEmpty(gradeVo.getSevenCode())) {
             //七大员继教
             Long num = baseMapper.getStudeCountByCode(gradeVo.getSevenCode());
             if (ObjectUtils.isNotNull(num)) {
@@ -1670,7 +1661,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             UserStudyRecord startRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(), item.getGradeId(), "ASC");
             if (ObjectUtils.isNotNull(startRecord)) {
                 item.setBeginTime(DateUtils.timestampToDateFormat(startRecord.getCreateTime(), date));
-                if (ObjectUtils.isNotNull(item.getFinishStatus()) && item.getFinishStatus() == 1){
+                if (ObjectUtils.isNotNull(item.getFinishStatus()) && item.getFinishStatus() == 1) {
                     //已学完
                     UserStudyRecord endRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(), item.getGradeId(), "DESC");
                     item.setApplyTime(DateUtils.timestampToDateFormat(endRecord.getCreateTime(), date));
@@ -1767,7 +1758,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         openUpBo.setClassName(bo.getClassName());
         openUpBo.setClassStartTime(bo.getClassStartTime());
         openUpBo.setClassEndTime(bo.getClassEndTime());
-        openUpBo.setLearningStatus(ObjectUtils.isNotNull(bo.getLearningStatus())?bo.getLearningStatus():1);
+        openUpBo.setLearningStatus(ObjectUtils.isNotNull(bo.getLearningStatus()) ? bo.getLearningStatus() : 1);
         openUpBo.setLearningTimeStart(bo.getLearningTimeStart());
         baseMapper.UpGradeStatusByTenant(openUpBo);
 
@@ -1864,16 +1855,16 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Override
     public List<ClassGradeVo> searchGradeList(ClassGradeQueryBo bo) {
         List<ClassGradeVo> classGradeVos = entity2Vo(baseMapper.searchGradeList(bo));
-        if (Validator.isEmpty(classGradeVos)||CollectionUtils.isEmpty(classGradeVos)) {
+        if (Validator.isEmpty(classGradeVos) || CollectionUtils.isEmpty(classGradeVos)) {
             return new ArrayList<>();
         }
         classGradeVos.forEach(item -> {
             //班级人数
-            if (ObjectUtils.isNotNull(item.getSevenCode())){
+            if (ObjectUtils.isNotNull(item.getSevenCode())) {
                 List<ClassGrade> list = list(new LambdaQueryWrapper<ClassGrade>()
                         .eq(ClassGrade::getSevenCode, item.getSevenCode())
                         .eq(ClassGrade::getStatus, 1));
-                if (CollectionUtils.isNotEmpty(list)){
+                if (CollectionUtils.isNotEmpty(list)) {
                     Integer count = iClassGradeUserService.count(new LambdaQueryWrapper<ClassGradeUser>()
                             .in(ClassGradeUser::getGradeId, list.stream().map(ClassGrade::getGradeId).collect(Collectors.toList()))
                             .eq(ClassGradeUser::getStatus, 1));
@@ -1893,38 +1884,38 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
 
     @Override
     public ClassGrade getCodeNoTenant(String registerCode, Long tenantId) {
-        return baseMapper.getCodeNoTenant(registerCode,tenantId);
+        return baseMapper.getCodeNoTenant(registerCode, tenantId);
     }
 
     @Override
     public void openOfficialSaveGrade(ClassGradeOpenBo bo) {
         List<SysTenant> tenantList = sysTenantService.getListNoTenant(0L);
-        if (CollectionUtils.isEmpty(tenantList)){
+        if (CollectionUtils.isEmpty(tenantList)) {
             return;
         }
         tenantList.forEach(tenant -> {
             //是否存在对应课程商品
-            List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(bo.getBusinessName(),bo.getMajorName(),tenant.getTenantId());
-            if (CollectionUtils.isEmpty(relGoods)){
+            List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(bo.getBusinessName(), bo.getMajorName(), tenant.getTenantId());
+            if (CollectionUtils.isEmpty(relGoods)) {
                 return;
             }
             //班级是否存在
-            if (StringUtils.isNotBlank(bo.getRegisterCode())){
-                ClassGrade grade = baseMapper.getCodeNoTenant(bo.getRegisterCode(),tenant.getTenantId());
-                if (ObjectUtils.isNotNull(grade)){
+            if (StringUtils.isNotBlank(bo.getRegisterCode())) {
+                ClassGrade grade = baseMapper.getCodeNoTenant(bo.getRegisterCode(), tenant.getTenantId());
+                if (ObjectUtils.isNotNull(grade)) {
                     //已经存在 过滤已经创建过班级的商品
                     List<ClassGradeGoods> classGradeGoods = iClassGradeGoodsService.listByIdNoTenant(grade.getGradeId());
                     List<Long> goodsIds = classGradeGoods.stream().map(ClassGradeGoods::getGoodsId).collect(Collectors.toList());
                     relGoods = relGoods.stream().filter(x -> !goodsIds.contains(x.getGoodsId())).collect(Collectors.toList());
                 }
-                if (CollectionUtils.isEmpty(relGoods)){
+                if (CollectionUtils.isEmpty(relGoods)) {
                     return;
                 }
             }
             relGoods.forEach(item -> {
                 ClassGrade classGrade = new ClassGrade();
                 classGrade.setCreateTime(DateUtils.getNowTime());
-                if (bo.getClassStatus() == 1){
+                if (bo.getClassStatus() == 1) {
                     //开班
                     classGrade.setClassStatus(1);
                     classGrade.setOfficialName(bo.getOfficialName());
@@ -1938,7 +1929,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                     if (CollectionUtils.isNotEmpty(interfaceList)) {
                         classGrade.setInterfacePushId(interfaceList.get(0).getId());
                     }
-                }else {
+                } else {
                     classGrade.setClassStatus(0);
                     classGrade.setLearningStatus(2);//待定
                     classGrade.setOfficialName(bo.getRegisterCode());

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderInputServiceImpl.java

@@ -320,8 +320,7 @@ public class OrderInputServiceImpl extends ServiceImpl<OrderInputMapper, OrderIn
         });
         ExcelUtil<OrderInputImpotVo> inputImpotVoExcelUtil = new ExcelUtil<>(OrderInputImpotVo.class);
         ExcelUtil<OrderListImportVo> importVoExcelUtil = new ExcelUtil<>(OrderListImportVo.class);
-        map.put("excel",inputImpotVoExcelUtil.exportEasyExcel(inputImpotVoExcelUtil.exportEasyData(orderInputImpotVos), "导出后台订单"));
-        map.put("excel",inputImpotVoExcelUtil.exportEasyExcel(importVoExcelUtil.exportEasyData(orderListImportVos), "导出订单详情"));
+        map.put("excel",inputImpotVoExcelUtil.exportEasyExcel(inputImpotVoExcelUtil.exportEasyData2(orderInputImpotVos,orderInputImpotVos), "导出后台订单"));
         return map;
     }
 

+ 79 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -605,9 +605,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN user_exam_goods ueg ON ueg.order_goods_id = og.order_goods_id
         LEFT JOIN user_profile up on cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
         where 1=1 and cgu.`status` = 1
+        <if test="sevenCode != null and sevenCode !='' ">
+            AND cg.seven_code = #{sevenCode}
+        </if>
         <if test="gradeId != null and gradeId !='' and (sevenCode == null or sevenCode =='')">
             and cgu.grade_id = #{gradeId}
         </if>
+        <if test="choice != null and choice == 1 ">
+            and (SELECT COUNT(cge.grade_id) FROM class_grade cge LEFT JOIN class_grade_user cgur on cge.grade_id = cgur.grade_id where cgu.user_id =cgur.user_id and  cgur.order_goods_id = cgu.order_goods_id AND (unix_timestamp(now()) &lt; cge.class_end_time or cge.class_start_time is null) and cge.`status`=1 and cgur.`status` =1)= 0 and cgu.period_status=0
+            AND (SELECT COUNT(cgde.grade_id) FROM class_grade cgde where cgde.grade_id = cg.grade_id and (unix_timestamp(now()) &lt; cgde.class_end_time or cgde.class_start_time is null)) =0
+        </if>
+        <if test="choice != null and choice == 2 ">
+            and (SELECT COUNT(cge.grade_id) FROM class_grade cge LEFT JOIN class_grade_user cgur on cge.grade_id = cgur.grade_id where cgu.user_id =cgur.user_id and  cgur.order_goods_id = cgu.order_goods_id  AND (unix_timestamp(now()) &lt; cge.class_end_time or cge.class_start_time is null)
+            and cge.`status`=1 and cgur.`status` =1)> 0
+            AND (SELECT COUNT(cgde.grade_id) FROM class_grade cgde where cgde.grade_id = cg.grade_id and (unix_timestamp(now()) &lt; cgde.class_end_time or cgde.class_start_time is null)) =0
+        </if>
+        <if test="studyCountMore != null and studyCountMore == 2 ">
+            AND og.study_count > 0 AND cgu.change_grade = 0 AND (cg.status = 0 or unix_timestamp(now()) > cg.class_end_time)
+        </if>
+        <if test="studyCountMore != null and studyCountMore == 1 ">
+            AND og.study_count > 0 AND cgu.change_grade = 1
+        </if>
+        <if test="studyCountMore != null and studyCountMore == 0 ">
+            AND og.study_count = 0
+        </if>
+        <if test="periodStatus != null ">
+            AND cgu.period_status = #{periodStatus}
+        </if>
         <if test="officialStatus != null and officialStatus == 1 ">
             AND cgu.official_status = 1
         </if>
@@ -620,6 +644,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="periodPlush != null and periodPlush == 0 ">
             AND (cgu.period_plush is NULL or cgu.period_plush=0)
         </if>
+        <if test="searchKey != null and searchKey != ''">
+            AND (cg.class_name like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.company_name like concat('%', #{searchKey}, '%'))
+        </if>
+        <if test="telphone != null and telphone != ''">
+            AND (u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
+        </if>
+        <if test="idCard != null and idCard != ''">
+            AND u.id_card like concat('%', #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
+        </if>
+        <if test="idCards != null and idCards.size() != 0">
+            AND u.id_card IN
+            <foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
+                #{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+            </foreach>
+        </if>
+        <if test="orderSn != null and orderSn != ''">
+            AND og.order_sn = #{orderSn}
+        </if>
+        <if test="goodsName != null and goodsName != ''">
+            AND g.goods_name like concat('%', #{goodsName}, '%')
+        </if>
+        <if test="searchStartTime != null and searchStartTime != ''">
+            AND cgu.create_time &gt; #{searchStartTime}
+        </if>
+        <if test="searchEndTime != null and searchEndTime != ''">
+            AND cgu.create_time &lt; #{searchEndTime}
+        </if>
+        <if test="finishStatus != null">
+            AND cgu.finish_status = #{finishStatus}
+        </if>
+        <if test="learnStatus != null">
+            AND cgu.learn_status = #{learnStatus}
+        </if>
+        <if test="projectId != null and projectId != ''">
+            AND g.project_id = #{projectId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="majorId != null and majorId != ''">
+            AND m.id = #{majorId}
+        </if>
+        <if test="hasInterface != null and hasInterface == 0">
+            AND cg.interface_account_id is null AND cg.no_interface_account_id is null
+        </if>
+        <if test="hasInterface != null and hasInterface == 1">
+            AND cg.interface_account_id is not null
+        </if>
+        <if test="hasInterface != null and hasInterface == 2">
+            AND cg.no_interface_account_id is not null
+        </if>
+        order by cgu.id desc
     </select>
 
     <select id="listGradeAll"  parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassGradeStudentVo">