Kaynağa Gözat

Merge branch 'feature-wcz' of lift-manager/lift-server into develop

wucizhong 5 yıl önce
ebeveyn
işleme
0df777b069

+ 17 - 7
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java

@@ -19,10 +19,11 @@ import cn.com.ty.lift.common.judge.Judge;
 import cn.com.ty.lift.common.judge.Judger;
 import cn.com.ty.lift.common.model.CountPage;
 import cn.com.ty.lift.common.utils.DateUtils;
-import cn.com.ty.lift.common.utils.FtlToWordUtil;
+import cn.com.ty.lift.common.utils.WordUtil;
 import cn.com.ty.lift.common.utils.StrPool;
 import cn.com.xwy.boot.web.dto.RestResponse;
 import cn.hutool.core.collection.IterUtil;
+import cn.hutool.core.img.ImgUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.StrUtil;
@@ -169,7 +170,7 @@ public class EmergencyRepairController {
         Long mtCompanyId = entity.getMtCompanyId();
         Long liftId = entity.getLiftId();
         int repairing = emergencyRepairService.countRepairing(mtCompanyId, liftId);
-        Judge.nlt0(repairing, Judge.Repair.haveUnfinisedRepair);
+        Judge.notlt0(repairing, Judge.Repair.haveUnfinisedRepair);
 
         //派单时间 急修单创建时间
         entity.setHasEvaluate(0);
@@ -553,6 +554,15 @@ public class EmergencyRepairController {
         return RestResponse.success(pages);
     }
 
+    private void fillLiftFaults(List<RepairResponse> repairResponses){
+        if(IterUtil.isEmpty(repairResponses)){
+            return;
+        }
+        repairResponses.forEach(repair -> {
+
+        });
+    }
+
     @PostMapping("export")
     @Judger(fields = {"ids", "exportPath"})
     public void export(@RequestBody RepairRequest request, HttpServletResponse response) {
@@ -624,9 +634,9 @@ public class EmergencyRepairController {
                     String filename = imgDir + "2.急修签名.jpg";
                     log.info("生成急修签名: {}", filename);
                     HttpUtil.downloadFile(mainSign, filename);
-                    repair.setMainSign(FtlToWordUtil.imageToBase64Str(filename));
+                    repair.setMainSign(ImgUtil.toBase64(ImgUtil.read(filename),"jpg"));
                 }else{
-                    repair.setMainSign(FtlToWordUtil.imageToBase64Str(missing));
+                    repair.setMainSign(ImgUtil.toBase64(ImgUtil.read(missing),"jpg"));
                 }
                 //处理客户签名图片
                 String imgUrl = repair.getImgUrl();
@@ -634,9 +644,9 @@ public class EmergencyRepairController {
                     String filename = imgDir + "3.客户签名.jpg";
                     log.info("生成客户签名: {}", filename);
                     HttpUtil.downloadFile(imgUrl, filename);
-                    repair.setImgUrl(FtlToWordUtil.imageToBase64Str(filename));
+                    repair.setImgUrl(ImgUtil.toBase64(ImgUtil.read(filename),"jpg"));
                 }else{
-                    repair.setImgUrl(FtlToWordUtil.imageToBase64Str(missing));
+                    repair.setImgUrl(ImgUtil.toBase64(ImgUtil.read(missing),"jpg"));
                 }
                 //设置急修单参数
                 Map<String, Object> dataMap = new HashMap<>();
@@ -645,7 +655,7 @@ public class EmergencyRepairController {
                 //生成急修单
                 String doc = imgDir + "1.急修单.doc";
                 log.info("生成急修单: {}", doc);
-                FtlToWordUtil.createWord(dataMap, ResourceUtils.getURL("classpath:templates").getPath(), "repair.doc.ftl", doc);
+                WordUtil.createWord(dataMap, ResourceUtils.getURL("classpath:templates").getPath(), "repair.doc.ftl", doc);
             }
 
             //压缩文件夹

+ 1 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/framework/aspect/GlobalDefaultExceptionHandler.java

@@ -80,6 +80,7 @@ public class GlobalDefaultExceptionHandler {
         error.setStackTrace(dwStackTrace);
         log.error(StrPool.LOG_GLOBAL_EXCEPTION_LINE);
         log.error(StrPool.LOG_URL + req.getRequestURI());
+        log.error(StrPool.LOG_HTTP_METHOD + req.getMethod());
         log.error(StrPool.LOG_STATUS + resp.getStatus());
         log.error(StrPool.LOG_EXCEPTION, error);
 

+ 6 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/model/request/LiftImportRequest.java

@@ -1,9 +1,11 @@
 package cn.com.ty.lift.business.library.dao.entity.model.request;
 
-import cn.com.ty.lift.common.judge.Judger;
 import lombok.Data;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
 /**
  * <p>
  *     电梯上传请求参数
@@ -14,12 +16,12 @@ import org.springframework.web.multipart.MultipartFile;
 @Data
 public class LiftImportRequest {
 
-    @Judger(message = "缺少上传文件数据")
+    @NotNull(message = "缺少上传文件数据")
     private MultipartFile file;
 
-    @Judger(message = "维保公司ID有误")
+    @Min(value = 1,message = "维保公司ID有误")
     private Long mtCompanyId;
 
-    @Judger(message = "项目ID有误")
+    @Min(value = 1,message = "项目ID有误")
     private Long projectId;
 }

+ 1 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/MaintenanceRecordController.java

@@ -114,8 +114,7 @@ public class MaintenanceRecordController {
             });
         }
         long count = maintenancePlanService.countPlanByCondition(request);
-        CountPage<MtPlanResponse> countPage = new CountPage<>(count,pages);
-        return RestResponse.success(countPage);
+        return RestResponse.success(CountPage.getCountPage(count, pages));
     }
 
     /**

+ 2 - 7
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/MaintenanceRecord.java

@@ -1,7 +1,6 @@
 package cn.com.ty.lift.business.maintenance.dao.entity;
 
 import cn.com.ty.lift.business.common.BaseEntity;
-import cn.com.ty.lift.common.judge.Judger;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -10,6 +9,7 @@ import lombok.EqualsAndHashCode;
 import org.hibernate.validator.constraints.Range;
 
 import javax.validation.constraints.NotNull;
+import javax.validation.constraints.PastOrPresent;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -90,38 +90,33 @@ public class MaintenanceRecord extends BaseEntity {
 	/**
 	 * 实际保养时间
 	 */
-	@Judger(message = "缺少实际保养时间")
+	@PastOrPresent(message = "缺少实际保养时间")
 	private LocalDate workDate;
 
 	/**
 	 * 停梯时间
 	 */
-    @NotNull(message = "缺少停梯时间")
 	private LocalDateTime stopDate;
 
 	/**
 	 * 恢复时间
 	 */
-    @NotNull(message = "缺少恢复时间")
 	private LocalDateTime recoveryDate;
 
 	/**
 	 * 保养建议
 	 */
-    @Judger(message = "缺少保养建议")
 	private String maintenanceAdvice;
 
 	/**
 	 * 维保项id:0/1/2, 0:无需保养,1:已保养,2:需要更换
 	 * 保养项目  用键值对的方式存储,如(1:0,2:1,3:1...)
 	 */
-    @Judger(message = "缺少维保项")
 	private String maintenanceOption;
 
 	/**
 	 * 签到位置
 	 */
-    @Judger(message = "缺少签到位置")
 	private String position;
 
 	/**

+ 2 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceOptionService.java

@@ -3,7 +3,7 @@ package cn.com.ty.lift.business.maintenance.service;
 import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceOption;
 import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceOptionMapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -28,8 +28,7 @@ public class MaintenanceOptionService extends ServiceImpl<MaintenanceOptionMappe
      * @return List<MaintenanceOption>
      */
     public List<MaintenanceOption> listByTypeAndLiftType(Integer type,Integer liftType,Long mtCompanyId){
-        QueryWrapper<MaintenanceOption> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MaintenanceOption> lambdaQueryWrapper = queryWrapper.lambda();
+        LambdaQueryWrapper<MaintenanceOption> lambdaQueryWrapper = Wrappers.lambdaQuery();
         lambdaQueryWrapper.eq(MaintenanceOption::getMtCompanyId,mtCompanyId);
         lambdaQueryWrapper.eq(MaintenanceOption::getType,type);
         lambdaQueryWrapper.eq(MaintenanceOption::getLiftType,liftType);

+ 5 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/model/request/ProjectImportRequest.java

@@ -1,9 +1,11 @@
 package cn.com.ty.lift.business.project.dao.entity.model.request;
 
-import cn.com.ty.lift.common.judge.Judger;
 import lombok.Data;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
 /**
  * <p>
  *     项目导入请求
@@ -15,9 +17,9 @@ import org.springframework.web.multipart.MultipartFile;
 @Data
 public class ProjectImportRequest {
 
-    @Judger(message = "缺少文件数据")
+    @NotNull(message = "缺少文件数据")
     private MultipartFile file;
 
-    @Judger(message = "维保公司ID有误")
+    @Min(value = 1,message = "维保公司ID有误")
     private Long mtCompanyId;
 }

+ 82 - 53
lift-common/src/main/java/cn.com.ty.lift.common/judge/Judge.java

@@ -79,30 +79,70 @@ public interface Judge {
     static boolean noNull(Object value){
         return null != value;
     }
-    static boolean gt0(long value) {
-        return value > 0;
+
+    static int compare0(Number value){
+        if(isLong(value)){
+            return Long.compare(value.longValue(), 0);
+        }else if (isInteger(value)){
+            return Integer.compare(value.intValue(), 0);
+        }else if(isDouble(value)){
+            return Double.compare(value.doubleValue(), 0);
+        }else if(isFloat(value)){
+            return Float.compare(value.floatValue(), 0);
+        }else if(isByte(value)){
+            return Byte.compare(value.byteValue(), Byte.valueOf("0"));
+        }else if(isShort(value)){
+            return Short.compare(value.shortValue(), Short.valueOf("0"));
+        }else {
+            return -2;
+        }
+    }
+
+    //compare0 > 0
+    static boolean gt0(Number value) {
+        return compare0(value) > 0;
     }
 
-    static boolean lt0(long value) {
-        return value < 0;
+    //compare0 < 0
+    static boolean lt0(Number value) {
+        return compare0(value) < 0;
     }
 
-    static boolean gte0(long value) {
-        return value >= 0;
+    static boolean gte0(Number value) {
+        return compare0(value) >= 0;
     }
 
-    static boolean lte0(long value) {
-        return value <= 0;
+    static boolean lte0(Number value) {
+        return compare0(value) <= 0;
     }
 
-    static boolean eq0(long value){
-        return value == 0;
+    static boolean eq0(Number value){
+        return compare0(value) == 0;
     }
 
     static boolean isBoolean(Object value){
         return (value instanceof Boolean);
     }
 
+    static boolean isLong(Object value){
+        return (value instanceof Long);
+    }
+    static boolean isInteger(Object value){
+        return (value instanceof Integer);
+    }
+    static boolean isDouble(Object value){
+        return (value instanceof Double);
+    }
+    static boolean isFloat(Object value){
+        return (value instanceof Float);
+    }
+    static boolean isByte(Object value){
+        return (value instanceof Byte);
+    }
+    static boolean isShort(Object value){
+        return (value instanceof Short);
+    }
+
     /**
      * 判断对象object是否为空,如果不为空,直接抛出异常,返回message
      *
@@ -213,10 +253,7 @@ public interface Judge {
      */
     static void gt0(Number value, String message) {
         notNull(value, message);
-        notTrue(value instanceof Long && value.longValue() <= 0, message);
-        notTrue(value instanceof Integer && value.intValue() <= 0, message);
-        notTrue(value instanceof Float && value.floatValue() <= 0, message);
-        notTrue(value instanceof Double && value.doubleValue() <= 0, message);
+        isTrue(compare0(value) > 0 ,message);
     }
 
     /**
@@ -239,10 +276,7 @@ public interface Judge {
      */
     static void lt0(Number value, String message) {
         notNull(value, message);
-        notTrue(value instanceof Long && value.longValue() >= 0, message);
-        notTrue(value instanceof Integer && value.intValue() >= 0, message);
-        notTrue(value instanceof Float && value.floatValue() >= 0, message);
-        notTrue(value instanceof Double && value.doubleValue() >= 0, message);
+        isTrue(compare0(value) < 0, message);
     }
 
     /**
@@ -265,10 +299,7 @@ public interface Judge {
      */
     static void eq0(Number value, String message) {
         notNull(value, message);
-        notTrue(value instanceof Long && value.longValue() != 0, message);
-        notTrue(value instanceof Integer && value.intValue() != 0, message);
-        notTrue(value instanceof Float && value.floatValue() != 0, message);
-        notTrue(value instanceof Double && value.doubleValue() != 0, message);
+        isTrue(compare0(value) == 0, message);
     }
 
     /**
@@ -288,12 +319,9 @@ public interface Judge {
      * @param value 数值型的值
      * @param message 抛出异常的消息
      */
-    static void ngt0(Number value, String message) {
+    static void notgt0(Number value, String message) {
         notNull(value, message);
-        notTrue(value instanceof Long && value.longValue() < 0, message);
-        notTrue(value instanceof Integer && value.intValue() < 0, message);
-        notTrue(value instanceof Float && value.floatValue() < 0, message);
-        notTrue(value instanceof Double && value.doubleValue() < 0, message);
+        isTrue(compare0(value) <= 0, message);
     }
 
     /**
@@ -301,10 +329,10 @@ public interface Judge {
      *
      * @param values 一个或多个数的数值型的值
      */
-    static void ngt0(Number... values) {
+    static void notgt0(Number... values) {
         notNull(values, MUST_NGT0);
         for (Number value : values) {
-            ngt0(value, MUST_NGT0);
+            notgt0(value, MUST_NGT0);
         }
     }
 
@@ -314,12 +342,9 @@ public interface Judge {
      * @param value 数值型的值
      * @param message 抛出异常的消息
      */
-    static void nlt0(Number value, String message) {
+    static void notlt0(Number value, String message) {
         notNull(value, message);
-        notTrue(value instanceof Long && value.longValue() > 0, message);
-        notTrue(value instanceof Integer && value.intValue() > 0, message);
-        notTrue(value instanceof Float && value.floatValue() > 0, message);
-        notTrue(value instanceof Double && value.doubleValue() > 0, message);
+        isTrue(compare0(value) >= 0, message);
     }
 
     /**
@@ -327,10 +352,10 @@ public interface Judge {
      *
      * @param values 一个或多个数的数值
      */
-    static void nlt0(Number... values) {
+    static void notlt0(Number... values) {
         notNull(values, MUST_NLT0);
         for (Number value : values) {
-            nlt0(value, MUST_NLT0);
+            notlt0(value, MUST_NLT0);
         }
     }
 
@@ -340,12 +365,9 @@ public interface Judge {
      * @param value 数值型的值
      * @param message 抛出异常的消息
      */
-    static void neq0(Number value, String message) {
+    static void noteq0(Number value, String message) {
         notNull(value, message);
-        notTrue(value instanceof Long && value.longValue() == 0, message);
-        notTrue(value instanceof Integer && value.intValue() == 0, message);
-        notTrue(value instanceof Float && value.floatValue() == 0, message);
-        notTrue(value instanceof Double && value.doubleValue() == 0, message);
+        isTrue(compare0(value) != 0, message);
     }
 
     /**
@@ -353,10 +375,10 @@ public interface Judge {
      *
      * @param values 一个或多个数的数值
      */
-    static void neq0(Number... values) {
+    static void noteq0(Number... values) {
         notNull(values, MUST_NEQ0);
         for (Number value : values) {
-            neq0(value, MUST_NEQ0);
+            noteq0(value, MUST_NEQ0);
         }
     }
 
@@ -403,7 +425,6 @@ public interface Judge {
             for (String field : fields) {
                 Field declaredField = objectClass.getDeclaredField(field);
                 declaredField.setAccessible(true);
-                Class<?> fieldClass = declaredField.getType();
                 //获取field的所有注解
                 Annotation[] annotations = declaredField.getDeclaredAnnotations();
                 if (ArrayUtil.isEmpty(annotations)) {
@@ -417,24 +438,32 @@ public interface Judge {
                 Judgement judgement = judgesClass.newInstance();
                 Object value = declaredField.get(object);
                 for (Annotation annotation : fieldAnnotation) {
-                    System.out.println("[INFO ] --- Discover field: " + field +  " -- value: " + value + " ---");
-                    System.out.println("[INFO ] with @interface: " + annotation.toString());
+                    System.out.println("--- Discover field: " + field +  " -- value: " + value + " ---");
+                    System.out.println("with @interface: " + annotation.toString());
                     Method method = judgesClass.getMethod("judge", Object.class, annotation.annotationType());
-                    System.out.println("[INFO ] find method: " + method.toString());
+                    System.out.println("find method: " + method.toString());
                     method.setAccessible(true);
                     Object result = method.invoke(judgement, value, annotation);
-                    System.out.println("[INFO ] --- Validation is completed. result: " + result.toString() + " ---");
-                    System.out.println("[INFO ]");
-                    notTrue(isBoolean(result) && !((Boolean) result), judgement.message());
+                    System.out.println("--- Validation is completed. result: " + result.toString() + " ---");
+                    if(null != result){
+                        Integer code = judgement.code();
+                        if(code == 2){
+                            throw illegalArgException(judgement.message());
+                        }
+                        notTrue(isBoolean(result) && !((Boolean) result), judgement.message());
+                    }
                 }
 
                 ////////////
+//                Class<?> fieldClass = declaredField.getType();
 //                Judger judger = declaredField.getDeclaredAnnotation(Judger.class);
-//                System.err.println("Number.class.isAssignableFrom(fieldClass) : " + Number.class.isAssignableFrom(fieldClass));
+//                boolean hasJudger = null == judger;
 //                if (Number.class.isAssignableFrom(fieldClass)) {
-//                    gt0((Number) value, null == judger ? MUST_GT0 : judger.message());
+//                    gt0((Number) value, hasJudger ? MUST_GT0 : judger.message());
+//                } else if (CharSequence.class.isAssignableFrom(fieldClass)){
+//                    notBlank((CharSequence) value, hasJudger ? DATA_MISSING_INCORRECT : judger.message());
 //                } else {
-//                    notNull(value, null == judger ? DATA_MISSING_INCORRECT : judger.message());
+//                    notNull(value, hasJudger ? DATA_MISSING_INCORRECT : judger.message());
 //                }
             }
         } catch (JudgeException e) {

+ 73 - 60
lift-common/src/main/java/cn.com.ty.lift.common/judge/Judgement.java

@@ -29,17 +29,8 @@ import static java.util.regex.Pattern.CASE_INSENSITIVE;
 public class Judgement {
 
     private ThreadLocal<String> message = new ThreadLocal<>();
+    private ThreadLocal<Integer> code = new ThreadLocal<>();
 
-    public String message() {
-        return message.get();
-    }
-
-    public void set(String message) {
-        this.message.set(message);
-    }
-
-    //实例
-    public static final  Judgement               INSTANCE                      = new Judgement();
     private static final int                     MAX_LOCAL_PART_LENGTH         = 64;
     private static final String                  LOCAL_PART_ATOM               = "[a-z0-9!#$%&'*+/=?^_`{|}~\u0080-\uFFFF-]";
     private static final String                  LOCAL_PART_INSIDE_QUOTES_ATOM = "([a-z0-9!#$%&'*.(),<>\\[\\]:;  @+/=?^_`{|}~\u0080-\uFFFF-]|\\\\\\\\|\\\\\\\")";
@@ -91,6 +82,28 @@ public class Judgement {
 
     private static final byte BYTE_ZERO = (byte) 0;
 
+    public String message() {
+        String m = message.get();
+        message.remove();
+        return m;
+    }
+
+    public Integer code(){
+        Integer c = code.get();
+        code.remove();
+        return c;
+    }
+
+    private void setVerify(String message) {
+        this.code.set(1);
+        this.message.set(message);
+    }
+
+    private void setIllegalArg(String message){
+        this.code.set(2);
+        this.message.set(message);
+    }
+
     private Clock getClock() {
         return Clock.systemDefaultZone();
     }
@@ -316,7 +329,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         return notNull(value);
     }
 
@@ -325,7 +338,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         return isNull(value);
     }
 
@@ -334,7 +347,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         return notNull(value) && isBoolean(value) && ((Boolean) value);
     }
 
@@ -343,7 +356,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         return notNull(value) && isBoolean(value) && !((Boolean) value);
     }
 
@@ -352,7 +365,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
 
         if (isNull(value)) {
             return false;
@@ -360,18 +373,18 @@ public class Judgement {
         final boolean isNumber = isNumber(value);
         final boolean isCharSequence = isCharSequence(value);
         if (!isNumber && !isCharSequence) {
-            set("The DecimalMax only for Number & CharSequence.");
+            setIllegalArg("The DecimalMax only for Number & CharSequence.");
             return false;
         }
         String maxValue = annotation.value();
         if (isNull(maxValue)) {
-            set("The value of DecimalMax is null, a invalid BigDecimal format.");
+            setIllegalArg("The value of DecimalMax is null, a invalid BigDecimal format.");
             return false;
         }
         BigDecimal max = newBigDecimal(maxValue);
 
         if (isNull(max)) {
-            set(maxValue + " does not represent a valid BigDecimal format.");
+            setIllegalArg(maxValue + " does not represent a valid BigDecimal format.");
             return false;
         }
         BigDecimal val;
@@ -381,7 +394,7 @@ public class Judgement {
             val = newBigDecimal((CharSequence) value);
         }
         if (isNull(val)) {
-            set(value + " does not represent a valid BigDecimal format.");
+            setIllegalArg(value + " does not represent a valid BigDecimal format.");
             return false;
         }
         int compare = decimalComparator(value, val, max, GREATER_THAN);
@@ -399,7 +412,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
 
         if (isNull(value)) {
             return false;
@@ -407,17 +420,17 @@ public class Judgement {
         final boolean isNumber = isNumber(value);
         final boolean isCharSequence = isCharSequence(value);
         if (!isNumber && !isCharSequence) {
-            set("The DecimalMin only for Number & CharSequence.");
+            setIllegalArg("The DecimalMin only for Number & CharSequence.");
             return false;
         }
         String minValue = annotation.value();
         if (isNull(minValue)) {
-            set("The value of DecimalMin is null, a invalid BigDecimal format.");
+            setIllegalArg("The value of DecimalMin is null, a invalid BigDecimal format.");
             return false;
         }
         BigDecimal min = newBigDecimal(minValue);
         if (isNull(min)) {
-            set(minValue + " does not represent a valid BigDecimal format.");
+            setIllegalArg(minValue + " does not represent a valid BigDecimal format.");
             return false;
         }
         BigDecimal val;
@@ -427,7 +440,7 @@ public class Judgement {
             val = newBigDecimal((CharSequence) value);
         }
         if (isNull(val)) {
-            set(value + " does not represent a valid BigDecimal format.");
+            setIllegalArg(value + " does not represent a valid BigDecimal format.");
             return false;
         }
         int compare = decimalComparator(value, val, min, LESS_THAN);
@@ -471,7 +484,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -523,22 +536,22 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
         int min = annotation.min();
         int max = annotation.max();
         if (lt0(min)) {
-            set("The min parameter cannot be negative.");
+            setIllegalArg("The min parameter cannot be negative.");
             return false;
         }
         if (lt0(max)) {
-            set("The max parameter cannot be negative.");
+            setIllegalArg("The max parameter cannot be negative.");
             return false;
         }
         if (min > max) {
-            set("The min and max length cannot be negative.");
+            setIllegalArg("The min and max length cannot be negative.");
             return false;
         }
         int length = length(value);
@@ -551,24 +564,24 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
         final boolean isNumber = isNumber(value);
         final boolean isCharSequence = isCharSequence(value);
         if (!isNumber && !isCharSequence) {
-            set("The Digits only for Number & CharSequence.");
+            setIllegalArg("The Digits only for Number & CharSequence.");
             return false;
         }
         int maxInteger = annotation.integer();
         int maxFraction = annotation.fraction();
         if (lt0(maxInteger)) {
-            set("The length of the integer part cannot be negative.");
+            setIllegalArg("The length of the integer part cannot be negative.");
             return false;
         }
         if (lt0(maxFraction)) {
-            set("The length of the fraction part cannot be negative.");
+            setIllegalArg("The length of the fraction part cannot be negative.");
             return false;
         }
         BigDecimal val;
@@ -578,7 +591,7 @@ public class Judgement {
             } else {
                 val = newBigDecimal(value.toString());
                 if (isNull(val)) {
-                    set(value + " does not represent a valid BigDecimal format.");
+                    setIllegalArg(value + " does not represent a valid BigDecimal format.");
                     return false;
                 }
                 val = val.stripTrailingZeros();
@@ -587,7 +600,7 @@ public class Judgement {
             val = newBigDecimal((CharSequence) value);
         }
         if (isNull(val)) {
-            set(value + " does not represent a valid BigDecimal format.");
+            setIllegalArg(value + " does not represent a valid BigDecimal format.");
             return false;
         }
         int integerPart = val.precision() - val.scale();
@@ -601,7 +614,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setIllegalArg(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -616,7 +629,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value) || !isCharSequence(value)) {
             return false;
         }
@@ -656,7 +669,7 @@ public class Judgement {
             try {
                 pattern = java.util.regex.Pattern.compile(regexp, intFlag);
             } catch (PatternSyntaxException e) {
-                set("The regexp for Email is Invalid regular expression.");
+                setIllegalArg("The regexp for Email is Invalid regular expression.");
                 return false;
             }
         }
@@ -669,7 +682,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value) || !isCharSequence(value)) {
             return false;
         }
@@ -688,7 +701,7 @@ public class Judgement {
         try {
             pattern = java.util.regex.Pattern.compile(regexp, intFlag);
         } catch (PatternSyntaxException e) {
-            set("The regexp for Email is Invalid regular expression.");
+            setIllegalArg("The regexp for Email is Invalid regular expression.");
             return false;
         }
 
@@ -700,14 +713,14 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
         final boolean isNumber = isNumber(value);
         final boolean isCharSequence = isCharSequence(value);
         if (!isCharSequence && !isNumber) {
-            set("The Max is only valid for CharSequence & Number.");
+            setIllegalArg("The Max is only valid for CharSequence & Number.");
             return false;
         }
         long max = annotation.value();
@@ -734,14 +747,14 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
         final boolean isNumber = isNumber(value);
         final boolean isCharSequence = isCharSequence(value);
         if (!isCharSequence && !isNumber) {
-            set("The Min is only valid for CharSequence & Number.");
+            setIllegalArg("The Min is only valid for CharSequence & Number.");
             return false;
         }
         long min = annotation.value();
@@ -833,7 +846,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -849,7 +862,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -865,7 +878,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -881,7 +894,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -943,7 +956,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -951,12 +964,12 @@ public class Judgement {
         final boolean isDate = isDate(value);
         final boolean isCalendar = isCalendar(value);
         if (!isTemporalAccessor && !isDate && !isCalendar) {
-            set("Future is only for TemporalAccessor & Date & Calendar");
+            setIllegalArg("Future is only for TemporalAccessor & Date & Calendar");
             return false;
         }
         int compare = dateComparator(value, isTemporalAccessor, isDate);
         if (-2 == compare) {
-            set(value.getClass().toString() + " is not a supported date class temporarily.");
+            setIllegalArg(value.getClass().toString() + " is not a supported date class temporarily.");
             return false;
         }
         //compare > 0
@@ -968,7 +981,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -976,12 +989,12 @@ public class Judgement {
         final boolean isDate = isDate(value);
         final boolean isCalendar = isCalendar(value);
         if (!isTemporalAccessor && !isDate && !isCalendar) {
-            set("FutureOrPresent is only for TemporalAccessor & Date & Calendar");
+            setIllegalArg("FutureOrPresent is only for TemporalAccessor & Date & Calendar");
             return false;
         }
         int compare = dateComparator(value, isTemporalAccessor, isDate);
         if (-2 == compare) {
-            set(value.getClass().toString() + " is not a supported date class temporarily.");
+            setIllegalArg(value.getClass().toString() + " is not a supported date class temporarily.");
             return false;
         }
         //compare >= 0
@@ -993,7 +1006,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -1001,12 +1014,12 @@ public class Judgement {
         final boolean isDate = isDate(value);
         final boolean isCalendar = isCalendar(value);
         if (!isTemporalAccessor && !isDate && !isCalendar) {
-            set("Past is only for TemporalAccessor & Date & Calendar");
+            setIllegalArg("Past is only for TemporalAccessor & Date & Calendar");
             return false;
         }
         int compare = dateComparator(value, isTemporalAccessor, isDate);
         if (-2 == compare) {
-            set(value.getClass().toString() + " is not a supported date class temporarily.");
+            setIllegalArg(value.getClass().toString() + " is not a supported date class temporarily.");
             return false;
         }
         //compare < 0
@@ -1018,7 +1031,7 @@ public class Judgement {
         if (isNull(annotation)) {
             return true;
         }
-        set(annotation.message());
+        setVerify(annotation.message());
         if (isNull(value)) {
             return false;
         }
@@ -1026,12 +1039,12 @@ public class Judgement {
         final boolean isDate = isDate(value);
         final boolean isCalendar = isCalendar(value);
         if (!isTemporalAccessor && !isDate && !isCalendar) {
-            set("PastOrPresent is only for TemporalAccessor & Date & Calendar");
+            setIllegalArg("PastOrPresent is only for TemporalAccessor & Date & Calendar");
             return false;
         }
         int compare = dateComparator(value, isTemporalAccessor, isDate);
         if (-2 == compare) {
-            set(value.getClass().toString() + " is not a supported date class temporarily.");
+            setIllegalArg(value.getClass().toString() + " is not a supported date class temporarily.");
             return false;
         }
         //compare <= 0

+ 2 - 5
lift-common/src/main/java/cn.com.ty.lift.common/utils/WordAndPdfUtil.java

@@ -23,8 +23,8 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
-public class WordAndPdfUtil {
-    private static Logger logger = LoggerFactory.getLogger(WordAndPdfUtil.class);
+public class PdfUtil {
+    private static Logger logger = LoggerFactory.getLogger(PdfUtil.class);
 
 
     public static void main(String[] args) throws Exception {
@@ -118,10 +118,8 @@ public class WordAndPdfUtil {
             result = true;
         } catch (IOException e) {
             logger.error("IO异常:{}", e.getMessage());
-            e.printStackTrace();
         } catch (TemplateException e) {
             logger.error("模板异常:{}", e.getMessage());
-            e.printStackTrace();
         } finally {
             docXmlFile.delete();
         }
@@ -148,7 +146,6 @@ public class WordAndPdfUtil {
             logger.info("word转pdf成功");
             result = true;
         } catch (Exception e) {
-            e.printStackTrace();
             logger.error("word转pdf失败");
         }
         return result;

+ 2 - 9
lift-common/src/main/java/cn.com.ty.lift.common/utils/FtlToWordUtil.java

@@ -22,9 +22,9 @@ import java.util.Map;
 //import javax.servlet.http.HttpServletResponse;
 
 
-public class FtlToWordUtil {
+public class WordUtil {
 
-    private static Logger logger = LoggerFactory.getLogger(FtlToWordUtil.class);
+    private static Logger logger = LoggerFactory.getLogger(WordUtil.class);
 
     /**
      * 图片转base64的字符串
@@ -75,7 +75,6 @@ public class FtlToWordUtil {
             configuration.setDirectoryForTemplateLoading(new File(folderPath));
         } catch (IOException e) {
             logger.error("初始化configuration失败,路径不存在:{}", folderPath);
-            e.printStackTrace();
         }
         return configuration;
     }
@@ -98,7 +97,6 @@ public class FtlToWordUtil {
             t.setEncoding("utf-8");
         } catch (IOException e) {
             logger.error("在路径:{}里找不到:{}", ftlFolderPath, tempName);
-            e.printStackTrace();
         }
         File outFile = new File(outputFilePath);
 
@@ -109,18 +107,13 @@ public class FtlToWordUtil {
             logger.info("word创建成功");
         } catch (FileNotFoundException e) {
             logger.error("文件不存在:{}", outFile);
-            e.printStackTrace();
         } catch (UnsupportedEncodingException e) {
             logger.error("未知的编码格式");
-            e.printStackTrace();
         } catch (TemplateException e) {
             logger.error("模板异常");
-            e.printStackTrace();
         } catch (IOException e) {
             logger.error("IO异常");
-            e.printStackTrace();
         }
-
         return result;
     }
 

+ 1 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/common/GlobalDefaultExceptionHandler.java

@@ -74,6 +74,7 @@ public class GlobalDefaultExceptionHandler {
         error.setStackTrace(dwStackTrace);
         log.error(StrPool.LOG_GLOBAL_EXCEPTION_LINE);
         log.error(StrPool.LOG_URL + req.getRequestURI());
+        log.error(StrPool.LOG_HTTP_METHOD + req.getMethod());
         log.error(StrPool.LOG_STATUS + resp.getStatus());
         log.error(StrPool.LOG_EXCEPTION, error);
 

+ 7 - 5
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java

@@ -120,6 +120,7 @@ public class AttendanceController {
         boolean top = ObjectUtil.isNotNull(topTime);
         boolean down = ObjectUtil.isNotNull(downTime);
         boolean am = top && down;
+        //上下班时间成对设置
         Judge.notTrue(top ^ down, Judge.Attend.SetAmTime);
         if(am){
             Judge.notTrue(topTime.isAfter(downTime), Judge.Attend.InvalidAmTime);
@@ -134,8 +135,8 @@ public class AttendanceController {
         if(pm){
             Judge.notTrue(topTimePm.isAfter(downTimePm), Judge.Attend.InvalidPmTime);
         }
-
-        if(toppm){
+        //上午下班 < 下午上班
+        if(down && toppm){
             Judge.notTrue(downTime.isAfter(topTimePm),Judge.Attend.AmDownPmTop);
         }
 
@@ -148,11 +149,12 @@ public class AttendanceController {
         if(ot){
             Judge.notTrue(topTimeOt.isAfter(downTimeOt), Judge.Attend.InvalidOtTime);
         }
-        Judge.isTrue(am || pm || ot, Judge.Attend.missingTime);
-
-        if(topot){
+        // 下午下班 < 加班上班
+        if(downpm && topot){
             Judge.notTrue(downTimePm.isAfter(topTimeOt), Judge.Attend.PmDownOtTop);
         }
+        //三组时间至少设置一组
+        Judge.isTrue(am || pm || ot, Judge.Attend.missingTime);
 
         MaintenanceCompany entity = maintenanceCompanyService.getById(request.getMtCompanyId());
         Judge.notNull(entity);