123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- package com.bofeng.service;
- import com.bofeng.JwtHelper;
- import com.bofeng.dao.MsSuspectedMapper;
- import com.bofeng.dao.OutScanEstateMapper;
- import com.bofeng.dao.RbMapper;
- import com.bofeng.dao.SweepCodeMapper;
- import com.bofeng.entity.*;
- import com.yvan.PageDb;
- import com.yvan.platform.StringUtils;
- import org.apache.shiro.util.CollectionUtils;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.text.ParseException;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.List;
- import java.util.Map;
- @Service
- @Transactional(readOnly = true)
- public class SweepCodeService {
- @Autowired
- private SweepCodeMapper sweepCodeMapper;
- @Autowired
- private OutScanEstateMapper outScanEstateMapper;
- @Autowired
- private RbMapper rbMapper;
- @Autowired
- private MsSuspectedMapper msSuspectedMapper;
- @Autowired
- private MsReportService msReportService;
- @Autowired
- private ScanService scanService;
- public List<SysUptownHouse> selectCode(PageDb pageDb, Map<String, Object> queryParam) {
- List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(pageDb,queryParam);
- return sysUptownHouses;
- }
- // public List<SysUptownHouse> selectLingyunUser(PageDb pageDb, Map<String, Object> queryParam) {
- // Long userId = JwtHelper.getUserId();
- // if (userId > 7000 && userId < 8000) {
- // queryParam.put("unitId", userId);
- // }
- // queryParam.put("uptownId", 1238790987234L);
- // List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectLingyunUser(pageDb,queryParam);
- // return sysUptownHouses;
- // }
- public List<ExcelRiBaoLYBM4> selectLingyunUser(PageDb pageDb, Map<String, Object> queryParam, Long uptownId) throws ParseException {
- Long userId = JwtHelper.getUserId();
- if (userId > 7000 && userId < 8000) {
- queryParam.put("unitId", userId);
- }
- queryParam.put("uptownId", uptownId);
- queryParam.put("orderStr", " suu.unit_id asc,suho.linkman ");
- List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserPage(pageDb,queryParam);
- if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
- String tripDet;
- for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
- if (excelRiBaoLYBM4.getIsContact() == 0) {
- excelRiBaoLYBM4.setIsContactDesc("否");
- } else if (excelRiBaoLYBM4.getIsContact() == 1) {
- excelRiBaoLYBM4.setIsContactDesc("是");
- }
- if (excelRiBaoLYBM4.getIsSuspected() == 0) {
- excelRiBaoLYBM4.setIsSuspectedDesc("否");
- } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
- excelRiBaoLYBM4.setIsSuspectedDesc("是");
- }
- tripDet = "";
- //出行详细
- List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
- if (listDet != null && listDet.size() > 0) {
- for (MsTripDet msTripDet : listDet) {
- tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
- tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
- tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
- tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
- }
- excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
- }
- // 复工
- excelRiBaoLYBM4.setReturnWork(scanService.returnWorkLYlist(excelRiBaoLYBM4.getUserId(), excelRiBaoLYBM4.getLinkman(), excelRiBaoLYBM4.getPhone()));
- }
- }
- return sysUptownHouses;
- }
- public List<ExcelRiBaoLYBM4> selectLingyunUserNotOnJob(PageDb pageDb, Map<String, Object> queryParam,Long notOnJob) throws ParseException {
- Long userId = JwtHelper.getUserId();
- if (userId > 7000 && userId < 8000) {
- queryParam.put("unitId", userId);
- }
- queryParam.put("notOnJob", notOnJob);
- queryParam.put("orderStr", " op.create_at desc ");
- List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserPage(pageDb,queryParam);
- if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
- String tripDet;
- for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
- if (excelRiBaoLYBM4.getIsContact() == 0) {
- excelRiBaoLYBM4.setIsContactDesc("否");
- } else if (excelRiBaoLYBM4.getIsContact() == 1) {
- excelRiBaoLYBM4.setIsContactDesc("是");
- }
- if (excelRiBaoLYBM4.getIsSuspected() == 0) {
- excelRiBaoLYBM4.setIsSuspectedDesc("否");
- } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
- excelRiBaoLYBM4.setIsSuspectedDesc("是");
- }
- tripDet = "";
- //出行详细
- List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
- if (listDet != null && listDet.size() > 0) {
- for (MsTripDet msTripDet : listDet) {
- tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
- tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
- tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
- tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
- }
- excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
- }
- // 复工
- excelRiBaoLYBM4.setReturnWork(scanService.returnWorkLYlist(excelRiBaoLYBM4.getUserId(), excelRiBaoLYBM4.getLinkman(), excelRiBaoLYBM4.getPhone()));
- }
- }
- return sysUptownHouses;
- }
- public List<ExcelRiBaoLYBM4> HCUser(PageDb pageDb, Map<String, Object> queryParam) {
- queryParam.put("uptownId", 100000002L);
- List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserPage(pageDb,queryParam);
- if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
- String tripDet;
- for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
- if (excelRiBaoLYBM4.getIsContact() == 0) {
- excelRiBaoLYBM4.setIsContactDesc("否");
- } else if (excelRiBaoLYBM4.getIsContact() == 1) {
- excelRiBaoLYBM4.setIsContactDesc("是");
- }
- if (excelRiBaoLYBM4.getIsSuspected() == 0) {
- excelRiBaoLYBM4.setIsSuspectedDesc("否");
- } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
- excelRiBaoLYBM4.setIsSuspectedDesc("是");
- }
- tripDet = "";
- //出行详细
- List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
- if (listDet != null && listDet.size() > 0) {
- for (MsTripDet msTripDet : listDet) {
- tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
- tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
- tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
- tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
- }
- excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
- }
- }
- }
- return sysUptownHouses;
- }
- public List<ExcelRiBaoLYBM4> selectLingyunUserHistory(PageDb pageDb, Long userId) {
- List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserHistory(pageDb,userId);
- if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
- String tripDet;
- for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
- if (excelRiBaoLYBM4.getIsContact() == 0) {
- excelRiBaoLYBM4.setIsContactDesc("否");
- } else if (excelRiBaoLYBM4.getIsContact() == 1) {
- excelRiBaoLYBM4.setIsContactDesc("是");
- }
- if (excelRiBaoLYBM4.getIsSuspected() == 0) {
- excelRiBaoLYBM4.setIsSuspectedDesc("否");
- } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
- excelRiBaoLYBM4.setIsSuspectedDesc("是");
- }
- tripDet = "";
- //出行详细
- List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
- if (listDet != null && listDet.size() > 0) {
- for (MsTripDet msTripDet : listDet) {
- tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
- tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
- tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
- tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
- }
- excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
- }
- }
- }
- return sysUptownHouses;
- }
- public List<ExcelRiBaoLYBM4> exSelectLingyunUser(Map<String, Object> queryParam, Long uptownId) throws ParseException {
- queryParam.put("uptownId", uptownId);
- List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUser(queryParam);
- if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
- String tripDet;
- for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
- if (excelRiBaoLYBM4.getIsContact() == 0) {
- excelRiBaoLYBM4.setIsContactDesc("否");
- } else if (excelRiBaoLYBM4.getIsContact() == 1) {
- excelRiBaoLYBM4.setIsContactDesc("是");
- }
- if (excelRiBaoLYBM4.getIsSuspected() == 0) {
- excelRiBaoLYBM4.setIsSuspectedDesc("否");
- } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
- excelRiBaoLYBM4.setIsSuspectedDesc("是");
- }
- if (excelRiBaoLYBM4.getReportStatus() == 0) {
- excelRiBaoLYBM4.setReportStatusDesc("未上报");
- } else if (excelRiBaoLYBM4.getMsStatus() == 1) {
- excelRiBaoLYBM4.setReportStatusDesc("正常");
- } else {
- excelRiBaoLYBM4.setReportStatusDesc("异常");
- }
- if(StringUtils.isNullOrEmpty(excelRiBaoLYBM4.getOldOpenId())){
- excelRiBaoLYBM4.setIsBand("否");
- }else{
- excelRiBaoLYBM4.setIsBand("是");
- }
- tripDet = "";
- //出行详细
- List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
- if (listDet != null && listDet.size() > 0) {
- for (MsTripDet msTripDet : listDet) {
- tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
- tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
- tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
- tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
- }
- excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
- }// 复工
- excelRiBaoLYBM4.setReturnWork(scanService.returnWorkLYlist(excelRiBaoLYBM4.getUserId(), excelRiBaoLYBM4.getLinkman(), excelRiBaoLYBM4.getPhone()));
- if (excelRiBaoLYBM4.getReturnWork() == 1) {
- excelRiBaoLYBM4.setReturnWorkMsg("允许复工");
- } else {
- excelRiBaoLYBM4.setReturnWorkMsg("禁止复工");
- }
- }
- }
- return sysUptownHouses;
- }
- public List<ExcelRiBaoHCBM4> exSelectHCUser(Map<String, Object> queryParam) {
- queryParam.put("uptownId", 100000002L);
- List<ExcelRiBaoHCBM4> sysUptownHouses = rbMapper.exSelectHCUser(queryParam);
- if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
- String tripDet;
- for (ExcelRiBaoHCBM4 excelRiBaoLYBM4 : sysUptownHouses) {
- if (excelRiBaoLYBM4.getIsContact() == 0) {
- excelRiBaoLYBM4.setIsContactDesc("否");
- } else if (excelRiBaoLYBM4.getIsContact() == 1) {
- excelRiBaoLYBM4.setIsContactDesc("是");
- }
- if (excelRiBaoLYBM4.getIsSuspected() == 0) {
- excelRiBaoLYBM4.setIsSuspectedDesc("否");
- } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
- excelRiBaoLYBM4.setIsSuspectedDesc("是");
- }
- tripDet = "";
- //出行详细
- List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
- if (listDet != null && listDet.size() > 0) {
- for (MsTripDet msTripDet : listDet) {
- tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
- tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
- tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
- tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
- }
- excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
- }
- }
- }
- return sysUptownHouses;
- }
- public List<SysUptownHouse> export(Map<String, Object> queryParam) {
- List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.export(queryParam);
- if(sysUptownHouses.size() != 0){
- for (int i = 0; i < sysUptownHouses.size(); i++) {
- if(sysUptownHouses.get(i).getInType() == 1 ){
- sysUptownHouses.get(i).setInTypeStr("进入");
- }else if(sysUptownHouses.get(i).getInType() == 2 ){
- sysUptownHouses.get(i).setInTypeStr("外出");
- }
- if(sysUptownHouses.get(i).getGoStatus() == 1 ){
- sysUptownHouses.get(i).setGoStatusStr("允许");
- }else if(sysUptownHouses.get(i).getGoStatus() == -1 ){
- sysUptownHouses.get(i).setGoStatusStr("禁止");
- }
- }
- }
- return sysUptownHouses;
- }
- public List<SysUptownHouseLY> selectCodeLY(PageDb pageDb, Map<String, Object> queryParam) {
- List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.selectCodeLY(pageDb,queryParam);
- return sysUptownHouses;
- }
- public List<SysUptownHouseLY> exportLY(Map<String, Object> queryParam) {
- List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.exportLY(queryParam);
- if(sysUptownHouses.size() != 0){
- for (int i = 0; i < sysUptownHouses.size(); i++) {
- if(sysUptownHouses.get(i).getInType() == 1 ){
- sysUptownHouses.get(i).setInTypeStr("进入");
- }else if(sysUptownHouses.get(i).getInType() == 2 ){
- sysUptownHouses.get(i).setInTypeStr("外出");
- }
- if(sysUptownHouses.get(i).getGoStatus() == 1 ){
- sysUptownHouses.get(i).setGoStatusStr("允许");
- }else if(sysUptownHouses.get(i).getGoStatus() == -1 ){
- sysUptownHouses.get(i).setGoStatusStr("禁止");
- }
- }
- }
- return sysUptownHouses;
- }
- public List<SysUptownHouseLY> selectCodeHC(PageDb pageDb, Map<String, Object> queryParam) {
- List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.selectCodeHC(pageDb,queryParam);
- return sysUptownHouses;
- }
- public List<SysUptownHouseLY> exportHC(Map<String, Object> queryParam) {
- List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.exportHC(queryParam);
- if(sysUptownHouses.size() != 0){
- for (int i = 0; i < sysUptownHouses.size(); i++) {
- if(sysUptownHouses.get(i).getInType() == 1 ){
- sysUptownHouses.get(i).setInTypeStr("进入");
- }else if(sysUptownHouses.get(i).getInType() == 2 ){
- sysUptownHouses.get(i).setInTypeStr("外出");
- }
- if(sysUptownHouses.get(i).getGoStatus() == 1 ){
- sysUptownHouses.get(i).setGoStatusStr("允许");
- }else if(sysUptownHouses.get(i).getGoStatus() == -1 ){
- sysUptownHouses.get(i).setGoStatusStr("禁止");
- }
- }
- }
- return sysUptownHouses;
- }
- public List<OutScanClock> selectClockLY(PageDb pageDb, Map<String, Object> queryParam) {
- queryParam.put("uptownId", 1238790987234L);
- Long userId = JwtHelper.getUserId();
- if (userId > 7000 && userId < 8000) {
- queryParam.put("unitId", userId);
- }
- List<OutScanClock> list = sweepCodeMapper.selectClockLY(pageDb,queryParam);
- return list;
- }
- public List<OutScanClock> exSelectClockLY(Map<String, Object> queryParam) {
- queryParam.put("uptownId", 1238790987234L);
- List<OutScanClock> list = sweepCodeMapper.exSelectClockLY(queryParam);
- return list;
- }
- public List<Clock> exClockCount(Map<String, Object> queryParam) {
- return sweepCodeMapper.exClockCount(queryParam);
- }
- public List<OutScanEstate> selectXunJian(PageDb pageDb, Map<String, Object> queryParam) {
- List<OutScanEstate> outScanEstates = outScanEstateMapper.selectXunJian(pageDb,queryParam);
- return outScanEstates;
- }
- public List<OutScanEstate> exportXunJian(Map<String, Object> queryParam) {
- List<OutScanEstate> outScanEstates = outScanEstateMapper.exportXunJian(queryParam);
- if(outScanEstates.size() != 0){
- for (int i = 0; i < outScanEstates.size(); i++) {
- if(outScanEstates.get(i).getGoStatus() == 1 ){
- outScanEstates.get(i).setGoStatusStr("允许");
- }else if(outScanEstates.get(i).getGoStatus() == -1 ){
- outScanEstates.get(i).setGoStatusStr("禁止");
- }
- }
- }
- return outScanEstates;
- }
- /**
- * 复制list实体 list -> another list
- * @param target 目标list实体
- * @param soucreList 源list实体
- * @param <T>
- * @param <F>
- * @return
- */
- public <T, F> List<F> listCopyToAotherList(Class<F> target, List<T> soucreList) {
- if (!CollectionUtils.isEmpty(soucreList)) {
- List<F> targetList = new ArrayList<>();
- for (T t : soucreList) {
- try {
- F f = target.newInstance();
- BeanUtils.copyProperties(t, f);
- targetList.add(f);
- } catch (Exception e) {
- //
- }
- }
- return targetList;
- } else {
- return null;
- }
- }
- }
|