ly 1 gadu atpakaļ
vecāks
revīzija
0b7daff843

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

@@ -2,6 +2,7 @@ package cn.ezhizao.project.business.workOrder.controller;
 
 import cn.ezhizao.common.exception.ServiceException;
 import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.aspectj.lang.annotation.Anonymous;
 import cn.ezhizao.framework.aspectj.lang.annotation.Log;
 import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
 import cn.ezhizao.framework.web.controller.BaseController;
@@ -333,10 +334,11 @@ public class WorkOrderCurrentController extends BaseController {
 
     @PreAuthorize("@ss.hasPermi('business:entrust:workOrder:current:trans')")
     @GetMapping("/transNext")
+    @Anonymous
     @Transactional(rollbackFor = Exception.class)
-    public AjaxResult transNext() {
+    public AjaxResult transNext(Long tenantId) {
         // 将本月改为上一月,将下月改成本月,添加新月
-        List<SysCurrentMonth> months = sysCurrentMonthService.query().eq("tenant_id", getTenantId()).ge("type", 0).list();
+        List<SysCurrentMonth> months = sysCurrentMonthService.query().eq("tenant_id", tenantId).ge("type", 0).list();
         SysCurrentMonth currentMonth = months.stream().filter(v -> v.getType().equals(0)).findFirst().orElse(new SysCurrentMonth());
         if (currentMonth.getId() == null) {
             throw new ServiceException("未设定本月");
@@ -348,11 +350,11 @@ public class WorkOrderCurrentController extends BaseController {
         DateTime nextMonthDate = DateTime.of(nextMonth.getYear() + nextMonth.getMonth() + "01", "yyyyMMdd");
         newNextMonth.setMonth(nextMonthDate.offsetNew(DateField.MONTH, 1).toString("MM"));
         newNextMonth.setYear(nextMonthDate.offsetNew(DateField.MONTH, 1).toString("yyyy"));
-        newNextMonth.setTenantId(getTenantId());
+        newNextMonth.setTenantId(tenantId);
         newNextMonth.setType(1);
 
         // 获取上月的委托
-        List<BizEntrust> entrusts = bizEntrustService.query().eq("tenant_id", getTenantId()).eq("work_month", nextMonthDate.toSqlDate()).list();
+        List<BizEntrust> entrusts = bizEntrustService.query().eq("tenant_id", tenantId).eq("work_month", nextMonthDate.toSqlDate()).list();
         List<BizEntrust> entr = new ArrayList<>(entrusts) ;
         //将到截至月的委托去掉
         for (BizEntrust b : entr) {
@@ -387,16 +389,14 @@ public class WorkOrderCurrentController extends BaseController {
         );
     }
 
-    @GetMapping("/test")
-    public String  test(){
-        return "测试成功";
-    }
+
     @PreAuthorize("@ss.hasPermi('business:entrust:workOrder:current:trans')")
     @GetMapping("/transNextForFactory")
+    @Anonymous
     @Transactional(rollbackFor = Exception.class)
-    public AjaxResult transNextForFactory() {
+    public AjaxResult transNextForFactory(Long tenantId) {
         // 将本月改为上一月,将下月改成本月,添加新月
-        List<SysCurrentMonth> months = sysCurrentMonthService.query().eq("tenant_id", getTenantId()).ge("type", 0).list();
+        List<SysCurrentMonth> months = sysCurrentMonthService.query().eq("tenant_id", tenantId).ge("type", 0).list();
         SysCurrentMonth currentMonth = months.stream().filter(v -> v.getType().equals(0)).findFirst().orElse(new SysCurrentMonth());
         if (currentMonth.getId() == null) {
             throw new ServiceException("未设定本月");
@@ -408,7 +408,7 @@ public class WorkOrderCurrentController extends BaseController {
         DateTime nextMonthDate = DateTime.of(nextMonth.getYear() + nextMonth.getMonth() + "01", "yyyyMMdd");
         newNextMonth.setMonth(nextMonthDate.offsetNew(DateField.MONTH, 1).toString("MM"));
         newNextMonth.setYear(nextMonthDate.offsetNew(DateField.MONTH, 1).toString("yyyy"));
-        newNextMonth.setTenantId(getTenantId());
+        newNextMonth.setTenantId(tenantId);
         newNextMonth.setType(1);
 
         return toAjax(
@@ -416,7 +416,6 @@ public class WorkOrderCurrentController extends BaseController {
                         (nextMonth.getId() == null || sysCurrentMonthService.updateById(nextMonth)) &&
                         sysCurrentMonthService.save(newNextMonth));
     }
-
     /**
      * 导出本月工单
      */