From 1369c87ddcc0e76e17d01208ef66261ee0cd27da Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期五, 27 二月 2026 18:13:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java |  530 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 460 insertions(+), 70 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
index cc37c83..8aef70c 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
@@ -1,25 +1,31 @@
 package com.fzzy.igds.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.fzzy.igds.constant.Constant;
-import com.fzzy.igds.data.NoticeDto;
-import com.fzzy.igds.data.NoticeParam;
-import com.fzzy.igds.mapper.InoutNoticeMapper;
-import com.fzzy.igds.repository.InoutNoticeInRepository;
-import com.fzzy.igds.repository.InoutNoticeOutRepository;
-import com.fzzy.igds.domain.InoutNoticeIn;
-import com.fzzy.igds.domain.InoutNoticeOut;
+import com.fzzy.igds.constant.InoutConstant;
+import com.fzzy.igds.data.*;
+import com.fzzy.igds.domain.*;
+import com.fzzy.igds.mapper.InoutNoticeInMapper;
+import com.fzzy.igds.mapper.InoutNoticeOutMapper;
 import com.fzzy.igds.utils.ContextUtil;
+import com.fzzy.work.data.WorkBizType;
+import com.fzzy.work.data.WorkStatus;
+import com.fzzy.work.domain.WorkOrderConf;
+import com.fzzy.work.service.BizWorkService;
 import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description 鍑哄叆搴撻�氱煡鍗晄ervice灞傦紝鍖呭惈鍏ュ簱閫氱煡鍗曞拰鍑哄簱閫氱煡鍗�
@@ -31,35 +37,95 @@
 public class InoutNoticeService {
 
     @Resource
-    private InoutNoticeInRepository noticeInRepository;
+    private InoutNoticeInMapper noticeInMapper;
     @Resource
-    private InoutNoticeOutRepository noticeOutRepository;
+    private InoutNoticeOutMapper noticeOutMapper;
     @Resource
-    private InoutNoticeMapper noticeMapper;
+    private DepotService depotService;
+    @Resource
+    private CoreDeptService coreDeptService;
+    @Resource
+    private PledgeContractService pledgeContractService;
+
+    @Resource
+    private BizWorkService workService;
+
+    /*----------------------鍏ュ簱閫氱煡鍗曚俊鎭�-------------------------*/
 
     /**
-     * JPA鍒嗛〉鏌ヨ鏁版嵁
-     *
-     * @param specification
-     * @param pageable
-     * @return
+     * 鍒嗛〉鏌ヨ鏁版嵁
+     * @param page
+     * @param param
      */
-    public Page<InoutNoticeIn> queryAllNoticeIn(Specification<InoutNoticeIn> specification, Pageable pageable) {
-        return noticeInRepository.findAll(specification, pageable);
+    public void pageQueryIn(Page<InoutNoticeIn> page, NoticeParam param) {
+        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
+
+        if (null == param) {
+            param = new NoticeParam();
+        }
+        param.setCompanyId(ContextUtil.getCompanyId());
+
+        queryWrapper.eq("company_id", param.getCompanyId());
+        if (StringUtils.isNotBlank(param.getDeptId())) {
+            queryWrapper.eq("dept_id", param.getDeptId());
+        }else {
+            queryWrapper.likeRight("dept_id", ContextUtil.subDeptId(null));
+        }
+        if (StringUtils.isNotBlank(param.getCustomerName())) {
+            queryWrapper.like("customer_name", param.getCustomerName());
+        }
+        if (StringUtils.isNotBlank(param.getFoodVariety())) {
+            queryWrapper.like("food_variety", param.getFoodVariety());
+        }
+        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
+            queryWrapper.like("complete_status", param.getCompleteStatus());
+        }
+
+        queryWrapper.orderByDesc("id");
+        noticeInMapper.selectPage(page, queryWrapper);
     }
 
     /**
-     * JPA鏌ヨ鏁版嵁
-     * @param companyId
-     * @param deptId
+     * 鏍规嵁鏉′欢鏌ヨ
      * @return
      */
-    public List<InoutNoticeIn> listNoticeIn(String companyId, String deptId) {
-        return noticeInRepository.listNoticeIn(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
+    public List<InoutNoticeIn> getNoticeIn(NoticeParam param) {
+
+        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
+        if (StringUtils.isNotBlank(param.getCompanyId())) {
+            queryWrapper.eq("company_id", param.getCompanyId());
+        }
+        if (StringUtils.isNotBlank(param.getDeptId())) {
+            queryWrapper.eq("dept_id", param.getDeptId());
+        }
+        if (StringUtils.isNotBlank(param.getAuditStatus())) {
+            queryWrapper.eq("audit_status", param.getAuditStatus());
+        }
+        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
+            queryWrapper.eq("complete_status", param.getCompleteStatus());
+        }
+        if (StringUtils.isNotBlank(param.getKey())) {
+            queryWrapper.like("name", param.getKey());
+        }
+        queryWrapper.orderByDesc("create_time");
+
+        return noticeInMapper.selectList(queryWrapper);
     }
 
     /**
-     * jpa 鑾峰彇淇℃伅
+     * 鏍规嵁鏉′欢鏌ヨ
+     * @param id
+     * @return
+     */
+    public InoutNoticeIn getNoticeInOne(String id) {
+
+        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("id", id);
+        return noticeInMapper.selectOne(queryWrapper);
+    }
+
+    /**
+     *  鏌ヨ鏁版嵁
      * @param companyId
      * @return
      */
@@ -67,58 +133,193 @@
         if (StringUtils.isEmpty(companyId)) {
             companyId = ContextUtil.getCompanyId();
         }
-        return noticeInRepository.listNoticeIn(companyId, Constant.COMPLETE_STATUS_NONE);
+        NoticeParam param = new NoticeParam();
+        param.setCompanyId(companyId);
+        param.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+        return this.getNoticeIn(param);
     }
 
     /**
-     * JPA - 淇濆瓨鏇存柊鏁版嵁
+     *  - 淇濆瓨鏇存柊鏁版嵁
      *
      * @param data
      * @return
      */
-    public String saveOrUpdateIn(InoutNoticeIn data) {
-        if (Constant.YN_Y.equals(data.getTag())) {
-            data.setCreateBy(ContextUtil.getLoginUserName());
-            data.setCreateTime(new Date());
-            data.setAuditStatus(Constant.COMPLETE_STATUS_NONE);
-            data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+    @Transactional(rollbackFor = Exception.class)
+    public BaseResp saveOrUpdateIn(InoutNoticeIn data) {
+
+        //濡傛灉鏄簱鍖鸿嚜寤洪�氱煡鍗�
+        if (InoutConstant.NOTICE_IN_TYPE_10.equals(data.getType())) {
+            //鑾峰彇璐ㄦ娂鍚堝悓鏁版嵁
+            PledgeContract pledge = this.getPledgeByDepotId(data);
+            if (null != pledge && pledge.getStatus().equals(Constant.YN_N)) {
+                return BaseResp.error("褰撳墠浠撳簱鏈夋湭瑙f娂鐨勮川鎶煎悎鍚岋紝璐ㄦ娂鍚堝悓=" + pledge.getName());
+            }
         }
+
+        //濡傛灉璐ㄦ娂閫氱煡鍗�
+        if (InoutConstant.NOTICE_IN_TYPE_20.equals(data.getType())) {
+            //1.楠岃瘉閾惰鏄惁濉啓锛屾湭濉啓锛屽垯涓嶅厑璁镐繚瀛�
+            if (StringUtils.isEmpty(data.getBankId())) {
+                return BaseResp.error("璐ㄦ娂閾惰涓嶈兘涓虹┖锛�");
+            }
+            //2.楠岃瘉閾惰鍜屼粨搴撶殑瀵瑰簲鍏崇郴鏄惁姝g‘锛屼笉姝g‘鍒欎笉鍏佽淇濆瓨
+            PledgeContract pledge = this.getPledgeByDepotIdAndBankId(data);
+            if (null == pledge) {
+                return BaseResp.error("鏈幏鍙栧埌褰撳墠搴撳尯銆佷粨搴撳拰閾惰涔嬮棿鐨勮川鎶间俊鎭紒");
+            }
+        }
+
+        //淇敼鍜屾彁浜ゆ槸涓や釜閫昏緫鍒ゆ柇
+        if (null == data.getUpdateBy()) {
+            return this.saveInAddStartWork(data);
+        } else {
+            data.setUpdateBy(ContextUtil.getLoginUserName());
+            data.setUpdateTime(new Date());
+            noticeInMapper.updateById(data);
+            return BaseResp.success();
+        }
+    }
+
+    private BaseResp saveInAddStartWork(InoutNoticeIn data) {
+        //鏁版嵁淇濆瓨
         data.setUpdateBy(ContextUtil.getLoginUserName());
         data.setUpdateTime(new Date());
-        noticeInRepository.save(data);
-        return null;
+        data.setCreateBy(ContextUtil.getLoginUserName());
+        data.setCreateTime(new Date());
+        data.setAuditStatus(WorkStatus.STATUS_10.getCode());
+        data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+
+        //鎵ц娴佺▼
+        WorkOrderConf conf = workService.getConfByDeptId(data.getDeptId(), WorkBizType.TYPE_10);
+        //娴佺▼涓嶅惎鐢�
+        if (null == conf || Constant.YN_N.equals(conf.getValTag())) {
+            data.setAuditStatus(WorkStatus.STATUS_50.getCode());
+        } else {
+            BaseResp resp = workService.startByNoticeIn(data, conf);
+            log.info("---------鍚姩宸ュ崟娴佺▼------{}", resp);
+        }
+
+        noticeInMapper.insert(data);
+
+        return BaseResp.success();
+    }
+
+
+    /**
+     * 鍒ゆ柇褰撳墠浠撳簱鏄惁鍦ㄨ川鎶煎悎鍚屼腑鏈В鎶�
+     * @param data 褰撳墠鏁版嵁
+     * @return true-鍦ㄨ川鎶煎悎鍚屼腑鏈В鎶硷紝false-鍦ㄨ川鎶煎悎鍚屼腑宸茶В鎶�
+     */
+    private PledgeContract getPledgeByDepotId(InoutNoticeIn data) {
+        IgdsBaseParam param = new IgdsBaseParam();
+        param.setCompanyId(data.getCompanyId());
+        param.setDeptId(data.getDeptId());
+        param.setDepotId(data.getDepotId());
+        return pledgeContractService.getByDepotId(param);
+    }
+
+    private PledgeContract getPledgeByDepotIdAndBankId(InoutNoticeIn data) {
+        IgdsBaseParam param = new IgdsBaseParam();
+        param.setCompanyId(data.getCompanyId());
+        param.setDeptId(data.getDeptId());
+        param.setDepotId(data.getDepotId());
+        param.setBankId(data.getBankId());
+        return pledgeContractService.getByDepotId(param);
     }
 
     /**
-     * JPA - 鍒犻櫎鏁版嵁
+     * 鏇存柊瀹℃牳鐘舵��
+     * @param id
+     * @param status
+     */
+    public void updateNoticeInStatus(String id, String status) {
+        UpdateWrapper<InoutNoticeIn> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", id).set("audit_status", status);
+
+        noticeInMapper.update(null, updateWrapper);
+    }
+
+    /**
+     *  - 鍒犻櫎鏁版嵁
      *
      * @param data
      * @return
      */
     public String delDataIn(InoutNoticeIn data) {
-        noticeInRepository.delete(data);
+        noticeInMapper.deleteById(data);
         return null;
     }
 
+    /*----------------------鍑哄簱閫氱煡鍗曚俊鎭�-------------------------*/
+
     /**
-     * JPA鍒嗛〉鏌ヨ鏁版嵁
-     *
-     * @param specification
-     * @param pageable
-     * @return
+     * 鍒嗛〉鏌ヨ鏁版嵁
+     * @param page
+     * @param param
      */
-    public Page<InoutNoticeOut> queryAllNoticeOut(Specification<InoutNoticeOut> specification, Pageable pageable) {
-        return noticeOutRepository.findAll(specification, pageable);
+    public void pageQueryOut(Page<InoutNoticeOut> page, NoticeParam param) {
+        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
+
+        if (null == param) {
+            param = new NoticeParam();
+        }
+        param.setCompanyId(ContextUtil.getCompanyId());
+
+        queryWrapper.eq("company_id", param.getCompanyId());
+        if (StringUtils.isNotBlank(param.getDeptId())) {
+            queryWrapper.eq("dept_id", param.getDeptId());
+        }else {
+            queryWrapper.likeRight("dept_id", ContextUtil.subDeptId(null));
+        }
+        if (StringUtils.isNotBlank(param.getCustomerName())) {
+            queryWrapper.like("customer_name", param.getCustomerName());
+        }
+        if (StringUtils.isNotBlank(param.getFoodVariety())) {
+            queryWrapper.like("food_variety", param.getFoodVariety());
+        }
+        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
+            queryWrapper.like("complete_status", param.getCompleteStatus());
+        }
+        queryWrapper.orderByDesc("id");
+        noticeOutMapper.selectPage(page, queryWrapper);
     }
 
     /**
-     * JPA鏌ヨ鏁版嵁
-     * @param companyId
-     * @param deptId
+     * 鏍规嵁鏉′欢鏌ヨ
      * @return
      */
-    public List<InoutNoticeOut> listNoticeOut(String companyId, String deptId) {
-        return noticeOutRepository.listNoticeOut(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
+    public List<InoutNoticeOut> getNoticeOut(NoticeParam param) {
+        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
+        if (StringUtils.isNotBlank(param.getCompanyId())) {
+            queryWrapper.eq("company_id", param.getCompanyId());
+        }
+        if (StringUtils.isNotBlank(param.getDeptId())) {
+            queryWrapper.eq("dept_id", param.getDeptId());
+        }
+        if (StringUtils.isNotBlank(param.getAuditStatus())) {
+            queryWrapper.eq("audit_status", param.getAuditStatus());
+        }
+        if (StringUtils.isNotBlank(param.getCompleteStatus())) {
+            queryWrapper.eq("complete_status", param.getCompleteStatus());
+        }
+        if (StringUtils.isNotBlank(param.getKey())) {
+            queryWrapper.like("name", param.getKey());
+        }
+        queryWrapper.orderByDesc("create_time");
+
+        return noticeOutMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 鏍规嵁鏉′欢鏌ヨ
+     * @param id
+     * @return
+     */
+    public InoutNoticeOut getNoticeOutOne(String id) {
+        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("id", id);
+        return noticeOutMapper.selectOne(queryWrapper);
     }
 
     /**
@@ -130,41 +331,124 @@
         if (StringUtils.isEmpty(companyId)) {
             companyId = ContextUtil.getCompanyId();
         }
-        return noticeOutRepository.listNoticeOut(companyId, Constant.COMPLETE_STATUS_NONE);
+        NoticeParam param = new NoticeParam();
+        param.setCompanyId(companyId);
+        param.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+        return this.getNoticeOut(param);
     }
 
     /**
-     * JPA - 淇濆瓨鏇存柊鏁版嵁
+     *  - 淇濆瓨鏇存柊鏁版嵁
      *
      * @param data
      * @return
      */
-    public String saveOrUpdateOut(InoutNoticeOut data) {
-        if (Constant.YN_Y.equals(data.getTag())) {
-            data.setCreateBy(ContextUtil.getLoginUserName());
-            data.setCreateTime(new Date());
-            data.setAuditStatus(Constant.COMPLETE_STATUS_NONE);
-            data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+    @Transactional(rollbackFor = Exception.class)
+    public BaseResp saveOrUpdateOut(InoutNoticeOut data) {
+        //濡傛灉鍑哄簱閫氱煡鍗曠被鍨嬩负搴撳尯閫氱煡鍗曪紝楠岃瘉浠撳簱鏄惁鏄湭瑙f娂寰椾粨搴擄紝鏄垯涓嶅厑璁镐繚瀛�
+        if (InoutConstant.NOTICE_IN_TYPE_10.equals(data.getType())) {
+            //鍦ㄨ川鎶煎悎鍚屾壘鍒版湭瑙f娂锛屼笖璐ㄦ娂浠撳簱鍖呭惈褰撳墠浠撳簱鐨勬暟鎹�
+            //鑾峰彇璐ㄦ娂鍚堝悓鏁版嵁
+            PledgeContract pledge = this.getPledgeByDepotIdOut(data);
+            if (null != pledge && pledge.getStatus().equals(Constant.YN_N)) {
+                return BaseResp.error("褰撳墠浠撳簱鏈夋湭瑙f娂鐨勮川鎶煎悎鍚岋紝璐ㄦ娂鍚堝悓=" + pledge.getName());
+            }
         }
-        data.setUpdateBy(ContextUtil.getLoginUserName());
-        data.setUpdateTime(new Date());
-        noticeOutRepository.save(data);
-        return null;
+        //濡傛灉鍑哄簱閫氱煡鍗曠被鍨嬩负鐩戠閫氱煡鍗�
+        //濡傛灉璐ㄦ娂閫氱煡鍗�
+        if (InoutConstant.NOTICE_IN_TYPE_20.equals(data.getType())) {
+            //1.楠岃瘉閾惰鏄惁濉啓锛屾湭濉啓锛屽垯涓嶅厑璁镐繚瀛�
+            if (StringUtils.isEmpty(data.getBankId())) {
+                return BaseResp.error("璐ㄦ娂閾惰涓嶈兘涓虹┖锛�");
+            }
+            //2.楠岃瘉閾惰鍜屼粨搴撶殑瀵瑰簲鍏崇郴鏄惁姝g‘锛屼笉姝g‘鍒欎笉鍏佽淇濆瓨
+            PledgeContract pledge = this.getPledgeByDepotIdAndBankIdOut(data);
+            if (null == pledge) {
+                return BaseResp.error("鏈幏鍙栧埌褰撳墠搴撳尯銆佷粨搴撳拰閾惰涔嬮棿鐨勮川鎶间俊鎭紒");
+            }
+        }
+
+        if (null == data.getUpdateBy()) {
+            return this.saveOutAddStartWork(data);
+        } else {
+            data.setUpdateBy(ContextUtil.getLoginUserName());
+            data.setUpdateTime(new Date());
+            noticeOutMapper.updateById(data);
+            return BaseResp.success();
+        }
     }
 
     /**
-     * JPA - 鍒犻櫎鏁版嵁
+     * 鏇存柊瀹℃牳鐘舵��
+     * @param id
+     * @param status
+     */
+    public void updateNoticeOutStatus(String id, String status) {
+        UpdateWrapper<InoutNoticeOut> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", id).set("audit_status", status);
+
+        noticeOutMapper.update(null, updateWrapper);
+    }
+
+    /**
+     * 鍒犻櫎鏁版嵁
      *
      * @param data
      * @return
      */
     public String delDataOut(InoutNoticeOut data) {
-        noticeOutRepository.delete(data);
+        noticeOutMapper.deleteById(data);
         return null;
     }
 
+    private BaseResp saveOutAddStartWork(InoutNoticeOut data) {
+        //鏁版嵁淇濆瓨
+        data.setUpdateBy(ContextUtil.getLoginUserName());
+        data.setUpdateTime(new Date());
+        data.setCreateBy(ContextUtil.getLoginUserName());
+        data.setCreateTime(new Date());
+        data.setAuditStatus(WorkStatus.STATUS_10.getCode());
+        data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+
+        //鎵ц娴佺▼
+        WorkOrderConf conf = workService.getConfByDeptId(data.getDeptId(), WorkBizType.TYPE_20);
+        //娴佺▼涓嶅惎鐢�
+        if (null == conf || Constant.YN_N.equals(conf.getValTag())) {
+            data.setAuditStatus(WorkStatus.STATUS_50.getCode());
+        } else {
+            BaseResp resp = workService.startByNoticeOut(data, conf);
+            log.info("---------鍚姩宸ュ崟娴佺▼------{}", resp);
+        }
+
+        noticeOutMapper.insert(data);
+
+        return BaseResp.success();
+    }
+
     /**
-     * JPA - 鏍规嵁ID鑾峰彇閫氱煡鍗曚俊鎭�
+     * 鍒ゆ柇褰撳墠浠撳簱鏄惁鍦ㄨ川鎶煎悎鍚屼腑鏈В鎶�
+     * @param data 褰撳墠鏁版嵁
+     * @return true-鍦ㄨ川鎶煎悎鍚屼腑鏈В鎶硷紝false-鍦ㄨ川鎶煎悎鍚屼腑宸茶В鎶�
+     */
+    private PledgeContract getPledgeByDepotIdOut(InoutNoticeOut data) {
+        IgdsBaseParam param = new IgdsBaseParam();
+        param.setCompanyId(data.getCompanyId());
+        param.setDeptId(data.getDeptId());
+        param.setDepotId(data.getDepotId());
+        return pledgeContractService.getByDepotId(param);
+    }
+
+    private PledgeContract getPledgeByDepotIdAndBankIdOut(InoutNoticeOut data) {
+        IgdsBaseParam param = new IgdsBaseParam();
+        param.setCompanyId(data.getCompanyId());
+        param.setDeptId(data.getDeptId());
+        param.setDepotId(data.getDepotId());
+        param.setBankId(data.getBankId());
+        return pledgeContractService.getByDepotId(param);
+    }
+
+    /**
+     * 鏍规嵁ID鑾峰彇閫氱煡鍗曚俊鎭�
      * @param id
      * @param type
      * @return
@@ -175,10 +459,10 @@
         }
         NoticeDto noticeDto = new NoticeDto();
         if (Constant.TYPE_IN.equals(type)) {
-            InoutNoticeIn noticeIn = noticeInRepository.getDataById(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
+            InoutNoticeIn noticeIn = this.getNoticeInOne(id);
             BeanUtils.copyProperties(noticeIn, noticeDto);
         } else {
-            InoutNoticeOut noticeOut = noticeOutRepository.getDataById(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
+            InoutNoticeOut noticeOut = this.getNoticeOutOne(id);
             BeanUtils.copyProperties(noticeOut, noticeDto);
         }
         return noticeDto;
@@ -217,6 +501,7 @@
      * @return
      */
     public String reSumNoticeInComplete(NoticeParam param) {
+        //TODO 寰呭疄鐜帮紝鍚庣画鏍规嵁闇�姹傝繘琛屽疄鐜�
         if (StringUtils.isEmpty(param.getCustomerName())) {
             return "瀹㈡埛缂栫爜涓虹┖锛�";
         }
@@ -229,7 +514,6 @@
         if (StringUtils.isEmpty(param.getDeptId())) {
             param.setDeptId(ContextUtil.subDeptId(null));
         }
-        noticeMapper.reSumNoticeInComplete(param);
         return null;
     }
 
@@ -249,7 +533,7 @@
         for (InoutNoticeOut noticeOut : noticeOutList) {
 
             param = new NoticeParam(noticeOut.getCompanyId(), noticeOut.getDeptId(), noticeOut.getDepotId(),
-                    noticeOut.getCustomerId(), noticeOut.getFoodVariety(), noticeOut.getId());
+                    noticeOut.getCustomerName(), noticeOut.getFoodVariety(), noticeOut.getId());
 
             log.info("寮�濮嬫洿鏂板嚭搴撻�氱煡鍗�={}", param.toString());
 
@@ -266,6 +550,7 @@
      * @return
      */
     public String reSumNoticeOutComplete(NoticeParam param) {
+        //TODO 寰呭疄鐜帮紝鍚庣画鏍规嵁闇�姹傝繘琛屽疄鐜�
         if (StringUtils.isEmpty(param.getCustomerName())) {
             return "瀹㈡埛缂栫爜涓虹┖锛�";
         }
@@ -281,8 +566,113 @@
         if (StringUtils.isEmpty(param.getDeptId())) {
             param.setDeptId(ContextUtil.subDeptId(null));
         }
-        noticeMapper.reSumNoticeOutComplete(param);
         return null;
     }
 
+    /**
+     *
+     * @param param
+     * @return
+     */
+    public ExportWordParam handleInData(ExportWordParam param) {
+
+        InoutNoticeIn notice = this.getNoticeInOne(param.getBizId());
+
+        //杞崲涓烘ā鏉块渶瑕佺殑map鏁版嵁婧�
+        Map<String, Object> map = new HashMap();
+
+        map.put("serId", notice.getId());
+        map.put("name", notice.getName());
+
+        String type = "";
+        if ("10".equals(notice.getType())) {
+            type = "搴撳尯閫氱煡鍗�";
+        }
+        if ("20".equals(notice.getType())) {
+            type = "鐩戠閫氱煡鍗�";
+        }
+        map.put("type", type);
+
+        map.put("customerName", notice.getCustomerName());
+
+        String unitName = "";
+        Dept dept = coreDeptService.getDeptById(notice.getUnitName());
+        if (dept != null) {
+            unitName = dept.getKqmc();
+        }
+        map.put("unitName", unitName);
+
+        Depot depot = depotService.getCacheDepot(notice.getCompanyId(), notice.getDepotId());
+        String depotId = "";
+        if (dept != null) {
+            depotId = depot.getName();
+        }
+        map.put("depotId", depotId);
+
+        map.put("year", notice.getYear());
+        map.put("targetNumber", notice.getTargetNumber());
+        map.put("completeNumber", notice.getCompleteNumber());
+        map.put("completeStatus", notice.getCompleteStatus());
+        map.put("contract", notice.getContract());
+        map.put("remark", notice.getRemark());
+        map.put("createUser", notice.getCreateBy());
+        map.put("createTime", DateFormatUtils.format(notice.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+
+        param.setDataMap(map);
+        return param;
+    }
+
+    /**
+     *
+     * @param param
+     * @return
+     */
+    public ExportWordParam handleOutData(ExportWordParam param) {
+
+        InoutNoticeOut notice = this.getNoticeOutOne(param.getBizId());
+
+        //杞崲涓烘ā鏉块渶瑕佺殑map鏁版嵁婧�
+        Map<String, Object> map = new HashMap();
+
+        map.put("serId", notice.getId());
+        map.put("name", notice.getName());
+
+        String type = "";
+        if ("10".equals(notice.getType())) {
+            type = "搴撳尯閫氱煡鍗�";
+        }
+        if ("20".equals(notice.getType())) {
+            type = "鐩戠閫氱煡鍗�";
+        }
+        map.put("type", type);
+
+        map.put("customerName", notice.getCustomerName());
+
+        String unitName = "";
+        Dept dept = coreDeptService.getDeptById(notice.getUnitName());
+        if (dept != null) {
+            unitName = dept.getKqmc();
+        }
+        map.put("unitName", unitName);
+
+        Depot depot = depotService.getCacheDepot(notice.getCompanyId(), notice.getDepotId());
+        String depotId = "";
+        if (dept != null) {
+            depotId = depot.getName();
+        }
+        map.put("depotId", depotId);
+
+        map.put("year", notice.getYear());
+        map.put("targetNumber", notice.getTargetNumber());
+        map.put("completeNumber", notice.getCompleteNumber());
+        map.put("completeStatus", notice.getCompleteStatus());
+        map.put("contract", notice.getContract());
+        map.put("remark", notice.getRemark());
+        map.put("createUser", notice.getCreateBy());
+        map.put("createTime", DateFormatUtils.format(notice.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+
+        param.setDataMap(map);
+        return param;
+    }
+
 }

--
Gitblit v1.9.3