瀏覽代碼

模型评价更新

ZhuDeKang 3 月之前
父節點
當前提交
83168772e5

+ 28 - 18
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MdEstimateController.java

@@ -4,9 +4,11 @@ import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.interfaces.domain.MdEstimate;
 import com.ruoyi.interfaces.domain.MdModelInfo;
+import com.ruoyi.interfaces.domain.vo.MdEstimateListVo;
 import com.ruoyi.interfaces.domain.vo.MdEstimateMdVo;
 import com.ruoyi.interfaces.service.IMdEstimateService;
 import com.ruoyi.interfaces.service.IMdModelInfoService;
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -33,14 +36,13 @@ public class MdEstimateController extends BaseController {
      * 查询模型应用流程列表
      */
     @GetMapping("/list")
-    public AjaxResult list(MdEstimate mdEstimate)
-    {
+    public AjaxResult list(MdEstimate mdEstimate) {
         List<MdEstimate> list = mdEstimateService.selectMdEstimateList(mdEstimate);
         return success(list);
     }
 
     @GetMapping("/mdList")
-    public AjaxResult mdList( MdModelInfo mdModelInfo){
+    public AjaxResult mdList(MdModelInfo mdModelInfo) {
         ArrayList<MdModelInfo> data = new ArrayList<>();
         List<MdModelInfo> mdModelInfos = mdModelInfoService.selectMdModelInfoList(mdModelInfo);
         for (MdModelInfo modelInfo : mdModelInfos) {
@@ -56,13 +58,11 @@ public class MdEstimateController extends BaseController {
     }
 
 
-
     /**
      * 获取模型应用流程详细信息
      */
     @GetMapping(value = "/{estimateId}")
-    public AjaxResult getInfo(@PathVariable("estimateId") Integer estimateId)
-    {
+    public AjaxResult getInfo(@PathVariable("estimateId") Integer estimateId) {
         return success(mdEstimateService.selectMdEstimateByEstimateId(estimateId));
     }
 
@@ -71,33 +71,44 @@ public class MdEstimateController extends BaseController {
      */
     @Log(title = "模型应用流程", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody List<MdEstimate> mdEstimates)
-    {
+    public AjaxResult add(@RequestBody List<MdEstimate> mdEstimates) {
 
 
         mdEstimates = mdEstimates.stream()
-                .filter(p-> StringUtils.isNotNull(p.getMdid()))
-                .filter(p-> StringUtils.isNotNull(p.getEstimateScore()))
-                .filter(p-> StringUtils.isNotNull(p.getEstimateType()))
-                .filter(p-> StringUtils.isNotNull(p.getEstimateTime()))
-                        .collect(Collectors.toList());
+                .filter(p -> StringUtils.isNotNull(p.getMdid()))
+                .filter(p -> StringUtils.isNotNull(p.getEstimateScore()))
+                .filter(p -> StringUtils.isNotNull(p.getEstimateType()))
+                .filter(p -> StringUtils.isNotNull(p.getEstimateTime()))
+                .collect(Collectors.toList());
         if (StringUtils.isEmpty(mdEstimates)) {
             return AjaxResult.error();
         }
         MdEstimate mdEstimate = mdEstimates.get(0);
         mdEstimateService.deleteMdEstimateByMdidAndEstimateTime(mdEstimate);
+        Date createTime = DateUtils.getDateDD(DateUtils.getNowDate());
+
+        mdEstimates.forEach(
+                p -> {
+                    p.setCreateBy(getUsername());
+                    p.setCreateTime(createTime);
+                    mdEstimateService.insertMdEstimate(p);
+                }
+        );
 
-        mdEstimates.forEach(mdEstimateService::insertMdEstimate);
         return toAjax(1);
     }
 
+    @GetMapping("/getEstimateLog")
+    public AjaxResult getEstimateLog( MdEstimateListVo estimateListVo){
+        return success(mdEstimateService.selectEstimateLog(estimateListVo));
+    }
+
     /**
      * 修改模型应用流程
      */
     @Log(title = "模型应用流程", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody MdEstimate mdEstimate)
-    {
+    public AjaxResult edit(@RequestBody MdEstimate mdEstimate) {
         return toAjax(mdEstimateService.updateMdEstimate(mdEstimate));
     }
 
@@ -106,8 +117,7 @@ public class MdEstimateController extends BaseController {
      */
     @Log(title = "模型应用流程", businessType = BusinessType.DELETE)
     @DeleteMapping("/{estimateIds}")
-    public AjaxResult remove(@PathVariable Long[] estimateIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] estimateIds) {
         return toAjax(mdEstimateService.deleteMdEstimateByEstimateIds(estimateIds));
     }
 }

+ 42 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/vo/MdEstimateListVo.java

@@ -0,0 +1,42 @@
+package com.ruoyi.interfaces.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.interfaces.domain.MdEstimate;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class MdEstimateListVo {
+
+    private String mdid;
+    /**
+     * 评价年份,;
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date estimateTime;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createTime;
+
+    /**
+     * 0 直接认定;1 = 评分认定
+     * 认定类型,;
+     */
+    private String firmlyType;
+    /**
+     *
+     *
+     * 认定状态,;
+     */
+    private String firmlyState;
+
+
+    private List<MdEstimate> mdEstimates;
+}

+ 3 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/MdEstimateMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.interfaces.mapper;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.interfaces.domain.MdEstimate;
+import com.ruoyi.interfaces.domain.vo.MdEstimateListVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -66,4 +67,6 @@ public interface MdEstimateMapper
     public int deleteMdEstimateByEstimateIds(Long[] estimateIds);
 
     int deleteMdEstimateByMdidAndEstimateTime(MdEstimate mdEstimate);
+
+    List<MdEstimateListVo> selectEstimateLog(MdEstimateListVo estimateListVo);
 }

+ 3 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IMdEstimateService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.interfaces.service;
 
 import com.ruoyi.interfaces.domain.MdEstimate;
+import com.ruoyi.interfaces.domain.vo.MdEstimateListVo;
 
 import java.util.List;
 
@@ -55,4 +56,6 @@ public interface IMdEstimateService {
     public int deleteMdEstimateByEstimateId(Long estimateId);
 
     int deleteMdEstimateByMdidAndEstimateTime(MdEstimate mdEstimate);
+
+    List<MdEstimateListVo> selectEstimateLog(MdEstimateListVo estimateListVo);
 }

+ 8 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdEstimateServiceImpl.java

@@ -2,11 +2,13 @@ package com.ruoyi.interfaces.service.impl;
 
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.interfaces.domain.MdEstimate;
+import com.ruoyi.interfaces.domain.vo.MdEstimateListVo;
 import com.ruoyi.interfaces.mapper.MdEstimateMapper;
 import com.ruoyi.interfaces.service.IMdEstimateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 @Service
@@ -93,4 +95,10 @@ public class MdEstimateServiceImpl implements IMdEstimateService {
     public int deleteMdEstimateByMdidAndEstimateTime(MdEstimate mdEstimate) {
         return mdEstimateMapper.deleteMdEstimateByMdidAndEstimateTime(mdEstimate);
     }
+
+    @Override
+    public List<MdEstimateListVo> selectEstimateLog(MdEstimateListVo estimateListVo) {
+
+        return mdEstimateMapper.selectEstimateLog(estimateListVo);
+    }
 }

+ 64 - 18
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdEstimateMapper.xml

@@ -5,29 +5,40 @@
 <mapper namespace="com.ruoyi.interfaces.mapper.MdEstimateMapper">
 
     <resultMap type="com.ruoyi.interfaces.domain.MdEstimate" id="MdEstimateResult">
-        <result property="estimateId"    column="estimate_id"    />
-        <result property="mdid"    column="mdid"    />
-        <result property="estimateScore"    column="estimate_score"    />
-        <result property="estimateType"    column="estimate_type"    />
-        <result property="remark"    column="remark"    />
-        <result property="estimateTime"    column="estimate_time"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
+        <result property="estimateId" column="estimate_id"/>
+        <result property="mdid" column="mdid"/>
+        <result property="estimateScore" column="estimate_score"/>
+        <result property="estimateType" column="estimate_type"/>
+        <result property="remark" column="remark"/>
+        <result property="estimateTime" column="estimate_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
     </resultMap>
 
     <sql id="selectMdEstimateVo">
-        select estimate_id, mdid, estimate_score, estimate_type, remark, estimate_time, create_by, create_time, update_by, update_time from md_estimate
+        select estimate_id,
+               mdid,
+               estimate_score,
+               estimate_type,
+               remark,
+               estimate_time,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from md_estimate
     </sql>
 
-    <select id="selectMdEstimateList" parameterType="com.ruoyi.interfaces.domain.MdEstimate" resultMap="MdEstimateResult">
+    <select id="selectMdEstimateList" parameterType="com.ruoyi.interfaces.domain.MdEstimate"
+            resultMap="MdEstimateResult">
         <include refid="selectMdEstimateVo"/>
         <where>
-            <if test="mdid != null  and mdid != ''"> and mdid = #{mdid}</if>
-            <if test="estimateScore != null  and estimateScore != ''"> and estimate_score = #{estimateScore}</if>
-            <if test="estimateType != null  and estimateType != ''"> and estimate_type = #{estimateType}</if>
-            <if test="estimateTime != null "> and estimate_time = #{estimateTime}</if>
+            <if test="mdid != null  and mdid != ''">and mdid = #{mdid}</if>
+            <if test="estimateScore != null  and estimateScore != ''">and estimate_score = #{estimateScore}</if>
+            <if test="estimateType != null  and estimateType != ''">and estimate_type = #{estimateType}</if>
+            <if test="estimateTime != null ">and estimate_time = #{estimateTime}</if>
         </where>
     </select>
 
@@ -36,7 +47,40 @@
         where estimate_id = #{estimateId}
     </select>
 
-    <insert id="insertMdEstimate" parameterType="com.ruoyi.interfaces.domain.MdEstimate" useGeneratedKeys="true" keyProperty="estimateId">
+
+    <resultMap id="MdEstimateListVoMap" type="com.ruoyi.interfaces.domain.vo.MdEstimateListVo">
+        <result property="mdid" column="mdid"/>
+        <result property="estimateTime" column="estimate_Time"/>
+        <result property="createBy" column="create_By"/>
+        <result property="createTime" column="create_Time"/>
+        <result property="firmlyType" column="firmly_Type"/>
+        <result property="firmlyState" column="firmly_State"/>
+        <collection property="mdEstimates" ofType="com.ruoyi.interfaces.domain.MdEstimate"
+                    resultMap="MdEstimateResult"/>
+    </resultMap>
+
+
+    <select id="selectEstimateLog" resultMap="MdEstimateListVoMap" >
+        SELECT e.mdid,
+        e.estimate_Time,
+        e.create_By,
+        e.create_Time,
+        ef.firmly_Type,
+        ef.firmly_State,
+        e.ESTIMATE_TYPE,
+        e.ESTIMATE_SCORE,
+        e.REMARK
+        FROM md_estimate e
+        LEFT JOIN md_estimate_firmly ef ON e.mdid = ef.mdid AND e.ESTIMATE_time = ef.firmly_Yr
+        <where>
+            <if test="mdid != null  and mdid != ''">and e.mdid = #{mdid}</if>
+            <if test="estimateTime != null ">and e.estimate_time = #{estimateTime}</if>
+            <if test="createBy != null">and e.create_By = #{createBy}</if>
+        </where>
+    </select>
+
+    <insert id="insertMdEstimate" parameterType="com.ruoyi.interfaces.domain.MdEstimate" useGeneratedKeys="true"
+            keyProperty="estimateId">
         insert into md_estimate
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="mdid != null">mdid,</if>
@@ -79,7 +123,9 @@
     </update>
 
     <delete id="deleteMdEstimateByEstimateId" parameterType="Long">
-        delete from md_estimate where estimate_id = #{estimateId}
+        delete
+        from md_estimate
+        where estimate_id = #{estimateId}
     </delete>
 
     <delete id="deleteMdEstimateByEstimateIds" parameterType="String">