xiongchao 3 lat temu
rodzic
commit
c12ed53768

+ 37 - 16
platform-common/src/main/java/com/platform/common/util/DateUtils.java

@@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
 import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAdjusters;
 import java.time.temporal.TemporalUnit;
 import java.util.Calendar;
 import java.util.Date;
@@ -34,27 +35,47 @@ public class DateUtils {
     private final static ZoneId ZONE_ID = ZoneId.systemDefault();
 
     /**
-     * 当前时间所在一周的周一时间
+     * 当前时间所在一周的周一时间:00:00:00
      *
      * @return
      */
-    public static String getWeekDate() {
+    public static LocalDateTime getMondayOfThisWeek() {
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime monday = now.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1).withHour(0).withMinute(0).withSecond(0);
+        return monday;
+    }
 
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+    /**
+     * 得到本周周日:23:59:59
+     *
+     * @return yyyy-MM-dd
+     */
+    public static LocalDateTime getSundayOfThisWeek() {
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime sunday = now.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1).withHour(23).withMinute(59).withSecond(59);
+        return sunday;
+    }
 
-        Calendar cal = Calendar.getInstance();
-        // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
-        cal.setFirstDayOfWeek(Calendar.MONDAY);
-        // 获得当前日期是一个星期的第几天
-        int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
-        if (dayWeek == 1) {
-            dayWeek = 8;
-        }
-        // 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
-        cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - dayWeek);
-        Date mondayDate = cal.getTime();
-        String weekBegin = sdf.format(mondayDate);
-        return weekBegin;
+    /**
+     * 获取当前月第一天:00:00:00
+     *
+     * @return
+     */
+    public static LocalDateTime getFirstDayOfThisMonth() {
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime firstday  =  now.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
+        return firstday;
+    }
+
+    /**
+     * 获取当前月最后一天:23:59:59
+     *
+     * @return
+     */
+    public static LocalDateTime getLastDayOfThisMonth() {
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime lastDay  =  now.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59);
+        return lastDay ;
     }
 
     /**

+ 8 - 0
platform-dao/src/main/java/com/platform/dao/dto/check/CheckJobDTO.java

@@ -86,6 +86,14 @@ public class CheckJobDTO extends BaseDTO implements Serializable {
      * 点检人id
      */
     private String checkUserId;
+    /**
+     * 设备等级
+     */
+    private Integer level;
+    /**
+     * 周期类型
+     */
+    private Integer periodType;
     /**
      * 点检人
      */

+ 9 - 1
platform-dao/src/main/java/com/platform/dao/dto/repair/RepairApplicationFormDTO.java

