buzhanyi 2 лет назад
Родитель
Сommit
89b3a61014

+ 14 - 10
purchase-admin/src/main/java/com/ozs/web/controller/plan/PlanQuarterController.java

@@ -11,7 +11,6 @@ import com.ozs.common.enums.BusinessType;
 import com.ozs.common.enums.DataIsDelete;
 import com.ozs.common.utils.DateUtils;
 import com.ozs.common.utils.PageUtils;
-import com.ozs.common.utils.file.FileUtils;
 import com.ozs.common.utils.poi.ExcelUtil;
 import com.ozs.framework.web.service.TokenService;
 import com.ozs.plan.doman.PlanQuarter;
@@ -84,15 +83,20 @@ public class PlanQuarterController extends BaseController {
             if (!ObjectUtils.isEmpty(vo.getProjectStatus())) {
                 lw.eq(PlanQuarter::getProjectStatus, vo.getProjectStatus());
             }
-            if (!ObjectUtils.isEmpty(vo.getBeginTime())) {
-                lw.ge(PlanQuarter::getPlanDemandSubTime, vo.getBeginTime());
-            }
-            if (!ObjectUtils.isEmpty(vo.getEndTime())) {
-                Date ofMonth = DateUtils.getLastDayOfMonth(vo.getEndTime());
-                SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                Date parse = dateFormatT.parse(dateFormat.format(ofMonth) + " 23:59:59:999");
-                lw.le(PlanQuarter::getPlanDemandSubTime, parse);
+            if (!ObjectUtils.isEmpty(vo.getParams())) {
+                if (!ObjectUtils.isEmpty(vo.getParams().get("beginTime"))) {
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+                    Date ofMonth = dateFormat.parse(vo.getParams().get("beginTime").toString() + "-01");
+                    lw.ge(PlanQuarter::getPlanDemandSubTime, ofMonth);
+                }
+                if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
+                    SimpleDateFormat dateFormaH = new SimpleDateFormat("yyyy-MM");
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                    SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
+                    Date ofMonth = DateUtils.getLastDayOfMonth(dateFormaH.parse(vo.getParams().get("endTime").toString()));
+                    Date parse = dateFormatT.parse(dateFormat.format(ofMonth) + " 23:59:59:999");
+                    lw.le(PlanQuarter::getPlanDemandSubTime, parse);
+                }
             }
             lw.orderBy(true, false, PlanQuarter::getCreateTime);
             List<PlanQuarter> list = quarterService.list(lw);

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

@@ -102,8 +102,7 @@ public class PlanYearsController extends BaseController {
                 }
                 if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
                     SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                    Date parse = dateFormatT.parse(dateFormat.format(vo.getParams().get("endTime")) + " 23:59:59:999");
+                    Date parse = dateFormatT.parse(vo.getParams().get("endTime").toString() + " 23:59:59:999");
                     lw.le(PlanYears::getPlanDemandSubTime, parse);
                 }
             }

+ 2 - 2
purchase-admin/src/main/resources/application.yml

@@ -10,5 +10,5 @@ server:
 # Spring配置
 spring:
   profiles:
-#    active: druid,test
-    active: prod
+    active: druid,test
+#    active: prod

+ 7 - 7
purchase-system/src/main/java/com/ozs/plan/doman/vo/requestVo/PlanQuarterStandardVo.java

