Procházet zdrojové kódy

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

3254194295 před 3 roky
rodič
revize
515aad7562
23 změnil soubory, kde provedl 909 přidání a 56 odebrání
  1. 14 0
      platform-dao/src/main/java/com/platform/dao/config/DataSourceConfig.java
  2. 1 1
      platform-dao/src/main/java/com/platform/dao/dto/check/CheckStandardDTO.java
  3. 4 0
      platform-dao/src/main/java/com/platform/dao/dto/repair/RepairApplicationFormDTO.java
  4. 5 0
      platform-dao/src/main/java/com/platform/dao/dto/upms/SysUserDTO.java
  5. 8 6
      platform-dao/src/main/java/com/platform/dao/entity/repair/RepairApplicationForm.java
  6. 4 0
      platform-dao/src/main/java/com/platform/dao/enums/SysRoleCodeEnum.java
  7. 68 0
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/PlanVO.java
  8. 68 0
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/PlandetailsVO.java
  9. 64 0
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/ProductHelpVO.java
  10. 84 0
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/ProductVO.java
  11. 32 0
      platform-dao/src/main/resources/application-daoDev.yml
  12. 9 0
      platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml
  13. 8 1
      platform-dao/src/main/resources/mapper/upms/SysUserMapper.xml
  14. 71 0
      platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhPlanDetails.java
  15. 41 0
      platform-service/src/main/java/com/platform/service/qykh/QykhPlanDetailsService.java
  16. 266 0
      platform-service/src/main/java/com/platform/service/qykh/impl/QykhPlanDetailsServiceImpl.java
  17. 29 34
      platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java
  18. 6 13
      platform-service/src/main/java/com/platform/service/repair/strategy/AbstractRepairBaseStrategy.java
  19. 120 0
      platform-service/src/main/java/com/platform/service/repair/strategy/impl/AllocateRepairBaseStrategy.java
  20. 1 1
      platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java
  21. 2 0
      platform-service/src/main/resources/application-serviceDev.yml
  22. 2 0
      platform-service/src/main/resources/application-serviceProd.yml
  23. 2 0
      platform-service/src/main/resources/application-serviceTest.yml

+ 14 - 0
platform-dao/src/main/java/com/platform/dao/config/DataSourceConfig.java

