|
@@ -6,23 +6,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.huimv.receive.common.token.TokenSign;
|
|
|
import com.huimv.receive.common.utils.Result;
|
|
|
import com.huimv.receive.common.utils.ResultCode;
|
|
|
-import com.huimv.receive.entity.BaseLocation;
|
|
|
-import com.huimv.receive.entity.BaseProcess;
|
|
|
+import com.huimv.receive.entity.*;
|
|
|
import com.huimv.receive.entity.vo.BaseProcessByLocationVo;
|
|
|
import com.huimv.receive.entity.vo.BaseProcessVo;
|
|
|
+import com.huimv.receive.entity.vo.ProcessVo;
|
|
|
import com.huimv.receive.entity.vo.UserAccountVo;
|
|
|
-import com.huimv.receive.mapper.BaseProcessMapper;
|
|
|
+import com.huimv.receive.mapper.*;
|
|
|
import com.huimv.receive.service.IBaseLocationService;
|
|
|
import com.huimv.receive.service.IBaseProcessService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -37,6 +37,20 @@ public class BaseProcessServiceImpl extends ServiceImpl<BaseProcessMapper, BaseP
|
|
|
|
|
|
@Autowired
|
|
|
private BaseProcessMapper baseProcessMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillPcrMapper pcrMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillCleanMapper cleanMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillCleanBeforeMapper cleanBeforeMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillDryMapper dryMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillIsolateMapper isolateMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillSamplingMapper samplingMapper;
|
|
|
+ @Autowired
|
|
|
+ private BillGoodsInventoryMapper goodsInventoryMapper;
|
|
|
@Override
|
|
|
public Result getOne(Map<String, String> map) {
|
|
|
String id = map.get("processId");
|
|
@@ -70,4 +84,138 @@ public class BaseProcessServiceImpl extends ServiceImpl<BaseProcessMapper, BaseP
|
|
|
}
|
|
|
return new Result(ResultCode.SUCCESS,baseProcessByLocationVos);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result listAll(Map<String, String> map) {
|
|
|
+ String farmId = map.get("farmId");
|
|
|
+ String type = map.get("type");//0 全部 1进行中 2 已完成
|
|
|
+ String pageNum = map.get("pageNum");
|
|
|
+ String pageSize = map.get("pageSize");
|
|
|
+ if ("".equals(type) || null == type) {
|
|
|
+ type = "0";
|
|
|
+ }
|
|
|
+ QueryWrapper<BaseProcess> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("a.farm_id", farmId);
|
|
|
+ if ("0".equals(type)) {
|
|
|
+ queryWrapper.in("a.process_type", 0, 1, 2,3);
|
|
|
+ } else if ("1".equals(type)) {
|
|
|
+ queryWrapper.eq("a.process_type", 0);
|
|
|
+ } else {
|
|
|
+ queryWrapper.in("a.process_type", 1, 2,3);
|
|
|
+ }
|
|
|
+ queryWrapper.orderByDesc("a.sub_date");
|
|
|
+ Page<ProcessVo> page = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
|
|
|
+ QueryWrapper<BaseProcess> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("farm_id", farmId).eq("process_type", 0);
|
|
|
+ return new Result(ResultCode.SUCCESS, baseProcessMapper.listAll(queryWrapper, page),baseProcessMapper.selectCount(queryWrapper1));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result edit(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ String processId = paramsMap.get("processId");
|
|
|
+ BaseProcess baseProcess = baseProcessMapper.selectById(processId);
|
|
|
+ baseProcess.setProcessType(3);
|
|
|
+ String currentFlowId = baseProcess.getCurrentFlowId();
|
|
|
+
|
|
|
+
|
|
|
+ String[] strings = currentFlowId.split(",");
|
|
|
+ String ss2 = "";
|
|
|
+ for (int i = 0; i < strings.length; i++) {
|
|
|
+ strings[i].replaceAll(strings[i], "4");
|
|
|
+ if (i == strings.length - 1) {
|
|
|
+ ss2 = ss2 + strings[i].replaceAll(strings[i], "4");
|
|
|
+ } else {
|
|
|
+ ss2 = strings[i].replaceAll(strings[i], "4") + "," + ss2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ baseProcess.setAllLocationStatus(ss2);
|
|
|
+
|
|
|
+ String s = currentFlowId.substring(currentFlowId.length() - 1);
|
|
|
+ if ("1".equals(s)) {
|
|
|
+ BillSampling billSampling = samplingMapper.selectOne(new QueryWrapper<BillSampling>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(2);
|
|
|
+ billSampling.setPassDate(LocalDateTime.now());
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ samplingMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if ("2".equals(s)) {
|
|
|
+ BillPcr billSampling = pcrMapper.selectOne(new QueryWrapper<BillPcr>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(2);
|
|
|
+ billSampling.setPassDate(new Date());
|
|
|
+ billSampling.setPcrType(3);
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ pcrMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if ("3".equals(s)) {
|
|
|
+ BillClean billSampling = cleanMapper.selectOne(new QueryWrapper<BillClean>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(2);
|
|
|
+ billSampling.setPassDate(new Date());
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ cleanMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if ("4".equals(s)) {
|
|
|
+ BillIsolate billSampling = isolateMapper.selectOne(new QueryWrapper<BillIsolate>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(2);
|
|
|
+ billSampling.setPassDate(new Date());
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ isolateMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if ("5".equals(s)) {
|
|
|
+ BillDry billSampling = dryMapper.selectOne(new QueryWrapper<BillDry>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(2);
|
|
|
+ billSampling.setPassDate(new Date());
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ dryMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if ("6".equals(s)) {
|
|
|
+ BillCleanBefore billSampling = cleanBeforeMapper.selectOne(new QueryWrapper<BillCleanBefore>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(2);
|
|
|
+ billSampling.setPassDate(LocalDateTime.now());
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ cleanBeforeMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if ("7".equals(s)) {
|
|
|
+ BillGoodsInventory billSampling = goodsInventoryMapper.selectOne(new QueryWrapper<BillGoodsInventory>()
|
|
|
+ .eq("process_id", processId).orderByDesc("id").last(" limit 1"));
|
|
|
+ if (ObjectUtil.isNotEmpty(billSampling)) {
|
|
|
+ billSampling.setBillStatus(1);
|
|
|
+ billSampling.setSubDate(LocalDateTime.now());
|
|
|
+ billSampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
|
+ billSampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
|
+ goodsInventoryMapper.updateById(billSampling);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ baseProcessMapper.updateById(baseProcess);
|
|
|
+ return new Result(ResultCode.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String s = "0,1,2,3,4,5,6";
|
|
|
+ System.out.println(s.substring(s.length() - 1));
|
|
|
+ }
|
|
|
}
|