|
@@ -0,0 +1,70 @@
|
|
|
+package com.fjhx.applet.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.applet.mapper.MaterialReceiveMapper;
|
|
|
+import com.fjhx.applet.service.MaterialReceiveService;
|
|
|
+import com.fjhx.base.BaseEntity;
|
|
|
+import com.fjhx.utils.Assert;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.StringJoiner;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class MaterialReceiveServiceImpl extends ServiceImpl<MaterialReceiveMapper, BaseEntity> implements MaterialReceiveService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public synchronized void submit() {
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = baseMapper.selectWaterDetail();
|
|
|
+
|
|
|
+
|
|
|
+ Map<Integer, List<Map<String, Object>>> stockChangeType =
|
|
|
+ list.stream().collect(Collectors.groupingBy(item -> (Integer) item.get("stockChangeType")));
|
|
|
+
|
|
|
+ StringJoiner outJoiner = new StringJoiner(",", "(", ")");
|
|
|
+ // 出库处理
|
|
|
+ List<Map<String, Object>> outList = stockChangeType.get(20);
|
|
|
+ if (outList != null) {
|
|
|
+ for (Map<String, Object> map : outList) {
|
|
|
+ // TODO 发起审批流
|
|
|
+ outJoiner.add(map.get("id").toString());
|
|
|
+ }
|
|
|
+ baseMapper.updateReceive(outJoiner.toString(), 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 补出库处理
|
|
|
+ StringJoiner repairJoiner = new StringJoiner(",", "(", ")");
|
|
|
+ List<Map<String, Object>> repairList = stockChangeType.get(23);
|
|
|
+ if (repairList != null) {
|
|
|
+ for (Map<String, Object> map : repairList) {
|
|
|
+ // TODO 发送消息
|
|
|
+ repairJoiner.add(map.get("id").toString());
|
|
|
+ }
|
|
|
+ baseMapper.updateReceive(repairJoiner.toString(), 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getList(String jobNo) {
|
|
|
+ Assert.notEmpty(jobNo, "工号不能为空");
|
|
|
+ return baseMapper.getList(jobNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void operation(Map<String, Object> condition) {
|
|
|
+ List<String> idList = (List<String>) condition.get("idList");
|
|
|
+ Integer operation = (Integer) condition.get("operation");
|
|
|
+
|
|
|
+ Assert.notEmpty(idList, "id列表不能为空");
|
|
|
+ Assert.notEmpty(operation, "操作类型不能为空");
|
|
|
+
|
|
|
+ StringJoiner idJoiner = new StringJoiner(",", "(", ")");
|
|
|
+ idList.forEach(idJoiner::add);
|
|
|
+
|
|
|
+ baseMapper.updateReceive(idJoiner.toString(), operation);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|