@@ -159,13 +159,13 @@ public class PlanQuarterStandardVo extends PageVo {
      */
     private List<SysFileRef> sysFileRefs;
 
-    /**
-     * 查询参数开始时间和结束时间
-     */
-    @JsonFormat(pattern = "yyyy-MM")
-    private Date beginTime;
-    @JsonFormat(pattern = "yyyy-MM")
-    private Date endTime;
+    ///**
+    // * 查询参数开始时间和结束时间
+    // */
+    //@JsonFormat(pattern = "yyyy-MM")
+    //private Date beginTime;
+    //@JsonFormat(pattern = "yyyy-MM")
+    //private Date endTime;
     /**
      * 请求参数
      */

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

@@ -10,6 +10,7 @@ import com.ozs.plan.doman.vo.requestVo.PlanYearsStandardVo;
 import com.ozs.plan.doman.vo.responseVo.PlanQuarterResponseVo;
 import com.ozs.plan.doman.vo.responseVo.PlanYearsResponseVo;
 
+import java.text.ParseException;
 import java.util.List;
 
 /**
@@ -247,7 +248,7 @@ public interface PlanYearsService extends IService<PlanYears> {
     /**
      * 查询审核分页
      */
-    List<PlanYears> queryPage(PlanYearsStandardVo vo);
+    List<PlanYears> queryPage(PlanYearsStandardVo vo) throws ParseException;
 
     List<PlanYearsResponseVo> changeTo(List<PlanYears> planYears);
 

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

@@ -10,6 +10,7 @@ import com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo;
 import com.ozs.plan.doman.vo.responseVo.ProvisionalPlanResVo;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
 import java.util.List;
 
 public interface ProvisionalPlanService extends IService<ProvisionalPlan> {
@@ -34,5 +35,5 @@ public interface ProvisionalPlanService extends IService<ProvisionalPlan> {
 
     AjaxResult auditNoPass(ProvisionalPlanVo provisionalPlanVo);
 
-    List<ProvisionalPlan> queryPage(ProvisionalPlanVo vo);
+    List<ProvisionalPlan> queryPage(ProvisionalPlanVo vo) throws ParseException;
 }

+ 8 - 10
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanQuarterServiceImpl.java

@@ -120,17 +120,16 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
                 }
                 if (!ObjectUtils.isEmpty(vo.getParams())) {
                     if (!ObjectUtils.isEmpty(vo.getParams().get("beginTime"))) {
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date beginTime = dateFormat.parse(vo.getParams().get("beginTime").toString() + "-01");
-                        //Date ofMonth = dateFormat.parse(date + "-01");
-                        lw.ge(PlanQuarter::getPlanDemandSubTime, beginTime);
+                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+                        Date ofMonth = dateFormat.parse(vo.getParams().get("beginTime").toString() + "-01");
+                        lw.ge(PlanQuarter::getPlanDemandSubTime, ofMonth);
                     }
                     if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
-                        SimpleDateFormat dateFormaH = new SimpleDateFormat("yyyy-MM-dd");
-                        Date ofMonth = DateUtils.getLastDayOfMonth(dateFormat.parse(vo.getParams().get("endTime").toString()));
+                        SimpleDateFormat dateFormaH = new SimpleDateFormat("yyyy-MM");
+                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                         SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                        Date parse = dateFormatT.parse(dateFormaH.format(ofMonth) + " 23:59:59:999");
+                        Date ofMonth = DateUtils.getLastDayOfMonth(dateFormaH.parse(vo.getParams().get("endTime").toString()));
+                        Date parse = dateFormatT.parse(dateFormat.format(ofMonth) + " 23:59:59:999");
                         lw.le(PlanQuarter::getPlanDemandSubTime, parse);
                     }
                 }
@@ -177,8 +176,7 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
                     }
                     if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
                         SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date parse = dateFormatT.parse(dateFormat.format(vo.getParams().get("endTime")) + " 23:59:59:999");
+                        Date parse = dateFormatT.parse(vo.getParams().get("endTime").toString() + " 23:59:59:999");
                         lw.le(PlanQuarter::getPlanDemandSubTime, parse);
                     }
                 }

+ 19 - 10
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanYearsServiceImpl.java

@@ -129,8 +129,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
                     }
                     if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
                         SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date parse = dateFormatT.parse(dateFormat.format(vo.getParams().get("endTime")) + " 23:59:59:999");
+                        Date parse = dateFormatT.parse(vo.getParams().get("endTime").toString() + " 23:59:59:999");
                         lw.le(PlanYears::getPlanDemandSubTime, parse);
                     }
                 }
@@ -172,18 +171,15 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
                 }
                 if (!ObjectUtils.isEmpty(vo.getParams())) {
                     if (!ObjectUtils.isEmpty(vo.getParams().get("beginTime"))) {
-                        String beginTime = vo.getParams().get("beginTime").toString();
-                        Date date = new Date();
-                        date.setYear(Integer.parseInt(beginTime.substring(0, 4)));
-                        date.setMonth(Integer.parseInt(beginTime.substring(5, 7)));
                         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
-                        Date ofMonth = dateFormat.parse(date + "-01");
+                        Date ofMonth = dateFormat.parse(vo.getParams().get("beginTime").toString() + "-01");
                         lw.ge(PlanYears::getPlanDemandSubTime, ofMonth);
                     }
                     if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
-                        SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
+                        SimpleDateFormat dateFormaH = new SimpleDateFormat("yyyy-MM");
                         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date ofMonth = DateUtils.getLastDayOfMonth(dateFormat.parse(vo.getParams().get("endTime").toString()));
+                        SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
+                        Date ofMonth = DateUtils.getLastDayOfMonth(dateFormaH.parse(vo.getParams().get("endTime").toString()));
                         Date parse = dateFormatT.parse(dateFormat.format(ofMonth) + " 23:59:59:999");
                         lw.le(PlanYears::getPlanDemandSubTime, parse);
                     }
@@ -955,7 +951,20 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
     }
 
     @Override
