Browse Source

LY 特种设备 报告

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

+ 39 - 1
master/src/main/java/com/ruoyi/project/training/controller/TTrainingbccController.java

@@ -2,11 +2,15 @@ package com.ruoyi.project.training.controller;
 
 import java.io.IOException;
 import java.time.LocalDate;
+import java.util.Iterator;
 import java.util.List;
 
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.framework.config.RuoYiConfig;
+import com.ruoyi.project.plant.domain.TStaffmgr;
+import com.ruoyi.project.plant.service.ITStaffmgrService;
 import com.ruoyi.project.training.bccnew.domain.TTsFirstplanTmpl;
+import com.ruoyi.project.training.domain.TTrainingDevice;
 import com.ruoyi.project.training.domain.TTrainingbccDevice;
 import com.ruoyi.project.training.mapper.TTrainingbccDeviceMapper;
 import com.ruoyi.project.training.mapper.TTrainingbccMapper;
@@ -41,6 +45,8 @@ public class TTrainingbccController extends BaseController
     private TTrainingbccDeviceMapper tTrainingbccDeviceMapper;
     @Resource
     private TTrainingbccMapper tTrainingbccMapper;
+    @Autowired
+    private ITStaffmgrService tStaffmgrService;
     /**
      * 查询装置培训跟踪b列表
      */
@@ -122,7 +128,39 @@ public class TTrainingbccController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TTrainingbcc tTrainingbcc)
     {
-        return toAjax(tTrainingbccService.insertTTrainingbcc(tTrainingbcc));
+        tTrainingbccService.insertTTrainingbcc(tTrainingbcc);
+        //培训岗位人员
+        if (tTrainingbcc.getPosition() != null) {
+            TStaffmgr s = new TStaffmgr();
+            s.setActualposts(tTrainingbcc.getPosition());
+            List<TStaffmgr> trainingStaff = tStaffmgrService.selectAllTStaffmgrList(s);
+            try {
+                //判断离职
+                if (!org.apache.commons.lang.StringUtils.isEmpty(tTrainingbcc.getYears())) {
+                    Iterator<TStaffmgr> iterator = trainingStaff.iterator();
+                    while (iterator.hasNext()) {
+                        TStaffmgr t = iterator.next();
+                        if (t.getLeftDate() != null && t.getDelFlag() == 9) {
+                            if (t.getLeftDate().getTime() - tTrainingbcc.getStartDate().getTime() < 0l) {
+                                logger.debug(t.getName() + "离职时间小于培训时间");
+                                iterator.remove();
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                logger.error(e.toString());
+            }
+            for (TStaffmgr staff : trainingStaff) {
+                TTrainingbccDevice tTrainingDevice = new TTrainingbccDevice();
+                tTrainingDevice.setStaffId(staff.getStaffid());
+                tTrainingDevice.setRegularId(tTrainingbcc.getId());
+                tTrainingDevice.setStartDate(tTrainingbcc.getCourseStartdate());
+                tTrainingDevice.setSupplementary("0");
+                tTrainingbccDeviceMapper.insertTTrainingbccDevice(tTrainingDevice);
+            }
+        }
+        return toAjax(1);
     }
 
     /**

+ 1 - 0
master/src/main/resources/application-druid.yml

@@ -10,6 +10,7 @@ spring:
 #                username: newcpms
 #                password: ENC(4lATQGvNzwZ8WCAEevb5GHDx4Ov/5OKE)
                 url: jdbc:oracle:thin:@47.114.101.16:1521/xe
+#                url: jdbc:oracle:thin:@1.13.182.229/ORCLPDB
                 username: newcpms
                 password: ssy666666
 #                password: ENC(FzROaSlYiq0Qs/Ty2PthgIfQmEfze5WJ)

+ 13 - 13
master/src/main/resources/mybatis/training/TTrainingbccDeviceMapper.xml

@@ -35,19 +35,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join t_staffmgr s on s.staffid = d.staff_id
         left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
         <where>
-            <if test="staffId != null  and staffId != ''"> and staff_id = #{staffId}</if>
-            <if test="regularId != null "> and regular_id = #{regularId}</if>
-            <if test="startDate != null "> and start_date = #{startDate}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
-            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
-            <if test="createdate != null "> and createdate = #{createdate}</if>
-            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
-            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
-            <if test="supplementary != null  and supplementary != ''"> and supplementary = #{supplementary}</if>
-            <if test="learnState != null "> and learn_state = #{learnState}</if>
-            <if test="examState != null "> and exam_state = #{examState}</if>
-            <if test="examId != null "> and exam_id = #{examId}</if>
-            <if test="learnTime != null "> and learn_time = #{learnTime}</if>
+            <if test="staffId != null  and staffId != ''"> and d.staff_id = #{staffId}</if>
+            <if test="regularId != null "> and d.regular_id = #{regularId}</if>
+            <if test="startDate != null "> and d.start_date = #{startDate}</if>
+            <if test="remarks != null  and remarks != ''"> and d.remarks = #{remarks}</if>
+            <if test="createrCode != null  and createrCode != ''"> and d.creater_code = #{createrCode}</if>
+            <if test="createdate != null "> and d.createdate = #{createdate}</if>
+            <if test="updaterCode != null  and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
+            <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
+            <if test="supplementary != null  and supplementary != ''"> and d.supplementary = #{supplementary}</if>
+            <if test="learnState != null "> and d.learn_state = #{learnState}</if>
+            <if test="examState != null "> and d.exam_state = #{examState}</if>
+            <if test="examId != null "> and d.exam_id = #{examId}</if>
+            <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
             <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
             and d.del_flag = 0
         </where>

+ 9 - 7
ui/src/views/training/trainingbcc/index.vue

@@ -1191,13 +1191,15 @@ export default {
           this.form.designatedStaff = staffId;
 
           var u = null;
-          this.form.unit.forEach(function (value,key,arr) {
-            if (key != 0) {
-              u = u + "," + value;
-            }else if (key == 0) {
-              u = value;
-            }
-          })
+          if (this.form.unit){
+            this.form.unit.forEach(function (value,key,arr) {
+              if (key != 0) {
+                u = u + "," + value;
+              }else if (key == 0) {
+                u = value;
+              }
+            })
+          }
 
           var parentId = null;
           this.nonParticipants.forEach(function (value,key,arr) {