BillPcrServiceImpl.java 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932
  1. package com.huimv.receive.service.impl;
  2. import cn.hutool.core.util.ObjectUtil;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5. import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  6. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  8. import com.huimv.receive.common.token.TokenSign;
  9. import com.huimv.receive.common.utils.*;
  10. import com.huimv.receive.entity.*;
  11. import com.huimv.receive.entity.dto.PcrDto;
  12. import com.huimv.receive.entity.vo.PcrVo;
  13. import com.huimv.receive.entity.vo.PcrVo1;
  14. import com.huimv.receive.mapper.*;
  15. import com.huimv.receive.service.IBillPcrService;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.stereotype.Service;
  18. import org.springframework.transaction.annotation.Transactional;
  19. import org.springframework.transaction.interceptor.TransactionAspectSupport;
  20. import org.springframework.web.multipart.MultipartFile;
  21. import javax.annotation.Resource;
  22. import javax.servlet.http.HttpServletRequest;
  23. import javax.servlet.http.HttpServletResponse;
  24. import java.io.IOException;
  25. import java.text.DecimalFormat;
  26. import java.text.ParseException;
  27. import java.text.SimpleDateFormat;
  28. import java.time.LocalDateTime;
  29. import java.util.*;
  30. import java.util.concurrent.Executors;
  31. import java.util.concurrent.ScheduledExecutorService;
  32. import java.util.concurrent.TimeUnit;
  33. /**
  34. * <p>
  35. * pcr 表 服务实现类
  36. * </p>
  37. *
  38. * @author author
  39. * @since 2023-07-21
  40. */
  41. @Service
  42. public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> implements IBillPcrService {
  43. @Resource
  44. private BillPcrMapper billPcrMapper;
  45. @Autowired
  46. private BillGoodsInventoryMapper inventoryMapper;
  47. @Autowired
  48. private SysAccountMultilevelMapper multilevelMapper;
  49. @Override
  50. public Result listPersonalPcr(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  51. String pageNo = paramsMap.get("pageNum");
  52. String pageSize = paramsMap.get("pageSize");
  53. String vistitType = paramsMap.get("vistitType");
  54. Page<BillPcr> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
  55. 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"));
  56. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  57. queryWrapper.eq(StringUtils.isNotBlank(vistitType), "vistit_type", vistitType).eq("admission_user_id", TokenSign.getMemberIdByJwtToken(httpServletRequest)).orderByDesc("sub_date");
  58. return new Result(ResultCode.SUCCESS, billPcrPage, billPcrMapper.selectCount(queryWrapper));
  59. }
  60. @Override
  61. public Result pcrWhole(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  62. String farmId = paramsMap.get("farmId");
  63. Date timesmorning = DataUill.getTimesmorning();
  64. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  65. queryWrapper.eq("farm_id", farmId).eq("bill_status", 1).ge("sub_date", timesmorning);//今日合格
  66. Integer count = billPcrMapper.selectCount(queryWrapper);
  67. QueryWrapper<BillPcr> queryWrapper1 = new QueryWrapper<>();
  68. queryWrapper1.eq("farm_id", farmId).eq("bill_status", 2).ge("sub_date", timesmorning);//今日异常
  69. Integer count1 = billPcrMapper.selectCount(queryWrapper1);
  70. QueryWrapper<BillPcr> queryWrapper2 = new QueryWrapper<>();
  71. queryWrapper2.eq("farm_id", farmId).eq("bill_status", 3).ge("sub_date", timesmorning);//今日失效
  72. Integer count2 = billPcrMapper.selectCount(queryWrapper2);
  73. PcrDto dto = new PcrDto();
  74. dto.setWholeCount(count + count1);
  75. dto.setPassCount(count);
  76. dto.setRefuseCount(count1);
  77. dto.setLoseCount(count2);
  78. return new Result(ResultCode.SUCCESS, dto);
  79. }
  80. @Override
  81. public Result listType(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  82. String farmId = paramsMap.get("farmId");
  83. String type = paramsMap.get("type");
  84. if ("".equals(type) || null == type) {
  85. type = "1";
  86. }
  87. List<PcrVo> pcrVos = null;
  88. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  89. queryWrapper.eq("farm_id", farmId).in("bill_status", 1, 2);
  90. if ("1".equals(type)) {
  91. Date timesmorning = DataUill.getTimesmorning();
  92. queryWrapper.ge("sub_date", timesmorning);
  93. } else if ("2".equals(type)) {
  94. Calendar calendar = Calendar.getInstance();
  95. calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
  96. queryWrapper.ge("sub_date", calendar.getTime());
  97. } else if ("3".equals(type)) {
  98. Date monthmorning = DataUill.getTimesMonthmorning();
  99. queryWrapper.ge("sub_date", monthmorning);
  100. }
  101. pcrVos = billPcrMapper.listPcr(queryWrapper);
  102. for (PcrVo pcrVo : pcrVos) {
  103. if (pcrVo.getType().equals("0")) {
  104. pcrVo.setType("人员");
  105. } else if (pcrVo.getType().equals("1")) {
  106. pcrVo.setType("环保车");
  107. } else if (pcrVo.getType().equals("2")) {
  108. pcrVo.setType("拉猪车");
  109. } else if (pcrVo.getType().equals("3")) {
  110. pcrVo.setType("饲料车");
  111. } else if (pcrVo.getType().equals("4")) {
  112. pcrVo.setType("送猪车");
  113. } else if (pcrVo.getType().equals("5")) {
  114. pcrVo.setType("物资车");
  115. }
  116. }
  117. return new Result(ResultCode.SUCCESS, pcrVos);
  118. }
  119. @Override
  120. public Result listLocation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  121. String farmId = paramsMap.get("farmId");
  122. String type = paramsMap.get("type");
  123. if ("".equals(type) || null == type) {
  124. type = "1";
  125. }
  126. List<PcrVo> pcrVos = null;
  127. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  128. queryWrapper.eq("farm_id", farmId).in("bill_status", 1, 2);
  129. if ("1".equals(type)) {
  130. Date timesmorning = DataUill.getTimesmorning();
  131. queryWrapper.ge("sub_date", timesmorning);
  132. } else if ("2".equals(type)) {
  133. Calendar calendar = Calendar.getInstance();
  134. calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
  135. queryWrapper.ge("sub_date", calendar.getTime());
  136. } else if ("3".equals(type)) {
  137. Date monthmorning = DataUill.getTimesMonthmorning();
  138. queryWrapper.ge("sub_date", monthmorning);
  139. }
  140. pcrVos = billPcrMapper.listLocation(queryWrapper);
  141. return new Result(ResultCode.SUCCESS, pcrVos);
  142. }
  143. @Override
  144. public Result listAll(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  145. String farmId = paramsMap.get("farmId");
  146. String personType = paramsMap.get("personType");
  147. String type = paramsMap.get("type");
  148. if ("".equals(type) || null == type) {
  149. type = "1";
  150. }
  151. List<PcrVo1> pcrVos = null;
  152. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  153. queryWrapper.eq("farm_id", farmId).in("bill_status", 1, 2);
  154. if ("".equals(personType) || null == personType) {
  155. } else {
  156. queryWrapper.eq("vistit_type", personType);
  157. }
  158. if ("1".equals(type)) {
  159. Date timesmorning = DataUill.getTimesmorning();
  160. queryWrapper.ge("sub_date", timesmorning);
  161. } else if ("2".equals(type)) {
  162. Calendar calendar = Calendar.getInstance();
  163. calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
  164. queryWrapper.ge("sub_date", calendar.getTime());
  165. } else if ("3".equals(type)) {
  166. Date monthmorning = DataUill.getTimesMonthmorning();
  167. queryWrapper.ge("sub_date", monthmorning);
  168. }
  169. pcrVos = billPcrMapper.listAll(queryWrapper);
  170. for (PcrVo1 pcrVo : pcrVos) {
  171. pcrVo.setAllCount(pcrVo.getPassCount() + pcrVo.getRefuseCount());
  172. }
  173. return new Result(ResultCode.SUCCESS, pcrVos);
  174. }
  175. @Override
  176. public Result selectList(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  177. String farmId = paramsMap.get("farmId");
  178. String type = paramsMap.get("type");//来访类型
  179. String destId = paramsMap.get("destId");//目的地
  180. String startTime = paramsMap.get("startTime");
  181. String endTime = paramsMap.get("endTime");
  182. String pageNum = paramsMap.get("pageNum");
  183. String pageSize = paramsMap.get("pageSize");
  184. if ("".equals(pageNum) || null == pageNum) {
  185. pageNum = "1";
  186. }
  187. if ("".equals(pageSize) || null == pageSize) {
  188. pageSize = "10";
  189. }
  190. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  191. if (ObjectUtil.isNotEmpty(startTime)) {
  192. startTime = startTime + " 00:00:00";
  193. endTime = endTime + " 23:59:59";
  194. queryWrapper.between("check_date", startTime, endTime);
  195. }
  196. queryWrapper.lambda().orderByDesc(BillPcr::getId);
  197. queryWrapper.eq("farm_id", farmId).eq(StringUtils.isNotBlank(destId), "dest_id", destId).eq(StringUtils.isNotBlank(type), "vistit_type", type);
  198. Page<BillPcr> page = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
  199. return new Result(ResultCode.SUCCESS, billPcrMapper.selectPage(page, queryWrapper));
  200. }
  201. @Override
  202. public void printPcr(HttpServletResponse httpServletRequest, Map<String, String> paramsMap) throws Exception {
  203. String ids = paramsMap.get("ids");
  204. String[] split = ids.split(",");
  205. List<BillPcr> list = new ArrayList<>();
  206. for (String s : split) {
  207. BillPcr admission = billPcrMapper.selectById(s);
  208. list.add(admission);
  209. }
  210. Print.printPcr(list);
  211. }
  212. @Override
  213. public Result PcrList(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  214. String farmId = paramsMap.get("farmId");
  215. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  216. if ("21".equals(farmId)) {
  217. queryWrapper.eq("farm_id", 26);
  218. } else {
  219. queryWrapper.eq("farm_id", farmId);
  220. }
  221. Integer integer = pcrMapper.selectCount(queryWrapper);//检测总数
  222. queryWrapper.in("bill_status", 1, 3);
  223. Integer integer1 = pcrMapper.selectCount(queryWrapper);//合格总数
  224. queryWrapper.orderByDesc("sub_date").last(" limit 10");
  225. DecimalFormat def = new DecimalFormat("0.00");
  226. String rank;
  227. if (integer == 0 || integer == null) {
  228. Double ranks = Double.valueOf("0.00");
  229. rank = ranks.toString();
  230. } else {
  231. Double ranks = (Double.valueOf(integer1.toString()) / Double.valueOf(integer.toString())) * 100;
  232. rank = def.format(ranks);
  233. }
  234. JSONObject jsonObject = new JSONObject();
  235. jsonObject.put("allCount", integer);
  236. jsonObject.put("passCount", integer1);
  237. jsonObject.put("rank", rank);
  238. jsonObject.put("pcrList", pcrMapper.selectList(queryWrapper));
  239. return new Result(ResultCode.SUCCESS, jsonObject);
  240. }
  241. @Autowired
  242. private BillPcrMapper pcrMapper;
  243. @Autowired
  244. private BaseProcessMapper processMapper;
  245. @Autowired
  246. private BaseLocationMapper locationMapper;
  247. @Autowired
  248. private BillCleanMapper cleanMapper;
  249. @Autowired
  250. private BillGoodsInventoryMapper goodsInventoryMapper;
  251. @Autowired
  252. private ConfigurationMapper configurationMapper;
  253. @Autowired
  254. private UploadImage uploadImage;
  255. @Autowired
  256. private ExistMapper existMapper;
  257. @Autowired
  258. private DeviceListMapper deviceListMapper;
  259. @Autowired
  260. private PeopleListMapper peopleListMapper;
  261. @Autowired
  262. private BillPersonnelAdmissionMapper personnelAdmissionMapper;
  263. @Autowired
  264. private BaseWashoutPointMapper washoutPointMapper;
  265. @Autowired
  266. private BillDryMapper dryMapper;
  267. @Autowired
  268. private BillIsolateMapper isolateMapper;
  269. @Autowired
  270. private BillSamplingMapper samplingMapper;
  271. @Autowired
  272. private BillCleanBeforeMapper beforeMapper;
  273. @Override
  274. public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  275. String farmId = paramsMap.get("farmId");
  276. String type = paramsMap.get("type");//展示类型
  277. String pageNum = paramsMap.get("pageNum");
  278. String pageSize = paramsMap.get("pageSize");
  279. if ("".equals(pageNum) || null == pageNum) {
  280. pageNum = "1";
  281. }
  282. if ("".equals(pageSize) || null == pageSize) {
  283. pageSize = "20";
  284. }
  285. Page<BillPcr> page = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
  286. String[] locationIds = TokenSign.getWorkIdByJwtToken(httpServletRequest).split(",");
  287. QueryWrapper<BillPcr> queryWrapper = new QueryWrapper<>();
  288. queryWrapper/*.in("test_location_id", locationIds)*/.orderByDesc("sub_date");
  289. if ("0".equals(type)) {
  290. queryWrapper.in("bill_status", 0, 1, 2, 3, 4);
  291. }
  292. if ("1".equals(type)) {
  293. queryWrapper.eq("bill_status", 0);
  294. }
  295. if ("2".equals(type)) {
  296. queryWrapper.eq("bill_status", 1);
  297. }
  298. if ("3".equals(type)) {
  299. queryWrapper.in("bill_status", 2, 3);
  300. }
  301. QueryWrapper<BillPcr> queryWrapper2 = new QueryWrapper<>();
  302. queryWrapper2/*.in("test_location_id", locationIds)*/.orderByDesc("sub_date");
  303. queryWrapper2.eq("bill_status", 0);
  304. return new Result(ResultCode.SUCCESS, pcrMapper.selectPage(page, queryWrapper), pcrMapper.selectCount(queryWrapper2));
  305. }
  306. @Override
  307. public Result listById(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
  308. String id = paramsMap.get("id");
  309. BillPcr billPcr = pcrMapper.selectById(id);
  310. return new Result(ResultCode.SUCCESS, billPcr);
  311. }
  312. @Override
  313. @Transactional
  314. public Result edit(HttpServletRequest httpServletRequest, String farmId, String id, String date, String result,
  315. MultipartFile img1, MultipartFile img2, MultipartFile img3, MultipartFile picture1, MultipartFile picture2,
  316. MultipartFile picture3) throws ParseException, IOException {
  317. //1为合格2为异常
  318. String s1 = "";
  319. String s2 = "";
  320. String s3 = "";
  321. if (ObjectUtil.isNotEmpty(img1)) {
  322. s1 = uploadImage.uploadImg(img1);
  323. if (s1.equals("上传失败")) {
  324. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  325. return new Result(10001, "检测图片1上传失败", false);
  326. }
  327. }
  328. if (ObjectUtil.isNotEmpty(img2)) {
  329. String s = uploadImage.uploadImg(img2);
  330. s2 = "," + s;
  331. if (s.equals("上传失败")) {
  332. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  333. return new Result(10001, "检测图片2上传失败", false);
  334. }
  335. }
  336. if (ObjectUtil.isNotEmpty(img3)) {
  337. String s = uploadImage.uploadImg(img3);
  338. s3 = "," + s;
  339. if (s.equals("上传失败")) {
  340. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  341. return new Result(10001, "检测图片3上传失败", false);
  342. }
  343. }
  344. String s = s1 + s2 + s3;
  345. String picUrl = null;
  346. if (ObjectUtil.isNotEmpty(picture1)){
  347. String pic1 = uploadImage.getImageCom(picture1);
  348. if (pic1.equals("上传失败")){
  349. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  350. return new Result(10001, "物品检测图片1上传失败", false);
  351. }else {
  352. picUrl = pic1;
  353. }
  354. }
  355. if (ObjectUtil.isNotEmpty(picture2)){
  356. String pic2 = uploadImage.getImageCom(picture2);
  357. if (pic2.equals("上传失败")){
  358. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  359. return new Result(10001, "物品检测图片2上传失败", false);
  360. }else {
  361. picUrl = picUrl + ","+pic2;
  362. }
  363. }
  364. if (ObjectUtil.isNotEmpty(picture3)){
  365. String pic3 = uploadImage.getImageCom(picture3);
  366. if (pic3.equals("上传失败")){
  367. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  368. return new Result(10001, "物品检测图片3上传失败", false);
  369. }else {
  370. picUrl = picUrl + ","+pic3;
  371. }
  372. }
  373. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  374. if (StringUtils.isBlank(date)) {
  375. date = sdf.format(new Date());
  376. }
  377. BillPcr billPcr = pcrMapper.selectById(id);
  378. if (billPcr.getBillStatus() != 0) {
  379. return new Result(10001, "此条记录已被他人修改,请退出刷新查看!", false);
  380. }
  381. billPcr.setImgUrl(s);
  382. billPcr.setImgStatus(1);
  383. if (billPcr.getVistitType() == 0){
  384. if (ObjectUtil.isNotEmpty(picUrl)){
  385. billPcr.setIsCarry(1);
  386. billPcr.setPicUrl(picUrl);
  387. }else {
  388. billPcr.setIsCarry(0);
  389. }
  390. }
  391. QueryWrapper<BaseProcess> processQueryWrapper = new QueryWrapper<>();
  392. processQueryWrapper.eq("id", billPcr.getProcessId());
  393. BaseProcess baseProcess = processMapper.selectOne(processQueryWrapper);//进程
  394. QueryWrapper<BaseLocation> locationQueryWrapper = new QueryWrapper<>();
  395. locationQueryWrapper.eq("id", billPcr.getTestLocationId());
  396. BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
  397. String allLocationId = baseProcess.getAllLocationId();//所有的位置id
  398. String allFlowId = baseProcess.getAllFlowId();//所有的流程id
  399. String currentFlowId = baseProcess.getCurrentFlowId();//当前已经完成的流程id
  400. String substring1 = allFlowId.substring(currentFlowId.length() + 1, allFlowId.length());
  401. String[] split = substring1.split(",");
  402. Integer nextId = Integer.parseInt(split[0]);
  403. if (billPcr.getBillStatus() != 0) {
  404. return new Result(10001, "该订单已通过,无需再次提交!", false);
  405. }
  406. if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
  407. return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
  408. } else {
  409. if ("1".equals(result)) {
  410. Integer pcrTime = washoutPointMapper.selectOne(new QueryWrapper<BaseWashoutPoint>().eq("farm_ids", baseProcess.getFarmId())
  411. .eq("visiting_type", billPcr.getVistitType()).eq("mid_id",billPcr.getMidId())
  412. .eq("location_id", baseLocation.getId())).getPcrTime();
  413. System.out.println("pcr的下一个流程id:" + nextId);
  414. billPcr.setBillStatus(1);
  415. billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
  416. billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
  417. billPcr.setTestLocation(baseLocation.getLocationName());
  418. billPcr.setTestLocationId(baseLocation.getId());
  419. billPcr.setCheckDate(sdf.parse(date));
  420. billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
  421. billPcr.setQualifiedDate(pcrTime);
  422. Object newObject = getNewObject(nextId, billPcr.getDestName(), billPcr.getDestId(), billPcr.getAdmissionUserName(),
  423. billPcr.getAdmissionUserId(), billPcr.getVistitDate(), billPcr.getSubDate(),
  424. billPcr.getProcessId(), billPcr.getFarmId(), billPcr.getTestLocation(), billPcr.getTestLocationId(),
  425. billPcr.getVistitType(), billPcr.getPhone(), billPcr.getDepartureName(), billPcr.getDepartureId()
  426. ,billPcr.getMidId(),billPcr.getMidName(),billPcr.getFarmName());
  427. System.out.println("这里是pcr通过的下一个流程id:" + nextId);
  428. if (nextId == 0) {
  429. if (split.length == 1) {
  430. baseProcess.setProcessType(1);
  431. String[] strings = allLocationId.split(",");
  432. String ss2 = "";
  433. for (int i = 0; i < strings.length; i++) {
  434. strings[i].replaceAll(strings[i], "2");
  435. if (i == strings.length - 1) {
  436. ss2 = ss2 + strings[i].replaceAll(strings[i], "2");
  437. } else {
  438. ss2 = strings[i].replaceAll(strings[i], "2") + "," + ss2;
  439. }
  440. }
  441. baseProcess.setAllLocationStatus(ss2);
  442. //下发人脸门禁白名单
  443. if (billPcr.getVistitType() == 0) {
  444. //人员隔离中心流程
  445. if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
  446. if ("29".equals(farmId) && baseLocation.getId() == 46) {
  447. //庙贝门禁单独的
  448. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
  449. Date now = new Date();
  450. Calendar calendar = Calendar.getInstance();
  451. calendar.setTime(now);
  452. calendar.add(Calendar.HOUR_OF_DAY, 6);
  453. Date date1 = calendar.getTime();
  454. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  455. PeopleList peopleList1 = new PeopleList();
  456. peopleList1.setFarmId("29");
  457. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  458. peopleList1.setUserId(billPcr.getProcessId().toString());
  459. peopleList1.setUserName(billPcr.getAdmissionUserName());
  460. peopleList1.setPassword("123456");
  461. peopleList1.setType(0);
  462. peopleList1.setCreateTime(new Date());
  463. peopleList1.setOutTime(date1);
  464. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  465. peopleListMapper.insert(peopleList1);
  466. } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
  467. //凤行门禁单独的
  468. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  469. Date now = new Date();
  470. Calendar calendar = Calendar.getInstance();
  471. calendar.setTime(now);
  472. calendar.add(Calendar.HOUR_OF_DAY, 6);
  473. Date date1 = calendar.getTime();
  474. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  475. PeopleList peopleList1 = new PeopleList();
  476. peopleList1.setFarmId("31");
  477. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  478. peopleList1.setUserId(billPcr.getProcessId().toString());
  479. peopleList1.setUserName(billPcr.getAdmissionUserName());
  480. peopleList1.setPassword("123456");
  481. peopleList1.setType(0);
  482. peopleList1.setCreateTime(new Date());
  483. peopleList1.setOutTime(date1);
  484. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  485. peopleListMapper.insert(peopleList1);
  486. } else {
  487. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
  488. PeopleList peopleList = new PeopleList();
  489. peopleList.setFarmId("2");
  490. peopleList.setDeviceCode(deviceList.getDeviceCode());
  491. peopleList.setUserId(billPcr.getProcessId().toString());
  492. peopleList.setUserName(billPcr.getAdmissionUserName());
  493. peopleList.setPassword("123456");
  494. peopleList.setType(0);
  495. peopleList.setCreateTime(new Date());
  496. Date now = new Date();
  497. Calendar calendar = Calendar.getInstance();
  498. calendar.setTime(now);
  499. calendar.add(Calendar.HOUR_OF_DAY, 6);
  500. Date date1 = calendar.getTime();
  501. peopleList.setOutTime(date1);
  502. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  503. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  504. peopleListMapper.insert(peopleList);
  505. }
  506. }
  507. //人员基地外围
  508. if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
  509. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
  510. PeopleList peopleList = new PeopleList();
  511. peopleList.setFarmId(billPcr.getFarmId().toString());
  512. peopleList.setDeviceCode(deviceList.getDeviceCode());
  513. peopleList.setUserId(billPcr.getProcessId().toString());
  514. peopleList.setUserName(billPcr.getAdmissionUserName());
  515. peopleList.setPassword("123456");
  516. peopleList.setType(0);
  517. peopleList.setCreateTime(new Date());
  518. Date now = new Date();
  519. Calendar calendar = Calendar.getInstance();
  520. calendar.setTime(now);
  521. calendar.add(Calendar.HOUR_OF_DAY, 6);
  522. Date date1 = calendar.getTime();
  523. peopleList.setOutTime(date1);
  524. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  525. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  526. peopleListMapper.insert(peopleList);
  527. }
  528. }
  529. } else {
  530. String[] strings = allLocationId.split(",");
  531. Integer index = 0;
  532. for (int i = 0; i < strings.length; i++) {
  533. if ((baseLocation.getId().toString()).equals(strings[i])) {
  534. index = i;
  535. }
  536. }
  537. QueryWrapper<BaseLocation> queryWrapper = new QueryWrapper();
  538. queryWrapper.eq("id", strings[index + 2]);
  539. BaseLocation location = locationMapper.selectOne(queryWrapper);
  540. FlowUtil flowUtil = new FlowUtil();
  541. Object entity = flowUtil.getEntity(Integer.parseInt(split[1]), billPcr.getVistitType(), billPcr.getDestName()
  542. , billPcr.getDestId(), billPcr.getAdmissionUserId(), billPcr.getAdmissionUserName(), billPcr.getPhone(),
  543. billPcr.getVistitDate(), location.getId(), location.getLocationName(), billPcr.getFarmId()
  544. , baseProcess.getId(), billPcr.getDepartureName(), billPcr.getDepartureId(),billPcr.getMidId(),billPcr.getMidName(),billPcr.getFarmName());
  545. if (Integer.parseInt(split[1]) == 1) {
  546. //新增采样
  547. BillSampling billSampling = (BillSampling) entity;
  548. if (billPcr.getVistitType() != 0) {
  549. billSampling.setCarNum(billPcr.getCarNum());
  550. }
  551. if (billPcr.getVistitType() == 5) {
  552. billSampling.setResource(billPcr.getResource());
  553. billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
  554. billSampling.setRemark(billPcr.getRemark());
  555. }
  556. samplingMapper.insert(billSampling);
  557. //下发人脸门禁白名单
  558. if (billPcr.getVistitType() == 0) {
  559. //人员隔离中心流程
  560. if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
  561. if ("29".equals(farmId) && baseLocation.getId() == 46) {
  562. //庙贝门禁单独的
  563. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
  564. Date now = new Date();
  565. Calendar calendar = Calendar.getInstance();
  566. calendar.setTime(now);
  567. Date date1 = calendar.getTime();
  568. calendar.add(Calendar.HOUR_OF_DAY, 6);
  569. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  570. PeopleList peopleList1 = new PeopleList();
  571. peopleList1.setFarmId("29");
  572. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  573. peopleList1.setUserId(billPcr.getProcessId().toString());
  574. peopleList1.setUserName(billPcr.getAdmissionUserName());
  575. peopleList1.setPassword("123456");
  576. peopleList1.setType(0);
  577. peopleList1.setCreateTime(new Date());
  578. peopleList1.setOutTime(date1);
  579. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  580. peopleListMapper.insert(peopleList1);
  581. } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
  582. //凤行门禁单独的
  583. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  584. Date now = new Date();
  585. Calendar calendar = Calendar.getInstance();
  586. calendar.setTime(now);
  587. calendar.add(Calendar.HOUR_OF_DAY, 6);
  588. Date date1 = calendar.getTime();
  589. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  590. PeopleList peopleList1 = new PeopleList();
  591. peopleList1.setFarmId("31");
  592. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  593. peopleList1.setUserId(billPcr.getProcessId().toString());
  594. peopleList1.setUserName(billPcr.getAdmissionUserName());
  595. peopleList1.setPassword("123456");
  596. peopleList1.setType(0);
  597. peopleList1.setCreateTime(new Date());
  598. peopleList1.setOutTime(date1);
  599. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  600. peopleListMapper.insert(peopleList1);
  601. } else {
  602. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
  603. PeopleList peopleList = new PeopleList();
  604. peopleList.setFarmId("2");
  605. peopleList.setDeviceCode(deviceList.getDeviceCode());
  606. peopleList.setUserId(billPcr.getProcessId().toString());
  607. peopleList.setUserName(billPcr.getAdmissionUserName());
  608. peopleList.setPassword("123456");
  609. peopleList.setType(0);
  610. peopleList.setCreateTime(new Date());
  611. Date now = new Date();
  612. Calendar calendar = Calendar.getInstance();
  613. calendar.setTime(now);
  614. calendar.add(Calendar.HOUR_OF_DAY, 6);
  615. Date date1 = calendar.getTime();
  616. peopleList.setOutTime(date1);
  617. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  618. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  619. peopleListMapper.insert(peopleList);
  620. }
  621. }
  622. //人员基地外围
  623. if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
  624. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
  625. PeopleList peopleList = new PeopleList();
  626. peopleList.setFarmId(billPcr.getFarmId().toString());
  627. peopleList.setDeviceCode(deviceList.getDeviceCode());
  628. peopleList.setUserId(billPcr.getProcessId().toString());
  629. peopleList.setUserName(billPcr.getAdmissionUserName());
  630. peopleList.setPassword("123456");
  631. peopleList.setType(0);
  632. peopleList.setCreateTime(new Date());
  633. Date now = new Date();
  634. Calendar calendar = Calendar.getInstance();
  635. calendar.setTime(now);
  636. calendar.add(Calendar.HOUR_OF_DAY, 6);
  637. Date date1 = calendar.getTime();
  638. peopleList.setOutTime(date1);
  639. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  640. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  641. peopleListMapper.insert(peopleList);
  642. }
  643. }
  644. } else if (Integer.parseInt(split[1]) == 2) {
  645. //新增pcr
  646. BillPcr billClean = (BillPcr) entity;
  647. if (billPcr.getVistitType() != 0) {
  648. billClean.setCarNum(billPcr.getCarNum());
  649. }
  650. if (billPcr.getVistitType() == 5) {
  651. billClean.setResource(billPcr.getResource());
  652. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  653. billClean.setRemark(billPcr.getRemark());
  654. }
  655. pcrMapper.insert(billClean);
  656. } else if (Integer.parseInt(split[1]) == 3) {
  657. //新增洗澡
  658. BillClean billClean = (BillClean) entity;
  659. if (billPcr.getVistitType() != 0) {
  660. billClean.setCarNum(billPcr.getCarNum());
  661. }
  662. if (billPcr.getVistitType() == 5) {
  663. billClean.setResource(billPcr.getResource());
  664. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  665. billClean.setRemark(billPcr.getRemark());
  666. }
  667. cleanMapper.insert(billClean);
  668. } else if (Integer.parseInt(split[1]) == 4) {
  669. //新增隔离
  670. BillIsolate pcr = (BillIsolate) entity;
  671. if (billPcr.getVistitType() != 0) {
  672. pcr.setCarNum(billPcr.getCarNum());
  673. }
  674. if (billPcr.getVistitType() == 5) {
  675. pcr.setResource(billPcr.getResource());
  676. pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
  677. pcr.setRemark(billPcr.getRemark());
  678. }
  679. isolateMapper.insert(pcr);
  680. } else if (Integer.parseInt(split[1]) == 5) {
  681. BillDry billClean = (BillDry) entity;
  682. if (billPcr.getVistitType() != 0) {
  683. billClean.setCarNum(billPcr.getCarNum());
  684. }
  685. if (billPcr.getVistitType() == 5) {
  686. billClean.setResource(billPcr.getResource());
  687. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  688. billClean.setRemark(billPcr.getRemark());
  689. }
  690. dryMapper.insert(billClean);
  691. //新增烘干
  692. } else if (Integer.parseInt(split[1]) == 6) {
  693. //新增洗澡前拍照
  694. BillCleanBefore before = (BillCleanBefore) entity;
  695. if (billPcr.getVistitType() != 0) {
  696. before.setCarNum(billPcr.getCarNum());
  697. }
  698. if (billPcr.getVistitType() == 5) {
  699. before.setResource(billPcr.getResource());
  700. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  701. before.setRemark(billPcr.getRemark());
  702. }
  703. beforeMapper.insert(before);
  704. } else if (Integer.parseInt(split[1]) == 7) {
  705. //新增洗澡前拍照
  706. BillGoodsInventory before = (BillGoodsInventory) entity;
  707. if (billPcr.getVistitType() != 0) {
  708. before.setCarNum(billPcr.getCarNum());
  709. }
  710. if (billPcr.getVistitType() == 5) {
  711. before.setResource(billPcr.getResource());
  712. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  713. before.setRemark(billPcr.getRemark());
  714. }
  715. inventoryMapper.insert(before);
  716. }
  717. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId + "," + split[1]);
  718. Integer locationId = billPcr.getTestLocationId();
  719. String[] split2 = allLocationId.split(",");
  720. int a = 0;
  721. for (int i = 0; i < split2.length; i++) {
  722. if (locationId.toString().equals(split2[i])) {
  723. a = i + 1;
  724. }
  725. }
  726. int indexOf = 2 * (a - 2);//当前位置在所有流程位置中的下标
  727. String substring = baseProcess.getAllLocationStatus().substring(0, indexOf + 3);//截取已经过的位置状态
  728. String[] split1 = substring.split(",");
  729. String sb2 = "";
  730. for (int i = 0; i < split1.length; i++) {
  731. if (i == split1.length - 1) {
  732. sb2 = sb2 + split1[i].replaceAll(split1[i], "2");
  733. } else {
  734. sb2 = split1[i].replaceAll(split1[i], "2") + "," + sb2;
  735. }
  736. }
  737. sb2 = sb2 + baseProcess.getAllLocationStatus().substring(indexOf + 3);
  738. StringBuilder sb = new StringBuilder(sb2);
  739. sb.replace(indexOf + 4, indexOf + 5, "2");
  740. sb.replace(indexOf + 6, indexOf + 7, "1");
  741. baseProcess.setAllLocationStatus(sb.toString());
  742. }
  743. } else if (nextId == 1) {
  744. //新增采样
  745. BillSampling billSampling = (BillSampling) newObject;
  746. if (billPcr.getVistitType() != 0) {
  747. billSampling.setCarNum(billPcr.getCarNum());
  748. }
  749. if (billPcr.getVistitType() == 5) {
  750. billSampling.setResource(billPcr.getResource());
  751. billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
  752. billSampling.setRemark(billPcr.getRemark());
  753. }
  754. samplingMapper.insert(billSampling);
  755. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  756. } else if (nextId == 2) {
  757. //新增pcr
  758. BillPcr billClean = (BillPcr) newObject;
  759. if (billPcr.getVistitType() != 0) {
  760. billClean.setCarNum(billPcr.getCarNum());
  761. }
  762. if (billPcr.getVistitType() == 5) {
  763. billClean.setResource(billPcr.getResource());
  764. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  765. billClean.setRemark(billPcr.getRemark());
  766. }
  767. pcrMapper.insert(billClean);
  768. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  769. //下发人脸门禁白名单
  770. if (billPcr.getVistitType() == 0) {
  771. //人员隔离中心流程
  772. if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
  773. if ("29".equals(farmId) && baseLocation.getId() == 46) {
  774. //庙贝门禁单独的
  775. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
  776. Date now = new Date();
  777. Calendar calendar = Calendar.getInstance();
  778. calendar.setTime(now);
  779. calendar.add(Calendar.HOUR_OF_DAY, 6);
  780. Date date1 = calendar.getTime();
  781. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  782. PeopleList peopleList1 = new PeopleList();
  783. peopleList1.setFarmId("29");
  784. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  785. peopleList1.setUserId(billPcr.getProcessId().toString());
  786. peopleList1.setUserName(billPcr.getAdmissionUserName());
  787. peopleList1.setPassword("123456");
  788. peopleList1.setType(0);
  789. peopleList1.setCreateTime(new Date());
  790. peopleList1.setOutTime(date1);
  791. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  792. peopleListMapper.insert(peopleList1);
  793. } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
  794. //凤行门禁单独的
  795. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  796. Date now = new Date();
  797. Calendar calendar = Calendar.getInstance();
  798. calendar.setTime(now);
  799. calendar.add(Calendar.HOUR_OF_DAY, 6);
  800. Date date1 = calendar.getTime();
  801. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  802. PeopleList peopleList1 = new PeopleList();
  803. peopleList1.setFarmId("31");
  804. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  805. peopleList1.setUserId(billPcr.getProcessId().toString());
  806. peopleList1.setUserName(billPcr.getAdmissionUserName());
  807. peopleList1.setPassword("123456");
  808. peopleList1.setType(0);
  809. peopleList1.setCreateTime(new Date());
  810. peopleList1.setOutTime(date1);
  811. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  812. peopleListMapper.insert(peopleList1);
  813. } else {
  814. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
  815. PeopleList peopleList = new PeopleList();
  816. peopleList.setFarmId("2");
  817. peopleList.setDeviceCode(deviceList.getDeviceCode());
  818. peopleList.setUserId(billPcr.getProcessId().toString());
  819. peopleList.setUserName(billPcr.getAdmissionUserName());
  820. peopleList.setPassword("123456");
  821. peopleList.setType(0);
  822. peopleList.setCreateTime(new Date());
  823. Date now = new Date();
  824. Calendar calendar = Calendar.getInstance();
  825. calendar.setTime(now);
  826. calendar.add(Calendar.HOUR_OF_DAY, 6);
  827. Date date1 = calendar.getTime();
  828. peopleList.setOutTime(date1);
  829. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  830. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  831. peopleListMapper.insert(peopleList);
  832. }
  833. }
  834. //人员基地外围
  835. if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
  836. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
  837. PeopleList peopleList = new PeopleList();
  838. peopleList.setFarmId(billPcr.getFarmId().toString());
  839. peopleList.setDeviceCode(deviceList.getDeviceCode());
  840. peopleList.setUserId(billPcr.getProcessId().toString());
  841. peopleList.setUserName(billPcr.getAdmissionUserName());
  842. peopleList.setPassword("123456");
  843. peopleList.setType(0);
  844. peopleList.setCreateTime(new Date());
  845. Date now = new Date();
  846. Calendar calendar = Calendar.getInstance();
  847. calendar.setTime(now);
  848. calendar.add(Calendar.HOUR_OF_DAY, 6);
  849. Date date1 = calendar.getTime();
  850. peopleList.setOutTime(date1);
  851. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  852. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  853. peopleListMapper.insert(peopleList);
  854. }
  855. }
  856. } else if (nextId == 3) {
  857. //新增洗澡
  858. BillClean billClean = (BillClean) newObject;
  859. if (billPcr.getVistitType() != 0) {
  860. billClean.setCarNum(billPcr.getCarNum());
  861. }
  862. if (billPcr.getVistitType() == 5) {
  863. billClean.setResource(billPcr.getResource());
  864. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  865. billClean.setRemark(billPcr.getRemark());
  866. }
  867. cleanMapper.insert(billClean);
  868. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  869. } else if (nextId == 4) {
  870. //新增隔离
  871. BillIsolate pcr = (BillIsolate) newObject;
  872. if (billPcr.getVistitType() != 0) {
  873. pcr.setCarNum(billPcr.getCarNum());
  874. }
  875. if (billPcr.getVistitType() == 5) {
  876. pcr.setResource(billPcr.getResource());
  877. pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
  878. pcr.setRemark(billPcr.getRemark());
  879. }
  880. isolateMapper.insert(pcr);
  881. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  882. } else if (nextId == 5) {
  883. BillDry billClean = (BillDry) newObject;
  884. if (billPcr.getVistitType() != 0) {
  885. billClean.setCarNum(billPcr.getCarNum());
  886. }
  887. if (billPcr.getVistitType() == 5) {
  888. billClean.setResource(billPcr.getResource());
  889. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  890. billClean.setRemark(billPcr.getRemark());
  891. }
  892. dryMapper.insert(billClean);
  893. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  894. //新增烘干
  895. } else if (nextId == 6) {
  896. //新增洗澡前拍照
  897. BillCleanBefore before = (BillCleanBefore) newObject;
  898. if (billPcr.getVistitType() != 0) {
  899. before.setCarNum(billPcr.getCarNum());
  900. }
  901. if (billPcr.getVistitType() == 5) {
  902. before.setResource(billPcr.getResource());
  903. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  904. before.setRemark(billPcr.getRemark());
  905. }
  906. beforeMapper.insert(before);
  907. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  908. } else if (nextId == 7) {
  909. //新增洗澡前拍照
  910. BillGoodsInventory before = (BillGoodsInventory) newObject;
  911. if (billPcr.getVistitType() != 0) {
  912. before.setCarNum(billPcr.getCarNum());
  913. }
  914. if (billPcr.getVistitType() == 5) {
  915. before.setResource(billPcr.getResource());
  916. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  917. before.setRemark(billPcr.getRemark());
  918. }
  919. inventoryMapper.insert(before);
  920. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  921. }
  922. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
  923. baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
  924. baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
  925. String status = baseProcess.getCurrentStatus();
  926. String substring = status.substring(0, status.length() - 1);
  927. baseProcess.setCurrentStatus(substring + "1," + 0);
  928. processMapper.updateById(baseProcess);
  929. pcrMapper.updateById(billPcr);
  930. if (billPcr.getVistitType() == 3 && billPcr.getFarmId() == 31 && billPcr.getTestLocationId() == 45) {
  931. //风行下发单独的饲料车流程门禁
  932. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  933. PeopleList peopleList = new PeopleList();
  934. peopleList.setFarmId("31");
  935. peopleList.setDeviceCode(deviceList.getDeviceCode());
  936. peopleList.setUserId(billPcr.getProcessId().toString());
  937. peopleList.setUserName(billPcr.getAdmissionUserName());
  938. peopleList.setPassword("123456");
  939. peopleList.setType(0);
  940. peopleList.setCreateTime(new Date());
  941. Date now = new Date();
  942. Calendar calendar = Calendar.getInstance();
  943. calendar.setTime(now);
  944. calendar.add(Calendar.HOUR_OF_DAY, 4);
  945. Date date1 = calendar.getTime();
  946. peopleList.setOutTime(date1);
  947. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  948. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  949. peopleListMapper.insert(peopleList);
  950. }
  951. return new Result(10000, "修改成功!", true);
  952. } else {
  953. billPcr.setBillStatus(2);
  954. billPcr.setPcrType(4);
  955. billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
  956. billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
  957. billPcr.setTestLocation(baseLocation.getLocationName());
  958. billPcr.setTestLocationId(baseLocation.getId());
  959. billPcr.setCheckDate(sdf.parse(date));
  960. billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
  961. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
  962. String status = baseProcess.getCurrentStatus();
  963. String substring = status.substring(0, status.length() - 1);
  964. baseProcess.setProcessType(2);
  965. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
  966. baseProcess.setCurrentLocation(baseProcess.getCurrentLocation());
  967. baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId());
  968. baseProcess.setCurrentStatus(substring + "2");
  969. int i = allLocationId.indexOf(billPcr.getTestLocationId().toString());
  970. String status1 = baseProcess.getAllLocationStatus();
  971. System.out.println(status1);
  972. StringBuilder sb = new StringBuilder(status1);
  973. sb.setCharAt(i, '3');
  974. baseProcess.setAllLocationStatus(sb.toString());
  975. processMapper.updateById(baseProcess);
  976. pcrMapper.updateById(billPcr);
  977. return new Result(10000, "修改成功!", true);
  978. }
  979. }
  980. }
  981. @Override
  982. @Transactional
  983. public Result editBatch(HttpServletRequest httpServletRequest,String farmId, String ids, String date, String result,
  984. MultipartFile img1, MultipartFile img2, MultipartFile img3, MultipartFile picture1, MultipartFile picture2, MultipartFile picture3) throws ParseException, IOException {
  985. String s1 = "";
  986. String s2 = "";
  987. String s3 = "";
  988. if (ObjectUtil.isNotEmpty(img1)) {
  989. s1 = uploadImage.uploadImg(img1);
  990. if (s1.equals("上传失败")) {
  991. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  992. return new Result(10001, "检测图片1上传失败", false);
  993. }
  994. }
  995. if (ObjectUtil.isNotEmpty(img2)) {
  996. String s = uploadImage.uploadImg(img2);
  997. s2 = "," + s;
  998. if (s.equals("上传失败")) {
  999. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  1000. return new Result(10001, "检测图片2上传失败", false);
  1001. }
  1002. }
  1003. if (ObjectUtil.isNotEmpty(img3)) {
  1004. String s = uploadImage.uploadImg(img3);
  1005. s3 = "," + s;
  1006. if (s.equals("上传失败")) {
  1007. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  1008. return new Result(10001, "检测图片3上传失败", false);
  1009. }
  1010. }
  1011. String s = s1 + s2 + s3;
  1012. String picUrl = null;
  1013. if (ObjectUtil.isNotEmpty(picture1)){
  1014. String pic1 = uploadImage.getImageCom(picture1);
  1015. if (pic1.equals("上传失败")){
  1016. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  1017. return new Result(10001, "物品检测图片1上传失败", false);
  1018. }else {
  1019. picUrl = pic1;
  1020. }
  1021. }
  1022. if (ObjectUtil.isNotEmpty(picture2)){
  1023. String pic2 = uploadImage.getImageCom(picture2);
  1024. if (pic2.equals("上传失败")){
  1025. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  1026. return new Result(10001, "物品检测图片2上传失败", false);
  1027. }else {
  1028. picUrl = picUrl + ","+pic2;
  1029. }
  1030. }
  1031. if (ObjectUtil.isNotEmpty(picture3)){
  1032. String pic3 = uploadImage.getImageCom(picture3);
  1033. if (pic3.equals("上传失败")){
  1034. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  1035. return new Result(10001, "物品检测图片3上传失败", false);
  1036. }else {
  1037. picUrl = picUrl + ","+pic3;
  1038. }
  1039. }
  1040. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  1041. if (StringUtils.isBlank(date)) {
  1042. date = sdf.format(new Date());
  1043. }
  1044. String[] splits = ids.split(",");
  1045. for (String id : splits) {
  1046. //1为合格2为异常
  1047. BillPcr billPcr = pcrMapper.selectById(id);
  1048. if (billPcr.getBillStatus() != 0) {
  1049. return new Result(10001, "此条记录已被他人修改,请退出刷新查看!", false);
  1050. }
  1051. billPcr.setImgUrl(s);
  1052. billPcr.setImgStatus(1);
  1053. if (billPcr.getVistitType() == 0){
  1054. if (ObjectUtil.isNotEmpty(picUrl)){
  1055. billPcr.setIsCarry(1);
  1056. billPcr.setPicUrl(picUrl);
  1057. }else {
  1058. billPcr.setIsCarry(0);
  1059. }
  1060. }
  1061. QueryWrapper<BaseProcess> processQueryWrapper = new QueryWrapper<>();
  1062. processQueryWrapper.eq("id", billPcr.getProcessId());
  1063. BaseProcess baseProcess = processMapper.selectOne(processQueryWrapper);//进程
  1064. QueryWrapper<BaseLocation> locationQueryWrapper = new QueryWrapper<>();
  1065. locationQueryWrapper.eq("id", billPcr.getTestLocationId());
  1066. BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
  1067. String allLocationId = baseProcess.getAllLocationId();//所有的位置id
  1068. String allFlowId = baseProcess.getAllFlowId();//所有的流程id
  1069. String currentFlowId = baseProcess.getCurrentFlowId();//当前已经完成的流程id
  1070. String substring1 = allFlowId.substring(currentFlowId.length() + 1, allFlowId.length());
  1071. String[] split = substring1.split(",");
  1072. Integer nextId = Integer.parseInt(split[0]);
  1073. if (billPcr.getBillStatus() != 0) {
  1074. return new Result(10001, "该订单已通过,无需再次提交!", false);
  1075. }
  1076. if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
  1077. return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
  1078. } else {
  1079. if ("1".equals(result)) {
  1080. Integer pcrTime = washoutPointMapper.selectOne(new QueryWrapper<BaseWashoutPoint>().eq("farm_ids", baseProcess.getFarmId())
  1081. .eq("visiting_type", billPcr.getVistitType()).eq("mid_id",billPcr.getMidId())
  1082. .eq("location_id", baseLocation.getId())).getPcrTime();
  1083. System.out.println("pcr的下一个流程id:" + nextId);
  1084. billPcr.setBillStatus(1);
  1085. billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
  1086. billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
  1087. billPcr.setTestLocation(baseLocation.getLocationName());
  1088. billPcr.setTestLocationId(baseLocation.getId());
  1089. billPcr.setCheckDate(sdf.parse(date));
  1090. billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
  1091. billPcr.setQualifiedDate(pcrTime);
  1092. Object newObject = getNewObject(nextId, billPcr.getDestName(), billPcr.getDestId(), billPcr.getAdmissionUserName(),
  1093. billPcr.getAdmissionUserId(), billPcr.getVistitDate(), billPcr.getSubDate(),
  1094. billPcr.getProcessId(), billPcr.getFarmId(), billPcr.getTestLocation(), billPcr.getTestLocationId(),
  1095. billPcr.getVistitType(), billPcr.getPhone(), billPcr.getDepartureName(), billPcr.getDepartureId(),billPcr.getMidId()
  1096. ,billPcr.getMidName(),billPcr.getFarmName());
  1097. System.out.println("这里是pcr通过的下一个流程id:" + nextId);
  1098. if (nextId == 0) {
  1099. if (split.length == 1) {
  1100. baseProcess.setProcessType(1);
  1101. String[] strings = allLocationId.split(",");
  1102. String ss2 = "";
  1103. for (int i = 0; i < strings.length; i++) {
  1104. strings[i].replaceAll(strings[i], "2");
  1105. if (i == strings.length - 1) {
  1106. ss2 = ss2 + strings[i].replaceAll(strings[i], "2");
  1107. } else {
  1108. ss2 = strings[i].replaceAll(strings[i], "2") + "," + ss2;
  1109. }
  1110. }
  1111. baseProcess.setAllLocationStatus(ss2);
  1112. //下发人脸门禁白名单
  1113. if (billPcr.getVistitType() == 0) {
  1114. //人员隔离中心流程
  1115. if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
  1116. if ("29".equals(farmId) && baseLocation.getId() == 46) {
  1117. //庙贝门禁单独的
  1118. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
  1119. Date now = new Date();
  1120. Calendar calendar = Calendar.getInstance();
  1121. calendar.setTime(now);
  1122. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1123. Date date1 = calendar.getTime();
  1124. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1125. PeopleList peopleList1 = new PeopleList();
  1126. peopleList1.setFarmId("29");
  1127. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  1128. peopleList1.setUserId(billPcr.getProcessId().toString());
  1129. peopleList1.setUserName(billPcr.getAdmissionUserName());
  1130. peopleList1.setPassword("123456");
  1131. peopleList1.setType(0);
  1132. peopleList1.setCreateTime(new Date());
  1133. peopleList1.setOutTime(date1);
  1134. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  1135. peopleListMapper.insert(peopleList1);
  1136. } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
  1137. //凤行门禁单独的
  1138. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  1139. Date now = new Date();
  1140. Calendar calendar = Calendar.getInstance();
  1141. calendar.setTime(now);
  1142. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1143. Date date1 = calendar.getTime();
  1144. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1145. PeopleList peopleList1 = new PeopleList();
  1146. peopleList1.setFarmId("31");
  1147. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  1148. peopleList1.setUserId(billPcr.getProcessId().toString());
  1149. peopleList1.setUserName(billPcr.getAdmissionUserName());
  1150. peopleList1.setPassword("123456");
  1151. peopleList1.setType(0);
  1152. peopleList1.setCreateTime(new Date());
  1153. peopleList1.setOutTime(date1);
  1154. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  1155. peopleListMapper.insert(peopleList1);
  1156. } else {
  1157. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
  1158. PeopleList peopleList = new PeopleList();
  1159. peopleList.setFarmId("2");
  1160. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1161. peopleList.setUserId(billPcr.getProcessId().toString());
  1162. peopleList.setUserName(billPcr.getAdmissionUserName());
  1163. peopleList.setPassword("123456");
  1164. peopleList.setType(0);
  1165. peopleList.setCreateTime(new Date());
  1166. Date now = new Date();
  1167. Calendar calendar = Calendar.getInstance();
  1168. calendar.setTime(now);
  1169. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1170. Date date1 = calendar.getTime();
  1171. peopleList.setOutTime(date1);
  1172. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1173. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1174. peopleListMapper.insert(peopleList);
  1175. }
  1176. }
  1177. //人员基地外围
  1178. if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
  1179. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
  1180. PeopleList peopleList = new PeopleList();
  1181. peopleList.setFarmId(billPcr.getFarmId().toString());
  1182. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1183. peopleList.setUserId(billPcr.getProcessId().toString());
  1184. peopleList.setUserName(billPcr.getAdmissionUserName());
  1185. peopleList.setPassword("123456");
  1186. peopleList.setType(0);
  1187. peopleList.setCreateTime(new Date());
  1188. Date now = new Date();
  1189. Calendar calendar = Calendar.getInstance();
  1190. calendar.setTime(now);
  1191. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1192. Date date1 = calendar.getTime();
  1193. peopleList.setOutTime(date1);
  1194. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1195. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1196. peopleListMapper.insert(peopleList);
  1197. }
  1198. }
  1199. } else {
  1200. String[] strings = allLocationId.split(",");
  1201. Integer index = 0;
  1202. for (int i = 0; i < strings.length; i++) {
  1203. if ((baseLocation.getId().toString()).equals(strings[i])) {
  1204. index = i;
  1205. }
  1206. }
  1207. QueryWrapper<BaseLocation> queryWrapper = new QueryWrapper();
  1208. queryWrapper.eq("id", strings[index + 2]);
  1209. BaseLocation location = locationMapper.selectOne(queryWrapper);
  1210. FlowUtil flowUtil = new FlowUtil();
  1211. Object entity = flowUtil.getEntity(Integer.parseInt(split[1]), billPcr.getVistitType(), billPcr.getDestName()
  1212. , billPcr.getDestId(), billPcr.getAdmissionUserId(), billPcr.getAdmissionUserName(), billPcr.getPhone(),
  1213. billPcr.getVistitDate(), location.getId(), location.getLocationName(), billPcr.getFarmId()
  1214. , baseProcess.getId(), billPcr.getDepartureName(), billPcr.getDepartureId(),billPcr.getMidId(),billPcr.getMidName(),billPcr.getFarmName());
  1215. if (Integer.parseInt(split[1]) == 1) {
  1216. //新增采样
  1217. BillSampling billSampling = (BillSampling) entity;
  1218. if (billPcr.getVistitType() != 0) {
  1219. billSampling.setCarNum(billPcr.getCarNum());
  1220. }
  1221. if (billPcr.getVistitType() == 5) {
  1222. billSampling.setResource(billPcr.getResource());
  1223. billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
  1224. billSampling.setRemark(billPcr.getRemark());
  1225. }
  1226. samplingMapper.insert(billSampling);
  1227. //下发人脸门禁白名单
  1228. if (billPcr.getVistitType() == 0) {
  1229. //人员隔离中心流程
  1230. if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
  1231. if ("29".equals(farmId) && baseLocation.getId() == 46) {
  1232. //庙贝门禁单独的
  1233. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
  1234. Date now = new Date();
  1235. Calendar calendar = Calendar.getInstance();
  1236. calendar.setTime(now);
  1237. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1238. Date date1 = calendar.getTime();
  1239. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1240. PeopleList peopleList1 = new PeopleList();
  1241. peopleList1.setFarmId("29");
  1242. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  1243. peopleList1.setUserId(billPcr.getProcessId().toString());
  1244. peopleList1.setUserName(billPcr.getAdmissionUserName());
  1245. peopleList1.setPassword("123456");
  1246. peopleList1.setType(0);
  1247. peopleList1.setCreateTime(new Date());
  1248. peopleList1.setOutTime(date1);
  1249. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  1250. peopleListMapper.insert(peopleList1);
  1251. } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
  1252. //凤行门禁单独的
  1253. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  1254. Date now = new Date();
  1255. Calendar calendar = Calendar.getInstance();
  1256. calendar.setTime(now);
  1257. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1258. Date date1 = calendar.getTime();
  1259. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1260. PeopleList peopleList1 = new PeopleList();
  1261. peopleList1.setFarmId("31");
  1262. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  1263. peopleList1.setUserId(billPcr.getProcessId().toString());
  1264. peopleList1.setUserName(billPcr.getAdmissionUserName());
  1265. peopleList1.setPassword("123456");
  1266. peopleList1.setType(0);
  1267. peopleList1.setCreateTime(new Date());
  1268. peopleList1.setOutTime(date1);
  1269. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  1270. peopleListMapper.insert(peopleList1);
  1271. } else {
  1272. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
  1273. PeopleList peopleList = new PeopleList();
  1274. peopleList.setFarmId("2");
  1275. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1276. peopleList.setUserId(billPcr.getProcessId().toString());
  1277. peopleList.setUserName(billPcr.getAdmissionUserName());
  1278. peopleList.setPassword("123456");
  1279. peopleList.setType(0);
  1280. peopleList.setCreateTime(new Date());
  1281. Date now = new Date();
  1282. Calendar calendar = Calendar.getInstance();
  1283. calendar.setTime(now);
  1284. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1285. Date date1 = calendar.getTime();
  1286. peopleList.setOutTime(date1);
  1287. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1288. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1289. peopleListMapper.insert(peopleList);
  1290. }
  1291. }
  1292. //人员基地外围
  1293. if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
  1294. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
  1295. PeopleList peopleList = new PeopleList();
  1296. peopleList.setFarmId(billPcr.getFarmId().toString());
  1297. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1298. peopleList.setUserId(billPcr.getProcessId().toString());
  1299. peopleList.setUserName(billPcr.getAdmissionUserName());
  1300. peopleList.setPassword("123456");
  1301. peopleList.setType(0);
  1302. peopleList.setCreateTime(new Date());
  1303. Date now = new Date();
  1304. Calendar calendar = Calendar.getInstance();
  1305. calendar.setTime(now);
  1306. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1307. Date date1 = calendar.getTime();
  1308. peopleList.setOutTime(date1);
  1309. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1310. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1311. peopleListMapper.insert(peopleList);
  1312. }
  1313. }
  1314. } else if (Integer.parseInt(split[1]) == 2) {
  1315. //新增pcr
  1316. BillPcr billClean = (BillPcr) entity;
  1317. if (billPcr.getVistitType() != 0) {
  1318. billClean.setCarNum(billPcr.getCarNum());
  1319. }
  1320. if (billPcr.getVistitType() == 5) {
  1321. billClean.setResource(billPcr.getResource());
  1322. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  1323. billClean.setRemark(billPcr.getRemark());
  1324. }
  1325. pcrMapper.insert(billClean);
  1326. } else if (Integer.parseInt(split[1]) == 3) {
  1327. //新增洗澡
  1328. BillClean billClean = (BillClean) entity;
  1329. if (billPcr.getVistitType() != 0) {
  1330. billClean.setCarNum(billPcr.getCarNum());
  1331. }
  1332. if (billPcr.getVistitType() == 5) {
  1333. billClean.setResource(billPcr.getResource());
  1334. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  1335. billClean.setRemark(billPcr.getRemark());
  1336. }
  1337. cleanMapper.insert(billClean);
  1338. } else if (Integer.parseInt(split[1]) == 4) {
  1339. //新增隔离
  1340. BillIsolate pcr = (BillIsolate) entity;
  1341. if (billPcr.getVistitType() != 0) {
  1342. pcr.setCarNum(billPcr.getCarNum());
  1343. }
  1344. if (billPcr.getVistitType() == 5) {
  1345. pcr.setResource(billPcr.getResource());
  1346. pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
  1347. pcr.setRemark(billPcr.getRemark());
  1348. }
  1349. isolateMapper.insert(pcr);
  1350. } else if (Integer.parseInt(split[1]) == 5) {
  1351. BillDry billClean = (BillDry) entity;
  1352. if (billPcr.getVistitType() != 0) {
  1353. billClean.setCarNum(billPcr.getCarNum());
  1354. }
  1355. if (billPcr.getVistitType() == 5) {
  1356. billClean.setResource(billPcr.getResource());
  1357. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  1358. billClean.setRemark(billPcr.getRemark());
  1359. }
  1360. dryMapper.insert(billClean);
  1361. //新增烘干
  1362. } else if (Integer.parseInt(split[1]) == 6) {
  1363. //新增洗澡前拍照
  1364. BillCleanBefore before = (BillCleanBefore) entity;
  1365. if (billPcr.getVistitType() != 0) {
  1366. before.setCarNum(billPcr.getCarNum());
  1367. }
  1368. if (billPcr.getVistitType() == 5) {
  1369. before.setResource(billPcr.getResource());
  1370. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  1371. before.setRemark(billPcr.getRemark());
  1372. }
  1373. beforeMapper.insert(before);
  1374. } else if (Integer.parseInt(split[1]) == 7) {
  1375. //新增洗澡前拍照
  1376. BillGoodsInventory before = (BillGoodsInventory) entity;
  1377. if (billPcr.getVistitType() != 0) {
  1378. before.setCarNum(billPcr.getCarNum());
  1379. }
  1380. if (billPcr.getVistitType() == 5) {
  1381. before.setResource(billPcr.getResource());
  1382. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  1383. before.setRemark(billPcr.getRemark());
  1384. }
  1385. inventoryMapper.insert(before);
  1386. }
  1387. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId + "," + split[1]);
  1388. Integer locationId = billPcr.getTestLocationId();
  1389. String[] split2 = allLocationId.split(",");
  1390. int a = 0;
  1391. for (int i = 0; i < split2.length; i++) {
  1392. if (locationId.toString().equals(split2[i])) {
  1393. a = i + 1;
  1394. }
  1395. }
  1396. int indexOf = 2 * (a - 2);//当前位置在所有流程位置中的下标
  1397. String substring = baseProcess.getAllLocationStatus().substring(0, indexOf + 3);//截取已经过的位置状态
  1398. String[] split1 = substring.split(",");
  1399. String sb2 = "";
  1400. for (int i = 0; i < split1.length; i++) {
  1401. if (i == split1.length - 1) {
  1402. sb2 = sb2 + split1[i].replaceAll(split1[i], "2");
  1403. } else {
  1404. sb2 = split1[i].replaceAll(split1[i], "2") + "," + sb2;
  1405. }
  1406. }
  1407. sb2 = sb2 + baseProcess.getAllLocationStatus().substring(indexOf + 3);
  1408. StringBuilder sb = new StringBuilder(sb2);
  1409. sb.replace(indexOf + 4, indexOf + 5, "2");
  1410. sb.replace(indexOf + 6, indexOf + 7, "1");
  1411. baseProcess.setAllLocationStatus(sb.toString());
  1412. }
  1413. } else if (nextId == 1) {
  1414. //新增采样
  1415. BillSampling billSampling = (BillSampling) newObject;
  1416. if (billPcr.getVistitType() != 0) {
  1417. billSampling.setCarNum(billPcr.getCarNum());
  1418. }
  1419. if (billPcr.getVistitType() == 5) {
  1420. billSampling.setResource(billPcr.getResource());
  1421. billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
  1422. billSampling.setRemark(billPcr.getRemark());
  1423. }
  1424. samplingMapper.insert(billSampling);
  1425. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1426. } else if (nextId == 2) {
  1427. //新增pcr
  1428. BillPcr billClean = (BillPcr) newObject;
  1429. if (billPcr.getVistitType() != 0) {
  1430. billClean.setCarNum(billPcr.getCarNum());
  1431. }
  1432. if (billPcr.getVistitType() == 5) {
  1433. billClean.setResource(billPcr.getResource());
  1434. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  1435. billClean.setRemark(billPcr.getRemark());
  1436. }
  1437. pcrMapper.insert(billClean);
  1438. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1439. //下发人脸门禁白名单
  1440. if (billPcr.getVistitType() == 0) {
  1441. //人员隔离中心流程
  1442. if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
  1443. if ("29".equals(farmId) && baseLocation.getId() == 46) {
  1444. //庙贝门禁单独的
  1445. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "29"));
  1446. Date now = new Date();
  1447. Calendar calendar = Calendar.getInstance();
  1448. calendar.setTime(now);
  1449. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1450. Date date1 = calendar.getTime();
  1451. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1452. PeopleList peopleList1 = new PeopleList();
  1453. peopleList1.setFarmId("29");
  1454. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  1455. peopleList1.setUserId(billPcr.getProcessId().toString());
  1456. peopleList1.setUserName(billPcr.getAdmissionUserName());
  1457. peopleList1.setPassword("123456");
  1458. peopleList1.setType(0);
  1459. peopleList1.setCreateTime(new Date());
  1460. peopleList1.setOutTime(date1);
  1461. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  1462. peopleListMapper.insert(peopleList1);
  1463. } else if ("31".equals(farmId) && baseLocation.getId() == 46) {
  1464. //凤行门禁单独的
  1465. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  1466. Date now = new Date();
  1467. Calendar calendar = Calendar.getInstance();
  1468. calendar.setTime(now);
  1469. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1470. Date date1 = calendar.getTime();
  1471. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1472. PeopleList peopleList1 = new PeopleList();
  1473. peopleList1.setFarmId("31");
  1474. peopleList1.setDeviceCode(deviceList.getDeviceCode());
  1475. peopleList1.setUserId(billPcr.getProcessId().toString());
  1476. peopleList1.setUserName(billPcr.getAdmissionUserName());
  1477. peopleList1.setPassword("123456");
  1478. peopleList1.setType(0);
  1479. peopleList1.setCreateTime(new Date());
  1480. peopleList1.setOutTime(date1);
  1481. peopleList1.setImgUrl(sysAccountMultilevel.getImgUrl());
  1482. peopleListMapper.insert(peopleList1);
  1483. } else {
  1484. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
  1485. PeopleList peopleList = new PeopleList();
  1486. peopleList.setFarmId("2");
  1487. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1488. peopleList.setUserId(billPcr.getProcessId().toString());
  1489. peopleList.setUserName(billPcr.getAdmissionUserName());
  1490. peopleList.setPassword("123456");
  1491. peopleList.setType(0);
  1492. peopleList.setCreateTime(new Date());
  1493. Date now = new Date();
  1494. Calendar calendar = Calendar.getInstance();
  1495. calendar.setTime(now);
  1496. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1497. Date date1 = calendar.getTime();
  1498. peopleList.setOutTime(date1);
  1499. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1500. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1501. peopleListMapper.insert(peopleList);
  1502. }
  1503. }
  1504. //人员基地外围
  1505. if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
  1506. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
  1507. PeopleList peopleList = new PeopleList();
  1508. peopleList.setFarmId(billPcr.getFarmId().toString());
  1509. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1510. peopleList.setUserId(billPcr.getProcessId().toString());
  1511. peopleList.setUserName(billPcr.getAdmissionUserName());
  1512. peopleList.setPassword("123456");
  1513. peopleList.setType(0);
  1514. peopleList.setCreateTime(new Date());
  1515. Date now = new Date();
  1516. Calendar calendar = Calendar.getInstance();
  1517. calendar.setTime(now);
  1518. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1519. Date date1 = calendar.getTime();
  1520. peopleList.setOutTime(date1);
  1521. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1522. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1523. peopleListMapper.insert(peopleList);
  1524. }
  1525. }
  1526. } else if (nextId == 3) {
  1527. //新增洗澡
  1528. BillClean billClean = (BillClean) newObject;
  1529. if (billPcr.getVistitType() != 0) {
  1530. billClean.setCarNum(billPcr.getCarNum());
  1531. }
  1532. if (billPcr.getVistitType() == 5) {
  1533. billClean.setResource(billPcr.getResource());
  1534. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  1535. billClean.setRemark(billPcr.getRemark());
  1536. }
  1537. cleanMapper.insert(billClean);
  1538. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1539. } else if (nextId == 4) {
  1540. //新增隔离
  1541. BillIsolate pcr = (BillIsolate) newObject;
  1542. if (billPcr.getVistitType() != 0) {
  1543. pcr.setCarNum(billPcr.getCarNum());
  1544. }
  1545. if (billPcr.getVistitType() == 5) {
  1546. pcr.setResource(billPcr.getResource());
  1547. pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
  1548. pcr.setRemark(billPcr.getRemark());
  1549. }
  1550. isolateMapper.insert(pcr);
  1551. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1552. } else if (nextId == 5) {
  1553. BillDry billClean = (BillDry) newObject;
  1554. if (billPcr.getVistitType() != 0) {
  1555. billClean.setCarNum(billPcr.getCarNum());
  1556. }
  1557. if (billPcr.getVistitType() == 5) {
  1558. billClean.setResource(billPcr.getResource());
  1559. billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
  1560. billClean.setRemark(billPcr.getRemark());
  1561. }
  1562. dryMapper.insert(billClean);
  1563. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1564. //新增烘干
  1565. } else if (nextId == 6) {
  1566. //新增洗澡前拍照
  1567. BillCleanBefore before = (BillCleanBefore) newObject;
  1568. if (billPcr.getVistitType() != 0) {
  1569. before.setCarNum(billPcr.getCarNum());
  1570. }
  1571. if (billPcr.getVistitType() == 5) {
  1572. before.setResource(billPcr.getResource());
  1573. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  1574. before.setRemark(billPcr.getRemark());
  1575. }
  1576. beforeMapper.insert(before);
  1577. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1578. } else if (nextId == 7) {
  1579. //新增洗澡前拍照
  1580. BillGoodsInventory before = (BillGoodsInventory) newObject;
  1581. if (billPcr.getVistitType() != 0) {
  1582. before.setCarNum(billPcr.getCarNum());
  1583. }
  1584. if (billPcr.getVistitType() == 5) {
  1585. before.setResource(billPcr.getResource());
  1586. before.setFeedImgUrl(billPcr.getFeedImgUrl());
  1587. before.setRemark(billPcr.getRemark());
  1588. }
  1589. inventoryMapper.insert(before);
  1590. baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
  1591. }
  1592. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
  1593. baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
  1594. baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
  1595. String status = baseProcess.getCurrentStatus();
  1596. String substring = status.substring(0, status.length() - 1);
  1597. baseProcess.setCurrentStatus(substring + "1," + 0);
  1598. processMapper.updateById(baseProcess);
  1599. pcrMapper.updateById(billPcr);
  1600. if (billPcr.getVistitType() == 3 && billPcr.getFarmId() == 31 && billPcr.getTestLocationId() == 45) {
  1601. //风行下发单独的饲料车流程门禁
  1602. DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "31"));
  1603. PeopleList peopleList = new PeopleList();
  1604. peopleList.setFarmId("31");
  1605. peopleList.setDeviceCode(deviceList.getDeviceCode());
  1606. peopleList.setUserId(billPcr.getProcessId().toString());
  1607. peopleList.setUserName(billPcr.getAdmissionUserName());
  1608. peopleList.setPassword("123456");
  1609. peopleList.setType(0);
  1610. peopleList.setCreateTime(new Date());
  1611. Date now = new Date();
  1612. Calendar calendar = Calendar.getInstance();
  1613. calendar.setTime(now);
  1614. calendar.add(Calendar.HOUR_OF_DAY, 6);
  1615. Date date1 = calendar.getTime();
  1616. peopleList.setOutTime(date1);
  1617. SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
  1618. peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
  1619. peopleListMapper.insert(peopleList);
  1620. }
  1621. return new Result(10000, "修改成功!", true);
  1622. } else {
  1623. billPcr.setBillStatus(2);
  1624. billPcr.setPcrType(4);
  1625. billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
  1626. billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
  1627. billPcr.setTestLocation(baseLocation.getLocationName());
  1628. billPcr.setTestLocationId(baseLocation.getId());
  1629. billPcr.setCheckDate(sdf.parse(date));
  1630. billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
  1631. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
  1632. String status = baseProcess.getCurrentStatus();
  1633. String substring = status.substring(0, status.length() - 1);
  1634. baseProcess.setProcessType(2);
  1635. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
  1636. baseProcess.setCurrentLocation(baseProcess.getCurrentLocation());
  1637. baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId());
  1638. baseProcess.setCurrentStatus(substring + "2");
  1639. int i = allLocationId.indexOf(billPcr.getTestLocationId().toString());
  1640. String status1 = baseProcess.getAllLocationStatus();
  1641. System.out.println(status1);
  1642. StringBuilder sb = new StringBuilder(status1);
  1643. sb.setCharAt(i, '3');
  1644. baseProcess.setAllLocationStatus(sb.toString());
  1645. processMapper.updateById(baseProcess);
  1646. pcrMapper.updateById(billPcr);
  1647. return new Result(10000, "修改成功!", true);
  1648. }
  1649. }
  1650. }
  1651. return new Result(10000, "修改成功!", true);
  1652. }
  1653. public static void main(String[] args) {
  1654. // int i = "0,45,0".indexOf("45");
  1655. // String status1 ="2,1,1,0";
  1656. // System.out.println(status1);
  1657. // StringBuilder sb = new StringBuilder(status1);
  1658. // sb.setCharAt(i-1, '3');
  1659. // System.out.println(sb);
  1660. int i = "0,45,0".indexOf("45");
  1661. String status1 = "2,1,1,0";
  1662. StringBuilder sb = new StringBuilder(status1);
  1663. sb.setCharAt(i, '3');
  1664. System.out.println(sb.toString());
  1665. }
  1666. private void xiugaiPro(BaseProcess baseProcess, BillPcr billPcr) {
  1667. baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + new Date());
  1668. baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + billPcr.getTestLocation());
  1669. baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + billPcr.getTestLocationId());
  1670. baseProcess.setCurrentStatus(baseProcess.getCurrentStatus() + "," + 2);
  1671. }
  1672. public String add() {
  1673. ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
  1674. Runnable task = new Runnable() {
  1675. @Override
  1676. public void run() {
  1677. //这里写业务
  1678. System.out.println();
  1679. }
  1680. };
  1681. // 设定延迟时间(两小时后执行,单位为秒)
  1682. long delay = 3;
  1683. // 执行定时任务
  1684. scheduler.schedule(task, delay, TimeUnit.SECONDS);
  1685. System.out.println("完结");
  1686. return "成功";
  1687. }
  1688. public static Object getNewObject(Integer id, String destName, Integer destId, String admissionUserName, Integer admissionUserId
  1689. , LocalDateTime vistitDate, LocalDateTime subDate, Integer processId, Integer farmId, String testLocation
  1690. , Integer testLocationId, Integer vistitType, String phone, String departureName, Integer departureId,Integer midId,String midName,String farmName) {
  1691. if (id == 1) {
  1692. //采样
  1693. BillSampling billSampling = new BillSampling();
  1694. billSampling.setVistitType(vistitType);
  1695. billSampling.setDestName(destName);
  1696. billSampling.setDestId(destId);
  1697. billSampling.setAdmissionUserName(admissionUserName);
  1698. billSampling.setAdmissionUserId(admissionUserId);
  1699. billSampling.setVistitDate(vistitDate);
  1700. billSampling.setSubDate(LocalDateTime.now());
  1701. billSampling.setPhone(phone);
  1702. billSampling.setTestLocation(testLocation);
  1703. billSampling.setTestLocationId(testLocationId);
  1704. billSampling.setProcessId(processId);
  1705. billSampling.setFarmId(String.valueOf(farmId));
  1706. billSampling.setDepartureName(departureName);
  1707. billSampling.setDepartureId(departureId);
  1708. billSampling.setMidId(midId);
  1709. billSampling.setMidName(midName);
  1710. billSampling.setFarmName(farmName);
  1711. return billSampling;
  1712. }
  1713. if (id == 2) {
  1714. //pcr
  1715. BillPcr billPcr = new BillPcr();
  1716. billPcr.setVistitType(vistitType);
  1717. billPcr.setDestName(destName);
  1718. billPcr.setDestId(destId);
  1719. billPcr.setAdmissionUserId(admissionUserId);
  1720. billPcr.setAdmissionUserName(admissionUserName);
  1721. billPcr.setVistitDate(vistitDate);
  1722. billPcr.setSubDate(subDate);
  1723. billPcr.setBillStatus(0);
  1724. billPcr.setProcessId(processId);
  1725. billPcr.setPhone(phone);
  1726. billPcr.setFarmId(farmId);
  1727. billPcr.setTestLocationId(testLocationId);
  1728. billPcr.setTestLocation(testLocation);
  1729. billPcr.setDepartureName(departureName);
  1730. billPcr.setDepartureId(departureId);
  1731. billPcr.setMidId(midId);
  1732. billPcr.setMidName(midName);
  1733. billPcr.setFarmName(farmName);
  1734. return billPcr;
  1735. }
  1736. if (id == 3) {
  1737. //洗消
  1738. BillClean billPcr = new BillClean();
  1739. billPcr.setVistitType(vistitType);
  1740. billPcr.setDestName(destName);
  1741. billPcr.setDestId(destId);
  1742. billPcr.setAdmissionUserId(admissionUserId);
  1743. billPcr.setAdmissionUserName(admissionUserName);
  1744. billPcr.setVistitDate(vistitDate);
  1745. billPcr.setSubDate(subDate);
  1746. billPcr.setBillStatus(0);
  1747. billPcr.setProcessId(processId);
  1748. billPcr.setPhone(phone);
  1749. billPcr.setFarmId(farmId);
  1750. billPcr.setTestLocationId(testLocationId);
  1751. billPcr.setTestLocation(testLocation);
  1752. billPcr.setDepartureName(departureName);
  1753. billPcr.setDepartureId(departureId);
  1754. billPcr.setMidId(midId);
  1755. billPcr.setMidName(midName);
  1756. billPcr.setFarmName(farmName);
  1757. return billPcr;
  1758. }
  1759. if (id == 4) {
  1760. //隔离
  1761. BillIsolate billPcr = new BillIsolate();
  1762. billPcr.setVistitType(vistitType);
  1763. billPcr.setDestName(destName);
  1764. billPcr.setDestId(destId);
  1765. billPcr.setAdmissionUserId(admissionUserId);
  1766. billPcr.setAdmissionUserName(admissionUserName);
  1767. billPcr.setVistitDate(vistitDate);
  1768. billPcr.setSubDate(subDate);
  1769. billPcr.setBillStatus(0);
  1770. billPcr.setProcessId(processId);
  1771. billPcr.setFarmId(farmId);
  1772. billPcr.setPhone(phone);
  1773. billPcr.setIsolateLocation(testLocation);
  1774. billPcr.setIsolateLocationId(testLocationId);
  1775. billPcr.setDepartureName(departureName);
  1776. billPcr.setDepartureId(departureId);
  1777. billPcr.setMidId(midId);
  1778. billPcr.setMidName(midName);
  1779. billPcr.setFarmName(farmName);
  1780. return billPcr;
  1781. }
  1782. if (id == 5) {
  1783. //烘干
  1784. BillDry billPcr = new BillDry();
  1785. billPcr.setVistitType(vistitType);
  1786. billPcr.setDestName(destName);
  1787. billPcr.setDestId(destId);
  1788. billPcr.setAdmissionUserId(admissionUserId);
  1789. billPcr.setAdmissionUserName(admissionUserName);
  1790. billPcr.setVistitDate(vistitDate);
  1791. billPcr.setSubDate(subDate);
  1792. billPcr.setBillStatus(0);
  1793. billPcr.setProcessId(processId);
  1794. billPcr.setFarmId(farmId);
  1795. billPcr.setPhone(phone);
  1796. billPcr.setTestLocationId(testLocationId);
  1797. billPcr.setTestLocation(testLocation);
  1798. billPcr.setDepartureName(departureName);
  1799. billPcr.setDepartureId(departureId);
  1800. billPcr.setMidId(midId);
  1801. billPcr.setMidName(midName);
  1802. billPcr.setFarmName(farmName);
  1803. return billPcr;
  1804. }
  1805. if (id == 6) {
  1806. //洗澡前拍照
  1807. BillCleanBefore billCleanBefore = new BillCleanBefore();
  1808. billCleanBefore.setVistitType(vistitType);
  1809. billCleanBefore.setVistitType(vistitType);
  1810. billCleanBefore.setDestName(destName);
  1811. billCleanBefore.setDestId(destId);
  1812. billCleanBefore.setAdmissionUserName(admissionUserName);
  1813. billCleanBefore.setAdmissionUserId(admissionUserId);
  1814. billCleanBefore.setVistitDate(vistitDate);
  1815. billCleanBefore.setSubDate(LocalDateTime.now());
  1816. billCleanBefore.setPhone(phone);
  1817. billCleanBefore.setTestLocation(testLocation);
  1818. billCleanBefore.setTestLocationId(testLocationId);
  1819. billCleanBefore.setProcessId(processId);
  1820. billCleanBefore.setFarmId(String.valueOf(farmId));
  1821. billCleanBefore.setDepartureName(departureName);
  1822. billCleanBefore.setDepartureId(departureId);
  1823. billCleanBefore.setMidId(midId);
  1824. billCleanBefore.setMidName(midName);
  1825. billCleanBefore.setFarmName(farmName);
  1826. return billCleanBefore;
  1827. }
  1828. if (id == 7) {
  1829. //洗澡前拍照
  1830. BillGoodsInventory billCleanBefore = new BillGoodsInventory();
  1831. billCleanBefore.setVistitType(vistitType);
  1832. billCleanBefore.setVistitType(vistitType);
  1833. billCleanBefore.setDestName(destName);
  1834. billCleanBefore.setDestId(destId);
  1835. billCleanBefore.setAdmissionUserName(admissionUserName);
  1836. billCleanBefore.setAdmissionUserId(admissionUserId);
  1837. billCleanBefore.setVistitDate(vistitDate);
  1838. billCleanBefore.setSubDate(LocalDateTime.now());
  1839. billCleanBefore.setPhone(phone);
  1840. billCleanBefore.setTestLocation(testLocation);
  1841. billCleanBefore.setTestLocationId(testLocationId);
  1842. billCleanBefore.setBillAdmission(processId);
  1843. billCleanBefore.setFarmId(String.valueOf(farmId));
  1844. billCleanBefore.setDepartureName(departureName);
  1845. billCleanBefore.setDepartureId(departureId);
  1846. billCleanBefore.setProcessId(processId);
  1847. billCleanBefore.setMidId(midId);
  1848. billCleanBefore.setMidName(midName);
  1849. billCleanBefore.setFarmName(farmName);
  1850. return billCleanBefore;
  1851. }
  1852. return null;
  1853. }
  1854. }