Browse Source

ly 培训矩阵到培训计划跟踪

ly 1 năm trước cách đây
mục cha
commit
aba368a5b7

+ 3 - 3
master/src/main/java/com/ruoyi/config/ActivitiConfig.java

@@ -113,9 +113,9 @@ public class ActivitiConfig {
 //        Resource spec3 = resourceLoader.getResource("classpath:/processes/sems/yearProcess.bpmn"); //加载流程图资源文件
 //        deploymentBuilder5.enableDuplicateFiltering().addInputStream(spec3.getFilename(), spec3.getInputStream()).name("特种设备年检报告流程").deploy();//按流程id部署
 //
-        DeploymentBuilder deploymentBuilder6 = repositoryService().createDeployment();
-        Resource spec4 = resourceLoader.getResource("classpath:/processes/sems/monthProcess.bpmn"); //加载流程图资源文件
-        deploymentBuilder6.enableDuplicateFiltering().addInputStream(spec4.getFilename(), spec4.getInputStream()).name("特种设备月度检验流程").deploy();//按流程id部署
+//        DeploymentBuilder deploymentBuilder6 = repositoryService().createDeployment();
+//        Resource spec4 = resourceLoader.getResource("classpath:/processes/sems/monthProcess.bpmn"); //加载流程图资源文件
+//        deploymentBuilder6.enableDuplicateFiltering().addInputStream(spec4.getFilename(), spec4.getInputStream()).name("特种设备月度检验流程").deploy();//按流程id部署
 
 //        DeploymentBuilder deploymentBuilder7 = repositoryService().createDeployment();
 //        Resource spec7 = resourceLoader.getResource("classpath:/processes/specTraining/specTrainingPlanProcess.bpmn"); //加载流程图资源文件

+ 152 - 5
master/src/main/java/com/ruoyi/project/training/controller/TTrainingbccRegularController.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.training.controller;
 
+import java.time.LocalDate;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Iterator;
 import java.util.List;
 
@@ -9,9 +11,7 @@ import com.ruoyi.project.plant.service.ITStaffmgrService;
 import com.ruoyi.project.system.domain.SysDictData;
 import com.ruoyi.project.system.service.ISysDictTypeService;
 import com.ruoyi.project.training.domain.*;
-import com.ruoyi.project.training.service.ITTrainingService;
-import com.ruoyi.project.training.service.ITTrainingbccDeviceService;
-import com.ruoyi.project.training.service.ITTrainingbccService;
+import com.ruoyi.project.training.service.*;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.project.training.service.ITTrainingbccRegularService;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -50,7 +49,8 @@ public class TTrainingbccRegularController extends BaseController
 
     @Autowired
     private ITTrainingbccDeviceService trainingbccDeviceService;
-
+    @Autowired
+    private ITTrainingMatrixService tTrainingMatrixService;
     @Autowired
     private ITStaffmgrService tStaffmgrService;
     /**
@@ -246,6 +246,153 @@ public class TTrainingbccRegularController extends BaseController
         return toAjax(doInsert);
     }
 
+    /**
+     * 新增装置培训计划
+     */
+    @PreAuthorize("@ss.hasPermi('training:bccregular:add')")
+    @Log(title = "装置培训计划", businessType = BusinessType.INSERT)
+    @GetMapping("batchAddTraining")
+    public AjaxResult addBatch() {
+        TTrainingbccRegular tr =new TTrainingbccRegular();
+        TTrainingMatrix tTrainingMatrix = new TTrainingMatrix();
+        tTrainingMatrix.setDeptId(103l);
+        tTrainingMatrix.setTrainingLevel("14");
+        List<TTrainingMatrix> list = tTrainingMatrixService.selectTTrainingMatrixList(tTrainingMatrix);
+        logger.info("===========" + list.size() + "");
+        int currentYear = LocalDate.now().getYear();
+        for (TTrainingMatrix matrix: list
+             ) {
+            int addFlag = 0;
+            if ("每年一次".equals(matrix.getFrequency()) || "每年至少一次".equals(matrix.getFrequency())) {
+                tr.setYear(String.valueOf(currentYear));
+                tr.setItem(matrix.getItem());
+                List<TTrainingbccRegular> regulars = tTrainingbccRegularService.selectTTrainingbccRegularList(tr);
+                if (regulars.size() == 0) {
+                    addFlag = 1;
+                }
+            }
+            if ("每年两次".equals(matrix.getFrequency()) || "每年2次".equals(matrix.getFrequency())) {
+                tr.setYear(String.valueOf(currentYear));
+                tr.setItem(matrix.getItem());
+                List<TTrainingbccRegular> regulars = tTrainingbccRegularService.selectTTrainingbccRegularList(tr);
+                if (regulars.size() < 2) {
+                    addFlag = 1;
+                }
+            }
+
+            if (addFlag == 1) {
+                TTrainingbccRegular tTrainingRegular = new TTrainingbccRegular();
+                tTrainingRegular.setDeptId(matrix.getDeptId());
+                tTrainingRegular.setActualpostId(matrix.getActualpostId());
+                tTrainingRegular.setCourseCode(matrix.getCourseCode());
+                tTrainingRegular.setItem(matrix.getItem());
+                tTrainingRegular.setHour(matrix.getHour());
+                tTrainingRegular.setInvolvedMoc("false");
+                tTrainingRegular.setNotPlan("false");
+                tTrainingRegular.setYear(String.valueOf(currentYear));
+
+                int doInsert = tTrainingbccRegularService.insertTTrainingbccRegular(tTrainingRegular);
+
+                logger.info("regular:" + tTrainingRegular);
+                tTrainingRegular.setDeptId(103l); //bcc专用
+                    //新增培训计划定期类
+                    TTrainingbcc tTraining = new TTrainingbcc();
+                    tTraining.setTrainingType("10");
+                    tTraining.setYears(tTrainingRegular.getYear());
+                    tTraining.setCourse(tTrainingRegular.getItem());
+                    tTraining.setCourseid(tTrainingRegular.getCourseCode());
+                    tTraining.setDuration(tTrainingRegular.getHour());
+                    tTraining.setTrainer(tTrainingRegular.getLecturer());
+                    tTraining.setPosition(tTrainingRegular.getActualpostId());
+                    tTraining.setIsfinish(Long.parseLong("0"));
+                    tTraining.setDeptId(tTrainingRegular.getDeptId());
+                    tTraining.setRegularId(tTrainingRegular.getId());
+                    trainingbccService.insertTTrainingbcc(tTraining);
+                    Long trainingId = tTraining.getId();
+                    //新增人员-装置级关系
+                    // 参培岗位人员
+                    if (tTrainingRegular.getActualpostId() != null) {
+                        logger.info("参培岗位人员");
+                        TStaffmgr staffmgr = new TStaffmgr();
+                        staffmgr.setActualposts(tTrainingRegular.getActualpostId());
+                        staffmgr.setDeptId(tTrainingRegular.getDeptId());
+                        List<TStaffmgr> staffmgrs = tStaffmgrService.selectAllTStaffmgrList(staffmgr);
+                        try {
+                            //判断离职
+                            if (!StringUtils.isEmpty(tTrainingRegular.getYear())) {
+                                Iterator<TStaffmgr> iterator = staffmgrs.iterator();
+                                while (iterator.hasNext()) {
+                                    TStaffmgr t = iterator.next();
+                                    if (t.getLeftDate() != null && t.getDelFlag() == 9){
+                                        if (t.getLeftDate().getTime() - tTrainingRegular.getPlanTrainingdate().getTime() < 0l ) {
+                                            logger.debug(t.getName() + "离职时间小于培训时间");
+                                            iterator.remove();
+                                        }
+                                    }
+                                }
+                            }
+                        }catch (Exception e) {
+                            logger.error(e.toString());
+                        }
+                        for (TStaffmgr s : staffmgrs) {
+                            TTrainingbccDevice tTrainingDevice = new TTrainingbccDevice();
+                            tTrainingDevice.setStaffId(s.getStaffid());
+                            tTrainingDevice.setRegularId(trainingId);
+                            tTrainingDevice.setStartDate(tTrainingRegular.getPlanTrainingdate());
+                            tTrainingDevice.setSupplementary("0");
+                            trainingbccDeviceService.insertTTrainingbccDevice(tTrainingDevice);
+                        }
+                    }
+                    //指定岗位人员
+                    if (tTrainingRegular.getDesignatedStaff() != null) {
+                        logger.info("指定岗位人员");
+                        String[] designatedStaffs = tTrainingRegular.getDesignatedStaff().split(",");
+                        for (String staffId : designatedStaffs) {
+                            TTrainingbccDevice tTrainingDevice = new TTrainingbccDevice();
+                            tTrainingDevice.setStaffId(staffId);
+                            tTrainingDevice.setRegularId(trainingId);
+                            tTrainingDevice.setStartDate(tTrainingRegular.getPlanTrainingdate());
+                            tTrainingDevice.setSupplementary("0");
+                            trainingbccDeviceService.insertTTrainingbccDevice(tTrainingDevice);
+                        }
+                    }
+                    //涉及其他部门
+                    if (tTrainingRegular.getInvolvedMoc().equals("true")){
+                        logger.info("涉及MOC人员");
+                        TStaffmgr staffmgrMoc = new TStaffmgr();
+                        staffmgrMoc.setActualposts(tTrainingRegular.getDesignatedOther());
+                        List<TStaffmgr> staffmgrsMoc = tStaffmgrService.selectAllTStaffmgrList(staffmgrMoc);
+                        try {
+                            //判断离职
+                            if (!StringUtils.isEmpty(tTrainingRegular.getYear())) {
+                                Iterator<TStaffmgr> iterator = staffmgrsMoc.iterator();
+                                while (iterator.hasNext()) {
+                                    TStaffmgr t = iterator.next();
+                                    if (t.getLeftDate() != null && t.getDelFlag() == 9){
+                                        if (t.getLeftDate().getTime() - tTrainingRegular.getPlanTrainingdate().getTime() > 0l ) {
+                                            logger.debug(t.getName() + "离职时间小于培训时间");
+                                            iterator.remove();
+                                        }
+                                    }
+                                }
+                            }
+                        }catch (Exception e) {
+                            logger.error(e.toString());
+                        }
+                        for (TStaffmgr s : staffmgrsMoc) {
+                            TTrainingbccDevice tTrainingDevice = new TTrainingbccDevice();
+                            tTrainingDevice.setStaffId(s.getStaffid());
+                            tTrainingDevice.setRegularId(trainingId);
+                            tTrainingDevice.setStartDate(tTrainingRegular.getPlanTrainingdate());
+                            tTrainingDevice.setSupplementary("0");
+                            trainingbccDeviceService.insertTTrainingbccDevice(tTrainingDevice);
+                        }
+                    }
+            }
+        }
+        return AjaxResult.success();
+    }
+
     /**
      * 修改装置培训计划
      */

+ 9 - 0
ui/src/api/training/bccregular.js

@@ -26,6 +26,15 @@ export function addBccregular(data) {
   })
 }
 
