gongdecai %!s(int64=3) %!d(string=hai) anos
pai
achega
9cea1e3554

+ 108 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ImportController.java

@@ -3,6 +3,28 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import jxl.Cell;
+
+import jxl.Sheet;
+
+import jxl.Workbook;
+
+import jxl.read.biff.BiffException;
+
+import org.springframework.stereotype.Controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+
+import java.io.FileInputStream;
+
+import java.io.IOException;
+
+import java.io.InputStream;
+
+import java.util.ArrayList;
+
+import java.util.List;
 
 /**
  * <p>
@@ -16,5 +38,91 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/import")
 public class ImportController {
 
+    private String filePath;
+
+    private List list = new ArrayList();
+
+
+    public ImportController(String filePath) {
+        this.filePath = filePath;
+
+    }
+
+    private void readExcel() throws IOException, BiffException {
+//创建输入流
+
+        InputStream stream = new FileInputStream(filePath);
+
+//获取Excel文件对象
+
+        Workbook rwb = Workbook.getWorkbook(stream);
+
+//获取文件的指定工作表 默认的第一个
+
+        Sheet sheet = rwb.getSheet(0);
+
+//行数(表头的目录不需要,从1开始)
+
+        for (int i = 0; i < sheet.getRows(); i++) {
+//创建一个数组 用来存储每一列的值
+
+            String[] str = new String[sheet.getColumns()];
+
+            Cell cell = null;
+
+//列数
+
+            for (int j = 0; j < sheet.getColumns(); j++) {
+//获取第i行,第j列的值
+
+                cell = sheet.getCell(j, i);
+
+                str[j] = cell.getContents();
+
+            }
+
+//把刚获取的列存入list
+
+            list.add(str);
+
+        }
+
+    }
+
+
+    private void outData() {
+        for (int i = 0; i < list.size(); i++) {
+            String[] str = (String[]) list.get(i);
+
+            for (int j = 0; j < str.length; j++) {
+                System.out.print(str[j] + '\t');
+
+            }
+
+            System.out.println();
+
+        }
+
+    }
+
+
+    public static void main(String args[]) throws BiffException, IOException {
+        ExcelController excel = new ExcelController("/Users/user12/Desktop/student1.xls");
+
+        excel.readExcel();
+
+        excel.outData();
+
+    }
+
+
+    @RequestMapping("toExcel")
+
+    public String toExcel() {
+        return "admin/Excel";
+
+    }
+
+
 }
 

+ 53 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranCarInfoServiceImpl.java

@@ -1,6 +1,14 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.google.common.collect.Lists;
+import com.winsea.svc.base.base.entity.CommonStaff;
+import com.winsea.svc.base.base.service.ICommonStaffService;
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.winsea.svc.notice.entity.NoticeTaskInfo;
+import com.winsea.svc.notice.entity.base.BaseNotice;
+import com.winsea.svc.notice.service.INoticeService;
+import com.winsea.svc.notice.service.INoticeTaskService;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
 import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
@@ -46,7 +54,12 @@ public class TranCarInfoServiceImpl extends ServiceImpl<TranCarInfoMapper, TranC
     private ISalesDeliveryReportService salesDeliveryReportService;
     @Autowired
     private GeTuiUtils geTuiUtils;
-
+    @Autowired
+    private INoticeService noticeService;
+    @Autowired
+    private INoticeTaskService noticeTaskService;
+    @Autowired
+    private ICommonStaffService staffService;
     /**
      * 添加发车信息
      *
@@ -96,6 +109,7 @@ public class TranCarInfoServiceImpl extends ServiceImpl<TranCarInfoMapper, TranC
             List<CommonUser> tmp = commonUserService.selectList(new EntityWrapper<CommonUser>().eq("phone", warehouseBaseInfo.getPersonPhone()));
             if (tmp.size() > 0) {
                 geTuiUtils.pushByCid("入库任务", "您有新的入库任务待完成,车牌号:" + warehouseInOutInfo.getCarNo(), tmp.get(0).getId());
+                tesk(warehouseInOutInfo, "2");
             }
         }
         boolean two = warehouseInOutInfoService.insert(warehouseInOutInfo);
@@ -188,4 +202,42 @@ public class TranCarInfoServiceImpl extends ServiceImpl<TranCarInfoMapper, TranC
             this.deleteById(tranCarInfo.getId());
         }
     }
+
+    /**
+     * 任务
+     *
+     * @param warehouseInOutInfo
+     */
+    private void tesk(WarehouseInOutInfo warehouseInOutInfo, String flag) {
+        // 先删除任务
+        noticeService.removeNotice(BaseNotice.NoticeStatus.TASK, "INOUTTASK-TASK-APPROVE",
+                warehouseInOutInfo.getId(), null);
+        String staffName = "XXX";
+        CommonStaff commitUserInfo = staffService.getInfo(AuthSecurityUtils.getCurrentUserId());
+        if (commitUserInfo != null) {
+            staffName = commitUserInfo.getMajorRole() != null
+                    ? commitUserInfo.getMajorRole().getRoleName() + " " + commitUserInfo.getStaffName()
+                    : commitUserInfo.getStaffName();
+        }
+        String taskContent = "";
+        // 向下一步操作人发送任务通知
+        if ("1".equals(flag)) {
+            taskContent = "您的合同(" + warehouseInOutInfo.getContractNo() + ")车辆:" + warehouseInOutInfo.getCarNo() + "已发出";
+        } else {
+            taskContent = "您的合同(" + warehouseInOutInfo.getContractNo() + ")车辆:" + warehouseInOutInfo.getCarNo() + "申请卸货,请及时确认";
+
+        }
+        NoticeTaskInfo taskInfo = new NoticeTaskInfo();
+        taskInfo.setCompId(commitUserInfo.getCompId());
+        taskInfo.setAcceptType(BaseNotice.AcceptStatus.STAFF);
+        taskInfo.setBusinessId(warehouseInOutInfo.getId());
+        taskInfo.setBusinessType("WAREHOUSE");
+        taskInfo.setMessageContent(taskContent);
+        taskInfo.setBusinessCode("INOUTTASK-TASK-APPROVE");
+//            taskInfo.setNoticeTaskStatus(NoticeTaskInfo.NoticeTaskStatus.RETURN);
+        noticeTaskService.createNoticeTask(Lists.newArrayList(warehouseInOutInfo.getCommonId()),
+                null, taskInfo);
+
+    }
+
 }

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -844,7 +844,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
         taskInfo.setMessageContent(taskContent);
         taskInfo.setBusinessCode("INOUTTASK-TASK-APPROVE");
 //            taskInfo.setNoticeTaskStatus(NoticeTaskInfo.NoticeTaskStatus.RETURN);
-        noticeTaskService.createNoticeTask(Lists.newArrayList(AuthSecurityUtils.getCurrentUserId()),
+        noticeTaskService.createNoticeTask(Lists.newArrayList(warehouseInOutInfo.getCommonId()),
                 null, taskInfo);
 
     }