-    public List<PlanYears> queryPage(PlanYearsStandardVo vo) {
+    public List<PlanYears> queryPage(PlanYearsStandardVo vo) throws ParseException {
+        Map<String, Object> params = vo.getParams();
+        if (!ObjectUtils.isEmpty(vo.getParams())) {
+            if (!ObjectUtils.isEmpty(vo.getParams().get("beginTime"))) {
+                params.put("beginTime", vo.getParams().get("beginTime").toString() + "-01");
+            }
+            if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
+                SimpleDateFormat dateFormaH = new SimpleDateFormat("yyyy-MM");
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                Date ofMonth = DateUtils.getLastDayOfMonth(dateFormaH.parse(vo.getParams().get("endTime").toString()));
+                params.put("endTime", dateFormat.format(ofMonth) + " 23:59:59:999");
+            }
+        }
+        vo.setParams(params);
         List<PlanYears> planYears = planYearsMapper.query(vo);
         if (!ObjectUtils.isEmpty(planYears)) {
             planYears.stream().map(o -> {

+ 14 - 7
purchase-system/src/main/java/com/ozs/plan/service/impl/ProvisionalPlanServiceImpl.java

@@ -50,6 +50,7 @@ import org.springframework.util.ObjectUtils;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -217,9 +218,7 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
                     }
                     if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
                         SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                        Date ofMonth = DateUtils.getLastDayOfMonth(dateFormat.parse(vo.getParams().get("endTime").toString()));
-                        Date parse = dateFormatT.parse(dateFormat.format(ofMonth) + " 23:59:59:999");
+                        Date parse = dateFormatT.parse(vo.getParams().get("endTime").toString() + " 23:59:59:999");
                         lw.le(ProvisionalPlan::getPlanDemandSubTime, parse);
                     }
                 }
@@ -303,9 +302,7 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
                 }
                 if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
                     SimpleDateFormat dateFormatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
-                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                    Date ofMonth = DateUtils.getLastDayOfMonth(dateFormat.parse(vo.getParams().get("endTime").toString()));
-                    Date parse = dateFormatT.parse(dateFormat.format(ofMonth) + " 23:59:59:999");
+                    Date parse = dateFormatT.parse(vo.getParams().get("endTime").toString() + " 23:59:59:999");
                     lw.le(ProvisionalPlan::getPlanDemandSubTime, parse);
                 }
             }
@@ -492,7 +489,17 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
     }
 
     @Override
-    public List<ProvisionalPlan> queryPage(ProvisionalPlanVo vo) {
+    public List<ProvisionalPlan> queryPage(ProvisionalPlanVo vo) throws ParseException {
+        Map<String, Object> params = vo.getParams();
+        if (!ObjectUtils.isEmpty(vo.getParams())) {
+            if (!ObjectUtils.isEmpty(vo.getParams().get("beginTime"))) {
+                params.put("beginTime", vo.getParams().get("beginTime").toString());
+            }
+            if (!ObjectUtils.isEmpty(vo.getParams().get("endTime"))) {
+                params.put("endTime", vo.getParams().get("endTime").toString() + " 23:59:59:999");
+            }
+        }
+        vo.setParams(params);
         List<ProvisionalPlan> provisionalPlanList = provisionalPlanMapper.query(vo);
         if (!ObjectUtils.isEmpty(provisionalPlanList)) {
             provisionalPlanList.stream().map(o -> {

+ 4 - 4
purchase-system/src/main/resources/mapper/plan/PlanYearsMapper.xml

@@ -119,11 +119,11 @@
 			<if test="projectStatus != null and projectStatus != ''">
 				AND p.project_status = #{projectStatus}
 			</if>
-			<if test="params!= null and params.beginTime != null"><!-- 开始时间检索 -->
-				and date_format(p.plan_demand_sub_time,'%y%m') &gt;= date_format(#{params.beginTime},'%y%m')
+			<if test="params.beginTime!= null and params.beginTime != ''"><!-- 开始时间检索 -->
+				and date_format(p.plan_demand_sub_time,'%y%m%d') &gt;= #{params.beginTime}
 			</if>
-			<if test="params!= null and params.endTime != null "><!-- 结束时间检索 -->
-				and date_format(p.plan_demand_sub_time,'%y%m') &lt;= date_format(#{params.endTime},'%y%m')
+			<if test="params.endTime!= null and params.endTime != '' "><!-- 结束时间检索 -->
+				and p.plan_demand_sub_time &lt;= #{params.endTime}
 			</if>
 			and p.del_flay=0
 		</where>

+ 4 - 4
purchase-system/src/main/resources/mapper/plan/ProvisionalPlanMapper.xml

@@ -226,11 +226,11 @@
             <if test="projectStatus != null and projectStatus != ''">
                 AND p.project_status = #{projectStatus}
             </if>
-            <if test="params.beginTime != null "><!-- 开始时间检索 -->
-                and date_format(p.plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
+            <if test="params.beginTime!= null and params.beginTime != ''"><!-- 开始时间检索 -->
+                and date_format(p.plan_demand_sub_time,'%y%m%d') &gt;= #{params.beginTime}
             </if>
-            <if test="params.endTime != null "><!-- 结束时间检索 -->
-                and date_format(p.plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+            <if test="params.endTime!= null and params.endTime != '' "><!-- 结束时间检索 -->
+                and p.plan_demand_sub_time &lt;= #{params.endTime}
             </if>
             and p.del_flay=0
         </where>

+ 3 - 1
purchase-system/src/main/resources/mapper/pm/PmDemandMapper.xml

@@ -638,7 +638,9 @@
             resultType="java.util.Map">
         select ifnull(COUNT(demand_id), 0) countNum, ifnull(sum(evaluation), 0) evaluationSum, year(create_time) yy
         from pm_demand
-        <include refid="deptListOrDemandIdAllNoAnd"/>
+        <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
+            <include refid="deptListOrDemandIdAllNoAnd"/>
+        </if>
         group by year(create_time)
     </select>