shi'sen'yuan 3 năm trước cách đây
mục cha
commit
ba5b6910a3

+ 32 - 29
master/src/main/java/com/ruoyi/project/training/controller/TTrainingCompanylevelController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.project.training.controller;
 
+import java.util.Date;
 import java.util.List;
 
 import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
@@ -64,35 +65,14 @@ public class TTrainingCompanylevelController extends BaseController
         return getDataTable(list);
     }
     /**
-     * 查询公司级培训列表
+     * 更新培训成绩
      */
     @GetMapping("/updateScore")
     public AjaxResult updateScore(TTrainingCompanylevel tTrainingCompanylevel)
     {
-//        List<TTrainingParticipants> list = tTrainingParticipantsMapper.selectTTrainingParticipantsListTask(new TTrainingParticipants());
-//        for (TTrainingParticipants t : list
-//        ) {
-//            TTrainingHisparticipants th = new TTrainingHisparticipants();
-//            th.setCompanyId(t.getCompanyId());
-//            th.setStaffId(t.getStaffId());
-//            List<TTrainingHisparticipants> hislist = tTrainingHisparticipantsMapper.selectTTrainingHisparticipantsListTask(th);
-//            if (hislist!= null && hislist.size() > 0){
-//                TTrainingHisparticipants hisparticipant = hislist.get(0);
-//                t.setBudget(hisparticipant.getBudget());
-//                t.setEndDate(hisparticipant.getEndDate());
-//                t.setStartDate(hisparticipant.getStartDate());
-//                t.setOperationScore(hisparticipant.getOperationScore());
-//                t.setScore(hisparticipant.getScore());
-//                t.setRemarks(hisparticipant.getRemarks());
-//                t.setTrainingCost(hisparticipant.getTrainingCost());
-//                t.setTrainingDuration(hisparticipant.getTrainingDuration());
-//                t.setTrainingPlace(hisparticipant.getTrainingPlace());
-//                int i = tTrainingParticipantsService.updateTTrainingParticipants(t);
-//            }
-//        }
         List<TTrainingHisparticipants> hislist = tTrainingHisparticipantsMapper.selectTTrainingHisparticipantsListTask(new TTrainingHisparticipants());
-        for (TTrainingHisparticipants hisparticipant:hislist
-             ) {
+        List<TTrainingCompanylevel> companylevels = tTrainingCompanylevelService.selectTTrainingCompanylevelList(new TTrainingCompanylevel());
+        for (TTrainingHisparticipants hisparticipant : hislist) {
             if (hisparticipant.getCompanyId() == null) {
                 continue;
             }
@@ -108,14 +88,37 @@ public class TTrainingCompanylevelController extends BaseController
             t.setTrainingCost(hisparticipant.getTrainingCost());
             t.setTrainingDuration(hisparticipant.getTrainingDuration());
             t.setTrainingPlace(hisparticipant.getTrainingPlace());
-            int i = tTrainingParticipantsMapper.updateTTrainingParticipantsByStaffAndCom(t);
-            if (i == 0) {
-                tTrainingParticipantsMapper.insertTTrainingParticipants(t);
+            t.setDelFlag(0l);
+            int i = 0 ;
+            for (TTrainingCompanylevel companylevel : companylevels){
+                if (companylevel.getId().equals(hisparticipant.getCompanyId())) {
+                    if (companylevel.getFrequency() != null) {
+                        Long frequency = Long.parseLong(companylevel.getFrequency()) * 365 * 24 * 3600 * 1000;
+                        Long validPeriod = hisparticipant.getStartDate().getTime() + frequency;
+                        Long nowDate = new Date().getTime();
+                        if (validPeriod <= nowDate) {
+                            TTrainingParticipants delParticipants = new TTrainingParticipants();
+                            delParticipants.setCompanyId(hisparticipant.getCompanyId());
+                            delParticipants.setStaffId(hisparticipant.getStaffId());
+                            delParticipants.setDelFlag(2l);
+                            tTrainingParticipantsMapper.updateTTrainingParticipantsByStaffAndCom(delParticipants);
+                        }else {
+                            i = tTrainingParticipantsMapper.updateTTrainingParticipantsByStaffAndCom(t);
+                            if (i == 0) {
+                                tTrainingParticipantsMapper.insertTTrainingParticipants(t);
+                            }
+                        }
+                    }else {
+                        i = tTrainingParticipantsMapper.updateTTrainingParticipantsByStaffAndCom(t);
+                        if (i == 0) {
+                            tTrainingParticipantsMapper.insertTTrainingParticipants(t);
+                        }
+                    }
+                }
             }
         }
         List<TTrainingCompanylevel> list1 = tTrainingCompanylevelService.selectTTrainingCompanylevelList(tTrainingCompanylevel);
-        for (TTrainingCompanylevel t: list1
-             ) {
+        for (TTrainingCompanylevel t : list1) {
             if (t.getStaffId() != null) {
                 String[] newStaffs = t.getStaffId().split(",");
                 for (String s : newStaffs) {

+ 7 - 0
master/src/main/java/com/ruoyi/project/training/controller/TTrainingParticipantsController.java

@@ -84,6 +84,13 @@ public class TTrainingParticipantsController extends BaseController
             companyDate.add(tTrainingCompanylevels.get(i).getCourseCode());
             company.add(tTrainingCompanylevels.get(i).getItem());
             companyDate.add(tTrainingCompanylevels.get(i).getItem());
+            if (tTrainingCompanylevels.get(i).getFrequency() != null) {
+                company.add("每" + tTrainingCompanylevels.get(i).getFrequency() + "年一次");
+                companyDate.add("每" + tTrainingCompanylevels.get(i).getFrequency() + "年一次");
+            }else {
+                company.add("一次");
+                companyDate.add("一次");
+            }
             for (TStaffmgr s : staffmgrs) {
                 //按人员筛
                 int m = 0;

+ 8 - 0
master/src/main/java/com/ruoyi/project/training/domain/TTrainingCompanylevel.java

@@ -32,6 +32,10 @@ public class TTrainingCompanylevel extends BaseEntity
     @Excel(name = "课程名称")
     private String item;
 
+    /** 培训频率 */
+    @Excel(name = "培训频率")
+    private String frequency;
+
     /** 需参会人员员工号 */
     @Excel(name = "需参会人员员工号")
     private String staffId;
@@ -98,6 +102,9 @@ public class TTrainingCompanylevel extends BaseEntity
     {
         return item;
     }
+    public void setFrequency(String frequency) { this.frequency = frequency; }
+
+    public String getFrequency() { return frequency; }
     public void setStaffId(String staffId)
     {
         this.staffId = staffId;
@@ -195,6 +202,7 @@ public class TTrainingCompanylevel extends BaseEntity
             .append("updaterCode", getUpdaterCode())
             .append("updatedate", getUpdatedate())
             .append("deptId", getDeptId())
+            .append("frequency", getFrequency())
             .toString();
     }
 }

+ 7 - 0
master/src/main/java/com/ruoyi/project/training/domain/TTrainingParticipants.java

@@ -88,6 +88,10 @@ public class TTrainingParticipants extends BaseEntity
     @Excel(name = "课程代码")
     private String courseCode;
 
+    /** 培训频率 */
+    @Excel(name = "培训频率")
+    private String frequency;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -253,6 +257,9 @@ public class TTrainingParticipants extends BaseEntity
     {
         return courseCode;
     }
+    public void setFrequency(String frequency) { this.frequency = frequency; }
+
+    public String getFrequency() { return frequency; }
 
     @Override
     public String toString() {

+ 6 - 1
master/src/main/resources/mybatis/training/TTrainingCompanylevelMapper.xml

@@ -16,12 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createdate"    column="createdate"    />
         <result property="updaterCode"    column="updater_code"    />
         <result property="updatedate"    column="updatedate"    />
+        <result property="frequency"    column="frequency"    />
         <result property="deptId"    column="dept_id"    />
         <result property="deptName" column="dept_name" />
     </resultMap>
 
     <sql id="selectTTrainingCompanylevelVo">
-        select d.id, d.serial_num, d.course_code, d.item, d.staff_id, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id ,s.dept_name from t_training_companylevel d
+        select d.id, d.serial_num, d.course_code, d.item, d.staff_id, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.frequency ,s.dept_name from t_training_companylevel d
       left join sys_dept s on s.dept_id = d.dept_id
     </sql>
 
@@ -62,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createdate != null">createdate,</if>
             <if test="updaterCode != null">updater_code,</if>
             <if test="updatedate != null">updatedate,</if>
+            <if test="frequency != null">frequency,</if>
             <if test="deptId != null">dept_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -76,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createdate != null">#{createdate},</if>
             <if test="updaterCode != null">#{updaterCode},</if>
             <if test="updatedate != null">#{updatedate},</if>
+            <if test="frequency != null">#{frequency},</if>
             <if test="deptId != null">#{deptId},</if>
          </trim>
     </insert>
@@ -94,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createdate != null">createdate = #{createdate},</if>
             <if test="updaterCode != null">updater_code = #{updaterCode},</if>
             <if test="updatedate != null">updatedate = #{updatedate},</if>
+            <if test="frequency != null">frequency = #{frequency},</if>
+            <if test="frequency == null">frequency = NULL,</if>
             <if test="deptId != null">dept_id = #{deptId},</if>
         </trim>
         where id = #{id}

+ 2 - 1
master/src/main/resources/mybatis/training/TTrainingParticipantsMapper.xml

@@ -23,11 +23,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updaterCode"    column="updater_code"    />
         <result property="updatedate"    column="updatedate"    />
         <result property="companyItem"    column="item"    />
+        <result property="frequency"    column="frequency"    />
         <result property="courseCode"    column="course_code"    />
     </resultMap>
 
     <sql id="selectTTrainingParticipantsVo">
-        select d.id, d.staff_id, d.company_id, s.item, s.course_code, d.start_date, d.end_date, d.score, d.operation_score, d.training_place, d.training_duration, d.training_cost, d.budget, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate from t_training_participants d
+        select d.id, d.staff_id, d.company_id, s.item, s.frequency, s.course_code, d.start_date, d.end_date, d.score, d.operation_score, d.training_place, d.training_duration, d.training_cost, d.budget, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate from t_training_participants d
         left join t_training_companylevel s on d.company_id = s.id
     </sql>
 

+ 3 - 2
ui/src/lang/en.js

@@ -1,8 +1,8 @@
 // en.js
 export default {
   login: {
-    title: 'Chemical Plant Management System',
-    logo: 'CPMS',
+    title: '系统测试平台',
+    logo: 'SSY',
     logIn: 'Log in',
     username: 'Username',
     password: 'Password',
@@ -831,6 +831,7 @@ export default {
   需要培训: 'Needs Training',
   '当被此项目涉及到时,如MOC、事件调查,需要培训': 'When involved in this project, such as MOC, incident investigation, training is needed',
   频率: 'Frequency',
+  是否需要重复培训: 'Repeat training?',
   责任部门: 'Responsible Department',
   指定人员岗位: 'Designated Personnel Position',
   培训矩阵: 'Training Matrix',

+ 3 - 2
ui/src/lang/zh.js

@@ -1,8 +1,8 @@
 // zh.js
 export default {
   login: {
-    title: 'CPMS管理系统',
-    logo: 'CPMS管理系统',
+    title: '系统测试平台',
+    logo: '系统测试平台',
     logIn: '登  录',
     username: '账号',
     password: '密码',
@@ -831,6 +831,7 @@ export default {
   需要培训: '需要培训',
   '当被此项目涉及到时,如MOC、事件调查,需要培训': '当被此项目涉及到时,如MOC、事件调查,需要培训',
   频率: '频率',
+  是否需要重复培训: '是否需要重复培训',
   责任部门: '责任部门',
   指定人员岗位: '指定人员岗位',
   培训矩阵: '培训矩阵',

+ 2 - 2
ui/src/views/login.vue

@@ -153,8 +153,8 @@ export default {
   justify-content: center;
   align-items: center;
   height: 100%;
-  background-image: url("../assets/image/CPMS20210107.jpg");
-  //background-image: url("../assets/image/login-background.jpg");
+  //background-image: url("../assets/image/CPMS20210107.jpg");
+  background-image: url("../assets/image/CPMS20211128.jpg");
   background-size: cover;
 }
 .title {

+ 34 - 1
ui/src/views/training/companylevel/index.vue

@@ -114,7 +114,13 @@
       <el-table-column :label="$t('序号')" align="center" prop="serialNum" width="70" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('课程代码')" align="center" prop="courseCode" width="150" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('课程名称')" align="center" prop="item" width="500" :show-overflow-tooltip="true"/>
-      <el-table-column :label="$t('参会人员名单')" align="center" prop="staffId" width="500" :show-overflow-tooltip="true"/>
+      <el-table-column :label="$t('频率')" align="center" prop="frequency" width="100" :show-overflow-tooltip="true" >
+        <template slot-scope="scope">
+          <span v-if="scope.row.frequency !== null">每{{scope.row.frequency}}年一次</span>
+          <span v-else>一次</span>
+        </template>
+      </el-table-column>
+      <el-table-column :label="$t('参会人员名单')" align="center" prop="staffId" width="400" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('备注')" align="center" prop="remarks" width="300" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('操作')" align="center" fixed="right" width="300" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -162,6 +168,20 @@
         <el-form-item :label="$t('课程名称')" prop="item">
           <el-input v-model="form.item" :placeholder="$t('请输入') + $t('课程名称')" />
         </el-form-item>
+        <el-row>
+          <el-col :span="8">
+            <el-form-item :label="$t('是否需要重复培训')" prop="needFrequency" label-width="125px">
+              <el-checkbox v-model="needFrequency"></el-checkbox>
+            </el-form-item>
+          </el-col>
+          <el-col :span="16">
+            <el-form-item :label="$t('频率')" prop="frequency" v-if="needFrequency === true">
+              每
+              <el-input-number v-model="form.frequency" controls-position="right" :min="1" :max="10" size="mini"></el-input-number>
+              年一次
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-form-item :label="$t('参会人员名单')" prop="staffId">
           <el-input v-model="form.staffId" :placeholder="$t('请输入') + $t('参会人员名单')" />
         </el-form-item>
@@ -340,6 +360,8 @@ export default {
       stffmgrOptions: undefined,
       // 表单参数
       form: {},
+      //是否需要重复培训
+      needFrequency: '',
       // 表单校验
       rules: {
         deptId: [
@@ -425,6 +447,7 @@ export default {
         createdate: null,
         updaterCode: null,
         updatedate: null,
+        frequency: null,
         deptId: null
       };
       this.resetForm("form");
@@ -501,6 +524,7 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
+      this.needFrequency = false;
       this.title = this.$t('新增') + this.$t('空格') + this.$t('公司级培训');
     },
     /** 修改按钮操作 */
@@ -509,6 +533,12 @@ export default {
       const id = row.id || this.ids
       getCompanylevel(id).then(response => {
         this.form = response.data;
+        //是否需要重复培训内容
+        if (this.form.frequency != null) {
+          this.needFrequency = true;
+        }else {
+          this.needFrequency = false;
+        }
         this.open = true;
         this.title = this.$t('修改') + this.$t('公司级培训');
       });
@@ -532,6 +562,9 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          if (this.needFrequency === false) {
+            this.form.frequency = null
+          }
           if (this.form.id != null) {
             updateCompanylevel(this.form).then(response => {
               this.msgSuccess(this.$t('修改成功'));

+ 14 - 1
ui/src/views/training/trainingrecords/index.vue

@@ -390,10 +390,15 @@
             {{scope.row[1]}}
           </template>
         </el-table-column>
+        <el-table-column :label="$t('频率')" align="center" width="120" fixed>
+          <template slot-scope="scope">
+            {{scope.row[2]}}
+          </template>
+        </el-table-column>
         <el-table-column v-for="(item, index) in transTitle" width="150" :label="item.actualpost" :key="index" align="center">
           <el-table-column width="150" :label="item.name" :key="index" align="center">
             <template slot-scope="scope">
-              {{scope.row[index + 2]}}
+              {{scope.row[index + 3]}}
             </template>
           </el-table-column>
         </el-table-column>
@@ -918,6 +923,14 @@ export default {
           colspan: _col
         };
       }
+      if (columnIndex === 2 ) {
+        const _row = this.setTable(this.companylevelList).merge[rowIndex];
+        const _col = _row > 0 ? 1 : 0;
+        return {
+          rowspan: _row,
+          colspan: _col
+        };
+      }
     },
     colspanDeviceMethod({ row, column, rowIndex, columnIndex }) {
       if (columnIndex === 0) {