@@ -13,6 +13,7 @@ import javax.persistence.Transient;
 import javax.validation.constraints.*;
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -35,6 +36,10 @@ public class RepairApplicationFormDTO extends BaseDTO implements Serializable {
      * 多长时间修复好
      */
     private Double limitHours;
+    /**
+     * 要求日期
+     */
+    private LocalDate limitDate;
     /**
      * 审核描述
      */
@@ -276,8 +281,11 @@ public class RepairApplicationFormDTO extends BaseDTO implements Serializable {
      * 委外类别
      */
     private Integer outType;
-
+    /**
+     * 委外单号
+     */
     private String outNo;
+
     /**
      * 类型
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/dto/repair/RepairFeeDTO.java

@@ -23,6 +23,10 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class RepairFeeDTO extends BaseDTO implements Serializable {
+    /**
+     * 单号:系统内部的单号,不是维修单号或者其他的单号
+     */
+    private String no;
     /**
      * 货币类型
      */

+ 7 - 0
platform-dao/src/main/java/com/platform/dao/entity/repair/RepairApplicationForm.java

@@ -7,6 +7,7 @@ import javax.persistence.Id;
 import javax.persistence.Table;
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 import com.platform.common.bean.DataScope;
@@ -67,6 +68,12 @@ public class RepairApplicationForm implements Serializable {
      * 报修来源:1-点检 2-保养 3-润滑 4-现场
      */
     private Integer source;
+
+    /**
+     * 要求日期
+     */
+    private LocalDate limitDate;
+
     /**
      * 报修时间
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/entity/repair/RepairFee.java

@@ -90,6 +90,10 @@ public class RepairFee implements Serializable {
      */
     @Transient
     private String updateUserName;
+    /**
+     * 单号:系统内部的单号,不是维修单号或者其他的单号
+     */
+    private String no;
     /**
      * 委外单号
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/enums/SysRoleCodeEnum.java

@@ -69,6 +69,10 @@ public enum SysRoleCodeEnum {
      * 项目部经理
      */
     XMB_XMJL,
+    /**
+     * 分公司机台
+     */
+    Opreator,
     /**
      * 分公司设备主管
      */

+ 5 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/check/ExportCheckStandardVO.java

@@ -90,4 +90,9 @@ public class ExportCheckStandardVO implements Serializable {
     @Excel(name = "执行人方式", orderNum = "14", dicCode="CHECK_USER_TYPE")
     private Integer checkUserType;
 
+    /**
+     * 标准工时
+     */
+    @Excel(name = "标准工时", orderNum = "15")
+    private String standardHours;
 }

+ 5 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/check/CheckJobVO.java

@@ -164,6 +164,11 @@ public class CheckJobVO implements Serializable{
      * 设备新号
      */
     private String sbNo;
+
+    /**
+     * 设备等级
+     */
+    private Integer level;
     /**
      * 部件名称
      */

+ 5 - 0
platform-dao/src/main/java/com/platform/dao/vo/repair/RepairApplicationFormVO.java

@@ -13,6 +13,7 @@ import javax.persistence.Id;
 import javax.persistence.Transient;
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -34,6 +35,10 @@ public class RepairApplicationFormVO extends BaseVO implements Serializable {
      * 多长时间修复好
      */
     private Double limitHours;
+    /**
+     * 最迟再多少号之前完成日期
+     */
+    private LocalDate limitDate;
     /**
      * 审核描述
      */

+ 13 - 2
platform-dao/src/main/resources/mapper/check/CheckJobMapper.xml

@@ -142,7 +142,12 @@
         <if test="zbh != null and zbh != ''">
             and sbinfo.zbh = #{zbh}
         </if>
-
+        <if test="level != null and level != ''">
+            and sbinfo.level = #{level}
+        </if>
+        <if test="periodType != null and periodType != ''">
+            and standard.period_type = #{periodType}
+        </if>
         <if test="checkUserId != null and checkUserId != ''">
             and checkjob.check_user_id = #{checkUserId}
         </if>
@@ -162,7 +167,7 @@
     <select id="selectList" parameterType="com.platform.dao.dto.check.CheckJobDTO"
             resultType="com.platform.dao.vo.query.check.CheckJobVO">
         select checkjob.*, u.real_name as checkUserName,
-               sbinfo.name sbName, sbinfo.no sbNo,
+               sbinfo.name sbName, sbinfo.no sbNo, sbinfo.level level,
                partinfo.name partName, standard.name standardName,
                standard.period period, standard.period_type periodType
         from t_check_job as checkjob
@@ -173,6 +178,12 @@
         <where>
             <include refid="List_Condition"/>
         </where>
+        Order By
+                 checkjob.start_time asc,
+                 sbinfo.level asc,
+                 sbinfo.no asc,
+                 standard.period_type asc,
+                 standard.period asc
     </select>
 
     <select id="getScreenCountByTime" parameterType="com.platform.dao.dto.check.CheckJobDTO"

+ 2 - 1
platform-dao/src/main/resources/mapper/repair/RepairFeeMapper.xml

@@ -5,6 +5,7 @@
         <id column="id" jdbcType="VARCHAR" property="id"/>
         <result column="sb_id" jdbcType="VARCHAR" property="sbId"/>
         <result column="repair_id" jdbcType="VARCHAR" property="repairId"/>
+        <result column="no" jdbcType="VARCHAR" property="no"/>
         <result column="fee" jdbcType="DOUBLE" property="fee"/>
         <result column="type" jdbcType="SMALLINT" property="type"/>
         <result column="reason" jdbcType="VARCHAR" property="reason"/>
@@ -24,7 +25,7 @@
                      select="com.platform.dao.mapper.repair.RepairFormMapper.selectNoById"/>
     </resultMap>
     <sql id="Base_Column_List">
-        id, sb_id, repair_id, fee, type, reason,
+        id, sb_id, no, repair_id, fee, type, reason,
 fee_date,money_type,
 descripition, remark, created_time, update_time,
         created_user_id, update_user_id

+ 18 - 0
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -74,9 +74,27 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
 
     @Override
     public AbstractPageResultBean<CheckJobVO> selectPageList(CheckJobDTO model, int pageNum, int pageSize) {
+
         if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
             UserInfo userInfo = SecurityUtils.getUserInfo();
             model.setCheckUserId(userInfo.getUserId());
+
+            // 根据登录用户的角色来设置周期,使用人员:1周的任务,维修人员1个月的任务
+            List<String> roleCodes = userInfo.getRoleCodes();
+            boolean isOperator = false;
+            for(String roleCode:roleCodes){
+                System.out.println("roleCode: " + roleCode);
+                if(roleCode.equals(SysRoleCodeEnum.Opreator.name())){
+                    isOperator = true;
+                    model.setSearchStartTime(DateUtils.getMondayOfThisWeek());
+                    model.setSearchEndTime(DateUtils.getSundayOfThisWeek());
+                    break;
+                }
+            }
+            if(!isOperator){
+                model.setSearchStartTime(DateUtils.getFirstDayOfThisMonth());
+                model.setSearchEndTime(DateUtils.getLastDayOfThisMonth());
+            }
         }
         PageHelper.startPage(pageNum, pageSize);
         return new MyPage(mapper.selectList(model));