Procházet zdrojové kódy

代码漏洞修改

linft před 2 roky
rodič
revize
13c327544c

+ 0 - 14
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/FunctionMapperUtil.java

@@ -51,12 +51,6 @@ public class FunctionMapperUtil {
      */
     private Map<Class,Field> cacheMap = new ConcurrentHashMap<>();
 
-    /**
-     * 缓存注解数据不用每次解析
-     */
-    private Map<Class, Map<Field, FunctionMapper>> cacheFunctionMapperMap = new ConcurrentHashMap<>();
-
-
     private Map<String,String> map = new HashMap<>();
     @PostConstruct
     public void initFunNum()
@@ -129,10 +123,6 @@ public class FunctionMapperUtil {
                         logger.debug("属性:{},注解{}",a.getName(),annotation1==null);
                         //这样只会拿第一个循环到的
                         annotation.compareAndSet(null,annotation1);
-//                        if(annotation.get()!=null&&!cacheMap.containsKey(o.getClass()))
-//                        {
-//                            cacheMap.put(o.getClass(),a);
-//                        }
                         Optional<FunctionMapper> functionMapper1 = Optional.ofNullable(functionMapper)
                                 .filter(b -> StrUtil.isNotEmpty(b.funNum()));
                         if(functionMapper1.isPresent())
@@ -217,10 +207,6 @@ public class FunctionMapperUtil {
 
         SubFunction  subFunction= new SubFunction();
         subFunction.setFunctionStatuses(mapper);
-//        String s = Optional.ofNullable(mapper)
-//                .filter(a -> a.size() > 0)
-//                .map(a -> a.get(0).getHardwareNum())
-//                .orElse(null);
         //通过缓存获取数据
         Long  cacheSubByGateway = labSensorService.getCacheSubByGateway(transmissionVo.getA3());
         return subFunction.setSubId(cacheSubByGateway);

+ 0 - 17
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/HexUtils.java

@@ -84,21 +84,6 @@ public class HexUtils {
         return num;
     }
 
-    public static List<String> getFileName(String path) {
-        List<String> list=new ArrayList<>();
-        File f = new File(path);//获取路径  F:测试目录
-        if (!f.exists()) {
-            return null;
-        }
-        File fa[] = f.listFiles();//用数组接收  F:笔记总结C#, F:笔记总结if语句.txt
-        for (int i = 0; i < fa.length; i++) {//循环遍历
-            File fs = fa[i];//获取数组中的第i个
-            list.add(fs.getName());
-        }
-        return list;
-    }
-
-
     /**
      * 将数字字符串转化为二进制byte数组
      * @param hex
@@ -215,7 +200,6 @@ public class HexUtils {
         stb.append(HEAD_ONE);
         //包头二
         stb.append(HEAD_TWO);
-        int intId=Integer.valueOf(id);
         String hexId=getHexCardNum(id,2);
         //ID号
         stb.append(hexId);
@@ -247,7 +231,6 @@ public class HexUtils {
         stb.append(HEAD_ONE+" ");
         //包头二
         stb.append(HEAD_TWO+" ");
-        int intId=Integer.valueOf(id);
         String hexId=getHexCardNum(id,2);
         //ID号
         stb.append(hexId+" ");

+ 0 - 138
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/InblackListScheduleTask.java

@@ -1,138 +0,0 @@
-package com.zd.laboratory.utils;
-
-import com.zd.exam.api.feign.RemoteExamService;
-import com.zd.laboratory.api.entity.LabMessageContent;
-import com.zd.laboratory.domain.LabNegativelistHistory;
-import com.zd.laboratory.domain.vo.LabBlacklistVO;
-import com.zd.laboratory.mapper.LabMessageContentMapper;
-import com.zd.laboratory.service.ILabBlacklistService;
-import com.zd.laboratory.service.ILabMessageDynamicService;
-import com.zd.laboratory.service.ILabMessageUserService;
-import com.zd.laboratory.service.ILabNegativeListRecordsService;
-import com.zd.model.domain.R;
-import com.zd.model.domain.ResultData;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Author: liujh
- * @Date: 2021/12/21/19:44
- * @Description:
- */
-@Configuration      //1.主要用于标记配置类,兼备Component的效果。
-@EnableScheduling   // 2.开启定时任务
-public class InblackListScheduleTask {
-
-    @Autowired
-    private ILabNegativeListRecordsService iLabNegativeListRecordsService;
-    @Autowired
-    private RemoteExamService remoteExamService;
-
-    @Autowired
-    private ILabBlacklistService iLabBlacklistService;
-
-    @Autowired
-    private ILabMessageDynamicService labMessageDynamicService;
-
-    @Autowired
-    private ILabMessageUserService labMessageUserService;
-
-    @Autowired
-    private LabMessageContentMapper labMessageContentMapper;
-
-    /**
-     * 每10分钟执行一次    //    @Scheduled(cron = "0 47 12 ? * *")
-     */
-    //@Scheduled(cron = "0 */10 * * * ?")
-    public void configureTasks() {
-        System.err.println("执行定时任务时间: " + LocalDateTime.now());
-        Map <String,Object> markconfigMap = new HashMap <>();
-        R<Object> data = remoteExamService.getPointsConfig(markconfigMap);
-        if (data!=null) {
-            String code = data.getCode() + "";
-            if (code.equals("200")) {
-                Map <String, Object> pointsConfig = (Map <String, Object>) data.getData();
-                ResultData list = iLabNegativeListRecordsService.getExpireTimeData();
-                List <LabNegativelistHistory> labNegativelistHistoryList = (List <LabNegativelistHistory>) list.getData();
-                for (LabNegativelistHistory history : labNegativelistHistoryList) {
-
-                    if(history.getCreditScore() == null || pointsConfig.get("blackScore") == null){
-                        continue;
-                    }
-                    Long deducPoints = history.getCreditScore() - Long.parseLong(pointsConfig.get("blackScore")+"");
-                    if(deducPoints>0){
-                        //这里扣减信用分
-                        if(deducPointsFun(history.getUserId(),deducPoints)){
-                            //这里移入黑名单
-                            LabBlacklistVO labBlacklistVO = new LabBlacklistVO();
-                            labBlacklistVO.setJoinUserId(history.getUserId());
-                            labBlacklistVO.setCreditScore(deducPoints+"");
-                            labBlacklistVO.setSurplusCreditScore((history.getCreditScore()-deducPoints)+"");
-                            labBlacklistVO.setReason("从负面清单移入到黑名单");
-                            labBlacklistVO.setFlagAction(true);
-                            iLabBlacklistService.addBlacklist(labBlacklistVO);
-                            //最后移除负面清单
-                            iLabNegativeListRecordsService.updateByUserId(history.getUserId(),history.getCreditScore()-deducPoints);
-
-//                            //逾期消息通知
-//                            LabMessageDynamic labMessageDynamic = new LabMessageDynamic();
-//                            labMessageDynamic.setSendRange(3);
-//                            labMessageDynamic.setMessClass(3);
-//                            labMessageDynamic.setContent("您有违规已经逾期,请及时处理,详细请登录系统查看具体处理方式方法。");
-//                            labMessageDynamic.setDynamicId(labBlacklistVO.getId());
-//                            labMessageDynamic.setRemark("违规逾期通知");
-//                            labMessageDynamic.setCreateBy("系统用户");
-//                            labMessageDynamic.setCreateTime(new Date());
-//                            int dynamicId = labMessageDynamicService.insertLabMessageDynamicByTask(labMessageDynamic);
-//                            if(dynamicId>0){
-//                                //给逾期未处理的人发送
-//                                LabMessageUser labMessageUser = new LabMessageUser();
-//                                labMessageUser.setJoinUserId(history.getUserId());
-//                                labMessageUser.setIsRead(false);
-//                                labMessageUser.setMessageId(labMessageDynamic.getId());
-//                                labMessageUserService.insertLabMessageUser(labMessageUser);
-//                            }
-
-                            //逾期消息通知
-                            LabMessageContent labMessageContent = new LabMessageContent();
-                            labMessageContent.setSendRange(3);
-                            labMessageContent.setMessClass(1);
-                            labMessageContent.setContent("您有违规已经逾期,请及时处理,详细请登录系统查看具体处理方式方法。");
-                            labMessageContent.setUserIds(history.getUserId()+"");
-                            labMessageContent.setUserId(-2L);
-                            labMessageContent.setCreateTime(new Date());
-                            labMessageContent.setCreateBy("系统");
-                            labMessageContentMapper.insertLabMessageContent(labMessageContent);
-
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-
-    private boolean deducPointsFun(Long joinUserId,Long deductPoints){
-        Map <String,Object> deducPointsMap = new HashMap <>();
-        deducPointsMap.put("joinUserId",joinUserId);
-        deducPointsMap.put("deductPoints",deductPoints);
-        deducPointsMap.put("pointsType",1);
-        deducPointsMap.put("reason","没有在指定时间完成负面清单学习,扣减信用分移入黑名单!!");
-        R<Object> data = remoteExamService.deductionPoints(deducPointsMap);
-        if (data!=null) {
-            String code = data.getCode() + "";
-            if (code.equals("200")) {
-                return true;
-            }
-        }
-        return false;
-    }
-}

+ 4 - 6
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/word/SignPicPolicy.java

@@ -1,10 +1,10 @@
 package com.zd.laboratory.utils.word;
 
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.http.HttpUtil;
+
 import com.deepoove.poi.exception.RenderException;
 import com.deepoove.poi.policy.AbstractRenderPolicy;
 import com.deepoove.poi.render.RenderContext;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.Units;
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
@@ -13,15 +13,13 @@ import org.apache.xmlbeans.XmlException;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;
 import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing;
-
 import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
 import java.net.URL;
 
+@Slf4j
 public class SignPicPolicy extends AbstractRenderPolicy<SignPictureRenderData> {
     @Override
     protected boolean validate(SignPictureRenderData data) {
@@ -118,7 +116,7 @@ public class SignPicPolicy extends AbstractRenderPolicy<SignPictureRenderData> {
                 anchor = drawing.getAnchorArray(0);
                 anchor.setGraphic(ctGraphicalObject);
             } catch (XmlException e) {
-                //e.printStackTrace();
+                log.error("异常信息:", e);
             }
             return anchor;
         }

+ 0 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/word/Word2DetailTablePolicy.java

@@ -29,8 +29,6 @@ public class Word2DetailTablePolicy extends DynamicTableRenderPolicy {
                     insertNewTableRow.createCell();
                 }
 
-                // 合并单元格
-//                TableTools.mergeCellsHorizonal(table, goodsStartRow, 0, 3);
                 // 单行渲染
                 TableRenderPolicy.Helper.renderRow(table.getRow(startRow), details.get(i));
             }

+ 0 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/word/Word3.java

@@ -82,10 +82,6 @@ public class Word3 {
          * 隐患描述
          */
         private String check_desc = "";
-        /**
-         * 隐患图片 - 多个
-         */
-//        private String check_img = "";
 
         public String getIndex() {
             return index;

+ 5 - 7
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/word/WordUtils.java

@@ -4,6 +4,7 @@ import com.deepoove.poi.XWPFTemplate;
 import com.deepoove.poi.config.Configure;
 import com.deepoove.poi.data.Includes;
 import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.core.io.ClassPathResource;
 
 import javax.servlet.http.HttpServletResponse;
@@ -12,6 +13,7 @@ import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.List;
 
+@Slf4j
 public class WordUtils {
 
     public static final String[] CN_NUM = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十"};
@@ -27,8 +29,6 @@ public class WordUtils {
         Configure config = Configure.builder().bind("details", new LoopRowTableRenderPolicy()).build();
 
         ClassPathResource classpathResource = new ClassPathResource("word/1.docx");
-
-//        XWPFTemplate template = XWPFTemplate.compile(url, config);
         XWPFTemplate template = XWPFTemplate.compile(classpathResource.getInputStream(), config);
 
         template.render(
@@ -44,7 +44,7 @@ public class WordUtils {
 
                             put(name, value);
                         } catch (IllegalAccessException e) {
-                            //e.printStackTrace();
+                            log.error("WordUtils", e);
                         }
                     }
                     put("details",list);
@@ -72,12 +72,10 @@ public class WordUtils {
 
                             put(name, value);
                         } catch (IllegalAccessException e) {
-                            //e.printStackTrace();
+                            log.error("WordUtils", e);
                         }
                     }
-//                    put("details",wordPolicy);
                     ClassPathResource classpathResource = new ClassPathResource("word/word2_detail.docx");
-//                    put("details", Includes.ofLocal(classpathResource.getInputStream()).setRenderModel(list).create());
                     put("details", Includes.ofStream(classpathResource.getInputStream()).setRenderModel(list).create());
                 }});
         template.write(response.getOutputStream());
@@ -105,7 +103,7 @@ public class WordUtils {
 
                             put(name, value);
                         } catch (IllegalAccessException e) {
-                            //e.printStackTrace();
+                            log.error("WordUtils", e);
                         }
                     }
                     put("details",list);