Prechádzať zdrojové kódy

抽取专家 返回 专家姓名

sunhh 2 rokov pred
rodič
commit
f948a202d3

+ 4 - 3
purchase-admin/src/main/java/com/ozs/web/controller/plan/ProvisionalPlanController.java

@@ -77,7 +77,8 @@ public class ProvisionalPlanController extends BaseController {
         provisionalPlan.setPlanType("1");
         // 项目状态(0:计划待提交,1:计划待审核,2:计划已退回,3:计划已审核)
         provisionalPlan.setProjectStatus("0");
-        provisionalPlan.setIsExcess(iSysDeptService.isExcessOrNo(provisionalPlan.getProjectType(), provisionalPlan.getEvaluation(), Long.valueOf(provisionalPlan.getPurchaseDeptId())));
+        // 计算是否超限额计划 *** 改为前端录入
+        // provisionalPlan.setIsExcess(iSysDeptService.isExcessOrNo(provisionalPlan.getProjectType(), provisionalPlan.getEvaluation(), Long.valueOf(provisionalPlan.getPurchaseDeptId())));
         boolean save = provisionalPlanService.save(provisionalPlan);
         log.info("provisionalPlan的主键id:{}", provisionalPlan.getPlanPracticalId());
         List<SysFileRef> sysFileRefs = provisionalPlan.getSysFileRefs();
@@ -118,8 +119,8 @@ public class ProvisionalPlanController extends BaseController {
             return error("临时计划id和修改数据不能为空");
         }
         log.info(":{}", provisionalPlan);
-        provisionalPlan.setIsExcess(iSysDeptService.isExcessOrNo(provisionalPlan.getProjectType(), provisionalPlan.getEvaluation(), getDeptId()));
-        ;
+        // 计算是否超限额计划 *** 改为前端录入
+        // provisionalPlan.setIsExcess(iSysDeptService.isExcessOrNo(provisionalPlan.getProjectType(), provisionalPlan.getEvaluation(), getDeptId()));
         return toAjax(provisionalPlanService.updateProvisionalPlanById(provisionalPlan));
     }
 

+ 2 - 0
purchase-system/src/main/java/com/ozs/base/mapper/BaseExpertMapper.java

@@ -16,4 +16,6 @@ public interface BaseExpertMapper extends BaseMapper<BaseExpert> {
     List<BaseUnitInformation> selectByUnitInformation(@Param("unitInformation") String unitInformation);
 
     Integer insertBaseUnitInformation(BaseUnitInformation baseUnitInformation);
+
+    List<String> getExpertNameList(@Param("demandId") Long demandId);
 }

+ 9 - 0
purchase-system/src/main/java/com/ozs/base/service/impl/BaseExpertServiceImpl.java