@@ -58,6 +58,20 @@ public class DataSourceConfig {
         return dataSource;
     }
 
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.qykh")
+    public DataSource qykhDataSource() {
+        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        WallConfig wallConfig = new WallConfig();
+        wallConfig.setMultiStatementAllow(true);
+        WallFilter wallFilter = new WallFilter();
+        wallFilter.setConfig(wallConfig);
+        List<Filter> filterList = ListUtils.newArrayList();
+        filterList.add(wallFilter);
+        dataSource.setProxyFilters(filterList);
+        return dataSource;
+    }
+
     @Bean("myRoutingDataSource")
     public DataSource myRoutingDataSource(@Qualifier("masterDataSource") DataSource masterDataSource,
                                           @Qualifier("slave1DataSource") DataSource slave1DataSource) {

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/dto/check/CheckStandardDTO.java

@@ -113,7 +113,7 @@ public class CheckStandardDTO extends BaseDTO implements Serializable {
      */
     private Integer actionType;
     /**
-     * 检查类型: 1-点检 2-巡检
+     * 检查类型: 1-点检 2-保养 3-润滑
      */
     private Integer type;
 

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

@@ -335,4 +335,8 @@ public class RepairApplicationFormDTO extends BaseDTO implements Serializable {
     private String queryRepairUserId;
 
     private List<Integer> statusList;
+
+    private String dispatchUserId;
+
+    private Integer checkAllFlag;
 }

+ 5 - 0
platform-dao/src/main/java/com/platform/dao/dto/upms/SysUserDTO.java

@@ -237,4 +237,9 @@ public class SysUserDTO extends BaseDTO implements Serializable {
     private Boolean workFlag;
 
     private String email;
+
+    /**
+     * 获取角色专用 1 代表根据创建时间升序
+     */
+    private Integer orderByFlag;
 }

+ 8 - 6
platform-dao/src/main/java/com/platform/dao/entity/repair/RepairApplicationForm.java

@@ -1,19 +1,15 @@
 package com.platform.dao.entity.repair;
 
-import com.sun.org.apache.xpath.internal.operations.Bool;
+import com.platform.common.bean.DataScope;
 import lombok.Data;
 
 import javax.persistence.Id;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 
-import com.platform.common.bean.DataScope;
-
-import javax.persistence.Transient;
-
 /**
  * @Description 保修单实体类
  * @Author liuyu
@@ -240,6 +236,12 @@ public class RepairApplicationForm implements Serializable {
      * 类型
      */
     private Integer type;
+
+    /**
+     * 分配人ID
+     */
+    private String dispatchUserId;
+
     /**
      * 报修人
      */

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

@@ -135,6 +135,10 @@ public enum SysRoleCodeEnum {
      * 报修单最后审核人员
      */
     REPAIR_EXAMINE,
+    /**
+     * 报修派工角色
+     */
+    REPAIR_DISPATCH,
     ;
 
 }

+ 68 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/PlanVO.java

@@ -0,0 +1,68 @@
+package com.platform.dao.vo.query.qykh;
+
+import lombok.Data;
+import com.platform.common.bean.BaseVO;
+import com.platform.common.bean.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import javax.validation.constraints.*;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.time.LocalDate;
+
+/**
+ * @Description 自定义报表VO结果类
+ * @Author xc
+ * @Date 2022-05-30 19:50:16
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class PlanVO extends BaseVO implements Serializable{
+
+    /**
+     * 主键id
+     */
+        private Integer id;
+        /**
+     * 方案类别名称
+     */
+        private String planname;
+        /**
+     * 类别说明
+     */
+        private String plandes;
+        /**
+     * 
+     */
+        private String shortdesc;
+        /**
+     * 
+     */
+        private Integer pid;
+        /**
+     * 
+     */
+        private Integer level;
+        /**
+     * 
+     */
+        private String purl;
+        /**
+     * 
+     */
+        private String bannerurl;
+        /**
+     * 
+     */
+        private Integer seoid;
+        /**
+     * 
+     */
+        private Integer ord;
+    
+
+
+}

+ 68 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/PlandetailsVO.java

@@ -0,0 +1,68 @@
+package com.platform.dao.vo.query.qykh;
+
+import lombok.Data;
+import com.platform.common.bean.BaseVO;
+import com.platform.common.bean.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.*;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.time.LocalDate;
+
+/**
+ * @Description 自定义报表VO结果类
+ * @Author xc
+ * @Date 2022-05-30 19:50:40
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class PlandetailsVO extends BaseVO implements Serializable {
+
+    /**
+     *
+     */
+    private Integer id;
+    /**
+     * 详情标题
+     */
+    private String plantitle;
+    /**
+     *
+     */
+    private String plancontext;
+    /**
+     *
+     */
+    private String shortdesc;
+    /**
+     * 对应的类别id
+     */
+    private Integer planid;
+    /**
+     *
+     */
+    private Integer orderid;
+    /**
+     *
+     */
+    private String digest;
+    /**
+     *
+     */
+    private String keywords;
+    /**
+     *
+     */
+    private Integer seoid;
+    /**
+     *
+     */
+    private String time;
+
+
+}

+ 64 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/ProductHelpVO.java

@@ -0,0 +1,64 @@
+package com.platform.dao.vo.query.qykh;
+
+import lombok.Data;
+import com.platform.common.bean.BaseVO;
+import com.platform.common.bean.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import javax.validation.constraints.*;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.time.LocalDate;
+
+/**
+ * @Description 自定义报表VO结果类
+ * @Author xc
+ * @Date 2022-05-30 19:45:56
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class ProductHelpVO extends BaseVO implements Serializable{
+
+    /**
+     * 
+     */
+        private Integer id;
+        /**
+     * 
+     */
+        private String title;
+        /**
+     * 
+     */
+        private String descr;
+        /**
+     * 
+     */
+        private String purl;
+        /**
+     * 对应的产品id
+     */
+        private Integer pid;
+        /**
+     * 
+     */
+        private String keywords;
+        /**
+     * 
+     */
+        private Integer ord;
+        /**
+     * 
+     */
+        private String digest;
+        /**
+     * 
+     */
+        private String time;
+    
+
+
+}

+ 84 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/ProductVO.java

