Quellcode durchsuchen

王子文 专项培养

wangggziwen vor 3 Jahren
Ursprung
Commit
b3d8c07337

+ 22 - 17
master/src/main/java/com/ruoyi/project/training/spec/controller/TStFeedbackController.java

@@ -145,7 +145,9 @@ public class TStFeedbackController extends BaseController
         BigDecimal avg = new BigDecimal("0.0");    // 子节点平均分
         BigDecimal overall = new BigDecimal("0.0");    // 季度平均分
         for (TStFeedback childNode : childNodes) {
-            count = count.add(new BigDecimal("1.0"));
+            if (childNode.getFeedbackScore()!=null) {
+                count = count.add(new BigDecimal("1.0"));
+            }
             sum = sum.add(new BigDecimal(childNode.getFeedbackScore()==null?"0.0":childNode.getFeedbackScore()));
         }
         // 计算子节点平均分
@@ -157,7 +159,7 @@ public class TStFeedbackController extends BaseController
             overall = new BigDecimal(parentNode.getFeedbackScore());
         } else {    // 父节点占比60%,子节点平均分占比40%
             overall = (new BigDecimal(parentNode.getFeedbackScore()).multiply(new BigDecimal("0.6")))
-                    .add(avg.multiply(new BigDecimal("0.4")));
+                    .add(avg.multiply(new BigDecimal("0.4"))).divide(new BigDecimal("1.0"),1,BigDecimal.ROUND_HALF_UP);
         }
         parentNode.setOverallScore(overall.toString());
         // 更新季度平均分
@@ -546,24 +548,27 @@ public class TStFeedbackController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody TStFeedback tStFeedback) throws PinyinException {
         TStFeedback feedback = tStFeedbackService.selectTStFeedbackById(tStFeedback.getId());
-        // 反馈类型为季度反馈
-        if (feedback.getFeedbackType() == 2) {
-            // 根据学员staffId获取用户对象
-            SysUser successor = sysUserService.selectUserByStaffId(feedback.getSuccessorId());
-            String email = successor.getEmail();
-            String successorName = successor.getNickName();
-            String successorNameEN = PinyinHelper.convertToPinyinString(successorName, " ", PinyinFormat.WITHOUT_TONE);
-            String feedbackYear = feedback.getFeedbackYear();
-            String feedbackMonth = feedback.getFeedbackMonth();
-            // 根据导师staffId获取用户对象
-            SysUser mentor = sysUserService.selectUserByStaffId(feedback.getMentorId());
-            String mentorName = mentor.getNickName();
-            String mentorNameEN = PinyinHelper.convertToPinyinString(mentorName, " ", PinyinFormat.WITHOUT_TONE);
-            // TODO: 部署前开启
-            // 邮件通知学员
+        Long feedbackType = feedback.getFeedbackType();
+        if (feedbackType != null) {
+            // 反馈类型为季度反馈
+            if (feedback.getFeedbackType() == 2) {
+                // 根据学员staffId获取用户对象
+                SysUser successor = sysUserService.selectUserByStaffId(feedback.getSuccessorId());
+                String email = successor.getEmail();
+                String successorName = successor.getNickName();
+                String successorNameEN = PinyinHelper.convertToPinyinString(successorName, " ", PinyinFormat.WITHOUT_TONE);
+                String feedbackYear = feedback.getFeedbackYear();
+                String feedbackMonth = feedback.getFeedbackMonth();
+                // 根据导师staffId获取用户对象
+                SysUser mentor = sysUserService.selectUserByStaffId(feedback.getMentorId());
+                String mentorName = mentor.getNickName();
+                String mentorNameEN = PinyinHelper.convertToPinyinString(mentorName, " ", PinyinFormat.WITHOUT_TONE);
+                // TODO: 部署前开启
+                // 邮件通知学员
 //            MonthlyFeedbackMailThread monthlyFeedbackMailThread = new MonthlyFeedbackMailThread(mailService, email, successorName, successorNameEN, mentorName, mentorNameEN, feedbackYear, feedbackMonth);
 //            Thread thread = new Thread(monthlyFeedbackMailThread);
 //            thread.start();
+            }
         }
         return toAjax(tStFeedbackService.updateTStFeedback(tStFeedback));
     }

+ 12 - 0
master/src/main/java/com/ruoyi/project/training/spec/controller/TStYearplanController.java

@@ -10,6 +10,7 @@ import com.ruoyi.project.training.spec.domain.vo.TStYearPlanExportVO;
 import com.ruoyi.project.training.spec.mapper.TStPlanMapper;
 import com.ruoyi.project.training.spec.mapper.TStYearplanMapper;
 import com.ruoyi.project.training.spec.service.ITStFeedbackService;
+import com.ruoyi.project.training.spec.service.ITStPlanService;
 import com.ruoyi.project.training.spec.service.ITStSuccessorService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -171,6 +172,17 @@ public class TStYearplanController extends BaseController
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
+        // 王子文 2022年5月31日 修改
+        for (int i = 0; i < ids.length; i++) {
+            TStYearplan yearplan = tStYearplanService.selectTStYearplanById(ids[i]);
+            TStFeedback queryObj = new TStFeedback();
+            queryObj.setSuccessorId(yearplan.getStaffId());
+            queryObj.setFeedbackYear(yearplan.getPlanYear().toString());
+            List<TStFeedback> result = feedbackService.selectTStFeedbackList(queryObj);
+            for (TStFeedback feedback : result) {
+                feedbackService.deleteTStFeedbackById(feedback.getId());
+            }
+        }
         return toAjax(tStYearplanService.deleteTStYearplanByIds(ids));
     }
 }

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

