|
@@ -18,11 +18,13 @@ import com.usky.fire.service.SiteContentService;
|
|
|
import com.usky.fire.service.util.OnlineMethod;
|
|
|
import com.usky.fire.service.vo.DataCountVo;
|
|
|
import com.usky.fire.service.vo.PatrolInspectionAreaVo;
|
|
|
+import com.usky.fire.service.vo.PatrolInspectionSiteExportVo;
|
|
|
import com.usky.system.model.LoginUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -50,9 +52,10 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
|
|
|
|
|
|
@Override
|
|
|
public List<PatrolInspectionAreaVo> areaLeftList() {
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
String userType = null;
|
|
|
- if (loginUser!=null&&!"".equals(loginUser)){
|
|
|
+ if (loginUser != null && !"".equals(loginUser)) {
|
|
|
userType = loginUser.getUserType();
|
|
|
}
|
|
|
LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -83,6 +86,7 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
|
|
|
if (patrolInspectionAreaList.size() > 0) {
|
|
|
for (int i = 0; i < patrolInspectionAreaList.size(); i++) {
|
|
|
PatrolInspectionAreaVo patrolInspectionAreaVo = new PatrolInspectionAreaVo();
|
|
|
+ patrolInspectionAreaVo.setXh(i + 1);
|
|
|
patrolInspectionAreaVo.setId(patrolInspectionAreaList.get(i).getId());
|
|
|
patrolInspectionAreaVo.setAreaName(patrolInspectionAreaList.get(i).getAreaName());
|
|
|
patrolInspectionAreaVo.setAreaFid(patrolInspectionAreaList.get(i).getAreaFid());
|
|
@@ -111,7 +115,7 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
|
|
|
public CommonPage<PatrolInspectionSite> patrolInspectionSiteList(Integer areaId, String siteName, Integer pageNum, Integer pageSize, Integer id) {
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
String userType = null;
|
|
|
- if (loginUser!=null&&!"".equals(loginUser)){
|
|
|
+ if (loginUser != null && !"".equals(loginUser)) {
|
|
|
userType = loginUser.getUserType();
|
|
|
}
|
|
|
LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -211,109 +215,43 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
|
|
|
}
|
|
|
|
|
|
|
|
|
-// @Override
|
|
|
-// public List<PatrolInspectionSiteExportVo> patrolInspectionSiteListExport(Integer areaId, String siteName, Integer id) {
|
|
|
-//LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
-// String userType = null;
|
|
|
-// if (loginUser!=null&&!"".equals(loginUser)){
|
|
|
-// userType = loginUser.getUserType();
|
|
|
-// }
|
|
|
-// LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getEnable, 1)
|
|
|
-// .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
-// if ("00".equals(userType)) {
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getCreator, SecurityUtils.getUsername());
|
|
|
-// }
|
|
|
-// if (areaId != null) {
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getAreaId, areaId);
|
|
|
-// }
|
|
|
-// if (id != null && id != 0) {
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getId, id);
|
|
|
-// }
|
|
|
-// if (siteName != null && !"".equals(siteName)) {
|
|
|
-// queryWrapper.like(PatrolInspectionSite::getSiteName, siteName);
|
|
|
-// }
|
|
|
-// queryWrapper.orderByDesc(PatrolInspectionSite::getId);
|
|
|
-// List<PatrolInspectionSite> patrolInspectionSiteList = this.list(queryWrapper);
|
|
|
-// List<PatrolInspectionSiteExportVo> list = new ArrayList<>();
|
|
|
-// for (int i = 0; i < patrolInspectionSiteList.size(); i++) {
|
|
|
-// PatrolInspectionSiteExportVo patrolInspectionSiteExportVo = new PatrolInspectionSiteExportVo();
|
|
|
-// patrolInspectionSiteExportVo.setXh(i + 1);
|
|
|
-// patrolInspectionSiteExportVo.setSiteName(patrolInspectionSiteList.get(i).getSiteName());
|
|
|
-// patrolInspectionSiteExportVo.setSiteNubmber(patrolInspectionSiteList.get(i).getSiteNubmber());
|
|
|
-// patrolInspectionSiteExportVo.setLatitude(patrolInspectionSiteList.get(i).getLatitude());
|
|
|
-// patrolInspectionSiteExportVo.setLongitude(patrolInspectionSiteList.get(i).getLongitude());
|
|
|
-// patrolInspectionSiteExportVo.setPictureUrl(patrolInspectionSiteList.get(i).getPictureUrl());
|
|
|
-// patrolInspectionSiteExportVo.setCreateTime("1111");
|
|
|
-// list.add(patrolInspectionSiteExportVo);
|
|
|
-// }
|
|
|
-// return list;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public String correspondDeviceExport(Integer areaId, String siteName, Integer id) {
|
|
|
-// DateFormat dFormat = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
|
|
|
-// SimpleDateFormat longSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-// Workbook workbook = null;
|
|
|
-// File file = null;
|
|
|
-// try {
|
|
|
-// ExportParams params = new ExportParams(null, "巡检地点列表");
|
|
|
-// workbook = ExcelExportUtil.exportBigExcel(params, PatrolInspectionSiteExportOneVo.class,
|
|
|
-// (o, i) -> {
|
|
|
-// String userType = null;
|
|
|
-// LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getEnable, 1)
|
|
|
-// .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
-// if ("00".equals(userType)) {
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getCreator, SecurityUtils.getUsername());
|
|
|
-// }
|
|
|
-// if (areaId != null) {
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getAreaId, areaId);
|
|
|
-// }
|
|
|
-// if (id != null && id != 0) {
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getId, id);
|
|
|
-// }
|
|
|
-// if (siteName != null && !"".equals(siteName)) {
|
|
|
-// queryWrapper.like(PatrolInspectionSite::getSiteName, siteName);
|
|
|
-// }
|
|
|
-// queryWrapper.orderByDesc(PatrolInspectionSite::getId);
|
|
|
-// List<PatrolInspectionSite> patrolInspectionSiteList = this.list(queryWrapper);
|
|
|
-// List<PatrolInspectionSiteExportVo> list = new ArrayList<>();
|
|
|
-// for (int j = 0; j < patrolInspectionSiteList.size(); j++) {
|
|
|
-// PatrolInspectionSiteExportVo patrolInspectionSiteExportVo = new PatrolInspectionSiteExportVo();
|
|
|
-// patrolInspectionSiteExportVo.setId(patrolInspectionSiteList.get(j).getId());
|
|
|
-// patrolInspectionSiteExportVo.setXh(j + 1);
|
|
|
-// patrolInspectionSiteExportVo.setSiteName(patrolInspectionSiteList.get(j).getSiteName());
|
|
|
-// patrolInspectionSiteExportVo.setSiteNubmber(patrolInspectionSiteList.get(j).getSiteNubmber());
|
|
|
-// patrolInspectionSiteExportVo.setLatitude(patrolInspectionSiteList.get(j).getLatitude());
|
|
|
-// patrolInspectionSiteExportVo.setLongitude(patrolInspectionSiteList.get(j).getLongitude());
|
|
|
-// patrolInspectionSiteExportVo.setPictureUrl(patrolInspectionSiteList.get(j).getPictureUrl());
|
|
|
-// patrolInspectionSiteExportVo.setCreateTime("1111");
|
|
|
-// list.add(patrolInspectionSiteExportVo);
|
|
|
-// }
|
|
|
-// return new ArrayList<>(BeanMapperUtils.mapList(list, PatrolInspectionSiteExportVo.class, PatrolInspectionSiteExportOneVo.class));
|
|
|
-// }, null);
|
|
|
-// if (null != workbook) {
|
|
|
-// file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "巡检地点列表", dFormat.format(System.currentTimeMillis()) + ""));
|
|
|
-// FileUtils.createFile(file.getAbsolutePath());
|
|
|
-// FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
|
|
|
-// workbook.write(allListingFileOutputStream);
|
|
|
-// } else {
|
|
|
-// throw new BusinessException("表格数据为空");
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// log.error("导出文件失败", e);
|
|
|
-// throw new BusinessException("导出文件失败");
|
|
|
-// } finally {
|
|
|
-// if (workbook != null) {
|
|
|
-// try {
|
|
|
-// workbook.close();
|
|
|
-// } catch (IOException e) {
|
|
|
-// log.error("===export spec=== 关闭workbook失败", e);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return file.getName();
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public List<PatrolInspectionSiteExportVo> patrolInspectionSiteListExport(Integer areaId, String siteName, Integer id) {
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ String userType = null;
|
|
|
+ if (loginUser != null && !"".equals(loginUser)) {
|
|
|
+ userType = loginUser.getUserType();
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getEnable, 1)
|
|
|
+ .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ if ("00".equals(userType)) {
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getCreator, SecurityUtils.getUsername());
|
|
|
+ }
|
|
|
+ if (areaId != null) {
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getAreaId, areaId);
|
|
|
+ }
|
|
|
+ if (id != null && id != 0) {
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getId, id);
|
|
|
+ }
|
|
|
+ if (siteName != null && !"".equals(siteName)) {
|
|
|
+ queryWrapper.like(PatrolInspectionSite::getSiteName, siteName);
|
|
|
+ }
|
|
|
+ queryWrapper.orderByDesc(PatrolInspectionSite::getId);
|
|
|
+ List<PatrolInspectionSite> patrolInspectionSiteList = this.list(queryWrapper);
|
|
|
+ List<PatrolInspectionSiteExportVo> list = new ArrayList<>();
|
|
|
+ for (int i = 0; i < patrolInspectionSiteList.size(); i++) {
|
|
|
+ PatrolInspectionSiteExportVo patrolInspectionSiteExportVo = new PatrolInspectionSiteExportVo();
|
|
|
+ patrolInspectionSiteExportVo.setXh(i + 1);
|
|
|
+ patrolInspectionSiteExportVo.setSiteName(patrolInspectionSiteList.get(i).getSiteName());
|
|
|
+ patrolInspectionSiteExportVo.setSiteNubmber(patrolInspectionSiteList.get(i).getSiteNubmber());
|
|
|
+ patrolInspectionSiteExportVo.setLatitude(patrolInspectionSiteList.get(i).getLatitude());
|
|
|
+ patrolInspectionSiteExportVo.setLongitude(patrolInspectionSiteList.get(i).getLongitude());
|
|
|
+ patrolInspectionSiteExportVo.setPictureUrl(patrolInspectionSiteList.get(i).getPictureUrl());
|
|
|
+ patrolInspectionSiteExportVo.setCreateTime(patrolInspectionSiteList.get(i).getCreateTime().format(df));
|
|
|
+ list.add(patrolInspectionSiteExportVo);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|