@@ -0,0 +1,84 @@
+package com.platform.dao.vo.query.qykh;
+
+import lombok.Data;
+import com.platform.common.bean.BaseVO;
+import com.platform.common.bean.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import javax.validation.constraints.*;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.time.LocalDate;
+
+/**
+ * @Description 自定义报表VO结果类
+ * @Author xc
+ * @Date 2022-05-30 19:49:47
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class ProductVO extends BaseVO implements Serializable{
+
+    /**
+     * 
+     */
+        private Integer id;
+        /**
+     * 
+     */
+        private Integer level;
+        /**
+     * 
+     */
+        private Integer pid;
+        /**
+     * 产品名称
+     */
+        private String pname;
+        /**
+     * 产品说明
+     */
+        private String desrc;
+        /**
+     * 
+     */
+        private String shortdesc;
+        /**
+     * 产品图片路径
+     */
+        private String purl;
+        /**
+     * 
+     */
+        private String bannerurl;
+        /**
+     * 
+     */
+        private Integer ord;
+        /**
+     * 
+     */
+        private String oname;
+        /**
+     * 
+     */
+        private Integer seoid;
+        /**
+     * 
+     */
+        private Integer iszt;
+        /**
+     * 
+     */
+        private String zturl;
+        /**
+     * 
+     */
+        private Integer iszhutui;
+    
+
+
+}

+ 32 - 0
platform-dao/src/main/resources/application-daoDev.yml

@@ -65,6 +65,38 @@ spring:
         #间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
         time-between-eviction-runs-millis: 60000
         validation-query: SELECT 'x'
+      qykh:
+        driver-class-name: com.mysql.cj.jdbc.Driver
+        url: jdbc:mysql://139.159.196.89:33306/qykh?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&allowMultiQueries=true
+        username: qykh
+        password: qykh@CQDWJS@!123
+        filters: wall,stat
+        filter:
+          stat:
+            log-slow-sql: true
+            #慢sql
+            slow-sql-millis: 1000
+        #初始化大小、最小、最大
+        initial-size: 1
+        max-active: 50
+        max-pool-prepared-statement-per-connection-size: 20
+        #获取连接等待超时的时间
+        max-wait: 60000
+        #一个连接在池中最小生存的时间,单位是毫秒
+        min-evictable-idle-time-millis: 300000
+        min-idle: 5
+        #打开PSCache,并且指定每个连接上PSCache的大小
+        #如果用Oracle,则把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false。
+        pool-prepared-statements: false
+        test-on-borrow: true
+        test-on-return: true
+        test-while-idle: true
+        #间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        time-between-eviction-runs-millis: 60000
+        validation-query: SELECT 'x'
+        stat-view-servlet:
+          login-password: platform8888
+          login-username: root
       stat-view-servlet:
         login-password: platform8888
         login-username: root

+ 9 - 0
platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml

@@ -109,6 +109,12 @@
             <if test="repairStartTimeEnd != null">
                 and application.repair_start_time <![CDATA[ < ]]> #{repairStartTimeEnd}
             </if>
+            <if test="dispatchUserId != null">
+                and application.dispatch_user_id = #{dispatchUserId}
+            </if>
+            <if test="checkAllFlag != null and checkAllFlag == 1">
+                and application.check_user_id is not null
+            </if>
         </where>
     </select>
     <select id="selectById" parameterType="java.lang.Object"
@@ -265,6 +271,9 @@
             <if test="type != null">
                 type = #{type},
             </if>
+            <if test="dispatchUserId">
+                and dispatch_user_id = #{dispatchUserId}
+            </if>
         </set>
         where id = #{id}
     </update>

+ 8 - 1
platform-dao/src/main/resources/mapper/upms/SysUserMapper.xml

@@ -70,7 +70,14 @@
                 #{item}
             </foreach>
         </if>
-        order by u.update_time desc
+        <choose>
+            <when test="orderByFlag != null and orderByFlag == 1">
+                order by u.created_time asc
+            </when>
+            <otherwise>
+                order by u.update_time desc
+            </otherwise>
+        </choose>
     </select>
 
     <select id="selectUserNameById" resultType="java.lang.String" parameterType="java.lang.Object">

+ 71 - 0
platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhPlanDetails.java