@@ -34,6 +34,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class BaseExpertServiceImpl extends ServiceImpl<BaseExpertMapper, BaseExpert> implements BaseExpertService {
@@ -96,8 +97,16 @@ public class BaseExpertServiceImpl extends ServiceImpl<BaseExpertMapper, BaseExp
 
     @Override
     public AjaxResult selectExtractionExpert(BaseExpertVo baseExpertVo) {
+        // 查询抽取过专家的项目列表
         List<PmDemand> pmDemandList = pmDemandService.selectExtractionExpert(baseExpertVo);
         List<PmDemandResVo> pmDemandResponseVoList = changTo(pmDemandList);
+        // 遍历项目 查询专家姓名
+        for (PmDemandResVo pmDemandResVo : pmDemandResponseVoList) {
+            Long demandId = pmDemandResVo.getDemandId();
+            List<String> expertNameList = baseExpertMapper.getExpertNameList(pmDemandResVo.getDemandId());
+            String expertNameStr = expertNameList.stream().collect(Collectors.joining(",", "{", "}"));
+            pmDemandResVo.setExpertNameStr(expertNameStr);
+        }
         PageHelper.startPage(baseExpertVo.getPageNum().intValue(), baseExpertVo.getPageSize().intValue());
         PageInfo<PmDemandResVo> pageInfo = new PageInfo<>(pmDemandResponseVoList);
         return AjaxResult.success(pageInfo);

+ 4 - 0
purchase-system/src/main/java/com/ozs/pm/doman/vo/responseVo/PmDemandResVo.java

@@ -251,4 +251,8 @@ public class PmDemandResVo extends BaseEntity
      * 详情类型(1项目计划,2需求建档,3任务下达,4中标信息,5合同信息,6建设情况)
      */
     private String detailType;
+    /**
+     * 抽取专家名称
+     */
+    private String expertNameStr;
 }

+ 4 - 0
purchase-system/src/main/resources/mapper/base/BaseExpertMapper.xml

@@ -157,4 +157,8 @@
             </if>
         </trim>
     </insert>
+
+    <select id="getExpertNameList" resultType="java.lang.String" parameterType="java.lang.Long">
+        select expert_name from base_expert where id in (select expert_id from pm_demand_expert_ref where demand_id = #{demandId})
+    </select>
 </mapper>

+ 69 - 54
purchase-system/src/main/resources/mapper/pm/PmDemandMapper.xml

@@ -13,18 +13,16 @@
 
     <select id="selectExtractionExpert" parameterType="com.ozs.base.domain.vo.BaseExpertVo"
             resultType="com.ozs.pm.doman.PmDemand">
-        select * from pm_demand
-        <where>
-            <if test="projectName != null and projectName != ''">
-                and project_name like '%' + #{projectName} + '%'
-            </if>
-            <if test="startTime != null  "><!-- 开始时间检索 -->
-                and date_format(plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
-            </if>
-            <if test="endTime != null  "><!-- 结束时间检索 -->
-                and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
-            </if>
-        </where>
+        select * from pm_demand where demand_id in (select demand_id from pm_demand_expert_ref group by demand_id)
+        <if test="projectName != null and projectName != ''">
+            and project_name like '%' + #{projectName} + '%'
+        </if>
+        <if test="startTime != null  "><!-- 开始时间检索 -->
+            and date_format(plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
+        </if>
+        <if test="endTime != null  "><!-- 结束时间检索 -->
+            and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+        </if>
     </select>
 
     <select id="purchaseProjectStatistical" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -118,8 +116,10 @@
         WHERE (real_demand_commit_time > plan_demand_sub_time
             or real_purchase_finish_time > plan_purchase_finish_time
             or real_deliver_time > plan_deliver_time)
-          and MONTH(create_time) = #{month}
-          AND DATE_FORMAT(create_time, '%Y') = #{year}
+            and MONTH (
+            create_time) = #{month}
+          AND DATE_FORMAT(create_time
+            , '%Y') = #{year}
         GROUP BY DATE_FORMAT(create_time, '%Y-%m')
     </select>
 
@@ -179,14 +179,14 @@
             , project_attr)
           AND `project_status` = #{code}
           and DATE_FORMAT(create_time
-                  , '%Y') = YEAR(NOW()) - 1
+            , '%Y') = YEAR (NOW()) - 1
     </select>
 
     <select id="countEveryStatusNum" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
         SELECT project_status columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
         FROM `pm_demand`
         WHERE `project_status` IN (9, 10, 11, 12, 13, 14)
-          and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
+          and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
         GROUP BY project_status
     </select>
 
@@ -194,7 +194,7 @@
         SELECT project_status columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
         FROM `pm_demand`
         WHERE `project_status` IN (15, 16, 17)
-          and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
+          and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
         GROUP BY project_status
     </select>
 
@@ -205,10 +205,12 @@
     </select>
 
     <select id="countMajorProjectLastYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
-        SELECT YEAR(NOW()) - 1 columnName, COUNT(demand_id) num, SUM(evaluation) evaluationTotal
+        SELECT YEAR (NOW()) - 1 columnName, COUNT (demand_id) num, SUM (evaluation) evaluationTotal
         FROM `pm_demand`
-        WHERE find_in_set('1', project_attr)
-          and DATE_FORMAT(create_time, '%Y') = YEAR(NOW()) - 1
+        WHERE find_in_set('1'
+            , project_attr)
+          and DATE_FORMAT(create_time
+            , '%Y') = YEAR (NOW()) - 1
     </select>
 
     <select id="countProjectMajorByYear" resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
@@ -259,22 +261,31 @@
 
     <select id="selectpurchaseProjectCompleteNumberYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="java.util.Map">
-        select count(demand_id) countNum, ifnull(sum(a.evaluation), 0) evaluation, year (a.plan_demand_sub_time) yy, ifnull(sum(b.contract_amount), 0) contractAmount
+        select count(demand_id)             countNum,
+               ifnull(sum(a.evaluation), 0) evaluation, year (a.plan_demand_sub_time) yy, ifnull(sum (b.contract_amount), 0) contractAmount
         from (
             select evaluation, plan_demand_sub_time, demand_id from pm_demand where project_status = '17'
-        ) a left join (
+            ) a left join (
             select contract_amount, demand_id from pm_contract_info
-        ) b on a.demand_id = b.demand_id
+            ) b
+        on a.demand_id = b.demand_id
         group by year (a.plan_demand_sub_time)
     </select>
 
     <select id="selectpurchaseProjectCompleteNumberQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="java.util.Map">
-        select ifnull(sum(a.evaluation), 0) evaluation, quarter(a.plan_demand_sub_time) yy, ifnull(sum(b.contract_amount), 0) contractAmount from (
-            select evaluation, plan_demand_sub_time, demand_id from pm_demand where project_status = '17' and year (plan_demand_sub_time) = year(NOW())
+        select ifnull(sum(a.evaluation), 0)      evaluation,
+               quarter(a.plan_demand_sub_time)   yy,
+               ifnull(sum(b.contract_amount), 0) contractAmount
+        from (
+                 select evaluation, plan_demand_sub_time, demand_id
+                 from pm_demand
+                 where project_status = '17' and year (plan_demand_sub_time) = year(NOW())
         ) a left join (
-            select contract_amount, demand_id from pm_contract_info
-        ) b on a.demand_id = b.demand_id
+        select contract_amount, demand_id
+        from pm_contract_info
+            ) b
+        on a.demand_id = b.demand_id
         group by concat(Year (a.plan_demand_sub_time), quarter(a.plan_demand_sub_time))
     </select>
 
@@ -287,29 +298,31 @@
                  select evaluation, plan_demand_sub_time, demand_id
                  from pm_demand
                  where project_status = '17'
-                   and year(plan_demand_sub_time) = year(NOW())
+                           and year (plan_demand_sub_time) = year(NOW())
              ) a
                  left join (
-            select contract_amount, demand_id
-            from pm_contract_info
-        ) b on a.demand_id = b.demand_id
+        select contract_amount, demand_id
+        from pm_contract_info
+            ) b
+        on a.demand_id = b.demand_id
         group by date_format(a.plan_demand_sub_time, '%y%m')
     </select>
 
     <select id="selectPurchaseTaskFinishYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="java.util.Map">
