24282 hai 1 ano
pai
achega
cc23602fe0

+ 2 - 2
sd-business/src/main/java/com/sd/business/entity/work/constant/MaterialsConstant.java

@@ -5,12 +5,12 @@ public interface MaterialsConstant {
     /**
      * 出血长度
      */
-    double RESERVE = 5.5;
+    double RESERVE = 0.8;
 
     /**
      * 卷材长度
      */
-    int MASTER_LENGTH = 4300;
+    int MASTER_LENGTH = 3400;
 
     /**
      * 卷材宽度

+ 1 - 1
sd-business/src/main/java/com/sd/business/entity/work/enums/WorkOrderFixationSpecEnum.java

@@ -10,7 +10,7 @@ import java.math.BigDecimal;
 @AllArgsConstructor
 public enum WorkOrderFixationSpecEnum {
 
-    SPEC_30_40(new BigDecimal("30"), new BigDecimal("40"), 430),
+    SPEC_30_40(new BigDecimal("30"), new BigDecimal("40"), 386),
     ;
 
     /**

+ 82 - 0
sd-framework/src/main/java/com/sd/framework/util/sql/ApplyFun.java

@@ -0,0 +1,82 @@
+package com.sd.framework.util.sql;
+
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.toolkit.sql.SqlInjectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class ApplyFun<R> {
+
+    private final Sql<R> sql;
+    private final List<Object> list = new ArrayList<>();
+    public ApplyFun(Sql<R> sql) {
+        this.sql = sql;
+    }
+
+    public <K, V> ApplyFun<R> arguments(SFunction<K, V> function) {
+        list.add(sql.getSqlFieldName(function));
+        return this;
+    }
+
+    public <K, V> ApplyFun<R> arguments(String alias, SFunction<K, V> function) {
+        list.add(sql.getSqlFieldName(alias, function));
+        return this;
+    }
+
+    public ApplyFun<R> arguments(String value) {
+        boolean check = SqlInjectionUtils.check(value);
+        if (check) {
+            throw new RuntimeException("sql注入非法字符");
+        }
+        list.add("'" + value + "'");
+        return this;
+    }
+
+    public ApplyFun<R> arguments(Integer value) {
+        list.add(value);
+        return this;
+    }
+
+    public ApplyFun<R> arguments(Long value) {
+        list.add(value);
+        return this;
+    }
+
+    public ApplyFun<R> arguments(Double value) {
+        list.add(value);
+        return this;
+    }
+
+    public ApplyFun<R> arguments(Float value) {
+        list.add(value);
+        return this;
+    }
+
+    public ApplyFun<R> arguments(BigDecimal value) {
+        list.add(value);
+        return this;
+    }
+
+    public ApplyFun<R> arguments(Date value) {
+        list.add(DateUtil.formatDateTime(value));
+        return this;
+    }
+
+    public ApplyFun<R> arguments(Date value, String format) {
+        list.add(DateUtil.format(value, format));
+        return this;
+    }
+
+    protected Object[] getObjects() {
+        Object[] objects = new Object[list.size()];
+        for (int i = 0; i < list.size(); i++) {
+            objects[i] = list.get(i);
+        }
+        return objects;
+    }
+
+}

+ 8 - 0
sd-framework/src/main/java/com/sd/framework/util/sql/ApplyFunImpl.java

@@ -0,0 +1,8 @@
+package com.sd.framework.util.sql;
+
+@FunctionalInterface
+public interface ApplyFunImpl {
+
+    void apply(ApplyFun<?> applyFun);
+
+}

+ 11 - 1
sd-framework/src/main/java/com/sd/framework/util/sql/Select.java

@@ -59,12 +59,22 @@ public class Select<T> {
         return this;
     }
 
-    public <S, V> Select<T> selectAs(String selectSql, SFunction<T, ?> asFunction) {
+    public Select<T> selectAs(String selectSql, SFunction<T, ?> asFunction) {
         String as = PropertyNamer.methodToProperty(LambdaUtils.extract(asFunction).getImplMethodName());
         sql.selectList.add(selectSql + StringPool.SPACE + as);
         return this;
     }
 
+    public Select<T> selectApply(String str, ApplyFunImpl applyFunImpl, SFunction<T, ?> asFunction) {
+        ApplyFun<T> applyFun = new ApplyFun<>(sql);
+        applyFunImpl.apply(applyFun);
+
+        String apply = StrUtil.indexedFormat(str, applyFun.getObjects());
+        String as = PropertyNamer.methodToProperty(LambdaUtils.extract(asFunction).getImplMethodName());
+        sql.selectList.add(apply + StringPool.SPACE + as);
+        return this;
+    }
+
     @SafeVarargs
     public final <S> Select<T> selectAll(Class<S> cls, SFunction<S, ?>... excludeFunction) {
         return selectAll(sql.getTableAlias(cls), cls, excludeFunction);

+ 16 - 0
sd-framework/src/main/java/com/sd/framework/util/sql/Where.java

@@ -2,6 +2,7 @@ package com.sd.framework.util.sql;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
 import com.baomidou.mybatisplus.core.conditions.SharedString;
 import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
@@ -541,6 +542,21 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
         return apply(condition, "FIND_IN_SET({0}, " + sql.getSqlFieldName(alias, function) + ")", value);
     }
 
+
+    /**
+     * 拼接
+     */
+    public Where<T> apply(boolean condition, String str, ApplyFunImpl applyFunImpl) {
+        ApplyFun<T> applyFun = new ApplyFun<>(sql);
+        applyFunImpl.apply(applyFun);
+        String apply = StrUtil.indexedFormat(str, applyFun.getObjects());
+        return apply(condition, apply);
+    }
+
+    public Where<T> apply(String str, ApplyFunImpl applyFunImpl) {
+        return apply(true, str, applyFunImpl);
+    }
+
     public List<T> list() {
         List<Map<String, Object>> list = Sql.mapper.list(sql.getSql(), this);
         return BeanUtil.copyToList(list, sql.resultCls);

+ 25 - 0
sd-starter/pom.xml

@@ -30,6 +30,31 @@
         </dependency>
 
         <dependency>
+            <groupId>org.bytedeco</groupId>
+            <artifactId>opencv</artifactId>
+            <version>4.7.0-1.5.9</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-imaging</artifactId>
+            <version>1.0-alpha3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>itextpdf</artifactId>
+            <version>5.5.13.3</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/com.lowagie/itext -->
+        <dependency>
+            <groupId>com.lowagie</groupId>
+            <artifactId>itext</artifactId>
+            <version>4.2.2</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>