|
@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.huimv.receive.common.token.TokenSign;
|
|
import com.huimv.receive.common.token.TokenSign;
|
|
|
|
+import com.huimv.receive.common.utils.DataUill;
|
|
|
|
+import com.huimv.receive.common.utils.Print;
|
|
import com.huimv.receive.common.utils.Result;
|
|
import com.huimv.receive.common.utils.Result;
|
|
import com.huimv.receive.common.utils.ResultCode;
|
|
import com.huimv.receive.common.utils.ResultCode;
|
|
-import com.huimv.receive.entity.BaseLocation;
|
|
|
|
-import com.huimv.receive.entity.BaseProcess;
|
|
|
|
-import com.huimv.receive.entity.BillClean;
|
|
|
|
-import com.huimv.receive.entity.BillPcr;
|
|
|
|
|
|
+import com.huimv.receive.entity.*;
|
|
|
|
+import com.huimv.receive.entity.dto.PcrDto;
|
|
|
|
+import com.huimv.receive.entity.vo.PcrVo;
|
|
|
|
+import com.huimv.receive.entity.vo.PcrVo1;
|
|
import com.huimv.receive.mapper.*;
|
|
import com.huimv.receive.mapper.*;
|
|
import com.huimv.receive.service.IBillPcrService;
|
|
import com.huimv.receive.service.IBillPcrService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -18,13 +20,11 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -55,6 +55,153 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
|
|
return new Result(ResultCode.SUCCESS, billPcrPage,billPcrMapper.selectCount(queryWrapper));
|
|
return new Result(ResultCode.SUCCESS, billPcrPage,billPcrMapper.selectCount(queryWrapper));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Result pcrWhole(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
|
+ Date timesmorning = DataUill.getTimesmorning();
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("farm_id", farmId).eq("bill_status", 1).ge("sub_date", timesmorning);//今日合格
|
|
|
|
+ Integer count = billPcrMapper.selectCount(queryWrapper);
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper1 = new QueryWrapper<>();
|
|
|
|
+ queryWrapper1.eq("farm_id", farmId).eq("bill_status", 2).ge("sub_date", timesmorning);//今日异常
|
|
|
|
+ Integer count1 = billPcrMapper.selectCount(queryWrapper1);
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper2 = new QueryWrapper<>();
|
|
|
|
+ queryWrapper2.eq("farm_id", farmId).eq("bill_status", 3).ge("sub_date", timesmorning);//今日失效
|
|
|
|
+ Integer count2 = billPcrMapper.selectCount(queryWrapper2);
|
|
|
|
+ PcrDto dto = new PcrDto();
|
|
|
|
+ dto.setWholeCount(count + count1);
|
|
|
|
+ dto.setPassCount(count);
|
|
|
|
+ dto.setRefuseCount(count1);
|
|
|
|
+ dto.setLoseCount(count2);
|
|
|
|
+ return new Result(ResultCode.SUCCESS, dto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result listType(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
|
+ String type = paramsMap.get("type");
|
|
|
|
+ if ("".equals(type) || null == type) {
|
|
|
|
+ type = "1";
|
|
|
|
+ }
|
|
|
|
+ List<PcrVo> pcrVos = null;
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("farm_id", farmId).in("bill_status", 1, 2);
|
|
|
|
+ if ("1".equals(type)) {
|
|
|
|
+ Date timesmorning = DataUill.getTimesmorning();
|
|
|
|
+ queryWrapper.ge("sub_date", timesmorning);
|
|
|
|
+
|
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.set(Calendar.DATE,calendar.get(Calendar.DATE)-7);
|
|
|
|
+ queryWrapper.ge("sub_date", calendar.getTime());
|
|
|
|
+
|
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
|
+ Date monthmorning = DataUill.getTimesMonthmorning();
|
|
|
|
+ queryWrapper.ge("sub_date",monthmorning);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ pcrVos = billPcrMapper.listPcr(queryWrapper);
|
|
|
|
+ return new Result(ResultCode.SUCCESS, pcrVos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result listLocation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
|
+ String type = paramsMap.get("type");
|
|
|
|
+ if ("".equals(type) || null == type) {
|
|
|
|
+ type = "1";
|
|
|
|
+ }
|
|
|
|
+ List<PcrVo> pcrVos = null;
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("farm_id", farmId).in("bill_status", 1, 2);
|
|
|
|
+ if ("1".equals(type)) {
|
|
|
|
+ Date timesmorning = DataUill.getTimesmorning();
|
|
|
|
+ queryWrapper.ge("sub_date", timesmorning);
|
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.set(Calendar.DATE,calendar.get(Calendar.DATE)-7);
|
|
|
|
+ queryWrapper.ge("sub_date", calendar.getTime());
|
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
|
+ Date monthmorning = DataUill.getTimesMonthmorning();
|
|
|
|
+ queryWrapper.ge("sub_date",monthmorning);
|
|
|
|
+ }
|
|
|
|
+ pcrVos = billPcrMapper.listLocation(queryWrapper);
|
|
|
|
+ return new Result(ResultCode.SUCCESS, pcrVos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result listAll(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
|
+ String personType = paramsMap.get("personType");
|
|
|
|
+ String type = paramsMap.get("type");
|
|
|
|
+ if ("".equals(type) || null == type) {
|
|
|
|
+ type = "1";
|
|
|
|
+ }
|
|
|
|
+ List<PcrVo1> pcrVos = null;
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("farm_id", farmId).in("bill_status", 1, 2);
|
|
|
|
+ if ("".equals(personType) || null == personType) {
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ queryWrapper.eq("vistit_type", personType);
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(type)) {
|
|
|
|
+ Date timesmorning = DataUill.getTimesmorning();
|
|
|
|
+ queryWrapper.ge("sub_date", timesmorning);
|
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.set(Calendar.DATE,calendar.get(Calendar.DATE)-7);
|
|
|
|
+ queryWrapper.ge("sub_date", calendar.getTime());
|
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
|
+ Date monthmorning = DataUill.getTimesMonthmorning();
|
|
|
|
+ queryWrapper.ge("sub_date",monthmorning);
|
|
|
|
+ }
|
|
|
|
+ pcrVos = billPcrMapper.listAll(queryWrapper);
|
|
|
|
+ for (PcrVo1 pcrVo : pcrVos) {
|
|
|
|
+ pcrVo.setAllCount(pcrVo.getPassCount() + pcrVo.getRefuseCount());
|
|
|
|
+ }
|
|
|
|
+ return new Result(ResultCode.SUCCESS, pcrVos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result selectList(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
|
+ String type = paramsMap.get("type");//来访类型
|
|
|
|
+ String destId = paramsMap.get("destId");//目的地
|
|
|
|
+ String startTime = paramsMap.get("startTime");
|
|
|
|
+ String endTime = paramsMap.get("endTime");
|
|
|
|
+ String pageNum = paramsMap.get("pageNum");
|
|
|
|
+ String pageSize = paramsMap.get("pageSize");
|
|
|
|
+ if ("".equals(pageNum) || null == pageNum) {
|
|
|
|
+ pageNum = "1";
|
|
|
|
+ }
|
|
|
|
+ if ("".equals(pageSize) || null == pageSize) {
|
|
|
|
+ pageSize = "10";
|
|
|
|
+ }
|
|
|
|
+ if ("".equals(startTime) || null == startTime) {
|
|
|
|
+ startTime = DataUill.getTimesmorning().toString();
|
|
|
|
+ endTime = LocalDateTime.now() + " 23:59:59";
|
|
|
|
+ }
|
|
|
|
+ QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.in("bill_status", 1, 2);
|
|
|
|
+ queryWrapper.eq("farm_id", farmId).eq(StringUtils.isNotBlank(destId),"dest_id", destId).eq(StringUtils.isNotBlank(type),"vistit_type",type);
|
|
|
|
+ queryWrapper.between("check_date", startTime, endTime);
|
|
|
|
+ Page<BillPcr> page = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
|
|
|
|
+ return new Result(ResultCode.SUCCESS, billPcrMapper.selectPage(page, queryWrapper));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void printPcr(HttpServletResponse httpServletRequest, Map<String, String> paramsMap) throws Exception {
|
|
|
|
+ String ids = paramsMap.get("ids");
|
|
|
|
+ String[] split = ids.split(",");
|
|
|
|
+ List<BillPcr> list = new ArrayList<>();
|
|
|
|
+ for (String s : split) {
|
|
|
|
+ BillPcr admission = billPcrMapper.selectById(s);
|
|
|
|
+ list.add(admission);
|
|
|
|
+ }
|
|
|
|
+ Print.printPcr(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private BillPcrMapper pcrMapper;
|
|
private BillPcrMapper pcrMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -65,6 +212,8 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
|
|
private BillCleanMapper cleanMapper;
|
|
private BillCleanMapper cleanMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private BillGoodsInventoryMapper goodsInventoryMapper;
|
|
private BillGoodsInventoryMapper goodsInventoryMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ConfigurationMapper configurationMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
@@ -135,6 +284,9 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
|
|
locationQueryWrapper.eq("farm_id", farmId).eq("id", billPcr.getTestLocationId());
|
|
locationQueryWrapper.eq("farm_id", farmId).eq("id", billPcr.getTestLocationId());
|
|
BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
|
|
BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
|
|
|
|
|
|
|
|
+ QueryWrapper<Configuration> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("farm_id", farmId);
|
|
|
|
+ Configuration configuration = configurationMapper.selectOne(queryWrapper);
|
|
|
|
|
|
if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
|
|
if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
|
|
return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
|
|
return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
|
|
@@ -148,7 +300,7 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
|
|
billPcr.setTestLocationId(baseLocation.getId());
|
|
billPcr.setTestLocationId(baseLocation.getId());
|
|
billPcr.setCheckDate(sdf.parse(date));
|
|
billPcr.setCheckDate(sdf.parse(date));
|
|
billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
|
|
billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
|
|
- billPcr.setQualifiedDate("2小时");
|
|
|
|
|
|
+ billPcr.setQualifiedDate(configuration.getPcr());
|
|
|
|
|
|
|
|
|
|
//通过生成洗消记录
|
|
//通过生成洗消记录
|
|
@@ -261,7 +413,7 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
|
|
billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
|
|
billPcr.setTestLocation(baseLocation.getLocationName());
|
|
billPcr.setTestLocation(baseLocation.getLocationName());
|
|
billPcr.setTestLocationId(baseLocation.getId());
|
|
billPcr.setTestLocationId(baseLocation.getId());
|
|
- billPcr.setQualifiedDate("2小时");
|
|
|
|
|
|
+ billPcr.setQualifiedDate(configuration.getPcr());
|
|
billPcr.setCheckDate(sdf.parse(date));
|
|
billPcr.setCheckDate(sdf.parse(date));
|
|
billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
|
|
billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
|
|
|
|
|
|
@@ -274,19 +426,6 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
|
|
baseProcess.setProcessType(1);
|
|
baseProcess.setProcessType(1);
|
|
processMapper.updateById(baseProcess);
|
|
processMapper.updateById(baseProcess);
|
|
pcrMapper.updateById(billPcr);
|
|
pcrMapper.updateById(billPcr);
|
|
- ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
|
|
|
|
- Runnable task = new Runnable() {
|
|
|
|
- @Override
|
|
|
|
- public void run() {
|
|
|
|
- //这里写业务
|
|
|
|
- billPcr.setBillStatus(3);
|
|
|
|
- pcrMapper.updateById(billPcr);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- // 设定延迟时间(两小时后执行,单位为秒)
|
|
|
|
- long delay = 60 * 60 * 2;
|
|
|
|
- // 执行定时任务
|
|
|
|
- scheduler.schedule(task, delay, TimeUnit.SECONDS);
|
|
|
|
return new Result(10000, "修改成功!", true);
|
|
return new Result(10000, "修改成功!", true);
|
|
} else {
|
|
} else {
|
|
if (baseLocation.getId() == 1) {
|
|
if (baseLocation.getId() == 1) {
|