-        select count(demand_id)                  countNum,
-               ifnull(sum(a.evaluation), 0)      evaluation,
-               year(a.plan_demand_sub_time)      yy,
-               ifnull(sum(b.contract_amount), 0) contractAmount
+        select count(demand_id)             countNum,
+               ifnull(sum(a.evaluation), 0) evaluation,
+            year (a.plan_demand_sub_time) yy,
+            ifnull(sum (b.contract_amount), 0) contractAmount
         from (
-                 select evaluation, plan_demand_sub_time, demand_id from pm_demand where project_status in (15, 16, 17)
-             ) a
-                 left join (
+            select evaluation, plan_demand_sub_time, demand_id from pm_demand where project_status in (15, 16, 17)
+            ) a
+            left join (
             select contract_amount, demand_id
             from pm_contract_info
-        ) b on a.demand_id = b.demand_id
-        group by year(a.plan_demand_sub_time)
+            ) b
+        on a.demand_id = b.demand_id
+        group by year (a.plan_demand_sub_time)
     </select>
 
     <select id="selectPurchaseTaskFinishQuarter" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -321,13 +334,14 @@
                  select evaluation, plan_demand_sub_time, demand_id
                  from pm_demand
                  where project_status in (15, 16, 17)
-                   and year(plan_demand_sub_time) = year(NOW())
+                           and year (plan_demand_sub_time) = year(NOW())
              ) a
                  left join (
-            select contract_amount, demand_id
-            from pm_contract_info
-        ) b on a.demand_id = b.demand_id
-        group by concat(Year(a.plan_demand_sub_time), quarter(a.plan_demand_sub_time))
+        select contract_amount, demand_id
+        from pm_contract_info
+            ) b
+        on a.demand_id = b.demand_id
+        group by concat(Year (a.plan_demand_sub_time), quarter(a.plan_demand_sub_time))
     </select>
 
     <select id="selectPurchaseTaskFinishMonth" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -339,12 +353,13 @@
                  select evaluation, plan_demand_sub_time, demand_id
                  from pm_demand
                  where project_status in (15, 16, 17)
