Browse Source

安全检查调试

jiawuxian 2 years ago
parent
commit
ff21151cc7

+ 1 - 1
project_data/sql/0.0.2/soc/soc.sql

@@ -973,7 +973,7 @@ CREATE TABLE `core_safetycheck_rule_point`  (
 
 SET FOREIGN_KEY_CHECKS = 1;
 
-DELETE from `sys_dict_type` WHERE id='question_confirm_status' or id='question_reform_status';
+DELETE from `sys_dict_type` WHERE dict_type='question_confirm_status' or dict_type='question_reform_status';
 INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '问题确认状态', 'question_confirm_status', '0', '超级管理员', '2023-09-13 18:14:59', '', NULL, NULL);
 INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '问题整改状态', 'question_reform_status', '0', '超级管理员', '2023-09-13 18:15:18', '', NULL, NULL);
 

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/SafetyCheckRegisterSericeImpl.java

@@ -211,7 +211,7 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
         // 找出检查内容
         List<AppTaskRegisterPointVo> points = baseMapper.selectPoint(plan.getId(), id);
         Map<Long, List<CoreSafetyTaskDataRemarkimg>> taskImgs = new HashMap<>();
-        if (ObjectUtil.equal(task.getStatus(), SafetyCheckTaskStatus.UnderWay.getValue())) {
+        if (ObjectUtil.equal(task.getDoneStatus(), SafetyCheckTaskStatus.UnderWay.getValue())) {
             //已保存未提交的才可能有问题图片
             LambdaQueryWrapper<CoreSafetyTaskDataRemarkimg> wrapper = new LambdaQueryWrapper<>();
             wrapper.eq(CoreSafetyTaskDataRemarkimg::getTaskId, id);

+ 1 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/SysMenu.java

@@ -34,6 +34,7 @@ public class SysMenu extends BaseEntity {
     /**
      * 菜单ID
      */
+
     private Long id;
 
     /**

+ 7 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysMenuServiceImpl.java

@@ -1,9 +1,11 @@
 package com.xunmei.system.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.UserConstants;
+import com.xunmei.common.core.utils.IDHelper;
 import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.system.api.domain.SysRole;
 import com.xunmei.system.api.domain.SysUser;
@@ -15,6 +17,7 @@ import com.xunmei.system.mapper.SysMenuMapper;
 import com.xunmei.system.mapper.SysRoleMapper;
 import com.xunmei.system.mapper.SysRoleMenuMapper;
 import com.xunmei.system.service.ISysMenuService;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -266,6 +269,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
      */
     @Override
     public int insertMenu(SysMenu menu) {
+        if(ObjectUtil.isNull(menu.getId())){
+            menu.setId(IDHelper.id());
+        }
+
         return menuMapper.insertMenu(menu);
     }
 

+ 0 - 116
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/IDHelper.java

@@ -1,116 +0,0 @@
-package com.xunmei.system.util;
-
-import cn.hutool.core.date.DateUtil;
-import com.xunmei.common.core.utils.snowId.DateHelper;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-import com.xunmei.system.util.SnowflaskGenerator;
-import javax.annotation.PostConstruct;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
-
-@Component
-public class IDHelper {
-
-
-    //    @Value("${snowflake.workerId}")
-//    private  long workerId;
-//    @Value("${snowflake.datacenterId}")
-//    private long datacenterId=0L;
-//    private  static  long _workerId=0L;
-//    private  static  long _datacenterId=0L;
-    @Autowired
-    private Environment environment;
-
-    @PostConstruct
-    public void setStatic() {
-        long _workerId = 0L;
-        long _datacenterId = 0L;
-        if (environment.containsProperty("snowflake.workerId")) {
-            _workerId = environment.getProperty("snowflake.workerId", long.class);
-        }
-        if (environment.containsProperty("snowflake.datacenterId")) {
-            _datacenterId = environment.getProperty("snowflake.datacenterId", long.class);
-        }
-
-//        snowflaskGenerator = new SnowflaskGenerator(_workerId, _datacenterId);
-        snowflaskGenerator = new SnowflaskGenerator(0L, 0L);
-    }
-
-    private static  SnowflaskGenerator snowflaskGenerator = null;
-
-    public static Long id() {
-        return snowflaskGenerator.nextId();
-    }
-
-    public static String dateTime(final Date date) {
-        return DateUtil.format(date, PURE_DATETIME_PATTERN);
-    }
-
-    public static String dateTime(final Date date, final Serializable other) {
-        return DateUtil.format(date, PURE_DATETIME_PATTERN) + "|" + other.toString();
-    }
-
-    public static String date(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "D" + dateHelper.getMonth() + "" + dateHelper.getDate() + "|" + other.toString();
-    }
-
-    public static String month(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "M" + dateHelper.getMonth() + "|" + other.toString();
-    }
-
-    public static String week(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "W" + dateHelper.getWeek() + "|" + other.toString();
-    }
-
-    public static String quarter(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "Q" + dateHelper.getQuarter() + "|" + other.toString();
-    }
-
-    public static String halfyear(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "H" + dateHelper.getHalfyear() + "|" + other.toString();
-    }
-
-    public static String year(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "Y" + dateHelper.getYear() + "|" + other.toString();
-    }
-
-    public static String hour(final Date date, final Serializable other) {
-        final DateHelper dateHelper = new DateHelper(date);
-        return dateHelper.getYear() + "R" + dateHelper.getMonth() + "" + dateHelper.getDate() + "" + dateHelper.getHour() + "|" + other.toString();
-    }
-
-    public static Long pad(final Serializable code, final Serializable id, final int i) {
-        return Long.parseLong(code + StringUtils.leftPad(id.toString(), i, "0"));
-    }
-
-    public static Long and(final Object... pp) {
-        return Long.parseLong(Stream.of(pp)
-                .filter(Objects::nonNull)
-                .map(Object::toString)
-                .collect(Collectors.joining()));
-    }
-
-    public static String md5(final Serializable... os) {
-        final StringBuilder stringBuilder = new StringBuilder(os.length * 10);
-        for (final Serializable o : os) {
-            stringBuilder.append(o.toString());
-        }
-        stringBuilder.trimToSize();
-        return DigestUtils.md5Hex(stringBuilder.toString());
-    }
-}

+ 32 - 32
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/ResumptionType.java

@@ -187,39 +187,39 @@ public enum ResumptionType {
         return null;
     }
 
-    /**
-     * @param formType
-     * @param date
-     * @param orgId
-     * @return
-     */
-    public String toId(final FormType formType, final Date date, final Long orgId) {
-        return this.toId(date, orgId) + "|" + formType.ordinal();
-    }
+//    /**
+//     * @param formType
+//     * @param date
+//     * @param orgId
+//     * @return
+//     */
+//    public String toId(final FormType formType, final Date date, final Long orgId) {
+//        return this.toId(date, orgId) + "|" + formType.ordinal();
+//    }
 
-    /**
-     * @param date
-     * @param orgId
-     * @return
-     */
-    public String toId(final Date date, final Long orgId) {
-        switch (this) {
-            case DAY:
-                return IDHelper.date(date, orgId);
-            case WEEK:
-                return IDHelper.week(date, orgId);
-            case MONTH:
-                return IDHelper.month(date, orgId);
-            case QUARTER:
-                return IDHelper.quarter(date, orgId);
-            case HALFYEAR:
-                return IDHelper.halfyear(date, orgId);
-            case HOUR:
-                return IDHelper.hour(date, orgId);
-            default:
-                return IDHelper.year(date, orgId);
-        }
-    }
+//    /**
+//     * @param date
+//     * @param orgId
+//     * @return
+//     */
+//    public String toId(final Date date, final Long orgId) {
+//        switch (this) {
+//            case DAY:
+//                return IDHelper.date(date, orgId);
+//            case WEEK:
+//                return IDHelper.week(date, orgId);
+//            case MONTH:
+//                return IDHelper.month(date, orgId);
+//            case QUARTER:
+//                return IDHelper.quarter(date, orgId);
+//            case HALFYEAR:
+//                return IDHelper.halfyear(date, orgId);
+//            case HOUR:
+//                return IDHelper.hour(date, orgId);
+//            default:
+//                return IDHelper.year(date, orgId);
+//        }
+//    }
 
     /**
      * @param date

+ 0 - 167
soc-modules/soc-modules-system/src/main/java/com/xunmei/util/SnowflaskGenerator.java

@@ -1,167 +0,0 @@
-package com.xunmei.system.util;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * Long类型ID生成器,固定为19位长度
- * 生成ID,采用snowflake算法,64bit整数,1秒可以生成800万个ID
- * 0-41bit毫秒时间戳-10bit机器ID-12bit序列化
- * 42bit的毫秒时间戳,2000年算起可以支持该算法使用到2068年,10bit的工作机器id可以支持1024台机器,12序列号支持1毫秒产生4096个自增序列id
- */
-@Slf4j
-
-public class SnowflaskGenerator {
-
-    /**
-     * 开始时间截 (2015-01-01)
-     */
-    private final long twepoch = 1420041600000L;
-
-    /**
-     * 机器id所占的位数
-     */
-    private final long workerIdBits = 1L;
-
-    /**
-     * 数据标识id所占的位数
-     */
-    private final long datacenterIdBits = 1L;
-
-    /**
-     * 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数)
-     */
-    private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
-
-    /**
-     * 支持的最大数据标识id,结果是31
-     */
-    private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
-
-    /**
-     * 序列在id中占的位数
-     */
-    private final long sequenceBits = 12L;
-
-    /**
-     * 机器ID向左移12位
-     */
-    private final long workerIdShift = sequenceBits;
-
-    /**
-     * 数据标识id向左移17位(12+5)
-     */
-    private final long datacenterIdShift = sequenceBits + workerIdBits;
-
-    /**
-     * 时间截向左移22位(3+3+12)
-     */
-    private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
-
-    /**
-     * 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095)
-     */
-    private final long sequenceMask = -1L ^ (-1L << sequenceBits);
-
-    /**
-     * 工作机器ID(0~31)
-     */
-    private long workerId;
-
-    /**
-     * 数据中心ID(0~31)
-     */
-    private long datacenterId;
-
-    /**
-     * 毫秒内序列(0~4095)
-     */
-    private long sequence = 0L;
-
-    /**
-     * 上次生成ID的时间截
-     */
-    private long lastTimestamp = -1L;
-
-
-    //==============================Constructors=====================================
-
-    /**
-     * 构造函数
-     *
-     * @param workerId     工作ID (0~31)
-     * @param datacenterId 数据中心ID (0~31)
-     */
-    public SnowflaskGenerator(long workerId, long datacenterId) {
-        if (workerId > maxWorkerId || workerId < 0) {
-            throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
-        }
-        if (datacenterId > maxDatacenterId || datacenterId < 0) {
-            throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
-        }
-        this.workerId = workerId;
-        this.datacenterId = datacenterId;
-    }
-
-    // ==============================Methods==========================================
-
-    /**
-     * 获得下一个ID (该方法是线程安全的)
-     *
-     * @return SnowflakeId
-     */
-    public synchronized long nextId() {
-        long timestamp = timeGen();
-
-        //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
-        if (timestamp < lastTimestamp) {
-            throw new RuntimeException(
-                    String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
-        }
-
-        //如果是同一时间生成的,则进行毫秒内序列
-        if (lastTimestamp == timestamp) {
-            sequence = (sequence + 1) & sequenceMask;
-            //毫秒内序列溢出
-            if (sequence == 0) {
-                //阻塞到下一个毫秒,获得新的时间戳
-                timestamp = tilNextMillis(lastTimestamp);
-            }
-        }
-        //时间戳改变,毫秒内序列重置
-        else {
-            sequence = 0L;
-        }
-
-        //上次生成ID的时间截
-        lastTimestamp = timestamp;
-
-        //移位并通过或运算拼到一起组成64位的ID
-        return ((timestamp - twepoch) << timestampLeftShift) //
-                | (datacenterId << datacenterIdShift) //
-                | (workerId << workerIdShift) //
-                | sequence;
-    }
-
-    /**
-     * 阻塞到下一个毫秒,直到获得新的时间戳
-     *
-     * @param lastTimestamp 上次生成ID的时间截
-     * @return 当前时间戳
-     */
-    protected long tilNextMillis(long lastTimestamp) {
-        long timestamp = timeGen();
-        while (timestamp <= lastTimestamp) {
-            timestamp = timeGen();
-        }
-        return timestamp;
-    }
-
-    /**
-     * 返回以毫秒为单位的当前时间
-     *
-     * @return 当前时间(毫秒)
-     */
-    protected long timeGen() {
-        return System.currentTimeMillis();
-    }
-}