@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="mentorId != null  and mentorId != ''"> and mentor_id = #{mentorId}</if>
             and parent_id is not null
+            and d.del_flag = 0
         </where>
     </select>
 
@@ -73,9 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="feedbackScore != null  and feedbackScore != ''"> and feedback_score = #{feedbackScore}</if>
             <if test="feedbackStatus != null "> and feedback_status = #{feedbackStatus}</if>
             <if test="meetingDate != null "> and meeting_date = #{meetingDate}</if>
+            and d.del_flag = 0
         </where>
         order by d.successor_id asc, d.feedback_year desc, d.feedback_season,
-       to_number(replace(d.feedback_month,',','')) asc
+        to_number(replace(d.feedback_month,',','')) asc
     </select>
 
     <select id="selectTStFeedbackByParams" parameterType="TStFeedback" resultMap="TStFeedbackResult">
@@ -96,17 +98,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="meetingDate != null "> and meeting_date = #{meetingDate}</if>
             <if test="parentId != null and parentId !=''"> and parent_id = #{parentId} </if>
             <if test="parentId == null or parentId == ''"> and parent_id is null </if>
+            and d.del_flag = 0
         </where>
     </select>
 
     <select id="selectTStFeedbackByPlanId" parameterType="Long" resultMap="TStFeedbackResult">
         <include refid="selectTStFeedbackVo"/>
         where plan_id = #{planId}
+        and d.del_flag = 0
     </select>
 
     <select id="selectTStFeedbackById" parameterType="Long" resultMap="TStFeedbackResult">
         <include refid="selectTStFeedbackVo"/>
         where id = #{id}
+        and d.del_flag = 0
     </select>
         
     <insert id="insertTStFeedback" parameterType="TStFeedback">

+ 36 - 34
ui/src/views/training/spec/plan/index.vue

@@ -416,40 +416,42 @@
     <!-- 反馈对话框 -->
     <el-dialog v-dialogDrag :title="feedbackDialog.title" :visible.sync="feedbackDialog.open" width="800px" append-to-body>
       <div style="width:700px; margin:0px auto;">
-        <h3 style="margin-bottom:20px;">学员心得</h3>
-        <el-table :data="tableData" border style="width: 100%">
-          <el-table-column prop="id" label="编号" width="50"></el-table-column>
-          <el-table-column prop="question" label="问题" width="250"></el-table-column>
-          <el-table-column prop="answer" label="答案"></el-table-column>
-        </el-table>
-        <el-table :data="docFeedback.commonfileList" border>
-          <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
-            <template slot-scope="scope">
-              <a  class="link-type"  @click="handleDownload(scope.row)">
-                <span>{{ scope.row.fileName }}</span>
-              </a>
-            </template>
-          </el-table-column>
-          <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
-          <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
-          <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
-            <template slot-scope="scope">
-              <el-button
-                v-if="scope.row.fileName.endsWith('pdf')"
-                size="mini"
-                type="text"
-                icon="el-icon-view"
-                @click="handleSee(scope.row)"
-              >{{ $t('预览') }}</el-button>
-              <el-button
-                size="mini"
-                type="text"
-                icon="el-icon-download"
-                @click="handleDownload(scope.row)"
-              >{{ $t('下载') }}</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
+        <div v-if="feedbackDialog.studyState != 0">
+          <h3 style="margin-bottom:20px;">学员心得</h3>
+          <el-table :data="tableData" border style="width: 100%">
+            <el-table-column prop="id" label="编号" width="50"></el-table-column>
+            <el-table-column prop="question" label="问题" width="250"></el-table-column>
+            <el-table-column prop="answer" label="答案"></el-table-column>
+          </el-table>
+          <el-table :data="docFeedback.commonfileList" border>
+            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
+              <template slot-scope="scope">
+                <a  class="link-type"  @click="handleDownload(scope.row)">
+                  <span>{{ scope.row.fileName }}</span>
+                </a>
+              </template>
+            </el-table-column>
+            <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
+            <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
+            <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
+              <template slot-scope="scope">
+                <el-button
+                  v-if="scope.row.fileName.endsWith('pdf')"
+                  size="mini"
+                  type="text"
+                  icon="el-icon-view"
+                  @click="handleSee(scope.row)"
+                >{{ $t('预览') }}</el-button>
+                <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-download"
+                  @click="handleDownload(scope.row)"
+                >{{ $t('下载') }}</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
         <el-form v-if="feedbackDialog.studyState == 2">
           <h3 style="margin-top:30px;margin-bottom:20px;">导师反馈</h3>
           <el-form-item>