@@ -0,0 +1,71 @@
+package com.platform.rest.controller.qykh;
+
+import com.platform.common.util.R;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.dto.sb.SbTypeDTO;
+import com.platform.dao.entity.sb.SbType;
+import com.platform.dao.vo.query.qykh.PlandetailsVO;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.qykh.QykhPlanDetailsService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/qykh/plan/details")
+public class QykhPlanDetails {
+    private final QykhPlanDetailsService qykhPlanDetailsService;
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R getById(@PathVariable("id") Integer id) {
+        return new R(qykhPlanDetailsService.selectSingle(id));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param sbTypeDTO 设备类别DTO
+     * @return R
+     */
+    @SysLog("新增设备类别")
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('sb-types-add')")
+    public R save(@Validated({AddGroup.class}) @RequestBody PlandetailsVO sbTypeDTO) {
+        return new R<>(qykhPlanDetailsService.insertSingle(sbTypeDTO));
+    }
+    
+    /**
+     * 获取分页
+     *
+     * @param pageNum 当前页码
+     * @param pageSize 每页条数
+     * @return R
+     */
+    @GetMapping("/page")
+    public R query(PlandetailsVO dto, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R(qykhPlanDetailsService.selectPage(pageNum,pageSize,dto));
+    }
+
+    /**
+     * 修改某条记录
+     * @param infoAdapterVO 电子保函表DTO
+     * @return R
+     */
+    @SysLog("修改")
+    @PutMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('guarantee-guarantee-infos-edit')")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody PlandetailsVO infoAdapterVO) {
+        qykhPlanDetailsService.modModel(infoAdapterVO);
+        return new R();
+    }
+
+
+}

+ 41 - 0
platform-service/src/main/java/com/platform/service/qykh/QykhPlanDetailsService.java

@@ -0,0 +1,41 @@
+package com.platform.service.qykh;
+
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.PlandetailsVO;
+
+public interface QykhPlanDetailsService {
+
+    /**
+     * 单个数据插入
+     * @param vo
+     */
+    String insertSingle(PlandetailsVO vo);
+
+    /**
+     * 单个数据查询
+     *
+     * @param vo
+     */
+    String selectSingle(Integer id);
+
+    /**
+     * 更新
+     *
+     * @param vo
+     */
+    void modModel(PlandetailsVO vo);
+
+    /**
+     * 分页查询
+     * @param pageNum
+     * @param pageSize
+     * @param plandetailsVO 查询对象
+     */
+    MyVOPage<PlandetailsVO> selectPage(int pageNum, int pageSize, PlandetailsVO plandetailsVO );
+
+    /**
+     * 统一手动插入
+     * @param sql
+     */
+    void centerInsertBatch(String sql);
+}

+ 266 - 0
platform-service/src/main/java/com/platform/service/qykh/impl/QykhPlanDetailsServiceImpl.java