+// 批量
+export function batchAddTraining(query) {
+  return request({
+    url: '/training/bccregular/batchAddTraining',
+    method: 'get',
+    params: query
+  })
+}
+
 // 修改装置培训计划
 export function updateBccregular(data) {
   return request({

+ 0 - 1
ui/src/views/sems/specReport/index.vue

@@ -32,7 +32,6 @@
 
     <el-table v-loading="loading" :data="specReportList" @selection-change="handleSelectionChange" :height="clientHeight" border>
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="id" align="center" prop="id" :show-overflow-tooltip="true"/>
       <el-table-column label="报告名" align="center" prop="reportName" :show-overflow-tooltip="true"/>
       <el-table-column label="报告" align="center" prop="reportUrl" :show-overflow-tooltip="true">
         <template slot-scope="scope">

+ 20 - 51
ui/src/views/shiftmgr/shiftdevelopment/index.vue

@@ -154,58 +154,11 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="developmentList" @selection-change="handleSelectionChange" :height="clientHeight" border>
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="班组" align="center" prop="team" :show-overflow-tooltip="true"/>
-      <el-table-column label="主题" align="center" prop="title" :show-overflow-tooltip="true"/>
-      <el-table-column label="地点" align="center" prop="location" :show-overflow-tooltip="true"/>
-      <el-table-column label="日期" align="center" prop="organizeDate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.organizeDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="组织人" align="center" prop="organizer" :show-overflow-tooltip="true"/>
-      <el-table-column label="参与人" align="center" prop="participants" :show-overflow-tooltip="true"/>
-      <el-table-column label="创建人" align="center" prop="createrCode" :show-overflow-tooltip="true"/>
-      <el-table-column label="创建时间" align="center" prop="createdate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createdate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="修改人" align="center" prop="updaterCode" :show-overflow-tooltip="true"/>
-      <el-table-column label="修改时间" align="center" prop="updatedate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <!--<el-table-column label="部门编号" align="center" prop="deptId" :show-overflow-tooltip="true"/>-->
-      <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['shiftmgr:development:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['shiftmgr:development:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
+      <el-calendar v-model="value"></el-calendar>
+
+
+
 
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
 
     <!-- 添加或修改班组建设对话框 -->
     <el-dialog  :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
@@ -318,6 +271,7 @@ export default {
   components: { Treeselect },
   data() {
     return {
+      value: new Date(),
       // 遮罩层
       loading: true,
       // 选中数组
@@ -540,3 +494,18 @@ export default {
   }
 };
 </script>
+<style scoped>
+.el-calendar-day {
+  width: 12.5% !important;
+}
+
+.el-calendar-table {
+  grid-template-columns: repeat(8, 1fr) !important;
+}
+
+/deep/ .el-calendar-day {
+  width: 12.5% !important;
+}
+
+</style>
+

+ 15 - 1
ui/src/views/training/bccregular/index.vue

@@ -55,6 +55,15 @@
           v-hasPermi="['training:regular:remove']"
         >{{ $t('删除') }}</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAddBatch"
+          v-hasPermi="['training:regular:add']"
+        >矩阵自动添加</el-button>
+      </el-col>
       <!--<el-col :span="1.5">
         <el-button
           type="info"
@@ -236,7 +245,7 @@
 </template>
 
 <script>
-import { listBccregular, getBccregular, delBccregular, addBccregular, updateBccregular, exportBccregular} from "@/api/training/bccregular";
+import {batchAddTraining, listBccregular, getBccregular, delBccregular, addBccregular, updateBccregular, exportBccregular} from "@/api/training/bccregular";
 import { listStaffmgr, listAllStaffmgr } from "@/api/plant/staffmgr";
 import { treeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
@@ -574,6 +583,11 @@ export default {
       });
       this.title = this.$t('添加') + this.$t('装置') +this.$t('空格') + this.$t('培训计划');
     },
+    handleAddBatch(){
+      batchAddTraining(null).then(response => {
+        this.msgSuccess('操作成功');
+      })
+    },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();