浏览代码

Merge remote-tracking branch 'origin/dev' into dev

纪新园 2 年之前
父节点
当前提交
14eba7f6e5
共有 22 个文件被更改,包括 530 次插入60 次删除
  1. 87 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wx/AttachmngsController.java
  2. 36 8
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wx/OrderBillsPlansController.java
  3. 7 0
      ruoyi-admin/src/main/resources/application-druid.yml
  4. 3 2
      ruoyi-admin/src/main/resources/application.yml
  5. 6 1
      ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
  6. 15 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java
  7. 1 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  8. 17 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/AttachMngs.java
  9. 9 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/LoadFeeItems.java
  10. 14 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderBillsPlans.java
  11. 30 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/TmsAttachMngs.java
  12. 5 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/WfTaskList.java
  13. 9 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/ImgVo.java
  14. 5 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/OrderBillsPlansVo.java
  15. 22 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/AttachMngsMapper.java
  16. 54 35
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/OrderBillsPlansMapper.java
  17. 21 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IAttachMngsService.java
  18. 17 5
      ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderBillsPlansService.java
  19. 31 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AttachMngsServiceImpl.java
  20. 81 7
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderBillsPlansServiceImpl.java
  21. 16 0
      ruoyi-system/src/main/resources/mapper/system/AttachMngsMapper.xml
  22. 44 2
      ruoyi-system/src/main/resources/mapper/system/OrderBillsPlansMapper.xml

+ 87 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wx/AttachmngsController.java

@@ -0,0 +1,87 @@
+package com.ruoyi.web.controller.wx;
+
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.system.domain.AttachMngs;
+import com.ruoyi.system.service.IAttachMngsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/attachmngs")
+public class AttachmngsController {
+
+    @Autowired
+    private IAttachMngsService attachMngsService;
+
+    /**
+     * 上传图片
+     *
+     * @param file 图片
+     * @return
+     * @throws Exception
+     */
+    @PostMapping
+    public AjaxResult updateAttachmngs(@RequestParam("avatarfile") MultipartFile file,
+                                       @RequestParam("attachId") Long attachId,
+                                       HttpServletRequest request) throws Exception {
+        if (file.isEmpty()) {
+            return AjaxResult.error("上传失败请重试1");
+        }
+        byte[] bytes = file.getBytes();
+        AttachMngs attachMngs = new AttachMngs();
+        attachMngs.setSysId(1L);
+        attachMngs.setAttachId(attachId);
+        attachMngs.setAttachFile(toObjects(bytes));
+
+        Integer i = attachMngsService.insertAttachMngs(attachMngs);
+
+        if (i != 1) {
+            return AjaxResult.error("上传失败请重试2");
+        }
+
+        // 拼接url
+        String serverName = request.getServerName();
+        int serverPort = request.getServerPort();
+
+        return AjaxResult.success("操作成功", "http://" + serverName + ":" + serverPort + "/attachmngs/img/" + attachId);
+    }
+
+    /**
+     * 获取图片
+     *
+     * @param attachId
+     * @return
+     */
+    @GetMapping(value = "/img/{attachId}", produces = MediaType.IMAGE_JPEG_VALUE)
+    public byte[] getImg(@PathVariable("attachId") String attachId) {
+        Byte[] img = attachMngsService.getImg(attachId);
+        return toPrimitives(img);
+    }
+
+    // byte[] to Byte[]
+    private Byte[] toObjects(byte[] bytesPrim) {
+        Byte[] bytes = new Byte[bytesPrim.length];
+
+        int i = 0;
+        for (byte b : bytesPrim) bytes[i++] = b; // Autoboxing
+
+        return bytes;
+    }
+
+    private byte[] toPrimitives(Byte[] oBytes)
+    {
+        byte[] bytes = new byte[oBytes.length];
+
+        for(int i = 0; i < oBytes.length; i++) {
+            bytes[i] = oBytes[i];
+        }
+
+        return bytes;
+    }
+}

+ 36 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wx/OrderBillsPlansController.java

