| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932 |
- package com.huimv.receive.service.impl;
- import cn.hutool.core.util.ObjectUtil;
- import com.alibaba.fastjson.JSONObject;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- 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.*;
- 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.service.IBillPcrService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.transaction.interceptor.TransactionAspectSupport;
- import org.springframework.web.multipart.MultipartFile;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.text.DecimalFormat;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.time.LocalDateTime;
- import java.util.*;
- import java.util.concurrent.Executors;
- import java.util.concurrent.ScheduledExecutorService;
- import java.util.concurrent.TimeUnit;
- /**
- * <p>
- * pcr 表 服务实现类
- * </p>
- *
- * @author author
- * @since 2023-07-21
- */
- @Service
- public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> implements IBillPcrService {
- @Resource
- private BillPcrMapper billPcrMapper;
- @Autowired
- private BillGoodsInventoryMapper inventoryMapper;
- @Autowired
- private SysAccountMultilevelMapper multilevelMapper;
- @Override
- public Result listPersonalPcr(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String pageNo = paramsMap.get("pageNum");
- String pageSize = paramsMap.get("pageSize");
- String vistitType = paramsMap.get("vistitType");
- Page<BillPcr> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
- Page<BillPcr> billPcrPage = billPcrMapper.selectPage(page, new QueryWrapper<BillPcr>().eq(StringUtils.isNotBlank(vistitType), "vistit_type", vistitType).eq("admission_user_id", TokenSign.getMemberIdByJwtToken(httpServletRequest)).orderByDesc("sub_date"));
- QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq(StringUtils.isNotBlank(vistitType), "vistit_type", vistitType).eq("admission_user_id", TokenSign.getMemberIdByJwtToken(httpServletRequest)).orderByDesc("sub_date");
- 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);
- for (PcrVo pcrVo : pcrVos) {
- if (pcrVo.getType().equals("0")) {
- pcrVo.setType("人员");
- } else if (pcrVo.getType().equals("1")) {
- pcrVo.setType("环保车");
- } else if (pcrVo.getType().equals("2")) {
- pcrVo.setType("拉猪车");
- } else if (pcrVo.getType().equals("3")) {
- pcrVo.setType("饲料车");
- } else if (pcrVo.getType().equals("4")) {
- pcrVo.setType("送猪车");
- } else if (pcrVo.getType().equals("5")) {
- pcrVo.setType("物资车");
- }
- }
- 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";
- }
- QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
- if (ObjectUtil.isNotEmpty(startTime)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("check_date", startTime, endTime);
- }
- queryWrapper.lambda().orderByDesc(BillPcr::getId);
- queryWrapper.eq("farm_id", farmId).eq(StringUtils.isNotBlank(destId), "dest_id", destId).eq(StringUtils.isNotBlank(type), "vistit_type", type);
- 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);
- }
- @Override
- public Result PcrList(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String farmId = paramsMap.get("farmId");
- QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
- if ("21".equals(farmId)) {
- queryWrapper.eq("farm_id", 26);
- } else {
- queryWrapper.eq("farm_id", farmId);
- }
- Integer integer = pcrMapper.selectCount(queryWrapper);//检测总数
- queryWrapper.in("bill_status", 1, 3);
- Integer integer1 = pcrMapper.selectCount(queryWrapper);//合格总数
- queryWrapper.orderByDesc("sub_date").last(" limit 10");
- DecimalFormat def = new DecimalFormat("0.00");
- String rank;
- if (integer == 0 || integer == null) {
- Double ranks = Double.valueOf("0.00");
- rank = ranks.toString();
- } else {
- Double ranks = (Double.valueOf(integer1.toString()) / Double.valueOf(integer.toString())) * 100;
- rank = def.format(ranks);
- }
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("allCount", integer);
- jsonObject.put("passCount", integer1);
- jsonObject.put("rank", rank);
- jsonObject.put("pcrList", pcrMapper.selectList(queryWrapper));
- return new Result(ResultCode.SUCCESS, jsonObject);
- }
- @Autowired
- private BillPcrMapper pcrMapper;
- @Autowired
- private BaseProcessMapper processMapper;
- @Autowired
- private BaseLocationMapper locationMapper;
- @Autowired
- private BillCleanMapper cleanMapper;
- @Autowired
- private BillGoodsInventoryMapper goodsInventoryMapper;
- @Autowired
- private ConfigurationMapper configurationMapper;
- @Autowired
- private UploadImage uploadImage;
- @Autowired
- private ExistMapper existMapper;
- @Autowired
- private DeviceListMapper deviceListMapper;
- @Autowired
- private PeopleListMapper peopleListMapper;
- @Autowired
- private BillPersonnelAdmissionMapper personnelAdmissionMapper;
- @Autowired
- private BaseWashoutPointMapper washoutPointMapper;
- @Autowired
- private BillDryMapper dryMapper;
- @Autowired
- private BillIsolateMapper isolateMapper;
- @Autowired
- private BillSamplingMapper samplingMapper;
- @Autowired
- private BillCleanBeforeMapper beforeMapper;
- @Override
- public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String farmId = paramsMap.get("farmId");
- String type = paramsMap.get("type");//展示类型
- String pageNum = paramsMap.get("pageNum");
- String pageSize = paramsMap.get("pageSize");
- if ("".equals(pageNum) || null == pageNum) {
- pageNum = "1";
- }
- if ("".equals(pageSize) || null == pageSize) {
- pageSize = "20";
- }
- Page<BillPcr> page = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
- String[] locationIds = TokenSign.getWorkIdByJwtToken(httpServletRequest).split(",");
- QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
- queryWrapper/*.in("test_location_id", locationIds)*/.orderByDesc("sub_date");
- if ("0".equals(type)) {
- queryWrapper.in("bill_status", 0, 1, 2, 3, 4);
- }
- if ("1".equals(type)) {
- queryWrapper.eq("bill_status", 0);
- }
- if ("2".equals(type)) {
- queryWrapper.eq("bill_status", 1);
- }
- if ("3".equals(type)) {
- queryWrapper.in("bill_status", 2, 3);
- }
- QueryWrapper<BillPcr> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2/*.in("test_location_id", locationIds)*/.orderByDesc("sub_date");
- queryWrapper2.eq("bill_status", 0);
- return new Result(ResultCode.SUCCESS, pcrMapper.selectPage(page, queryWrapper), pcrMapper.selectCount(queryWrapper2));
- }
- @Override
- public Result listById(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String id = paramsMap.get("id");
- BillPcr billPcr = pcrMapper.selectById(id);
- return new Result(ResultCode.SUCCESS, billPcr);
- }
- @Override
- @Transactional
- public Result edit(HttpServletRequest httpServletRequest, String farmId, String id, String date, String result,
- MultipartFile img1, MultipartFile img2, MultipartFile img3, MultipartFile picture1, MultipartFile picture2,
- MultipartFile picture3) throws ParseException, IOException {
- //1为合格2为异常
- String s1 = "";
- String s2 = "";
- String s3 = "";
- if (ObjectUtil.isNotEmpty(img1)) {
- s1 = uploadImage.uploadImg(img1);
- if (s1.equals("上传失败")) {
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "检测图片1上传失败", false);
- }
- }
- if (ObjectUtil.isNotEmpty(img2)) {
- String s = uploadImage.uploadImg(img2);
- s2 = "," + s;
- if (s.equals("上传失败")) {
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "检测图片2上传失败", false);
- }
- }
- if (ObjectUtil.isNotEmpty(img3)) {
- String s = uploadImage.uploadImg(img3);
- s3 = "," + s;
- if (s.equals("上传失败")) {
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "检测图片3上传失败", false);
- }
- }
- String s = s1 + s2 + s3;
- String picUrl = null;
- if (ObjectUtil.isNotEmpty(picture1)){
- String pic1 = uploadImage.getImageCom(picture1);
- if (pic1.equals("上传失败")){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "物品检测图片1上传失败", false);
- }else {
- picUrl = pic1;
- }
- }
- if (ObjectUtil.isNotEmpty(picture2)){
- String pic2 = uploadImage.getImageCom(picture2);
- if (pic2.equals("上传失败")){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "物品检测图片2上传失败", false);
- }else {
- picUrl = picUrl + ","+pic2;
- }
- }
- if (ObjectUtil.isNotEmpty(picture3)){
- String pic3 = uploadImage.getImageCom(picture3);
- if (pic3.equals("上传失败")){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "物品检测图片3上传失败", false);
- }else {
- picUrl = picUrl + ","+pic3;
- }
- }
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- if (StringUtils.isBlank(date)) {
- date = sdf.format(new Date());
- }
- BillPcr billPcr = pcrMapper.selectById(id);
- if (billPcr.getBillStatus() != 0) {
- return new Result(10001, "此条记录已被他人修改,请退出刷新查看!", false);
- }
- billPcr.setImgUrl(s);
- billPcr.setImgStatus(1);
- if (billPcr.getVistitType() == 0){
- if (ObjectUtil.isNotEmpty(picUrl)){
- billPcr.setIsCarry(1);
- billPcr.setPicUrl(picUrl);
- }else {
- billPcr.setIsCarry(0);
- }
- }
- QueryWrapper<BaseProcess> processQueryWrapper = new QueryWrapper<>();
- processQueryWrapper.eq("id", billPcr.getProcessId());
- BaseProcess baseProcess = processMapper.selectOne(processQueryWrapper);//进程
- QueryWrapper<BaseLocation> locationQueryWrapper = new QueryWrapper<>();
- locationQueryWrapper.eq("id", billPcr.getTestLocationId());
- BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
- String allLocationId = baseProcess.getAllLocationId();//所有的位置id
- String allFlowId = baseProcess.getAllFlowId();//所有的流程id
- String currentFlowId = baseProcess.getCurrentFlowId();//当前已经完成的流程id
- String substring1 = allFlowId.substring(currentFlowId.length() + 1, allFlowId.length());
- String[] split = substring1.split(",");
- Integer nextId = Integer.parseInt(split[0]);
- if (billPcr.getBillStatus() != 0) {
- return new Result(10001, "该订单已通过,无需再次提交!", false);
- }
- if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
- return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
- } else {
- if ("1".equals(result)) {
- Integer pcrTime = washoutPointMapper.selectOne(new QueryWrapper<BaseWashoutPoint>().eq("farm_ids", baseProcess.getFarmId())
- .eq("visiting_type", billPcr.getVistitType()).eq("mid_id",billPcr.getMidId())
- .eq("location_id", baseLocation.getId())).getPcrTime();
- System.out.println("pcr的下一个流程id:" + nextId);
- billPcr.setBillStatus(1);
- billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
- billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
- billPcr.setTestLocation(baseLocation.getLocationName());
- billPcr.setTestLocationId(baseLocation.getId());
- billPcr.setCheckDate(sdf.parse(date));
- billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
- billPcr.setQualifiedDate(pcrTime);
- Object newObject = getNewObject(nextId, billPcr.getDestName(), billPcr.getDestId(), billPcr.getAdmissionUserName(),
- billPcr.getAdmissionUserId(), billPcr.getVistitDate(), billPcr.getSubDate(),
- billPcr.getProcessId(), billPcr.getFarmId(), billPcr.getTestLocation(), billPcr.getTestLocationId(),
- billPcr.getVistitType(), billPcr.getPhone(), billPcr.getDepartureName(), billPcr.getDepartureId()
- ,billPcr.getMidId(),billPcr.getMidName(),billPcr.getFarmName());
- System.out.println("这里是pcr通过的下一个流程id:" + nextId);
- if (nextId == 0) {
- if (split.length == 1) {
- baseProcess.setProcessType(1);
- String[] strings = allLocationId.split(",");
- String ss2 = "";
- for (int i = 0; i < strings.length; i++) {
- strings[i].replaceAll(strings[i], "2");
- if (i == strings.length - 1) {
- ss2 = ss2 + strings[i].replaceAll(strings[i], "2");
- } else {
- ss2 = strings[i].replaceAll(strings[i], "2") + "," + ss2;
- }
- }
- baseProcess.setAllLocationStatus(ss2);
- //下发人脸门禁白名单
- if (billPcr.getVistitType() == 0) {
- //人员隔离中心流程
- if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
- if ("29".equals(farmId) && baseLocation.getId() == 46) {
- //庙贝门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("29");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
- //凤行门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("31");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("2");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- //人员基地外围
- if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId(billPcr.getFarmId().toString());
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- } else {
- String[] strings = allLocationId.split(",");
- Integer index = 0;
- for (int i = 0; i < strings.length; i++) {
- if ((baseLocation.getId().toString()).equals(strings[i])) {
- index = i;
- }
- }
- QueryWrapper<BaseLocation> queryWrapper = new QueryWrapper();
- queryWrapper.eq("id", strings[index + 2]);
- BaseLocation location = locationMapper.selectOne(queryWrapper);
- FlowUtil flowUtil = new FlowUtil();
- Object entity = flowUtil.getEntity(Integer.parseInt(split[1]), billPcr.getVistitType(), billPcr.getDestName()
- , billPcr.getDestId(), billPcr.getAdmissionUserId(), billPcr.getAdmissionUserName(), billPcr.getPhone(),
- billPcr.getVistitDate(), location.getId(), location.getLocationName(), billPcr.getFarmId()
- , baseProcess.getId(), billPcr.getDepartureName(), billPcr.getDepartureId(),billPcr.getMidId(),billPcr.getMidName(),billPcr.getFarmName());
- if (Integer.parseInt(split[1]) == 1) {
- //新增采样
- BillSampling billSampling = (BillSampling) entity;
- if (billPcr.getVistitType() != 0) {
- billSampling.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billSampling.setResource(billPcr.getResource());
- billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
- billSampling.setRemark(billPcr.getRemark());
- }
- samplingMapper.insert(billSampling);
- //下发人脸门禁白名单
- if (billPcr.getVistitType() == 0) {
- //人员隔离中心流程
- if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
- if ("29".equals(farmId) && baseLocation.getId() == 46) {
- //庙贝门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- Date date1 = calendar.getTime();
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("29");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
- //凤行门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("31");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("2");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- //人员基地外围
- if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId(billPcr.getFarmId().toString());
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- } else if (Integer.parseInt(split[1]) == 2) {
- //新增pcr
- BillPcr billClean = (BillPcr) entity;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- pcrMapper.insert(billClean);
- } else if (Integer.parseInt(split[1]) == 3) {
- //新增洗澡
- BillClean billClean = (BillClean) entity;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- cleanMapper.insert(billClean);
- } else if (Integer.parseInt(split[1]) == 4) {
- //新增隔离
- BillIsolate pcr = (BillIsolate) entity;
- if (billPcr.getVistitType() != 0) {
- pcr.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- pcr.setResource(billPcr.getResource());
- pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
- pcr.setRemark(billPcr.getRemark());
- }
- isolateMapper.insert(pcr);
- } else if (Integer.parseInt(split[1]) == 5) {
- BillDry billClean = (BillDry) entity;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- dryMapper.insert(billClean);
- //新增烘干
- } else if (Integer.parseInt(split[1]) == 6) {
- //新增洗澡前拍照
- BillCleanBefore before = (BillCleanBefore) entity;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- beforeMapper.insert(before);
- } else if (Integer.parseInt(split[1]) == 7) {
- //新增洗澡前拍照
- BillGoodsInventory before = (BillGoodsInventory) entity;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- inventoryMapper.insert(before);
- }
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId + "," + split[1]);
- Integer locationId = billPcr.getTestLocationId();
- String[] split2 = allLocationId.split(",");
- int a = 0;
- for (int i = 0; i < split2.length; i++) {
- if (locationId.toString().equals(split2[i])) {
- a = i + 1;
- }
- }
- int indexOf = 2 * (a - 2);//当前位置在所有流程位置中的下标
- String substring = baseProcess.getAllLocationStatus().substring(0, indexOf + 3);//截取已经过的位置状态
- String[] split1 = substring.split(",");
- String sb2 = "";
- for (int i = 0; i < split1.length; i++) {
- if (i == split1.length - 1) {
- sb2 = sb2 + split1[i].replaceAll(split1[i], "2");
- } else {
- sb2 = split1[i].replaceAll(split1[i], "2") + "," + sb2;
- }
- }
- sb2 = sb2 + baseProcess.getAllLocationStatus().substring(indexOf + 3);
- StringBuilder sb = new StringBuilder(sb2);
- sb.replace(indexOf + 4, indexOf + 5, "2");
- sb.replace(indexOf + 6, indexOf + 7, "1");
- baseProcess.setAllLocationStatus(sb.toString());
- }
- } else if (nextId == 1) {
- //新增采样
- BillSampling billSampling = (BillSampling) newObject;
- if (billPcr.getVistitType() != 0) {
- billSampling.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billSampling.setResource(billPcr.getResource());
- billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
- billSampling.setRemark(billPcr.getRemark());
- }
- samplingMapper.insert(billSampling);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 2) {
- //新增pcr
- BillPcr billClean = (BillPcr) newObject;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- pcrMapper.insert(billClean);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- //下发人脸门禁白名单
- if (billPcr.getVistitType() == 0) {
- //人员隔离中心流程
- if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
- if ("29".equals(farmId) && baseLocation.getId() == 46) {
- //庙贝门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("29");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
- //凤行门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("31");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("2");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- //人员基地外围
- if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId(billPcr.getFarmId().toString());
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- } else if (nextId == 3) {
- //新增洗澡
- BillClean billClean = (BillClean) newObject;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- cleanMapper.insert(billClean);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 4) {
- //新增隔离
- BillIsolate pcr = (BillIsolate) newObject;
- if (billPcr.getVistitType() != 0) {
- pcr.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- pcr.setResource(billPcr.getResource());
- pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
- pcr.setRemark(billPcr.getRemark());
- }
- isolateMapper.insert(pcr);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 5) {
- BillDry billClean = (BillDry) newObject;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- dryMapper.insert(billClean);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- //新增烘干
- } else if (nextId == 6) {
- //新增洗澡前拍照
- BillCleanBefore before = (BillCleanBefore) newObject;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- beforeMapper.insert(before);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 7) {
- //新增洗澡前拍照
- BillGoodsInventory before = (BillGoodsInventory) newObject;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- inventoryMapper.insert(before);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- }
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
- baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
- baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
- String status = baseProcess.getCurrentStatus();
- String substring = status.substring(0, status.length() - 1);
- baseProcess.setCurrentStatus(substring + "1," + 0);
- processMapper.updateById(baseProcess);
- pcrMapper.updateById(billPcr);
- if (billPcr.getVistitType() == 3 && billPcr.getFarmId() == 31 && billPcr.getTestLocationId() == 45) {
- //风行下发单独的饲料车流程门禁
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("31");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 4);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- return new Result(10000, "修改成功!", true);
- } else {
- billPcr.setBillStatus(2);
- billPcr.setPcrType(4);
- billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
- billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
- billPcr.setTestLocation(baseLocation.getLocationName());
- billPcr.setTestLocationId(baseLocation.getId());
- billPcr.setCheckDate(sdf.parse(date));
- billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
- String status = baseProcess.getCurrentStatus();
- String substring = status.substring(0, status.length() - 1);
- baseProcess.setProcessType(2);
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
- baseProcess.setCurrentLocation(baseProcess.getCurrentLocation());
- baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId());
- baseProcess.setCurrentStatus(substring + "2");
- int i = allLocationId.indexOf(billPcr.getTestLocationId().toString());
- String status1 = baseProcess.getAllLocationStatus();
- System.out.println(status1);
- StringBuilder sb = new StringBuilder(status1);
- sb.setCharAt(i, '3');
- baseProcess.setAllLocationStatus(sb.toString());
- processMapper.updateById(baseProcess);
- pcrMapper.updateById(billPcr);
- return new Result(10000, "修改成功!", true);
- }
- }
- }
- @Override
- @Transactional
- public Result editBatch(HttpServletRequest httpServletRequest,String farmId, String ids, String date, String result,
- MultipartFile img1, MultipartFile img2, MultipartFile img3, MultipartFile picture1, MultipartFile picture2, MultipartFile picture3) throws ParseException, IOException {
- String s1 = "";
- String s2 = "";
- String s3 = "";
- if (ObjectUtil.isNotEmpty(img1)) {
- s1 = uploadImage.uploadImg(img1);
- if (s1.equals("上传失败")) {
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "检测图片1上传失败", false);
- }
- }
- if (ObjectUtil.isNotEmpty(img2)) {
- String s = uploadImage.uploadImg(img2);
- s2 = "," + s;
- if (s.equals("上传失败")) {
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "检测图片2上传失败", false);
- }
- }
- if (ObjectUtil.isNotEmpty(img3)) {
- String s = uploadImage.uploadImg(img3);
- s3 = "," + s;
- if (s.equals("上传失败")) {
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "检测图片3上传失败", false);
- }
- }
- String s = s1 + s2 + s3;
- String picUrl = null;
- if (ObjectUtil.isNotEmpty(picture1)){
- String pic1 = uploadImage.getImageCom(picture1);
- if (pic1.equals("上传失败")){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "物品检测图片1上传失败", false);
- }else {
- picUrl = pic1;
- }
- }
- if (ObjectUtil.isNotEmpty(picture2)){
- String pic2 = uploadImage.getImageCom(picture2);
- if (pic2.equals("上传失败")){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "物品检测图片2上传失败", false);
- }else {
- picUrl = picUrl + ","+pic2;
- }
- }
- if (ObjectUtil.isNotEmpty(picture3)){
- String pic3 = uploadImage.getImageCom(picture3);
- if (pic3.equals("上传失败")){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return new Result(10001, "物品检测图片3上传失败", false);
- }else {
- picUrl = picUrl + ","+pic3;
- }
- }
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- if (StringUtils.isBlank(date)) {
- date = sdf.format(new Date());
- }
- String[] splits = ids.split(",");
- for (String id : splits) {
- //1为合格2为异常
- BillPcr billPcr = pcrMapper.selectById(id);
- if (billPcr.getBillStatus() != 0) {
- return new Result(10001, "此条记录已被他人修改,请退出刷新查看!", false);
- }
- billPcr.setImgUrl(s);
- billPcr.setImgStatus(1);
- if (billPcr.getVistitType() == 0){
- if (ObjectUtil.isNotEmpty(picUrl)){
- billPcr.setIsCarry(1);
- billPcr.setPicUrl(picUrl);
- }else {
- billPcr.setIsCarry(0);
- }
- }
- QueryWrapper<BaseProcess> processQueryWrapper = new QueryWrapper<>();
- processQueryWrapper.eq("id", billPcr.getProcessId());
- BaseProcess baseProcess = processMapper.selectOne(processQueryWrapper);//进程
- QueryWrapper<BaseLocation> locationQueryWrapper = new QueryWrapper<>();
- locationQueryWrapper.eq("id", billPcr.getTestLocationId());
- BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
- String allLocationId = baseProcess.getAllLocationId();//所有的位置id
- String allFlowId = baseProcess.getAllFlowId();//所有的流程id
- String currentFlowId = baseProcess.getCurrentFlowId();//当前已经完成的流程id
- String substring1 = allFlowId.substring(currentFlowId.length() + 1, allFlowId.length());
- String[] split = substring1.split(",");
- Integer nextId = Integer.parseInt(split[0]);
- if (billPcr.getBillStatus() != 0) {
- return new Result(10001, "该订单已通过,无需再次提交!", false);
- }
- if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
- return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
- } else {
- if ("1".equals(result)) {
- Integer pcrTime = washoutPointMapper.selectOne(new QueryWrapper<BaseWashoutPoint>().eq("farm_ids", baseProcess.getFarmId())
- .eq("visiting_type", billPcr.getVistitType()).eq("mid_id",billPcr.getMidId())
- .eq("location_id", baseLocation.getId())).getPcrTime();
- System.out.println("pcr的下一个流程id:" + nextId);
- billPcr.setBillStatus(1);
- billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
- billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
- billPcr.setTestLocation(baseLocation.getLocationName());
- billPcr.setTestLocationId(baseLocation.getId());
- billPcr.setCheckDate(sdf.parse(date));
- billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
- billPcr.setQualifiedDate(pcrTime);
- Object newObject = getNewObject(nextId, billPcr.getDestName(), billPcr.getDestId(), billPcr.getAdmissionUserName(),
- billPcr.getAdmissionUserId(), billPcr.getVistitDate(), billPcr.getSubDate(),
- billPcr.getProcessId(), billPcr.getFarmId(), billPcr.getTestLocation(), billPcr.getTestLocationId(),
- billPcr.getVistitType(), billPcr.getPhone(), billPcr.getDepartureName(), billPcr.getDepartureId(),billPcr.getMidId()
- ,billPcr.getMidName(),billPcr.getFarmName());
- System.out.println("这里是pcr通过的下一个流程id:" + nextId);
- if (nextId == 0) {
- if (split.length == 1) {
- baseProcess.setProcessType(1);
- String[] strings = allLocationId.split(",");
- String ss2 = "";
- for (int i = 0; i < strings.length; i++) {
- strings[i].replaceAll(strings[i], "2");
- if (i == strings.length - 1) {
- ss2 = ss2 + strings[i].replaceAll(strings[i], "2");
- } else {
- ss2 = strings[i].replaceAll(strings[i], "2") + "," + ss2;
- }
- }
- baseProcess.setAllLocationStatus(ss2);
- //下发人脸门禁白名单
- if (billPcr.getVistitType() == 0) {
- //人员隔离中心流程
- if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
- if ("29".equals(farmId) && baseLocation.getId() == 46) {
- //庙贝门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("29");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
- //凤行门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("31");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("2");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- //人员基地外围
- if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId(billPcr.getFarmId().toString());
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- } else {
- String[] strings = allLocationId.split(",");
- Integer index = 0;
- for (int i = 0; i < strings.length; i++) {
- if ((baseLocation.getId().toString()).equals(strings[i])) {
- index = i;
- }
- }
- QueryWrapper<BaseLocation> queryWrapper = new QueryWrapper();
- queryWrapper.eq("id", strings[index + 2]);
- BaseLocation location = locationMapper.selectOne(queryWrapper);
- FlowUtil flowUtil = new FlowUtil();
- Object entity = flowUtil.getEntity(Integer.parseInt(split[1]), billPcr.getVistitType(), billPcr.getDestName()
- , billPcr.getDestId(), billPcr.getAdmissionUserId(), billPcr.getAdmissionUserName(), billPcr.getPhone(),
- billPcr.getVistitDate(), location.getId(), location.getLocationName(), billPcr.getFarmId()
- , baseProcess.getId(), billPcr.getDepartureName(), billPcr.getDepartureId(),billPcr.getMidId(),billPcr.getMidName(),billPcr.getFarmName());
- if (Integer.parseInt(split[1]) == 1) {
- //新增采样
- BillSampling billSampling = (BillSampling) entity;
- if (billPcr.getVistitType() != 0) {
- billSampling.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billSampling.setResource(billPcr.getResource());
- billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
- billSampling.setRemark(billPcr.getRemark());
- }
- samplingMapper.insert(billSampling);
- //下发人脸门禁白名单
- if (billPcr.getVistitType() == 0) {
- //人员隔离中心流程
- if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
- if ("29".equals(farmId) && baseLocation.getId() == 46) {
- //庙贝门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("29");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
- //凤行门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("31");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("2");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- //人员基地外围
- if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId(billPcr.getFarmId().toString());
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- } else if (Integer.parseInt(split[1]) == 2) {
- //新增pcr
- BillPcr billClean = (BillPcr) entity;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- pcrMapper.insert(billClean);
- } else if (Integer.parseInt(split[1]) == 3) {
- //新增洗澡
- BillClean billClean = (BillClean) entity;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- cleanMapper.insert(billClean);
- } else if (Integer.parseInt(split[1]) == 4) {
- //新增隔离
- BillIsolate pcr = (BillIsolate) entity;
- if (billPcr.getVistitType() != 0) {
- pcr.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- pcr.setResource(billPcr.getResource());
- pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
- pcr.setRemark(billPcr.getRemark());
- }
- isolateMapper.insert(pcr);
- } else if (Integer.parseInt(split[1]) == 5) {
- BillDry billClean = (BillDry) entity;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- dryMapper.insert(billClean);
- //新增烘干
- } else if (Integer.parseInt(split[1]) == 6) {
- //新增洗澡前拍照
- BillCleanBefore before = (BillCleanBefore) entity;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- beforeMapper.insert(before);
- } else if (Integer.parseInt(split[1]) == 7) {
- //新增洗澡前拍照
- BillGoodsInventory before = (BillGoodsInventory) entity;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- inventoryMapper.insert(before);
- }
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId + "," + split[1]);
- Integer locationId = billPcr.getTestLocationId();
- String[] split2 = allLocationId.split(",");
- int a = 0;
- for (int i = 0; i < split2.length; i++) {
- if (locationId.toString().equals(split2[i])) {
- a = i + 1;
- }
- }
- int indexOf = 2 * (a - 2);//当前位置在所有流程位置中的下标
- String substring = baseProcess.getAllLocationStatus().substring(0, indexOf + 3);//截取已经过的位置状态
- String[] split1 = substring.split(",");
- String sb2 = "";
- for (int i = 0; i < split1.length; i++) {
- if (i == split1.length - 1) {
- sb2 = sb2 + split1[i].replaceAll(split1[i], "2");
- } else {
- sb2 = split1[i].replaceAll(split1[i], "2") + "," + sb2;
- }
- }
- sb2 = sb2 + baseProcess.getAllLocationStatus().substring(indexOf + 3);
- StringBuilder sb = new StringBuilder(sb2);
- sb.replace(indexOf + 4, indexOf + 5, "2");
- sb.replace(indexOf + 6, indexOf + 7, "1");
- baseProcess.setAllLocationStatus(sb.toString());
- }
- } else if (nextId == 1) {
- //新增采样
- BillSampling billSampling = (BillSampling) newObject;
- if (billPcr.getVistitType() != 0) {
- billSampling.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billSampling.setResource(billPcr.getResource());
- billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
- billSampling.setRemark(billPcr.getRemark());
- }
- samplingMapper.insert(billSampling);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 2) {
- //新增pcr
- BillPcr billClean = (BillPcr) newObject;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- pcrMapper.insert(billClean);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- //下发人脸门禁白名单
- if (billPcr.getVistitType() == 0) {
- //人员隔离中心流程
- if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
- if ("29".equals(farmId) && baseLocation.getId() == 46) {
- //庙贝门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("29");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
- //凤行门禁单独的
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- PeopleList peopleList1 = new PeopleList();
- peopleList1.setFarmId("31");
- peopleList1.setDeviceCode(deviceList.getDeviceCode());
- peopleList1.setUserId(billPcr.getProcessId().toString());
- peopleList1.setUserName(billPcr.getAdmissionUserName());
- peopleList1.setPassword("123456");
- peopleList1.setType(0);
- peopleList1.setCreateTime(new Date());
- peopleList1.setOutTime(date1);
- peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList1);
- } else {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("2");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- //人员基地外围
- if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId(billPcr.getFarmId().toString());
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- }
- } else if (nextId == 3) {
- //新增洗澡
- BillClean billClean = (BillClean) newObject;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- cleanMapper.insert(billClean);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 4) {
- //新增隔离
- BillIsolate pcr = (BillIsolate) newObject;
- if (billPcr.getVistitType() != 0) {
- pcr.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- pcr.setResource(billPcr.getResource());
- pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
- pcr.setRemark(billPcr.getRemark());
- }
- isolateMapper.insert(pcr);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 5) {
- BillDry billClean = (BillDry) newObject;
- if (billPcr.getVistitType() != 0) {
- billClean.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- billClean.setResource(billPcr.getResource());
- billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
- billClean.setRemark(billPcr.getRemark());
- }
- dryMapper.insert(billClean);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- //新增烘干
- } else if (nextId == 6) {
- //新增洗澡前拍照
- BillCleanBefore before = (BillCleanBefore) newObject;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- beforeMapper.insert(before);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- } else if (nextId == 7) {
- //新增洗澡前拍照
- BillGoodsInventory before = (BillGoodsInventory) newObject;
- if (billPcr.getVistitType() != 0) {
- before.setCarNum(billPcr.getCarNum());
- }
- if (billPcr.getVistitType() == 5) {
- before.setResource(billPcr.getResource());
- before.setFeedImgUrl(billPcr.getFeedImgUrl());
- before.setRemark(billPcr.getRemark());
- }
- inventoryMapper.insert(before);
- baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
- }
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
- baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
- baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
- String status = baseProcess.getCurrentStatus();
- String substring = status.substring(0, status.length() - 1);
- baseProcess.setCurrentStatus(substring + "1," + 0);
- processMapper.updateById(baseProcess);
- pcrMapper.updateById(billPcr);
- if (billPcr.getVistitType() == 3 && billPcr.getFarmId() == 31 && billPcr.getTestLocationId() == 45) {
- //风行下发单独的饲料车流程门禁
- DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
- PeopleList peopleList = new PeopleList();
- peopleList.setFarmId("31");
- peopleList.setDeviceCode(deviceList.getDeviceCode());
- peopleList.setUserId(billPcr.getProcessId().toString());
- peopleList.setUserName(billPcr.getAdmissionUserName());
- peopleList.setPassword("123456");
- peopleList.setType(0);
- peopleList.setCreateTime(new Date());
- Date now = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.HOUR_OF_DAY, 6);
- Date date1 = calendar.getTime();
- peopleList.setOutTime(date1);
- SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
- peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
- peopleListMapper.insert(peopleList);
- }
- return new Result(10000, "修改成功!", true);
- } else {
- billPcr.setBillStatus(2);
- billPcr.setPcrType(4);
- billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
- billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
- billPcr.setTestLocation(baseLocation.getLocationName());
- billPcr.setTestLocationId(baseLocation.getId());
- billPcr.setCheckDate(sdf.parse(date));
- billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
- String status = baseProcess.getCurrentStatus();
- String substring = status.substring(0, status.length() - 1);
- baseProcess.setProcessType(2);
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
- baseProcess.setCurrentLocation(baseProcess.getCurrentLocation());
- baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId());
- baseProcess.setCurrentStatus(substring + "2");
- int i = allLocationId.indexOf(billPcr.getTestLocationId().toString());
- String status1 = baseProcess.getAllLocationStatus();
- System.out.println(status1);
- StringBuilder sb = new StringBuilder(status1);
- sb.setCharAt(i, '3');
- baseProcess.setAllLocationStatus(sb.toString());
- processMapper.updateById(baseProcess);
- pcrMapper.updateById(billPcr);
- return new Result(10000, "修改成功!", true);
- }
- }
- }
- return new Result(10000, "修改成功!", true);
- }
- public static void main(String[] args) {
- // int i = "0,45,0".indexOf("45");
- // String status1 ="2,1,1,0";
- // System.out.println(status1);
- // StringBuilder sb = new StringBuilder(status1);
- // sb.setCharAt(i-1, '3');
- // System.out.println(sb);
- int i = "0,45,0".indexOf("45");
- String status1 = "2,1,1,0";
- StringBuilder sb = new StringBuilder(status1);
- sb.setCharAt(i, '3');
- System.out.println(sb.toString());
- }
- private void xiugaiPro(BaseProcess baseProcess, BillPcr billPcr) {
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + new Date());
- baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + billPcr.getTestLocation());
- baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + billPcr.getTestLocationId());
- baseProcess.setCurrentStatus(baseProcess.getCurrentStatus() + "," + 2);
- }
- public String add() {
- ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
- Runnable task = new Runnable() {
- @Override
- public void run() {
- //这里写业务
- System.out.println();
- }
- };
- // 设定延迟时间(两小时后执行,单位为秒)
- long delay = 3;
- // 执行定时任务
- scheduler.schedule(task, delay, TimeUnit.SECONDS);
- System.out.println("完结");
- return "成功";
- }
- public static Object getNewObject(Integer id, String destName, Integer destId, String admissionUserName, Integer admissionUserId
- , LocalDateTime vistitDate, LocalDateTime subDate, Integer processId, Integer farmId, String testLocation
- , Integer testLocationId, Integer vistitType, String phone, String departureName, Integer departureId,Integer midId,String midName,String farmName) {
- if (id == 1) {
- //采样
- BillSampling billSampling = new BillSampling();
- billSampling.setVistitType(vistitType);
- billSampling.setDestName(destName);
- billSampling.setDestId(destId);
- billSampling.setAdmissionUserName(admissionUserName);
- billSampling.setAdmissionUserId(admissionUserId);
- billSampling.setVistitDate(vistitDate);
- billSampling.setSubDate(LocalDateTime.now());
- billSampling.setPhone(phone);
- billSampling.setTestLocation(testLocation);
- billSampling.setTestLocationId(testLocationId);
- billSampling.setProcessId(processId);
- billSampling.setFarmId(String.valueOf(farmId));
- billSampling.setDepartureName(departureName);
- billSampling.setDepartureId(departureId);
- billSampling.setMidId(midId);
- billSampling.setMidName(midName);
- billSampling.setFarmName(farmName);
- return billSampling;
- }
- if (id == 2) {
- //pcr
- BillPcr billPcr = new BillPcr();
- billPcr.setVistitType(vistitType);
- billPcr.setDestName(destName);
- billPcr.setDestId(destId);
- billPcr.setAdmissionUserId(admissionUserId);
- billPcr.setAdmissionUserName(admissionUserName);
- billPcr.setVistitDate(vistitDate);
- billPcr.setSubDate(subDate);
- billPcr.setBillStatus(0);
- billPcr.setProcessId(processId);
- billPcr.setPhone(phone);
- billPcr.setFarmId(farmId);
- billPcr.setTestLocationId(testLocationId);
- billPcr.setTestLocation(testLocation);
- billPcr.setDepartureName(departureName);
- billPcr.setDepartureId(departureId);
- billPcr.setMidId(midId);
- billPcr.setMidName(midName);
- billPcr.setFarmName(farmName);
- return billPcr;
- }
- if (id == 3) {
- //洗消
- BillClean billPcr = new BillClean();
- billPcr.setVistitType(vistitType);
- billPcr.setDestName(destName);
- billPcr.setDestId(destId);
- billPcr.setAdmissionUserId(admissionUserId);
- billPcr.setAdmissionUserName(admissionUserName);
- billPcr.setVistitDate(vistitDate);
- billPcr.setSubDate(subDate);
- billPcr.setBillStatus(0);
- billPcr.setProcessId(processId);
- billPcr.setPhone(phone);
- billPcr.setFarmId(farmId);
- billPcr.setTestLocationId(testLocationId);
- billPcr.setTestLocation(testLocation);
- billPcr.setDepartureName(departureName);
- billPcr.setDepartureId(departureId);
- billPcr.setMidId(midId);
- billPcr.setMidName(midName);
- billPcr.setFarmName(farmName);
- return billPcr;
- }
- if (id == 4) {
- //隔离
- BillIsolate billPcr = new BillIsolate();
- billPcr.setVistitType(vistitType);
- billPcr.setDestName(destName);
- billPcr.setDestId(destId);
- billPcr.setAdmissionUserId(admissionUserId);
- billPcr.setAdmissionUserName(admissionUserName);
- billPcr.setVistitDate(vistitDate);
- billPcr.setSubDate(subDate);
- billPcr.setBillStatus(0);
- billPcr.setProcessId(processId);
- billPcr.setFarmId(farmId);
- billPcr.setPhone(phone);
- billPcr.setIsolateLocation(testLocation);
- billPcr.setIsolateLocationId(testLocationId);
- billPcr.setDepartureName(departureName);
- billPcr.setDepartureId(departureId);
- billPcr.setMidId(midId);
- billPcr.setMidName(midName);
- billPcr.setFarmName(farmName);
- return billPcr;
- }
- if (id == 5) {
- //烘干
- BillDry billPcr = new BillDry();
- billPcr.setVistitType(vistitType);
- billPcr.setDestName(destName);
- billPcr.setDestId(destId);
- billPcr.setAdmissionUserId(admissionUserId);
- billPcr.setAdmissionUserName(admissionUserName);
- billPcr.setVistitDate(vistitDate);
- billPcr.setSubDate(subDate);
- billPcr.setBillStatus(0);
- billPcr.setProcessId(processId);
- billPcr.setFarmId(farmId);
- billPcr.setPhone(phone);
- billPcr.setTestLocationId(testLocationId);
- billPcr.setTestLocation(testLocation);
- billPcr.setDepartureName(departureName);
- billPcr.setDepartureId(departureId);
- billPcr.setMidId(midId);
- billPcr.setMidName(midName);
- billPcr.setFarmName(farmName);
- return billPcr;
- }
- if (id == 6) {
- //洗澡前拍照
- BillCleanBefore billCleanBefore = new BillCleanBefore();
- billCleanBefore.setVistitType(vistitType);
- billCleanBefore.setVistitType(vistitType);
- billCleanBefore.setDestName(destName);
- billCleanBefore.setDestId(destId);
- billCleanBefore.setAdmissionUserName(admissionUserName);
- billCleanBefore.setAdmissionUserId(admissionUserId);
- billCleanBefore.setVistitDate(vistitDate);
- billCleanBefore.setSubDate(LocalDateTime.now());
- billCleanBefore.setPhone(phone);
- billCleanBefore.setTestLocation(testLocation);
- billCleanBefore.setTestLocationId(testLocationId);
- billCleanBefore.setProcessId(processId);
- billCleanBefore.setFarmId(String.valueOf(farmId));
- billCleanBefore.setDepartureName(departureName);
- billCleanBefore.setDepartureId(departureId);
- billCleanBefore.setMidId(midId);
- billCleanBefore.setMidName(midName);
- billCleanBefore.setFarmName(farmName);
- return billCleanBefore;
- }
- if (id == 7) {
- //洗澡前拍照
- BillGoodsInventory billCleanBefore = new BillGoodsInventory();
- billCleanBefore.setVistitType(vistitType);
- billCleanBefore.setVistitType(vistitType);
- billCleanBefore.setDestName(destName);
- billCleanBefore.setDestId(destId);
- billCleanBefore.setAdmissionUserName(admissionUserName);
- billCleanBefore.setAdmissionUserId(admissionUserId);
- billCleanBefore.setVistitDate(vistitDate);
- billCleanBefore.setSubDate(LocalDateTime.now());
- billCleanBefore.setPhone(phone);
- billCleanBefore.setTestLocation(testLocation);
- billCleanBefore.setTestLocationId(testLocationId);
- billCleanBefore.setBillAdmission(processId);
- billCleanBefore.setFarmId(String.valueOf(farmId));
- billCleanBefore.setDepartureName(departureName);
- billCleanBefore.setDepartureId(departureId);
- billCleanBefore.setProcessId(processId);
- billCleanBefore.setMidId(midId);
- billCleanBefore.setMidName(midName);
- billCleanBefore.setFarmName(farmName);
- return billCleanBefore;
- }
- return null;
- }
- }
|