ly 1 rok temu
rodzic
commit
5d9d27c3fc

+ 11 - 10
src/main/java/cn/ezhizao/project/business/workOrder/controller/WorkOrderCurrentController.java

@@ -706,11 +706,12 @@ public class WorkOrderCurrentController extends BaseController {
     @Log(title = "本月工单门店导出", businessType = BusinessType.EXPORT)
     @PostMapping("/exportStore")
     public void exportStore(HttpServletResponse response, BizWorkOrder bizWorkOrder) throws NoSuchFieldException, IllegalAccessException {
-        List<SysCurrentMonth> months = sysCurrentMonthService.list(new LambdaQueryWrapper<SysCurrentMonth>()
-                .eq(SysCurrentMonth::getTenantId, getTenantId())
-                .eq(SysCurrentMonth::getType, 0));
-        Date date = DateTime.of(months.get(0).getYear() + "-" + months.get(0).getMonth() + "-01", "yyyy-MM-dd").toSqlDate();
-        bizWorkOrder.setWorkDate(date);
+//        List<SysCurrentMonth> months = sysCurrentMonthService.list(new LambdaQueryWrapper<SysCurrentMonth>()
+//                .eq(SysCurrentMonth::getTenantId, getTenantId())
+//                .eq(SysCurrentMonth::getType, 0));
+//        Date date = DateTime.of(months.get(0).getYear() + "-" + months.get(0).getMonth() + "-01", "yyyy-MM-dd").toSqlDate();
+//        bizWorkOrder.setWorkDate(date);
+        bizWorkOrder.setWorkDate(bizWorkOrder.getCurrentMonth());
         setTenantId(bizWorkOrder);
         startOrderBy();
 //        bizWorkOrder.setIsStop(0);
@@ -725,11 +726,11 @@ public class WorkOrderCurrentController extends BaseController {
         setTenantId(bizWorkOrder);
         startOrderBy();
 //        bizWorkOrder.setIsStop(0);
-        List<SysCurrentMonth> months = sysCurrentMonthService.list(new LambdaQueryWrapper<SysCurrentMonth>()
-                .eq(SysCurrentMonth::getTenantId, getTenantId())
-                .eq(SysCurrentMonth::getType, 1));
-        Date date = DateTime.of(months.get(0).getYear() + "-" + months.get(0).getMonth() + "-01", "yyyy-MM-dd").toSqlDate();
-        bizWorkOrder.setWorkDate(date);
+//        List<SysCurrentMonth> months = sysCurrentMonthService.list(new LambdaQueryWrapper<SysCurrentMonth>()
+//                .eq(SysCurrentMonth::getTenantId, getTenantId())
+//                .eq(SysCurrentMonth::getType, 1));
+//        Date date = DateTime.of(months.get(0).getYear() + "-" + months.get(0).getMonth() + "-01", "yyyy-MM-dd").toSqlDate();
+        bizWorkOrder.setWorkDate(bizWorkOrder.getCurrentMonth());
         List<BizWorkOrder> list = bizWorkOrderService.getList(bizWorkOrder);
         ExcelUtil<BizWorkOrder> util = new ExcelUtil<BizWorkOrder>(BizWorkOrder.class);
         util.exportExcel(response, list, "下月工单");

+ 1 - 0
src/main/java/cn/ezhizao/project/business/workOrder/domain/vo/Condition.java

@@ -17,4 +17,5 @@ public class Condition extends BaseEntity {
     private String toAccountName;
     private String fromCompanyName;
     private Long tenantId;
+    private String currentMonth;
 }

+ 1 - 0
src/main/java/cn/ezhizao/project/business/workOrder/domain/vo/EntrustRes.java

@@ -18,4 +18,5 @@ public class EntrustRes {
     private String endMonth;
     private Integer monthNum;
     private String fromCompanyName;
+    private String currentMonth;
 }

+ 14 - 1
src/main/resources/mybatis/business/BizWorkOrderMapper.xml

@@ -89,7 +89,7 @@
                 concat( '%', #{toAccountName}, '%' ))
             </if>
 
-            <if test="fromCompanyName != null and fromCompanyName!=''">AND  t7.account_name LIKE
+            <if test="fromCompanyName != null and fromCompanyName!=''">AND t7.account_name LIKE
                 concat( '%', #{fromCompanyName}, '%' )
             </if>
             <if test="companyName != null and companyName!=''">AND t2.name like concat('%', #{companyName}, '%')</if>
@@ -142,6 +142,11 @@
         LEFT JOIN biz_tenant t7 on t1.from_tenant_id =t7.id
         <where>
             t1.deleted = 0 and t5.id is not null
+            AND t5.type = 1
+            AND t5.no_contract = 0
+            AND t5.is_stop = 0
+            AND t5.start_month != 0
+            and t5.deleted = 0
             <if test="fromTenantId != null and fromTenantId != ''">
                 AND t1.from_tenant_id = #{fromTenantId}
             </if>
@@ -165,6 +170,14 @@
             <if test="toAccountName != null and toAccountName!=''">
                 AND t2.account_name like concat( '%', #{toAccountName}, '%' )
             </if>
+            <if test="currentMonth != null">AND t5.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &gt;=
+                (case when t5.task_type_id
+                = 1 then DATE_ADD(t5.start_month,interval 1 month) else t5.start_month end) and
+                DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &lt;=
+                (case when t5.is_continue=1 then #{currentMonth} when t5.end_month = 0 then DATE_FORMAT(#{currentMonth},
+                '%Y-%m-%d') when t5.task_type_id = 1 then
+                DATE_ADD(t5.end_month,interval 1 month) else t5.end_month end)
+            </if>
         </where>
         ORDER BY
         t1.work_month DESC