@@ -1,14 +1,15 @@
 package com.ruoyi.web.controller.wx;
 
+import cn.hutool.http.server.HttpServerRequest;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.system.domain.Items;
-import com.ruoyi.system.domain.OrderBillsPlans;
-import com.ruoyi.system.domain.vo.LoadFeeItemsVo;
+import com.ruoyi.system.domain.TmsAttachMngs;
 import com.ruoyi.system.domain.vo.OrderBillsPlansVo;
 import com.ruoyi.system.service.IOrderBillsPlansService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 @RestController
@@ -21,7 +22,7 @@ public class OrderBillsPlansController {
     /**
      * 查询业务表数据List
      *
-     * @param orderNo 单号
+     * @param orderNo   单号
      * @param dataStart 日期起
      * @param dataEnd   日期止
      * @return 数据list
@@ -44,16 +45,19 @@ public class OrderBillsPlansController {
 
     /**
      * 根据orderNo查询
+     *
      * @param orderNo orderNo
      * @return 详情
      */
     @GetMapping("/{orderNo}")
-    public AjaxResult getOrderBillsPlansByid(@PathVariable(value = "orderNo") Long orderNo) {
-        return AjaxResult.success(orderBillsPlansService.getOrderBillsPlansByid(orderNo));
+    public AjaxResult getOrderBillsPlansByid(@PathVariable(value = "orderNo") Long orderNo,
+                                             HttpServletRequest request) {
+        return AjaxResult.success(orderBillsPlansService.getOrderBillsPlansByid(orderNo, request));
     }
 
     /**
      * 保存保单信息
+     *
      * @param orderBillsPlansVo
      * @return
      */
@@ -63,7 +67,7 @@ public class OrderBillsPlansController {
     }
 
     /**
-     * 获取报销费用list
+     * 获取报销费用下拉
      *
      * @return
      */
@@ -74,6 +78,7 @@ public class OrderBillsPlansController {
 
     /**
      * 查询报销信息
+     *
      * @param
      * @return 数据
      */
@@ -84,6 +89,7 @@ public class OrderBillsPlansController {
 
     /**
      * 报销
+     *
      * @param orderBillsPlansVo
      * @return 操作结果
      */
@@ -93,7 +99,8 @@ public class OrderBillsPlansController {
     }
 
     /**
-     * 查询报销费用报销金额下拉选
+     * 查询报销费用报销金额单选
+     *
      * @return
      */
     @GetMapping("/gas-stations")
@@ -102,4 +109,25 @@ public class OrderBillsPlansController {
     }
 
 
+    /**
+     * 插入主库图片数据
+     * @param tmsAttachMngs
+     * @return
+     */
+    @PostMapping("/attach-mngs")
+    public AjaxResult insertAttachMngs(@RequestBody TmsAttachMngs tmsAttachMngs) {
+        return orderBillsPlansService.insertAttachMngs(tmsAttachMngs);
+    }
+
+    /**
+     * 根据attachId在Tms库的AttachMngs表删除数据
+     * @param attachId
+     * @return
+     */
+    @GetMapping("/attach-mngs/delete/{attachId}")
+    public AjaxResult deleteTmsAttachMngs(@PathVariable("attachId") Long attachId) {
+        return orderBillsPlansService.deleteTmsAttachMngs(attachId);
+    }
+
+
 }

+ 7 - 0
ruoyi-admin/src/main/resources/application-druid.yml

@@ -23,6 +23,13 @@ spring:
         url: jdbc:firebirdsql://49.4.78.17:3050/C:\sealong\TMS\DataDemo\SLEMP-TMS.FB25?encoding=GB_2312
         username: SYSDBA
         password: masterkey
+
+      attachs:
+        # 图片数据库
+        enabled: true
+        url: jdbc:firebirdsql://49.4.78.17:3050/C:\sealong\TMS\DataDemo\SLEMP-ATTACHS.FB25?encoding=GB_2312
+        username: SYSDBA
+        password: masterkey
       # 初始连接数
       initialSize: 5
       # 最小连接池数量

+ 3 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -10,7 +10,8 @@ ruoyi:
   demoEnabled: true
     # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
     # 本地文件上传路径
-  profile: D:/ruoyi/uploadPath
+#  profile: D:/ruoyi/uploadPath
+  profile: /home/ruoyi/uploadPath
   # 服务器文件路径
 #  profile: /home/ruoyi/uploadPath
   # 获取ip地址开关
@@ -23,7 +24,7 @@ ruoyi:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 9010
+  port: 8010
   servlet:
     # 应用的访问路径
     context-path: /

+ 6 - 1
ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java

@@ -15,5 +15,10 @@ public enum DataSourceType
     /**
      * 从库
      */
-    SLAVE
+    SLAVE,
+
+    /**
+     * 危险订单图片数据库
+     */
+    ATTACHS
 }

+ 15 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java

@@ -49,6 +49,20 @@ public class DruidConfig
         return druidProperties.dataSource(dataSource);
     }
 
+    /**
+     * 途宝订单图片数据库
+     * @param druidProperties
+     * @return
+     */
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.attachs")
+    @ConditionalOnProperty(prefix = "spring.datasource.druid.attachs", name = "enabled", havingValue = "true")
+    public DataSource attachsDataSource(DruidProperties druidProperties)
+    {
+        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        return druidProperties.dataSource(dataSource);
+    }
+
     @Bean(name = "dynamicDataSource")
     @Primary
     public DynamicDataSource dataSource(DataSource masterDataSource)
@@ -56,6 +70,7 @@ public class DruidConfig
         Map<Object, Object> targetDataSources = new HashMap<>();
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+        setDataSource(targetDataSources, DataSourceType.ATTACHS.name(), "attachsDataSource");
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
     

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -117,6 +117,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/api/**").anonymous()
                 .antMatchers("/open/wms/**").anonymous()
                 .antMatchers("/bulkWareHouse/**").anonymous()
+                .antMatchers("/attachmngs/img/**").anonymous()
 //                .antMatchers("/ccb/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()

+ 17 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/AttachMngs.java

@@ -0,0 +1,17 @@
+package com.ruoyi.system.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import org.apache.ibatis.type.JdbcType;
+
+@Data
+public class AttachMngs {
+
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long sysId;
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long attachId;
+    // BLOB SUB_TYPE BINARY
+    @TableField(jdbcType = JdbcType.BLOB)
+    private Byte[] attachFile;
+}

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/LoadFeeItems.java

@@ -18,10 +18,14 @@ public class LoadFeeItems {
     private Date itemDate;
     private String itemAuditType;
 
+    @TableField(jdbcType = JdbcType.DOUBLE)
     private Double amt;
 
+    @TableField(jdbcType = JdbcType.INTEGER)
     private Long entityId;
 
+
+    @TableField(jdbcType = JdbcType.INTEGER)
     private Long lineNo;
 
     @TableField(jdbcType = JdbcType.DOUBLE)
@@ -57,4 +61,9 @@ public class LoadFeeItems {
     @TableField(jdbcType = JdbcType.VARCHAR)
     private String gasstation2;
 
+
+    private String cName;
+    // private String itemProp;
+    private String auditType;
+
 }

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderBillsPlans.java

@@ -106,5 +106,19 @@ public class OrderBillsPlans {
     private String driver1Name;
     private String driver1mobile;
 
+    private Long sysId;
+
+
+
+
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long loadBillsEntityId;
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long loadBillsSysId;
+
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long billStatus;
+
+
 
 }

+ 30 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TmsAttachMngs.java

@@ -0,0 +1,30 @@
+package com.ruoyi.system.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import org.apache.ibatis.type.JdbcType;
+
+@Data
+public class TmsAttachMngs {
+
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long sysId;
+    // @TableField(jdbcType = JdbcType.INTEGER)
+    // private Long entityId;
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long actId;
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long lineNo;
+    @TableField(jdbcType = JdbcType.VARCHAR)
+    private String userName;
+    @TableField(jdbcType = JdbcType.VARCHAR)
+    private String attachName;
+
+
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long loadBillsEntityId;
+
+
+    @TableField(jdbcType = JdbcType.INTEGER)
+    private Long loadBillsSysId;
+}

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/WfTaskList.java

@@ -1,7 +1,9 @@
 package com.ruoyi.system.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.apache.ibatis.type.JdbcType;
 
 import java.util.Date;
 
@@ -39,4 +41,7 @@ public class WfTaskList {
     private Date billDate;
     private Double rightqty;
 
+    private Long billStatus;
+    private String billStatusName;
+
 }

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/ImgVo.java

@@ -0,0 +1,9 @@
+package com.ruoyi.system.domain.vo;
+
+import lombok.Data;
+
+@Data
+public class ImgVo {
+
+    private String url;
+}

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/OrderBillsPlansVo.java

@@ -27,4 +27,9 @@ public class OrderBillsPlansVo extends OrderBillsPlans {
      */
     @TableField(jdbcType = JdbcType.INTEGER)
     private Long loadBillsEntityId;
+
+    /**
+     * 照片
+     */
+    private List<ImgVo> fileList1;
 }

