瀏覽代碼

专家库,临时计划 修改

sunhh 2 年之前
父節點
當前提交
304f1f7efd

+ 1 - 2
purchase-admin/src/main/java/com/ozs/web/controller/plan/ProvisionalPlanController.java

@@ -138,8 +138,7 @@ public class ProvisionalPlanController extends BaseController {
         if (StringUtils.isNull(provisionalPlanVo) || StringUtils.isNull(provisionalPlanVo.getPlanPracticalId())) {
             throw new ServiceException("id不能为空!");
         }
-        ProvisionalPlan provisionalPlan = provisionalPlanService.seletById(provisionalPlanVo.getPlanPracticalId());
-        return success(provisionalPlan);
+        return provisionalPlanService.seletById(provisionalPlanVo.getPlanPracticalId());
     }
 
     @ApiOperation(value = "导入临时计划")

+ 5 - 0
purchase-system/src/main/java/com/ozs/plan/doman/vo/requestVo/ProvisionalPlanVo.java

@@ -3,6 +3,7 @@ package com.ozs.plan.doman.vo.requestVo;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ozs.common.vo.PageVo;
+import com.ozs.system.domain.SysFileInfo;
 import com.ozs.system.domain.SysFileRef;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -21,6 +22,10 @@ public class ProvisionalPlanVo extends PageVo {
      * 上传附件
      */
     private List<SysFileRef> sysFileRefs;
+    /**
+     * 已上传的关联附件信息
+     */
+    List<SysFileInfo> fileInfos;
 
     @ApiModelProperty(value = "主键ID")
     private Integer planPracticalId;

+ 1 - 1
purchase-system/src/main/java/com/ozs/plan/service/ProvisionalPlanService.java

@@ -22,7 +22,7 @@ public interface ProvisionalPlanService extends IService<ProvisionalPlan> {
 
     int commitProvisionalPlan(ProvisionalPlanVo provisionalPlanVo);
 
-    ProvisionalPlan seletById(Integer planPracticalId);
+    AjaxResult seletById(Integer planPracticalId);
 
     PageInfo<ProvisionalPlan> selectProvisionalPlan(ProvisionalPlanVo provisionalPlanVo);
 

+ 26 - 3
purchase-system/src/main/java/com/ozs/plan/service/impl/ProvisionalPlanServiceImpl.java

@@ -24,12 +24,14 @@ import com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo;
 import com.ozs.plan.mapper.PlanYearsMapper;
 import com.ozs.plan.mapper.ProvisionalPlanMapper;
 import com.ozs.plan.service.ProvisionalPlanService;
+import com.ozs.system.domain.SysFileInfo;
 import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.mapper.SysDeptMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
 import com.ozs.system.service.ISysDeptService;
 import com.ozs.system.service.ISysDictTypeService;
+import com.ozs.system.service.SysFileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
@@ -52,6 +54,8 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
     private PlanYearsMapper planYearsMapper;
     @Autowired
     private SysFileRefMapper sysFileRefMapper;
+    @Autowired
+    private SysFileService fileService;
 
     @Override
     public int deleteProvisionalPlanById(Integer planYearId) {
@@ -175,9 +179,28 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
     }
 
     @Override
-    public ProvisionalPlan seletById(Integer planPracticalId) {
-        ProvisionalPlan provisionalPlan = changeToProvisionalPlan(provisionalPlanMapper.seletById(planPracticalId));
-        return provisionalPlan;
+    public AjaxResult seletById(Integer planPracticalId) {
+        ProvisionalPlan provisionalPlan = provisionalPlanMapper.seletById(planPracticalId);
+        if (StringUtils.isNull(provisionalPlan)) {
+            return AjaxResult.error("数据查询失败");
+        }
+        // 转换字段中文
+        ProvisionalPlan provisionalPlanC = changeToProvisionalPlan(provisionalPlan);
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("red_id", provisionalPlanC.getPlanPracticalId());
+        map.put("type", SysFileRefEnum.PLAN_TEMPORARY.getType());
+        List<SysFileRef> fileRefs = sysFileRefMapper.selectByMap(map);
+        List<SysFileInfo> fileInfos = new ArrayList<>();
+        ProvisionalPlanVo provisionalPlanVo = new ProvisionalPlanVo();
+        BeanUtils.copyProperties(provisionalPlanC, provisionalPlanVo);
+        if (!ObjectUtils.isEmpty(fileRefs)) {
+            for (SysFileRef ref : fileRefs) {
+                SysFileInfo fileInfo = fileService.getById(ref.getFileId());
+                fileInfos.add(fileInfo);
+            }
+            provisionalPlanVo.setFileInfos(fileInfos);
+        }
+        return AjaxResult.success(provisionalPlanVo);
     }
 
     @Override

+ 8 - 8
purchase-system/src/main/resources/mapper/base/BaseSupplierMapper.xml

@@ -64,13 +64,13 @@
         <if test="created != null and created != ''">
             created,
         </if>
-        <if test="createTime != null and createTime != ''">
+        <if test="createTime != null">
             create_time,
         </if>
         <if test="updated != null and updated != ''">
             updated,
         </if>
-        <if test="updateTime != null and updateTime != ''">
+        <if test="updateTime != null">
             update_time
         </if>
         ) values (
@@ -113,13 +113,13 @@
         <if test="created != null and created != ''">
             #{created},
         </if>
-        <if test="createTime != null and createTime != ''">
+        <if test="createTime != null">
             #{createTime},
         </if>
         <if test="updated != null and updated != ''">
             #{updated},
         </if>
-        <if test="updateTime != null and updateTime != ''">
+        <if test="updateTime != null">
             #{updateTime}
         </if>
         )
@@ -173,13 +173,13 @@
             <if test="created != null and created != ''">
                 created = #{created},
             </if>
-            <if test="createTime != null and createTime != ''">
+            <if test="createTime != null">
                 create_time = #{createTime},
             </if>
             <if test="updated != null and updated != ''">
                 updated = #{updated},
             </if>
-            <if test="updateTime != null and updateTime != ''">
+            <if test="updateTime != null">
                 update_time = #{updateTime},
             </if>
         </set>
@@ -231,13 +231,13 @@
             <if test="created != null and created != ''">
                 created = #{created},
             </if>
-            <if test="createTime != null and createTime != ''">
+            <if test="createTime != null">
                 create_time = #{createTime},
             </if>
             <if test="updated != null and updated != ''">
                 updated = #{updated},
             </if>
-            <if test="updateTime != null and updateTime != ''">
+            <if test="updateTime != null">
                 update_time = #{updateTime}
             </if>
         </where>