-                   and year(plan_demand_sub_time) = year(NOW())
+                           and year (plan_demand_sub_time) = year(NOW())
              ) a
                  left join (
-            select contract_amount, demand_id
-            from pm_contract_info
-        ) b on a.demand_id = b.demand_id
+        select contract_amount, demand_id
+        from pm_contract_info
+            ) b
+        on a.demand_id = b.demand_id
         group by date_format(a.plan_demand_sub_time, '%y%m')
     </select>
 
@@ -355,20 +370,20 @@
             or real_purchase_finish_time > plan_purchase_finish_time
             or real_deliver_time > plan_deliver_time)
           AND find_in_set('1', project_attr)
-          and DATE_FORMAT(create_time, '%Y') = YEAR(NOW())
+          and DATE_FORMAT(create_time, '%Y') = YEAR (NOW())
     </select>
 
     <select id="purchaseProjectDistribution" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="java.util.Map">
         select count(demand_id) countNumber from pm_demand where project_status in
-        <foreach item = "item" collection="projectStatusList" separator="," open="(" close=")">
+        <foreach item="item" collection="projectStatusList" separator="," open="(" close=")">
             #{item}
         </foreach>
     </select>
 
     <select id="purchaseProjectNumberAnalysisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="java.util.Map">
-        select count(demand_id) countNum, year(plan_demand_sub_time) yy
+        select count(demand_id) countNum, year (plan_demand_sub_time) yy
         from pm_demand
         group by year (plan_demand_sub_time)
     </select>
@@ -377,7 +392,7 @@
             resultType="java.util.Map">
         select count(demand_id) countNum, quarter(plan_demand_sub_time) yy
         from pm_demand
-        where year (plan_demand_sub_time) = year(NOW())
+        where year (plan_demand_sub_time) = year (NOW())
         group by concat(Year (plan_demand_sub_time), quarter(plan_demand_sub_time))
     </select>
 
@@ -385,7 +400,7 @@
             resultType="java.util.Map">
         select count(demand_id) countNum, date_format(plan_demand_sub_time, '%m') yy
         from pm_demand
-        where year(plan_demand_sub_time) = year(NOW())
+        where year (plan_demand_sub_time) = year (NOW())
         group by date_format(plan_demand_sub_time, '%y%m')
     </select>
 </mapper>