|
@@ -1,15 +1,23 @@
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.toolkit.CollectionUtils;
|
|
|
|
-import com.yh.saas.common.support.util.StringUtils;
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.plugins.Page;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.yh.saas.common.support.util.IdGenerator;
|
|
|
|
+import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.ProcurementPlanInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.ProcurementPlanInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.ProcurementPlanInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.ProcurementPlanInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IProcurementPlanInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IProcurementPlanInfoService;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
-import static com.yh.saas.common.support.util.StringUtils.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -21,6 +29,9 @@ import static com.yh.saas.common.support.util.StringUtils.*;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class ProcurementPlanInfoServiceImpl extends ServiceImpl<ProcurementPlanInfoMapper, ProcurementPlanInfo> implements IProcurementPlanInfoService {
|
|
public class ProcurementPlanInfoServiceImpl extends ServiceImpl<ProcurementPlanInfoMapper, ProcurementPlanInfo> implements IProcurementPlanInfoService {
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICommonBillOperateHisService billOperateHisService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查看采购计划
|
|
* 查看采购计划
|
|
* @param id
|
|
* @param id
|
|
@@ -49,6 +60,7 @@ public class ProcurementPlanInfoServiceImpl extends ServiceImpl<ProcurementPlanI
|
|
return procurementPlanInfos.getId();
|
|
return procurementPlanInfos.getId();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 删除采购计划
|
|
* 删除采购计划
|
|
* @param id
|
|
* @param id
|
|
@@ -63,4 +75,82 @@ public class ProcurementPlanInfoServiceImpl extends ServiceImpl<ProcurementPlanI
|
|
this.deleteById(procurementPlanInfo.getId());
|
|
this.deleteById(procurementPlanInfo.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 采购计划列表
|
|
|
|
+ * @param procurementPlanInfo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Page<ProcurementPlanInfo> selectProcurementPlanInfo(ProcurementPlanInfo procurementPlanInfo){
|
|
|
|
+ Map<String, Object> pageView = new HashMap<>();
|
|
|
|
+ pageView.put("startRecord", (procurementPlanInfo.getCurrentPage() - 1)
|
|
|
|
+ * procurementPlanInfo.getPageSize());
|
|
|
|
+ //公司id
|
|
|
|
+ pageView.put("compId",procurementPlanInfo.getCompId());
|
|
|
|
+ pageView.put("searchKeyWord",procurementPlanInfo.getSearchKeyWord());
|
|
|
|
+ pageView.put("pageSize",procurementPlanInfo.getPageSize());
|
|
|
|
+ pageView.put("currentPage",procurementPlanInfo.getCurrentPage());
|
|
|
|
+ // 查询采购订单总数
|
|
|
|
+ Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
|
|
+ List<ProcurementPlanInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
|
|
+ Page<ProcurementPlanInfo> page = new Page<>();
|
|
|
|
+ page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
|
|
+ page.setTotal(dataCount == null ? 0 : dataCount);
|
|
|
|
+ page.setCurrent(procurementPlanInfo.getCurrentPage());
|
|
|
|
+ page.setSize(procurementPlanInfo.getPageSize());
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加采购计划
|
|
|
|
+ * @param procurementPlanInfo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String insertProcurementPlanInfo(ProcurementPlanInfo procurementPlanInfo){
|
|
|
|
+ //新增主键id
|
|
|
|
+ procurementPlanInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ procurementPlanInfo.setStatus(StatusEnum.PURCHASE_SHOW.getName());
|
|
|
|
+ procurementPlanInfo.setStatusFlag(StatusEnum.PURCHASE_SHOW.getFlag());
|
|
|
|
+ // 操作主表数据
|
|
|
|
+ this.insert(procurementPlanInfo);
|
|
|
|
+ // 插入操作历史
|
|
|
|
+ String staffName = this.billOperateHisService.getStaffAndName();
|
|
|
|
+ // 插入操作历史
|
|
|
|
+ this.billOperateHisService.saveBillOperateHis(procurementPlanInfo.getId(), NumberConstant.CONSTANT_PURCHASE, staffName, null,
|
|
|
|
+ procurementPlanInfo.getStatus(), null, "");
|
|
|
|
+ return procurementPlanInfo.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更改状态
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String editStatus(String id){
|
|
|
|
+ //查询采购订单信息
|
|
|
|
+ ProcurementPlanInfo procurementPlanInfo = this.selectById(id);
|
|
|
|
+ //更改状态
|
|
|
|
+ if (procurementPlanInfo != null ){
|
|
|
|
+ if (StatusEnum.PURCHASE_HIDE.getFlag().equals(procurementPlanInfo.getStatusFlag())) {
|
|
|
|
+ procurementPlanInfo.setStatusFlag(StatusEnum.PURCHASE_SHOW.getFlag());
|
|
|
|
+ procurementPlanInfo.setStatus(StatusEnum.PURCHASE_SHOW.getName());
|
|
|
|
+ } else {
|
|
|
|
+ procurementPlanInfo.setStatusFlag(StatusEnum.PURCHASE_HIDE.getFlag());
|
|
|
|
+ procurementPlanInfo.setStatus(StatusEnum.PURCHASE_HIDE.getName());
|
|
|
|
+ }
|
|
|
|
+ //更改运输任务信息
|
|
|
|
+ this.updateById(procurementPlanInfo);
|
|
|
|
+ // 插入操作历史
|
|
|
|
+ String staffName = this.billOperateHisService.getStaffAndName();
|
|
|
|
+ // 插入操作历史
|
|
|
|
+ this.billOperateHisService.saveBillOperateHis(procurementPlanInfo.getId(), NumberConstant.CONSTANT_PURCHASE, staffName, null,
|
|
|
|
+ procurementPlanInfo.getStatus(), null, "");
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
|
|
+ return "NG";
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|