+ 22 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/AttachMngsMapper.java

@@ -0,0 +1,22 @@
+package com.ruoyi.system.mapper;
+
+
+import com.ruoyi.system.domain.AttachMngs;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AttachMngsMapper {
+    /**
+     * 上传图片
+     * @param attachMngs 实体类
+     * @return
+     */
+    Integer insertAttachmngs(AttachMngs attachMngs);
+
+    /**
+     * 查询图片二进制集合
+     * @param attachId
+     * @return
+     */
+    AttachMngs getAttachmngsBySysIdAndAttchId(String attachId);
+}

+ 54 - 35
ruoyi-system/src/main/java/com/ruoyi/system/mapper/OrderBillsPlansMapper.java

@@ -36,41 +36,6 @@ public interface OrderBillsPlansMapper {
      * @param orderBillsPlans
      * @return
      */
-
-    /*
-    <set>
-            <if test="loadQty != null and loadQty != ''">
-                LoadQty = #{loadQty},
-            </if>
-            <if test="loadDate != null">
-                LoadDate = #{loadDate},
-            </if>
-            <if test="unLoadQty != null and unLoadQty != ''">
-                UnLoadQty = #{unLoadQty},
-            </if>
-            <if test="unLoadDate != null">
-                UnLoadDate = #{unLoadDate},
-            </if>
-            <if test="emptyaddr1 != null and emptyaddr1 != ''">
-                EMPTYADDR1 = #{emptyaddr1},
-            </if>
-            <if test="odometerstart != null and odometerstart != ''">
-                ODOMETERSTART = #{odometerstart},
-            </if>
-            <if test="emptyaddr2 != null and emptyaddr2 != ''">
-                EMPTYADDR2 = #{emptyaddr2},
-            </if>
-            <if test="odometerend != null and odometerend != ''">
-                ODOMETEREND = #{odometerend},
-            </if>
-            <if test="loadmile != null and loadmile != ''">
-                LOADMILE = #{loadmile},
-            </if>
-            <if test="remarks != null and remarks != ''">
-                Remarks = #{remarks},
-            </if>
-        </set>
-     */
     Integer updateOrderBillsPlansByid(OrderBillsPlans orderBillsPlans);
 
     /**
@@ -101,6 +66,7 @@ public interface OrderBillsPlansMapper {
 
     /**
      * 报销
+     *
      * @param orderBillsPlansVo
      * @return
      */
@@ -108,6 +74,7 @@ public interface OrderBillsPlansMapper {
 
     /**
      * 删除
+     *
      * @param loadBillsEntityId
      * @return
      */
@@ -115,10 +82,62 @@ public interface OrderBillsPlansMapper {
 
     /**
      * 查询报销信息
+     *
      * @param
      * @return 数据
      */
     OrderBillsPlansVo getOrderBillsPlansByOrder(Long orderNo);
 
+    /**
+     * 查询其他费用list
+     *
+     * @param entityId
+     * @return
+     */
     List<LoadFeeItems> getLoadFeeItemsByEntityId(@Param("entityId") Long entityId);
+
+    /**
+     * 更新其他费用金额
+     *
+     * @param loadFeeItems
+     */
+    void updateOrderBillsPlansBySysidEntityidLineno(LoadFeeItems loadFeeItems);
+
+    /**
+     * 查询最大的lineNo进行+1赋值
+     *
+     * @param tmsAttachMngs
+     * @return
+     */
+    Long getAttachMngsBySysIdEntityId(TmsAttachMngs tmsAttachMngs);
+
+    /**
+     * 插入照片表
+     * @param tmsAttachMngs
+     * @return
+     */
+    Integer insertAttachMngs(TmsAttachMngs tmsAttachMngs);
+
+    /**
+     * 查询AttachtypeId返回前端在照片库中插入
+     * AttachtypeId
+     * @param tmsAttachMngs
+     * @return
+     */
+    Long getAttachMngsAttachtypeIdBySysIdAndEntityIdAndLineNo(TmsAttachMngs tmsAttachMngs);
+
+    /**
+     * 查找照片List
+     * @param orderBillsPlans
+     * @return
+     */
+    List<Long> getAttachMngsAttachIdBySysIdAndEntityIdAndActId(OrderBillsPlans orderBillsPlans);
+
+    /**
+     * 根据attachId在Tms库的AttachMngs表删除数据
+     *
+     * @param attachId
+     * @return
+     */
+    Integer deleteTmsAttachMngsByAttachId(Long attachId);
 }

+ 21 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IAttachMngsService.java

@@ -0,0 +1,21 @@
+package com.ruoyi.system.service;
+
+
+import com.ruoyi.system.domain.AttachMngs;
+
+public interface IAttachMngsService {
+
+    /**
+     * 上传图片
+     * @param attachMngs 实体类
+     * @return
+     */
+    Integer insertAttachMngs(AttachMngs attachMngs);
+
+    /**
+     * 获取图片
+     * @param attachId
+     * @return
+     */
+    Byte[] getImg(String attachId);
+}

+ 17 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderBillsPlansService.java

@@ -1,14 +1,12 @@
 package com.ruoyi.system.service;
 
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.system.domain.Items;
-import com.ruoyi.system.domain.LoadFeeItems;
-import com.ruoyi.system.domain.OrderBillsPlans;
-import com.ruoyi.system.domain.WfTaskList;
+import com.ruoyi.system.domain.*;
 import com.ruoyi.system.domain.vo.ItemsVo;
 import com.ruoyi.system.domain.vo.LoadFeeItemsVo;
 import com.ruoyi.system.domain.vo.OrderBillsPlansVo;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 public interface IOrderBillsPlansService {
@@ -28,7 +26,7 @@ public interface IOrderBillsPlansService {
      * @param orderNo orderNo
      * @return 详情
      */
-    OrderBillsPlansVo getOrderBillsPlansByid(Long orderNo);
+    OrderBillsPlansVo getOrderBillsPlansByid(Long orderNo, HttpServletRequest request);
 
 
     /**
@@ -63,4 +61,18 @@ public interface IOrderBillsPlansService {
      * @return 数据
      */
     OrderBillsPlansVo getLoadFeeItems(Long orderNo);
+
+    /**
+     * 插入主库图片数据
+     * @param tmsAttachMngs
+     * @return
+     */
+    AjaxResult insertAttachMngs(TmsAttachMngs tmsAttachMngs);
+
+    /**
+     * 根据attachId在Tms库的AttachMngs表删除数据
+     * @param attachId
+     * @return
+     */
+    AjaxResult deleteTmsAttachMngs(Long attachId);
 }

+ 31 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AttachMngsServiceImpl.java

@@ -0,0 +1,31 @@
+package com.ruoyi.system.service.impl;
+
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.system.domain.AttachMngs;
+import com.ruoyi.system.mapper.AttachMngsMapper;
+import com.ruoyi.system.service.IAttachMngsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@DataSource(value = DataSourceType.ATTACHS)
+@Service
+public class AttachMngsServiceImpl implements IAttachMngsService {
+
+    @Autowired
+    private AttachMngsMapper attachMngsMapper;
+
+    @Override
+    public Integer insertAttachMngs(AttachMngs attachmngs) {
+        return attachMngsMapper.insertAttachmngs(attachmngs);
+    }
+
+    @Override
+    public Byte[] getImg(String attachId) {
+
+        AttachMngs attachMngs = attachMngsMapper.getAttachmngsBySysIdAndAttchId(attachId);
+
+        return attachMngs.getAttachFile();
+    }
+}

+ 81 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderBillsPlansServiceImpl.java

@@ -6,6 +6,7 @@ import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.SnowFlakeUtil;
 import com.ruoyi.system.domain.*;
+import com.ruoyi.system.domain.vo.ImgVo;
 import com.ruoyi.system.domain.vo.ItemsVo;
 import com.ruoyi.system.domain.vo.LoadFeeItemsVo;
 import com.ruoyi.system.domain.vo.OrderBillsPlansVo;
@@ -16,6 +17,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletRequest;
 import java.beans.Transient;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -71,6 +73,13 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
         map.put("orderNo", orderNo);
 
         List<WfTaskList> orderBillsPlansList = orderBillsPlansMapper.getOrderBillsPlansLsit(map);
+        for (WfTaskList wfTaskList : orderBillsPlansList) {
+            if (wfTaskList.getBillStatus() == 6) {
+                wfTaskList.setBillStatusName("禁止修改");
+            } else if (wfTaskList.getBillStatus() == 2) {
+                wfTaskList.setBillStatusName("允许修改");
+            }
+        }
         return orderBillsPlansList;
     }
 
@@ -81,7 +90,7 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
      * @return 详情
      */
     @Override
-    public OrderBillsPlansVo getOrderBillsPlansByid(Long orderNo) {
+    public OrderBillsPlansVo getOrderBillsPlansByid(Long orderNo, HttpServletRequest request) {
         OrderBillsPlans orderBillsPlans = orderBillsPlansMapper.getOrderBillsPlansByid(orderNo);
         OrderBillsPlansVo vo = new OrderBillsPlansVo();
         BeanUtils.copyProperties(orderBillsPlans, vo);
@@ -96,6 +105,23 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
         if (unLoadDate != null) {
             vo.setUnLoadDateString(ft.format(unLoadDate));
         }
+
+        // 查找照片List
+        List<Long> attachIdList = orderBillsPlansMapper.getAttachMngsAttachIdBySysIdAndEntityIdAndActId(orderBillsPlans);
+
+        List<ImgVo> fileList1 = new ArrayList<>();
+        for (Long attachId : attachIdList) {
+            ImgVo imgVo = new ImgVo();
+
+            String serverName = request.getServerName();
+            int serverPort = request.getServerPort();
+            String url = "http://" + serverName + ":" + serverPort + "/attachmngs/img/" + attachId;
+            imgVo.setUrl(url);
+
+            fileList1.add(imgVo);
+        }
+
+        vo.setFileList1(fileList1);
         return vo;
     }
 
@@ -172,13 +198,22 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
         // }
 
         // 删除所有明细
-        Integer t = orderBillsPlansMapper.deleteLoadFeeItemsByEntityId(orderBillsPlansVo.getLoadBillsEntityId());
+        // Integer t = orderBillsPlansMapper.deleteLoadFeeItemsByEntityId(orderBillsPlansVo.getLoadBillsEntityId());
+        //
+        // Long lineNo = 1L;
+        // for (ItemsVo itemsVo : itemsVoList) {
+        //     itemsVo.setLineNo(lineNo);
+        //     Integer x = orderBillsPlansMapper.insertLoadFeeItems(orderBillsPlansVo, itemsVo, empls);
+        //     lineNo++;
+        // }
+
+        for (LoadFeeItems loadFeeItems : orderBillsPlansVo.getLoadFeeItemsList()) {
+
+            if (loadFeeItems.getAmt() == 0)
+                break;
+
+            orderBillsPlansMapper.updateOrderBillsPlansBySysidEntityidLineno(loadFeeItems);
 
-        Long lineNo = 1L;
-        for (ItemsVo itemsVo : itemsVoList) {
-            itemsVo.setLineNo(lineNo);
-            Integer x = orderBillsPlansMapper.insertLoadFeeItems(orderBillsPlansVo, itemsVo, empls);
-            lineNo++;
         }
 
 
@@ -208,4 +243,43 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
         data.setLoadFeeItemsList(loadFeeItemsList);
         return data;
     }
+
+    /**
+     * 插入主库图片数据
+     * @param tmsAttachMngs
+     * @return
+     */
+    @Override
+    public AjaxResult insertAttachMngs(TmsAttachMngs tmsAttachMngs) {
+
+        // 查询最大的lineNo进行+1赋值
+        Long lineNo = orderBillsPlansMapper.getAttachMngsBySysIdEntityId(tmsAttachMngs);
+
+        String username = SecurityUtils.getLoginUser().getUsername();
+        tmsAttachMngs.setActId(375L);
+        tmsAttachMngs.setAttachName(UUID.randomUUID().toString().replace("-", ""));
+        tmsAttachMngs.setLineNo(lineNo == null ? 1L : lineNo + 1);
+        tmsAttachMngs.setUserName(username);
+
+        // 插入照片表
+        Integer i = orderBillsPlansMapper.insertAttachMngs(tmsAttachMngs);
+        // 查询AttachtypeId返回前端在照片库中插入
+        Long attachId = orderBillsPlansMapper.getAttachMngsAttachtypeIdBySysIdAndEntityIdAndLineNo(tmsAttachMngs);
+        return AjaxResult.success(attachId);
+    }
+
+    /**
+     * 根据attachId在Tms库的AttachMngs表删除数据
+     * @param attachId
+     * @return
+     */
+    @Override
+    public AjaxResult deleteTmsAttachMngs(Long attachId) {
+        Integer i = orderBillsPlansMapper.deleteTmsAttachMngsByAttachId(attachId);
+
+        if (i == 1) {
+            return AjaxResult.success();
+        }
+        return AjaxResult.error();
+    }
 }

+ 16 - 0
ruoyi-system/src/main/resources/mapper/system/AttachMngsMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.AttachMngsMapper">
+
+
+    <insert id="insertAttachmngs">
+        insert into Attachmngs (sysId, attachId, attachFile) values (#{sysId}, #{attachId}, #{attachFile})
+    </insert>
+    <select id="getAttachmngsBySysIdAndAttchId" resultType="com.ruoyi.system.domain.AttachMngs">
+        select attachFile from Attachmngs where sysId = 1 and attachId = #{attachId,jdbcType=INTEGER}
+    </select>
+
+
+</mapper>

+ 44 - 2
ruoyi-system/src/main/resources/mapper/system/OrderBillsPlansMapper.xml

@@ -10,6 +10,10 @@
                 #{i.amt}, #{i.amt}, #{i.amt}, #{i.amt}, #{i.amt},
                 #{e.EmplId}, #{e.empl}, #{o.actId}, #{o.entityId}, #{o.lineNo})
     </insert>
+    <insert id="insertAttachMngs">
+        insert into AttachMngs (SYSID, ENTITYID, ACTID, LINENO, USERNAME,ATTACHNAME)
+        values (#{loadBillsSysId}, #{loadBillsEntityId}, #{actId}, #{lineNo}, #{userName}, #{attachName})
+    </insert>
 
     <update id="updateOrderBillsPlansByid">
         update OrderBillsPlans
@@ -44,9 +48,24 @@
             gasstation2    = #{gasstation2}
         where orderNo = #{orderNo}
     </update>
+    <update id="updateOrderBillsPlansBySysidEntityidLineno">
+
+        update LoadFeeItems
+        set Price  = #{amt},
+            Amt    = #{amt},
+            AMT1   = #{amt},
+            AMT2   = #{amt},
+            AMTORG = #{amt}
+
+        where sysId = '1'
+          AND entityid = #{entityId} and lineno = #{lineNo}
+    </update>
     <delete id="deleteLoadFeeItemsByEntityId">
         delete from LoadFeeItems where sysid = 1 and entityid = #{entityId}
     </delete>
+    <delete id="deleteTmsAttachMngsByAttachId">
+        delete from AttachMngs where attachId = #{attachId}
+    </delete>
 
 
     <select id="getOrderBillsPlansLsit" parameterType="Map" resultType="com.ruoyi.system.domain.WfTaskList">
@@ -81,6 +100,8 @@
         ,e.Empl transact
         , b.BillDate billDate
         , p.rightqty
+
+        , b.billStatus
         from wf_TaskList t
         Left join LoadBills b on (b.SysID=t.SysID and b.EntityID=t.EntityID)
         Left join OrderBillsPlans p on (p.SysID=b.SysID and p.EntityID=b.SrcEntityID and p.LineNo=b.SrcLineNo)
@@ -137,7 +158,10 @@
              , dr1.Empl        driver1Name
              , dr1.mobile      driver1mobile
 
-
+             , p.sysId
+             , b.entityId      loadBillsEntityId
+             , b.sysId         loadBillsSysId
+             , b.billStatus
         from OrderBillsPlans p
                  Left join Empls e on (e.SysID = p.SysID and e.EmplID = p.TransactID)
                  Left join Empls dr1 on (dr1.SysID = p.SysID and dr1.EmplID = p.DRIVER1ID)
@@ -146,6 +170,11 @@
                  Left join Corps l on (l.SysID = p.SysID and l.CorpID = p.LoadFactoryID)
                  Left join Corps ul on (ul.SysID = p.SysID and ul.CorpID = p.UnLoadFactoryID)
                  Left join Goods g on (g.SysID = p.SysID and g.GoodsID = p.GoodsID)
+                 INNER JOIN LoadBills b
+                            ON
+                                        p.SysID = b.SysID
+                                    AND p.EntityID = b.SrcEntityID
+                                    AND p.LineNo = b.SrcLineNo
         where p.SysID = 1
           and p.OrderNo = #{orderNo}
     </select>
@@ -194,6 +223,19 @@
         where o.orderNo = #{orderNo} and dr1.SysID = 1
     </select>
     <select id="getLoadFeeItemsByEntityId" resultType="com.ruoyi.system.domain.LoadFeeItems">
-        select itemid, amt from LoadFeeItems where sysid = 1 and entityId = #{entityId}
+        select l.itemid, l.amt, i.cName, i.itemProp, i.auditType, l.lineNo, l.entityid
+        from LoadFeeItems l
+                 inner join Items i on l.ItemID = i.ItemID
+        where l.sysid = 1
+          and l.entityId = #{entityId};
+    </select>
+    <select id="getAttachMngsBySysIdEntityId" resultType="java.lang.Long">
+        select MAX(lineNo) from AttachMngs where sysId = #{loadBillsSysId} and entityId = #{loadBillsEntityId}
+    </select>
+    <select id="getAttachMngsAttachtypeIdBySysIdAndEntityIdAndLineNo" resultType="java.lang.Long">
+        select attachId from AttachMngs where SysId = #{loadBillsSysId} and EntityId = #{loadBillsEntityId} and LineNo = #{lineNo}
+    </select>
+    <select id="getAttachMngsAttachIdBySysIdAndEntityIdAndActId" resultType="java.lang.Long">
+        select attachId from AttachMngs where SysId = #{loadBillsSysId} and EntityId = #{loadBillsEntityId} and ActID = 375
     </select>
 </mapper>