@@ -0,0 +1,266 @@
+package com.platform.service.qykh.impl;
+
+import com.github.pagehelper.Page;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.exception.DeniedException;
+import com.platform.common.util.*;
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.PlandetailsVO;
+import com.platform.service.qykh.QykhPlanDetailsService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.*;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("qykhPlanDetailsService")
+@Slf4j
+public class QykhPlanDetailsServiceImpl implements QykhPlanDetailsService {
+    @Resource
+    private DataSource qykhDataSource;
+
+    @Value("${qykh.plandetails}")
+    private String info_table_name;
+
+    @Override
+    public MyVOPage<PlandetailsVO> selectPage(int pageNum, int pageSize, PlandetailsVO guaranteeInfoDTO) {
+        MyVOPage<PlandetailsVO> myVOPage = new MyVOPage<>();
+        myVOPage.setPageNum(pageNum);
+        myVOPage.setPageSize(pageSize);
+        Connection conn = null;
+        Statement stmt = null;
+        ResultSet rs = null;
+        StringBuffer querySql = new StringBuffer("select " +
+                "id," +
+                "plantitle," +
+                "plancontext," +
+                "shortdesc," +
+                "planid," +
+                "orderid," +
+                "digest," +
+                "keywords," +
+                "seoid, " +
+                "time ");
+        StringBuffer countSql = new StringBuffer("select count(*) ");
+        StringBuffer sql = new StringBuffer(" from " + info_table_name + " where 1 = 1 ");
+        if (StringUtils.isNotBlank(guaranteeInfoDTO.getPlantitle())) {
+            sql.append("and ProjectNo like '%" + guaranteeInfoDTO.getPlantitle() + "%' ");
+        }
+        sql.append(" order by Insert_Time desc ");
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            rs = stmt.executeQuery(countSql.append(sql).toString());
+            rs.next();
+            long total = rs.getLong(1);
+            Page page = new Page(pageNum, pageSize);
+            page.setTotal(total);
+            myVOPage.setPages(page.getPages());
+            myVOPage.setTotal(total);
+            if (total < 1) {
+                myVOPage.setRows(new ArrayList<PlandetailsVO>());
+                return myVOPage;
+            }
+            int startNum = (pageNum - 1) * pageSize;
+            sql.append("limit " + startNum + "," + pageSize);
+            rs = stmt.executeQuery(querySql.append(sql).toString());
+            // 封装数据
+            myVOPage.setRows(packageInfo(rs));
+            rs.close();
+            stmt.close();
+            conn.close();
+            return myVOPage;
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取宿州数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    @Override
+    public void modModel(PlandetailsVO vo) {
+        Connection conn = null;
+        Statement stmt = null;
+        StringBuffer updateSql = new StringBuffer("update " + info_table_name + " set " +
+                "plantitle='" + vo.getPlantitle() +
+                "',plancontext='" + vo.getPlancontext() +
+                "',shortdesc='" + vo.getShortdesc() +
+                "',planid='" + vo.getPlanid() +
+                "',orderid='" + vo.getOrderid() +
+                "',digest='" + vo.getDigest() +
+                "',keywords='" + vo.getKeywords() +
+                "',seoid='" + vo.getSeoid() +
+                "',time='" + vo.getTime() +
+                "' where id='" + vo.getId() + "'");
+        log.info("更新数据:" + updateSql);
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            int result = stmt.executeUpdate(updateSql.toString());
+            if (result != 1) {
+                throw new BusinessException("");
+            }
+            stmt.close();
+            conn.close();
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取宿州数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    private List<PlandetailsVO> packageInfo(ResultSet rs) throws SQLException {
+        List<PlandetailsVO> list = new ArrayList<>();
+        while (rs.next()) {
+            PlandetailsVO vo = new PlandetailsVO();
+            vo.setId(rs.getInt(1));
+            vo.setPlantitle(rs.getString(2));
+            vo.setPlancontext(rs.getString(3));
+            vo.setShortdesc(rs.getString(4));
+            vo.setPlanid(rs.getInt(5));
+            vo.setOrderid(rs.getInt(6));
+            vo.setDigest(rs.getString(7));
+            vo.setKeywords(rs.getString(8));
+            vo.setSeoid(rs.getInt(9));
+            vo.setTime(rs.getString(10));
+            list.add(vo);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String insertSingle(PlandetailsVO vo) {
+        try {
+            if (vo != null) {
+                if (vo.getTime() == null) {
+                    vo.setTime(DateUtils.dateToString(LocalDateTime.now(), DateUtils.PATTERN_YMD_HMS));
+                }
+                StringBuffer sql = new StringBuffer();
+                sql.append("insert into " + info_table_name +
+                        " (plantitle,plancontext,shortdesc,planid,orderid,digest,keywords,seoid,time) values ");
+                sql.append("('");
+                sql.append("'" + vo.getPlantitle() + "',");
+                sql.append("'" + vo.getPlancontext() + "',");
+                sql.append("'" + vo.getShortdesc() + "',");
+                sql.append("'" + vo.getPlanid() + "',");
+                sql.append("'" + vo.getOrderid() + "',");
+                sql.append("'" + vo.getDigest() + "',");
+                sql.append("'" + vo.getKeywords() + "',");
+                sql.append("'" + vo.getSeoid() + "',");
+                sql.append("'" + vo.getTime() + "',");
+                sql.append(")");
+                log.info("----------" + sql.toString());
+                centerInsertBatch(sql.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            //throw new DeniedException("单个宿州交易中心失败,请联系技术处理");
+        }
+        return "推送成功";
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void centerInsertBatch(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            stmt.executeUpdate(sql);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public String selectSingle(Integer id) {
+        try {
+            StringBuffer sql = new StringBuffer();
+            sql.append("select " +
+                    "plantitle," +
+                    "plancontext," +
+                    "shortdesc," +
+                    "planid," +
+                    "orderid," +
+                    "digest," +
+                    "keywords," +
+                    "seoid, " +
+                    "time " +
+                    "from "
+                    + info_table_name + " where id = '" + id + "'");
+            ResultSet set = queryQykh(sql.toString());
+            log.info(sql.toString());
+            if (set != null) {
+                log.info(JsonUtils.objectToJson(set));
+                return JsonUtils.objectToJson(set);
+            }
+            return id + "";
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public ResultSet queryQykh(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            return stmt.executeQuery(sql);
+        } catch (Exception e) {
+            log.info(e.getCause().getMessage());
+            e.printStackTrace();
+            //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 29 - 34
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -144,46 +144,21 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
     @Override
     public MyVOPage<RepairApplicationFormVO> selectPageInfoVO(RepairApplicationFormDTO record, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
-
-        /*if (record.getSearchType() != null) {
-            // 获取报修人
-            if (record.getSearchType() == 1) {
-                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                    UserInfo userInfo = SecurityUtils.getUserInfo();
-                    record.setUserId(userInfo.getUserId());
-                }
-            }
-            // 获取维修人,包括第二维修人
-            if (record.getSearchType() == 2) {
-                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                    UserInfo userInfo = SecurityUtils.getUserInfo();
-                    record.setRepairUserId(userInfo.getUserId());
-                }
-            }
-            // 获取验收人
-            if (record.getSearchType() == 3) {
-                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                    UserInfo userInfo = SecurityUtils.getUserInfo();
-                    record.setCheckUserId(userInfo.getUserId());
-                }
-            }
-        }*/
-
         UserInfo userInfo = SecurityUtils.getUserInfo();
         record.setRepairUserId(userInfo.getUserId());
-        // 排除超级用户
-        String userNames = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_SUPER_USERS.name());
-        if(StringUtils.isBlank(userNames)){
-            throw new DeniedException("请设置维修菜单的超级用户");
-        }
-        if(userNames.contains(userInfo.getUsername())){
-            record.setRepairUserId(null);
-        }
+        String repairModel = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_STRATEGY_MODEL.name()); // 维修模式
         if(record.getSearchType() != null){
             List<Integer> statusList = new ArrayList<>();
             if(record.getSearchType() == 1){ // 待分配
                 statusList.add(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
-                record.setRepairUserId(null);
+                switch (repairModel){
+                    case CommonConstants.REPAIR_STRATEGY_MODEL_BASE:
+                        record.setRepairUserId(null);
+                        break;
+                    case CommonConstants.REPAIR_STRATEGY_MODEL_DISPATCH:
+                        record.setDispatchUserId(SecurityUtils.getUserInfo().getUserId());
+                        break;
+                }
             }
             if(record.getSearchType() == 2){ // 待维修
                 statusList.add(RepairApplicationFormStatusEnum.PROCESSING.getValue());
@@ -205,8 +180,28 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
                 statusList.add(RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue());
                 statusList.add(RepairApplicationFormStatusEnum.REBACK.getValue());
             }
+            if(record.getSearchType() == 7){
+                // 获取验收人
+                record.setRepairUserId(null);
+                record.setCheckUserId(SecurityUtils.getUserInfo().getUserId());
+            }
             record.setStatusList(statusList);
         }
+        // 排除超级用户
+        String userNames = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_SUPER_USERS.name()); // 超级用户
+        if(StringUtils.isBlank(userNames)){
+            throw new DeniedException("请设置维修菜单的超级用户");
+        }
+        // 维修模式为派工的情况
+        if(userNames.contains(userInfo.getUsername())){
+            record.setRepairUserId(null);
+            record.setDispatchUserId(null);
+            // 超级可以看到所有待审核的工单
+            if(record.getSearchType() != null && record.getSearchType() == 7){
+                record.setCheckUserId(null);
+                record.setCheckAllFlag(1);
+            }
+        }
         return new MyVOPage<>(mapper.selectPageList(record));
     }
 

+ 6 - 13
platform-service/src/main/java/com/platform/service/repair/strategy/AbstractRepairBaseStrategy.java

@@ -127,23 +127,16 @@ public abstract class AbstractRepairBaseStrategy implements RepairBaseStrategy{
         if (!RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue().equals(applicationForm.getStatus()) && !RepairApplicationFormStatusEnum.REBACK.getValue().equals(applicationForm.getStatus())) {
             throw new BusinessException("该状态不允许接收任务");
         }
-        model.setRepairStartTime(applicationForm.getRepairStartTime());
-        model.setApplyTime(applicationForm.getApplyTime());
-        model.setNo(applicationForm.getNo());
-        model.setUserId(applicationForm.getUserId());
         SbInfo sbInfo = sbInfoService.getModelById(applicationForm.getSbId());
         if (sbInfo == null) {
             throw new BusinessException("设备不存在,无法接收");
         }
-        /*if (sbInfo.getRepairUser() == null) {
-            throw new BusinessException("设备的第一维修人未设置,无法接受任务");
-        }
-        if (sbInfo.getRepairUserSecond() == null) {
-            throw new BusinessException("设备的第二维修人未设置,无法接受任务");
-        }
-        if (!SecurityUtils.isRole(SysRoleCodeEnum.MM.name()) && !SecurityUtils.isRole(SysRoleCodeEnum.Maintenance.name())) {
-            throw new BusinessException("您不是维修人或维修主管,无法接受任务");
-        }*/
+        model.setRepairStartTime(applicationForm.getRepairStartTime());
+        model.setApplyTime(applicationForm.getApplyTime());
+        model.setNo(applicationForm.getNo());
+        model.setUserId(applicationForm.getUserId());
+        model.setDispatchUserId(applicationForm.getDispatchUserId());
+        model.setRepairDispatchList(applicationForm.getRepairDispatchList());
         return model;
     }
 

+ 120 - 0
platform-service/src/main/java/com/platform/service/repair/strategy/impl/AllocateRepairBaseStrategy.java

@@ -1,9 +1,129 @@
 package com.platform.service.repair.strategy.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.platform.common.cache.ConfigCache;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.exception.DeniedException;
+import com.platform.common.model.UserInfo;
+import com.platform.common.util.*;
+import com.platform.dao.dto.repair.RepairApplicationFormDTO;
+import com.platform.dao.dto.upms.SysUserDTO;
+import com.platform.dao.entity.repair.RepairApplicationForm;
+import com.platform.dao.entity.sb.SbInfo;
+import com.platform.dao.enums.RepairApplicationFormStatusEnum;
+import com.platform.dao.enums.SysConfigEnum;
+import com.platform.dao.enums.SysRoleCodeEnum;
+import com.platform.dao.vo.SysUserVO;
 import com.platform.service.repair.strategy.AbstractRepairBaseStrategy;
 import org.springframework.stereotype.Component;
 
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
 @Component
 public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
 
+    @Override
+    public RepairApplicationForm callRepair(RepairApplicationFormDTO model) {
+        RepairApplicationForm form = super.callRepair(model);
+        // 根据自身需要将任务推送通知还是派送到具体主管手上
+        SysUserDTO query = new SysUserDTO();
+        query.setOrderByFlag(1);
+        query.setRoleCode(SysRoleCodeEnum.REPAIR_DISPATCH.name());
+        List<SysUserVO> users = sysUserService.selectDeptRoleUser(query);
+        String dispatchUserId = "";
+        if (CollectionUtil.isNotEmpty(users)) {
+            int size = users.size()-1;
+            if(size == 0){ // 就他一个,直接就给他了
+                dispatchUserId = users.get(0).getUserId();
+            }else{
+                String key = SysRoleCodeEnum.REPAIR_DISPATCH.name() + "_dispatchIndex";
+                // 平均派发任务
+                String dispatchIndex = RedisUtils.getString(key);
+                int indexNum = 0;
+                if(!StringUtils.isBlank(dispatchIndex)){
+                    indexNum = Integer.parseInt(dispatchIndex);
+                }
+                indexNum = indexNum == size ? 0 : indexNum; // 从头再来
+                dispatchUserId = users.get(indexNum).getUserId();
+                indexNum++;
+                RedisUtils.del(key);
+                RedisUtils.setString(key,indexNum+"");
+            }
+        } else {
+            throw new BusinessException("派工角色:REPAIR_DISPATCH未绑定用户,REPAIR_DISPATCH为维修单派发人,请设置用户");
+        }
+        RepairApplicationForm updForm = new RepairApplicationForm();
+        updForm.setId(form.getId());
+        //updForm.setDispatchTime(LocalDateTime.now());
+        updForm.setDispatchUserId(dispatchUserId);
+        repairApplicationFormMapper.updateByPrimaryKeySelective(updForm);
+        // 这里的基础模式是,维修人员自主接收,我们获取需要需要派送的信息Ids集合
+        List<String> openIds = new ArrayList<>();
+        List<String> userIds = new ArrayList<>();
+        List<String> mails = new ArrayList<>();
+        List<String> receiverList = new ArrayList<>();
+
+        // 发送短信通知给所有维修,且必须是正式环境
+        SysUserDTO sysUserDTO = new SysUserDTO();
+        sysUserDTO.setRoleCode(SysRoleCodeEnum.Maintenance.name());
+        List<SysUserVO> sysUserVOList = sysUserService.getDeptChildrenRoleUser(sysUserDTO);
+        if (CollectionUtil.isNotEmpty(sysUserVOList)) {
+            for (SysUserVO sysUserVO : sysUserVOList) {
+                // 站内信需要用户id
+                userIds.add(sysUserVO.getUserId());
+                if (StringUtils.isNotBlank(sysUserVO.getWxOpenid())) {
+                    // 微信id
+                    openIds.add(sysUserVO.getWxOpenid());
+                }
+                if (StringUtils.isNotBlank(sysUserVO.getPhone())) {
+                    // 手机
+                    receiverList.add(sysUserVO.getPhone());
+                }
+                if (StringUtils.isNotBlank(sysUserVO.getEmail())) {
+                    // 邮箱
+                    mails.add(sysUserVO.getEmail());
+                }
+            }
+        }
+        model = BeanConverterUtil.copyObjectProperties(form,RepairApplicationFormDTO.class);
+        SbInfo sb = sbInfoService.getModelById(model.getSbId());
+        // 推送站内信和邮箱,根据业务需要
+        sendWorkplaceAndEmail(mails,userIds,model,sb);
+        // 推送微信
+        sendWechat(openIds,model,sb);
+        // 短信
+        sendSms(receiverList,model,sb);
+        // 启动超时监控
+        overTimeListen(form.getId());
+        return form;
+    }
+
+    @Override
+    public RepairApplicationFormDTO sendRepair(RepairApplicationFormDTO model) {
+        RepairApplicationFormDTO superModel = super.sendRepair(model);
+        // 自己派工
+        UserInfo userInfo = SecurityUtils.getUserInfo();
+        String userNames = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_SUPER_USERS.name()); // 超级用户
+        if(StringUtils.isNotBlank(userNames) && !userNames.contains(userInfo.getUsername())){
+            // 非超级用户,判断是否具有审核派工权限
+            if(!userInfo.getUserId().equals(model.getDispatchUserId())){
+                throw new DeniedException("您不具有派工权限");
+            }
+        }
+        RepairApplicationForm applicationForm = new RepairApplicationForm();
+        applicationForm.setId(model.getId());
+        applicationForm.setRepairUserId(superModel.getRepairUserId());
+        applicationForm.setStatus(RepairApplicationFormStatusEnum.PROCESSING.getValue());
+        if (superModel.getRepairStartTime() == null) {
+            applicationForm.setRepairStartTime(LocalDateTime.now());
+        }
+        applicationForm.setReceiveMinutes(DateUtils.getDurationHours(superModel.getApplyTime(), applicationForm.getRepairStartTime()));
+        applicationForm.setUpdateTime(LocalDateTime.now());
+        repairApplicationFormMapper.updateByPrimaryKeySelective(applicationForm);
+        // 给报修人发送消息
+        sendMessageToRepairCaller(superModel.getId(),superModel.getNo(),superModel.getUserId());
+        return model;
+    }
 }

+ 1 - 1
platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java

@@ -570,7 +570,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
         UserInfo userInfo = SecurityUtils.getUserInfo();
         InStoreForm model = this.getModelById(id);
         // 采购单入库的路由至新流程
-        if (InStoreTypeEnum.CAIGOU_RUKU.getValue() == model.getType()) {
+        if (InStoreTypeEnum.CAIGOU_RUKU.getValue() == model.getType() && StringUtils.isNotBlank(model.getPurchaseId())) {
             handlePurchaseInForm(model, userInfo);
             return;
         }

+ 2 - 0
platform-service/src/main/resources/application-serviceDev.yml

@@ -0,0 +1,2 @@
+qykh:
+  plandetails: qykh_plandetails

+ 2 - 0
platform-service/src/main/resources/application-serviceProd.yml

@@ -0,0 +1,2 @@
+qykh:
+  plandetails: qykh_plandetails

+ 2 - 0
platform-service/src/main/resources/application-serviceTest.yml

@@ -0,0 +1,2 @@
+qykh:
+  plandetails: qykh_plandetails