|
|
@@ -26,6 +26,7 @@ import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.enums.InspectionStatusEnum;
|
|
|
import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
|
|
|
import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
|
|
|
import org.springblade.modules.baseinfo.rtu.service.IRtuBaseInfoService;
|
|
|
@@ -51,6 +52,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.jnlp.UnavailableServiceException;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
@@ -69,834 +71,889 @@ import java.util.*;
|
|
|
@RequiredArgsConstructor
|
|
|
@Api(value = "设备巡检管理模块", tags = "设备巡检管理模块")
|
|
|
public class EquipmentInspectionController extends BladeController {
|
|
|
- private final IEquipmentInspectionService equipmentInspectionService;
|
|
|
- private final IEquipmentInspectionPlanService planService;
|
|
|
- private final IDeptService deptService;
|
|
|
- private final IRtuBaseInfoService rtuBaseInfoService;
|
|
|
- private final IDeptRegionService deptRegionService;
|
|
|
- private final IEquipmentInspectionReportService inspectionReportService;
|
|
|
- private final IUserService userService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private OssBuilder ossBuilder;
|
|
|
-
|
|
|
- @Value("${export-config.workdir}")
|
|
|
- private String workDir;
|
|
|
-
|
|
|
- @Value("${export-config.inspection-unfinished-template}")
|
|
|
- private String inspectionUnfinishedTemplate;
|
|
|
-
|
|
|
- /**
|
|
|
- * 全部列表
|
|
|
- */
|
|
|
- @GetMapping("/list")
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
- @ApiOperation(value = "全部列表,不分页")
|
|
|
- public R<List<EquipmentInspectionInfoVO>> list() {
|
|
|
- List<EquipmentInspectionInfoEntity> pages = equipmentInspectionService.list();
|
|
|
- return R.data(EquipmentInspectionWrapper.build().listVO(pages));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping("/page")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
- })
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
|
|
|
- public R<IPage<EquipmentInspectionInfoVO>> page(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
- }
|
|
|
- } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- }
|
|
|
- }
|
|
|
- IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
- return R.data(pages);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping("/rain/page")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
|
|
|
- @ApiImplicitParam(name = "servicePersonId", value = "运维人员", paramType = "query", dataType = "long"),
|
|
|
- @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType = "long")
|
|
|
- })
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
|
|
|
- public R<IPage<EquipmentInspectionInfoVO>> rainpage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- if (inspectionInfoDTO.getDeptId() != null) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, inspectionInfoDTO.getDeptId());
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- } else {
|
|
|
- if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
- }
|
|
|
- } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
-
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() != null) {
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() == 1) {
|
|
|
- inspectionInfoDTO.setBeforeRainSeasonStatus(1);
|
|
|
- inspectionInfoDTO.setBeforeRainSeasonReportUser(inspectionInfoDTO.getServicePersonId());
|
|
|
- } else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
|
|
|
- inspectionInfoDTO.setRainSeasonFirstStatus(1);
|
|
|
- inspectionInfoDTO.setRainSeasonFirstReportUser(inspectionInfoDTO.getServicePersonId());
|
|
|
- } else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
|
|
|
- inspectionInfoDTO.setRainSeasonSecondStatus(1);
|
|
|
- inspectionInfoDTO.setRainSeasonSecondReportUser(inspectionInfoDTO.getServicePersonId());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
- return R.data(pages);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/rtu/page")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
- })
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "当前汛期待巡检设备", notes = "传入 EquipmentInspectionInfoDTO 实体类")
|
|
|
- public R<IPage<EquipmentInspectionInfoVO>> rtuPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
- }
|
|
|
- } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- }
|
|
|
- }
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
|
|
|
- calendar.setTime(new Date());
|
|
|
- Date dt = calendar.getTime();
|
|
|
- if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getBeforeRainSeasonStartTime())) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
|
|
|
- inspectionInfoDTO.setBeforeRainSeasonStatus(1);
|
|
|
- } else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonFirstStartTime())) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
|
|
|
- inspectionInfoDTO.setRainSeasonFirstStatus(1);
|
|
|
- } else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonSecondStartTime())) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
|
|
|
- inspectionInfoDTO.setRainSeasonSecondStatus(1);
|
|
|
- }
|
|
|
- IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectRtuPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
- List<EquipmentInspectionInfoVO> list = pages.getRecords();
|
|
|
- for (EquipmentInspectionInfoVO vo : list) {
|
|
|
- LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
|
|
|
- wrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
|
|
|
- wrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, inspectionInfoDTO.getInspectionYearStartDate());
|
|
|
- wrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, inspectionInfoDTO.getInspectionYearStartDate());
|
|
|
-
|
|
|
- }
|
|
|
- return R.data(pages);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 统计本年度巡检设备数量、各汛期巡检设备数量
|
|
|
- *
|
|
|
- * @param inspectionInfoDTO
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/count")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
- })
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
- @ApiOperation(value = "已巡检上报设备数量")
|
|
|
- public R<Map<String, Object>> inspectionReportCount(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
- }
|
|
|
- } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> data = new HashMap<>();
|
|
|
-
|
|
|
- long count = rtuBaseInfoService.rtuCount(inspectionInfoDTO.getAdCode());
|
|
|
- data.put("rtus", count);
|
|
|
- long rtus = count;
|
|
|
- int rainKind = 0;
|
|
|
- long remaininspectionrtus = 0;
|
|
|
- EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
|
|
|
-
|
|
|
- Date dt = new Date();
|
|
|
- if (dt.after(planEntity.getBeforeRainSeasonStartTime()) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
|
|
|
- rainKind = 1;
|
|
|
- } else if (dt.after(planEntity.getRainSeasonFirstStartTime()) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
|
|
|
- rainKind = 2;
|
|
|
- } else if (dt.after(planEntity.getRainSeasonSecondStartTime()) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
|
|
|
- rainKind = 3;
|
|
|
- }
|
|
|
- data.put("rainKind", rainKind);
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
-
|
|
|
- count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
- data.put("inspectionCount", count);
|
|
|
-
|
|
|
- EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
-
|
|
|
-
|
|
|
- inspectionReportDTO.setRainSeasonKind(1);
|
|
|
- count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
- data.put("beforeRainInspectionCount", count);
|
|
|
- if (rainKind == 1) {
|
|
|
- remaininspectionrtus = rtus - count;
|
|
|
- }
|
|
|
-
|
|
|
- inspectionReportDTO.setRainSeasonKind(2);
|
|
|
- count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
- data.put("firstRainInspectionCount", count);
|
|
|
- if (rainKind == 2) {
|
|
|
- remaininspectionrtus = rtus - count;
|
|
|
- }
|
|
|
- inspectionReportDTO.setRainSeasonKind(3);
|
|
|
- count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
- data.put("sencodRainInspectionCount", count);
|
|
|
- if (rainKind == 3) {
|
|
|
- remaininspectionrtus = rtus - count;
|
|
|
- }
|
|
|
- data.put("remaininspectionrtus", remaininspectionrtus);
|
|
|
-
|
|
|
- return R.data(data);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 填报状态
|
|
|
- */
|
|
|
- @GetMapping("/reportStatus")
|
|
|
- @ApiOperationSupport(order = 1)
|
|
|
- @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
|
|
|
- public R<EquipmentInspectionInfoVO> getReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
- if (null == equipmentInspectionInfoEntity.getId()) {
|
|
|
- return R.fail("参数错误");
|
|
|
- }
|
|
|
- EquipmentInspectionInfoEntity detail = equipmentInspectionService.getById(equipmentInspectionInfoEntity.getId());
|
|
|
- return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 填报状态
|
|
|
- */
|
|
|
- @GetMapping("/rtu/reportStatus")
|
|
|
- @ApiOperationSupport(order = 1)
|
|
|
- @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
|
|
|
- public R<EquipmentInspectionInfoVO> getRtuReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
- if (null == equipmentInspectionInfoEntity.getRtuCode()) {
|
|
|
- return R.fail("参数错误");
|
|
|
- }
|
|
|
- LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
|
|
|
- wrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
|
|
|
- wrapper.eq(EquipmentInspectionInfoEntity::getRtuCode, equipmentInspectionInfoEntity.getRtuCode());
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- calendar.set(Calendar.MILLISECOND, 0);
|
|
|
- wrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- wrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
|
|
|
- EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(wrapper);
|
|
|
- if (null == detail) {
|
|
|
- detail = new EquipmentInspectionInfoEntity();
|
|
|
- detail.setBeforeRainSeasonStatus(0);
|
|
|
- detail.setRainSeasonFirstStatus(0);
|
|
|
- detail.setRainSeasonSecondStatus(0);
|
|
|
- }
|
|
|
- return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 详情
|
|
|
- */
|
|
|
- @GetMapping("/detail")
|
|
|
- @ApiOperationSupport(order = 1)
|
|
|
- @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
|
|
|
- public R<EquipmentInspectionInfoVO> detail(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
- if (null == equipmentInspectionInfoEntity.getId()) {
|
|
|
- return R.fail("参数错误");
|
|
|
- }
|
|
|
- EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(Condition.getQueryWrapper(equipmentInspectionInfoEntity));
|
|
|
- return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增
|
|
|
- */
|
|
|
- @PostMapping("/save")
|
|
|
- @ApiOperationSupport(order = 4)
|
|
|
- @ApiOperation(value = "新增", notes = "传入orderProcessInfoEntity")
|
|
|
- public R save(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
- return R.status(equipmentInspectionService.save(equipmentInspectionInfoEntity));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改
|
|
|
- */
|
|
|
- @PostMapping("/update")
|
|
|
- @ApiOperationSupport(order = 5)
|
|
|
- @ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
|
|
|
- public R update(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
- return R.status(equipmentInspectionService.updateById(equipmentInspectionInfoEntity));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增或修改
|
|
|
- */
|
|
|
- @PostMapping("/submit")
|
|
|
- @ApiOperationSupport(order = 6)
|
|
|
- @ApiOperation(value = "新增或修改", notes = "传入orderProcessInfoEntity")
|
|
|
- public R submit(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
- return R.status(equipmentInspectionService.saveOrUpdate(equipmentInspectionInfoEntity));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除
|
|
|
- */
|
|
|
- @PostMapping("/remove")
|
|
|
- @ApiOperationSupport(order = 7)
|
|
|
- @ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
|
|
|
- public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
|
|
|
- boolean temp = equipmentInspectionService.deleteLogic(Func.toLongList(ids));
|
|
|
- return R.status(temp);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 巡检统计
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/person/statistics")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "统计表格")
|
|
|
- public R<List<EquipmentInspectionStatisticsVO>> inspectionStatistics() {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- LambdaQueryWrapper<User> userQueryWrapper = Wrappers.<User>query().lambda();
|
|
|
- userQueryWrapper.eq(User::getIsDeleted, 0);
|
|
|
- userQueryWrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- List<User> list = userService.list(userQueryWrapper);
|
|
|
- List<EquipmentInspectionStatisticsVO> countList = new LinkedList<>();
|
|
|
- for (User u : list) {
|
|
|
- EquipmentInspectionStatisticsVO vo = new EquipmentInspectionStatisticsVO();
|
|
|
- vo.setUserId(u.getId());
|
|
|
- vo.setServicePersonName(u.getRealName());
|
|
|
- EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- inspectionInfoDTO.setBeforeRainSeasonReportUser(u.getId());
|
|
|
- long count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
- vo.setBeforeRainInspectionCount(count);
|
|
|
- inspectionInfoDTO.setBeforeRainSeasonReportUser(null);
|
|
|
- inspectionInfoDTO.setRainSeasonFirstReportUser(u.getId());
|
|
|
- count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
- vo.setFirstRainInspectionCount(count);
|
|
|
- inspectionInfoDTO.setRainSeasonFirstReportUser(null);
|
|
|
- inspectionInfoDTO.setRainSeasonSecondReportUser(u.getId());
|
|
|
- count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
- vo.setSencodRainInspectionCount(count);
|
|
|
- countList.add(vo);
|
|
|
- }
|
|
|
- return R.data(countList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 巡检统计
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/org/statistics")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "统计表格")
|
|
|
- public R<List<OrgEquipmentInspectionStatisticsVO>> orgInspectionStatistics() {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- List<Dept> root = new LinkedList<>();
|
|
|
- List<OrgEquipmentInspectionStatisticsVO> list = new LinkedList<>();
|
|
|
- if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- Dept dept = deptService.getById(Func.toLong(user.getDeptId()));
|
|
|
- root.add(dept);
|
|
|
- } else {
|
|
|
- LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
|
|
|
- wrapper.eq(Dept::getIsDeleted, 0);
|
|
|
- wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
|
|
|
- root = this.deptService.list(wrapper);
|
|
|
- }
|
|
|
-
|
|
|
- for (Dept dept : root) {
|
|
|
- OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
|
|
|
- orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
|
|
|
- orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
|
|
|
- Long count = rtuBaseInfoService.rtuCount(deptRegionEntity.getAdcd());
|
|
|
- orgEquipmentInspectionStatisticsVO.setRtuCount(count);
|
|
|
- EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
- orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
|
|
|
- EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
|
|
|
- inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- inspectionReportDTO.setRainSeasonKind(1);
|
|
|
- count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
- orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
|
|
|
- inspectionReportDTO.setRainSeasonKind(2);
|
|
|
- count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
- orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
|
|
|
- inspectionReportDTO.setRainSeasonKind(3);
|
|
|
- count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
- orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
|
|
|
- list.add(orgEquipmentInspectionStatisticsVO);
|
|
|
- }
|
|
|
- return R.data(list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 未完成巡检设备清单信息列表,分页
|
|
|
- */
|
|
|
- @GetMapping("/unfinished/page")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
|
|
|
- @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
|
|
|
- })
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
- @ApiOperation(value = "未完成巡检设备清单信息列表")
|
|
|
- public R<IPage<EquipmentInspectionInfoVO>> unfinishedInspectionEquipmentPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
- inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
- } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- }
|
|
|
- Date now = new Date();
|
|
|
- if (inspectionInfoDTO.getInspectionYear() != null) {
|
|
|
- Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(year);
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- } else {
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(new Date());
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
- //处理汛期类别
|
|
|
- LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
|
|
|
- wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
|
|
|
- wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
|
|
|
- List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
|
|
|
- if (null != list && list.size() > 0) {
|
|
|
- EquipmentInspectionPlanEntity entity = list.get(0);
|
|
|
-
|
|
|
- Calendar dt = Calendar.getInstance();
|
|
|
- Calendar calendarStart = Calendar.getInstance();
|
|
|
- Calendar calendarEnd = Calendar.getInstance();
|
|
|
- dt.setTime(now);
|
|
|
- //汛前上报
|
|
|
- calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
|
|
|
- calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
|
|
|
- if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
- inspectionInfoDTO.setRainSeasonKind(1);
|
|
|
- }
|
|
|
- //汛中第一次上报
|
|
|
- calendarStart.setTime(entity.getRainSeasonFirstStartTime());
|
|
|
- calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
|
|
|
- if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
- inspectionInfoDTO.setRainSeasonKind(2);
|
|
|
- }
|
|
|
- //汛中第二次上报
|
|
|
- calendarStart.setTime(entity.getRainSeasonSecondStartTime());
|
|
|
- calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
|
|
|
- if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
- inspectionInfoDTO.setRainSeasonKind(3);
|
|
|
- }
|
|
|
- }
|
|
|
- //没在当年任意一个汛期,直接返回
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
- return R.data(null);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectUnfinishedInspectionEquipmentPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
- List<EquipmentInspectionInfoVO> volist = pages.getRecords();
|
|
|
- for (EquipmentInspectionInfoVO vo : volist) {
|
|
|
- EquipmentInspectionWrapper.build().entityVO(vo);
|
|
|
- }
|
|
|
- return R.data(pages);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 未完成巡检设备清单信息导出
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/unfinished/export")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "未完成巡检设备清单导出", notes = "")
|
|
|
- public R<Map<String, Object>> unfinishedInspectionEquipmentExport(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
- inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
- } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
- LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
- deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
- DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
- inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
- }
|
|
|
- //文件标题
|
|
|
- String title = "";
|
|
|
- //当前时间
|
|
|
- Date now = new Date();
|
|
|
- if (inspectionInfoDTO.getInspectionYear() != null) {
|
|
|
- Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(year);
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
- title += Func.formatDate(year) + "年";
|
|
|
-
|
|
|
- } else {
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(now);
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- calendar.set(Calendar.MINUTE, 0);
|
|
|
- calendar.set(Calendar.SECOND, 0);
|
|
|
- inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
-
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
-
|
|
|
- title += Func.formatDate(now) + "年";
|
|
|
-
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
- //处理汛期类别
|
|
|
- LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
|
|
|
- wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
|
|
|
- wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
|
|
|
- List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
|
|
|
- if (null != list && list.size() > 0) {
|
|
|
- EquipmentInspectionPlanEntity entity = list.get(0);
|
|
|
-
|
|
|
- Calendar dt = Calendar.getInstance();
|
|
|
- Calendar calendarStart = Calendar.getInstance();
|
|
|
- Calendar calendarEnd = Calendar.getInstance();
|
|
|
- dt.setTime(now);
|
|
|
- //汛前上报
|
|
|
- calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
|
|
|
- calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
|
|
|
- if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
- inspectionInfoDTO.setRainSeasonKind(1);
|
|
|
- title += "汛前";
|
|
|
- }
|
|
|
- //汛中第一次上报
|
|
|
- calendarStart.setTime(entity.getRainSeasonFirstStartTime());
|
|
|
- calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
|
|
|
- if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
- inspectionInfoDTO.setRainSeasonKind(2);
|
|
|
- title += "汛中第一次";
|
|
|
- }
|
|
|
- //汛中第二次上报
|
|
|
- calendarStart.setTime(entity.getRainSeasonSecondStartTime());
|
|
|
- calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
|
|
|
- if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
- inspectionInfoDTO.setRainSeasonKind(3);
|
|
|
- title += "汛中第二次";
|
|
|
- }
|
|
|
- }
|
|
|
- //没在当年任意一个汛期,直接返回
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
- List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
|
|
|
- Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
|
|
|
- return R.data(data);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() != null) {
|
|
|
- if (inspectionInfoDTO.getRainSeasonKind() == 1) {
|
|
|
- title += "汛前";
|
|
|
- } else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
|
|
|
- title += "汛中第一次";
|
|
|
- } else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
|
|
|
- title += "汛中第二次";
|
|
|
- }
|
|
|
- }
|
|
|
- List<EquipmentInspectionInfoVO> equipmentInspectionInfoVOList = equipmentInspectionService.selectUnfinishedInspectionEquipmentList(inspectionInfoDTO);
|
|
|
- //生成数据
|
|
|
- List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
|
|
|
- if (null != equipmentInspectionInfoVOList && equipmentInspectionInfoVOList.size() > 0) {
|
|
|
- int index = 1;
|
|
|
- for (EquipmentInspectionInfoVO entity : equipmentInspectionInfoVOList) {
|
|
|
- UnfinishedInspectionEquipmentExportEntity exportEntity = new UnfinishedInspectionEquipmentExportEntity();
|
|
|
- exportEntity.setIndex(index);
|
|
|
- if (entity.getAdCity() != null) {
|
|
|
- exportEntity.setAdCity(entity.getAdCity());
|
|
|
- } else {
|
|
|
- exportEntity.setAdCity("");
|
|
|
- }
|
|
|
- if (entity.getAdDist() != null) {
|
|
|
- exportEntity.setAdDist(entity.getAdDist());
|
|
|
- } else {
|
|
|
- exportEntity.setAdDist("");
|
|
|
- }
|
|
|
- if (entity.getRtuName() != null) {
|
|
|
- exportEntity.setRtuName(entity.getRtuName());
|
|
|
- } else {
|
|
|
- exportEntity.setRtuName("");
|
|
|
- }
|
|
|
- exportEntity.setRtuCode(entity.getRtuCode());
|
|
|
- String rtuKindDesc = "";
|
|
|
- if (entity.getIsRain() != null && entity.getIsRain() == 1) {
|
|
|
- rtuKindDesc += "雨量站";
|
|
|
- }
|
|
|
- if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
|
|
|
- if (rtuKindDesc.length() > 0) {
|
|
|
- rtuKindDesc += "/";
|
|
|
- }
|
|
|
- rtuKindDesc += "水位站";
|
|
|
- }
|
|
|
- if (entity.getIsGround() != null && entity.getIsGround() == 1) {
|
|
|
- if (rtuKindDesc.length() > 0) {
|
|
|
- rtuKindDesc += "/";
|
|
|
- }
|
|
|
- rtuKindDesc += "墒情站";
|
|
|
- }
|
|
|
- if (entity.getIsVideo() != null && entity.getIsVideo() == 1) {
|
|
|
- if (rtuKindDesc.length() > 0) {
|
|
|
- rtuKindDesc += "/";
|
|
|
- }
|
|
|
- rtuKindDesc += "视频站";
|
|
|
- }
|
|
|
- exportEntity.setRtuKindDesc(rtuKindDesc);
|
|
|
-
|
|
|
- if (entity.getLng() != null) {
|
|
|
- exportEntity.setLng(entity.getLng());
|
|
|
- } else {
|
|
|
- exportEntity.setLng("");
|
|
|
- }
|
|
|
- if (entity.getLat() != null) {
|
|
|
- exportEntity.setLat(entity.getLat());
|
|
|
- } else {
|
|
|
- exportEntity.setLat("");
|
|
|
- }
|
|
|
- if (entity.getLocationDesc() != null) {
|
|
|
- exportEntity.setLocationDesc(entity.getLocationDesc());
|
|
|
- } else {
|
|
|
- exportEntity.setLocationDesc("");
|
|
|
- }
|
|
|
-
|
|
|
- if (entity.getBeforeRainSeasonStatus() != null) {
|
|
|
- if (entity.getBeforeRainSeasonStatus() == 0) {
|
|
|
- exportEntity.setBeforeRainSeasonStatus("");
|
|
|
- } else if (entity.getBeforeRainSeasonStatus() == 1) {
|
|
|
- exportEntity.setBeforeRainSeasonStatus("已填报");
|
|
|
- } else {
|
|
|
- exportEntity.setBeforeRainSeasonStatus("");
|
|
|
- }
|
|
|
- } else {
|
|
|
- exportEntity.setBeforeRainSeasonStatus("");
|
|
|
- }
|
|
|
- if (entity.getRainSeasonFirstStatus() != null) {
|
|
|
- if (entity.getRainSeasonFirstStatus() == 0) {
|
|
|
- exportEntity.setRainSeasonFirstStatus("");
|
|
|
- } else if (entity.getRainSeasonFirstStatus() == 1) {
|
|
|
- exportEntity.setRainSeasonFirstStatus("已填报");
|
|
|
- } else {
|
|
|
- exportEntity.setRainSeasonFirstStatus("");
|
|
|
- }
|
|
|
- } else {
|
|
|
- exportEntity.setRainSeasonFirstStatus("");
|
|
|
- }
|
|
|
- if (entity.getRainSeasonSecondStatus() != null) {
|
|
|
- if (entity.getRainSeasonSecondStatus() == 0) {
|
|
|
- exportEntity.setRainSeasonSecondStatus("");
|
|
|
- } else if (entity.getRainSeasonSecondStatus() == 1) {
|
|
|
- exportEntity.setRainSeasonSecondStatus("已填报");
|
|
|
- } else {
|
|
|
- exportEntity.setRainSeasonSecondStatus("");
|
|
|
- }
|
|
|
- } else {
|
|
|
- exportEntity.setRainSeasonSecondStatus("");
|
|
|
- }
|
|
|
- unfinishedInspectionEquipmentExportEntities.add(exportEntity);
|
|
|
- index += 1;
|
|
|
- }
|
|
|
- }
|
|
|
- Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
|
|
|
- return R.data(data);
|
|
|
- }
|
|
|
-
|
|
|
- private Map<String, Object> exportUnfinishedInspectionEquipmentExcel(String title, List<UnfinishedInspectionEquipmentExportEntity> list) {
|
|
|
- //当前时间
|
|
|
- //Calendar dt = Calendar.getInstance();
|
|
|
- //dt.setTime(new Date());
|
|
|
- Map<String, Object> data = new HashMap<>();
|
|
|
- data.put("status", 0);
|
|
|
- String templateFilePath = this.workDir + File.separator + this.inspectionUnfinishedTemplate;
|
|
|
- String outpath = this.workDir + File.separator + Func.formatDate(new Date());
|
|
|
- File dir = new File(outpath);
|
|
|
- if (!dir.exists()) {
|
|
|
- if (!dir.mkdir()) {
|
|
|
- data.put("error", "目录创建失败");
|
|
|
- return data;
|
|
|
- }
|
|
|
- }
|
|
|
- String outFileName = Func.randomUUID() + ".xlsx";
|
|
|
- outpath += File.separator + outFileName;
|
|
|
- ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
|
|
|
- WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
|
|
|
- excelWriter.write(list, writeSheet);
|
|
|
- excelWriter.finish();
|
|
|
- try {
|
|
|
- FileInputStream fileInputStream = new FileInputStream(new File(outpath));
|
|
|
- BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
|
|
|
- String ossPath = bladeFile.getName();
|
|
|
- //String p = bladeFile.getDomain();
|
|
|
- data.put("name", ossPath);
|
|
|
- data.put("url", ossPath);
|
|
|
- data.put("filename", "未完成巡检设备(" + title + ")统计清单表");
|
|
|
- data.put("status", 1);
|
|
|
-
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- data.put("error", "导出失败!");
|
|
|
- }
|
|
|
- return data;
|
|
|
- }
|
|
|
+ private final IEquipmentInspectionService equipmentInspectionService;
|
|
|
+ private final IEquipmentInspectionPlanService planService;
|
|
|
+ private final IDeptService deptService;
|
|
|
+ private final IRtuBaseInfoService rtuBaseInfoService;
|
|
|
+ private final IDeptRegionService deptRegionService;
|
|
|
+ private final IEquipmentInspectionReportService inspectionReportService;
|
|
|
+ private final IUserService userService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private OssBuilder ossBuilder;
|
|
|
+
|
|
|
+ @Value("${export-config.workdir}")
|
|
|
+ private String workDir;
|
|
|
+
|
|
|
+ @Value("${export-config.inspection-unfinished-template}")
|
|
|
+ private String inspectionUnfinishedTemplate;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 全部列表
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "全部列表,不分页")
|
|
|
+ public R<List<EquipmentInspectionInfoVO>> list() {
|
|
|
+ List<EquipmentInspectionInfoEntity> pages = equipmentInspectionService.list();
|
|
|
+ return R.data(EquipmentInspectionWrapper.build().listVO(pages));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
+ })
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
|
|
|
+ public R<IPage<EquipmentInspectionInfoVO>> page(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
+ }
|
|
|
+ } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 待巡检任务
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/todo/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "全部列表,不分页")
|
|
|
+ public R<List<EquipmentInspectionInfoVO>> todoList() {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ EquipmentInspectionInfoDTO dto = new EquipmentInspectionInfoDTO();
|
|
|
+ dto.setInspectionStatus(InspectionStatusEnum.STATUS_TODO.getCode());
|
|
|
+ dto.setOrgId(Func.toLong(user.getDeptId()));
|
|
|
+// LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
|
|
|
+// wrapper.eq(EquipmentInspectionInfoEntity::getInspectionStatus, InspectionStatusEnum.STATUS_TODO.getCode());
|
|
|
+// wrapper.eq(EquipmentInspectionInfoEntity::getOrgId, Func.toLong(user.getDeptId()));
|
|
|
+ List<EquipmentInspectionInfoVO> list = equipmentInspectionService.todoInspectionList(dto);
|
|
|
+ for (EquipmentInspectionInfoVO vo : list) {
|
|
|
+ EquipmentInspectionWrapper.build().entityVO(vo);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/close-approve/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "全部列表,不分页")
|
|
|
+ public R<List<EquipmentInspectionInfoVO>> closeApproveList() {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ EquipmentInspectionInfoDTO dto = new EquipmentInspectionInfoDTO();
|
|
|
+ dto.setInspectionStatus(InspectionStatusEnum.STATUS_CLOSE_APPROVE.getCode());
|
|
|
+ dto.setOrgId(Func.toLong(user.getDeptId()));
|
|
|
+ List<EquipmentInspectionInfoVO> list = equipmentInspectionService.todoInspectionList(dto);
|
|
|
+ for (EquipmentInspectionInfoVO vo : list) {
|
|
|
+ EquipmentInspectionWrapper.build().entityVO(vo);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/approved/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "全部列表,不分页")
|
|
|
+ public R<List<EquipmentInspectionInfoVO>> approvedList() {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ EquipmentInspectionInfoDTO dto = new EquipmentInspectionInfoDTO();
|
|
|
+ dto.setInspectionStatus(InspectionStatusEnum.STATUS_APPROVED.getCode());
|
|
|
+ dto.setOrgId(Func.toLong(user.getDeptId()));
|
|
|
+// LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
|
|
|
+// wrapper.eq(EquipmentInspectionInfoEntity::getInspectionStatus, InspectionStatusEnum.STATUS_TODO.getCode());
|
|
|
+// wrapper.eq(EquipmentInspectionInfoEntity::getOrgId, Func.toLong(user.getDeptId()));
|
|
|
+ List<EquipmentInspectionInfoVO> list = equipmentInspectionService.todoInspectionList(dto);
|
|
|
+ for (EquipmentInspectionInfoVO vo : list) {
|
|
|
+ EquipmentInspectionWrapper.build().entityVO(vo);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/rain/page")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
|
|
|
+ @ApiImplicitParam(name = "servicePersonId", value = "运维人员", paramType = "query", dataType = "long"),
|
|
|
+ @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType = "long")
|
|
|
+ })
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
|
|
|
+ public R<IPage<EquipmentInspectionInfoVO>> rainpage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (inspectionInfoDTO.getDeptId() != null) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, inspectionInfoDTO.getDeptId());
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ } else {
|
|
|
+ if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
+ }
|
|
|
+ } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() != null) {
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() == 1) {
|
|
|
+ inspectionInfoDTO.setBeforeRainSeasonStatus(1);
|
|
|
+ inspectionInfoDTO.setBeforeRainSeasonReportUser(inspectionInfoDTO.getServicePersonId());
|
|
|
+ } else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
|
|
|
+ inspectionInfoDTO.setRainSeasonFirstStatus(1);
|
|
|
+ inspectionInfoDTO.setRainSeasonFirstReportUser(inspectionInfoDTO.getServicePersonId());
|
|
|
+ } else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
|
|
|
+ inspectionInfoDTO.setRainSeasonSecondStatus(1);
|
|
|
+ inspectionInfoDTO.setRainSeasonSecondReportUser(inspectionInfoDTO.getServicePersonId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/rtu/page")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
+ })
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "当前汛期待巡检设备", notes = "传入 EquipmentInspectionInfoDTO 实体类")
|
|
|
+ public R<IPage<EquipmentInspectionInfoVO>> rtuPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
+ }
|
|
|
+ } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ Date dt = calendar.getTime();
|
|
|
+ if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getBeforeRainSeasonStartTime())) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
|
|
|
+ inspectionInfoDTO.setBeforeRainSeasonStatus(1);
|
|
|
+ } else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonFirstStartTime())) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
|
|
|
+ inspectionInfoDTO.setRainSeasonFirstStatus(1);
|
|
|
+ } else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonSecondStartTime())) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
|
|
|
+ inspectionInfoDTO.setRainSeasonSecondStatus(1);
|
|
|
+ }
|
|
|
+ IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectRtuPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
+ List<EquipmentInspectionInfoVO> list = pages.getRecords();
|
|
|
+ for (EquipmentInspectionInfoVO vo : list) {
|
|
|
+ LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
|
|
|
+ wrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
|
|
|
+ wrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, inspectionInfoDTO.getInspectionYearStartDate());
|
|
|
+ wrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, inspectionInfoDTO.getInspectionYearStartDate());
|
|
|
+
|
|
|
+ }
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统计本年度巡检设备数量、各汛期巡检设备数量
|
|
|
+ *
|
|
|
+ * @param inspectionInfoDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/count")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
|
|
|
+ })
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "已巡检上报设备数量")
|
|
|
+ public R<Map<String, Object>> inspectionReportCount(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
+ }
|
|
|
+ } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ if (inspectionInfoDTO.getAdCode() == null) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+
|
|
|
+ long count = rtuBaseInfoService.rtuCount(inspectionInfoDTO.getAdCode());
|
|
|
+ data.put("rtus", count);
|
|
|
+ long rtus = count;
|
|
|
+ int rainKind = 0;
|
|
|
+ long remaininspectionrtus = 0;
|
|
|
+ EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
|
|
|
+
|
|
|
+ Date dt = new Date();
|
|
|
+ if (dt.after(planEntity.getBeforeRainSeasonStartTime()) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
|
|
|
+ rainKind = 1;
|
|
|
+ } else if (dt.after(planEntity.getRainSeasonFirstStartTime()) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
|
|
|
+ rainKind = 2;
|
|
|
+ } else if (dt.after(planEntity.getRainSeasonSecondStartTime()) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
|
|
|
+ rainKind = 3;
|
|
|
+ }
|
|
|
+ data.put("rainKind", rainKind);
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+
|
|
|
+ count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
+ data.put("inspectionCount", count);
|
|
|
+
|
|
|
+ EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+
|
|
|
+
|
|
|
+ inspectionReportDTO.setRainSeasonKind(1);
|
|
|
+ count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
+ data.put("beforeRainInspectionCount", count);
|
|
|
+ if (rainKind == 1) {
|
|
|
+ remaininspectionrtus = rtus - count;
|
|
|
+ }
|
|
|
+
|
|
|
+ inspectionReportDTO.setRainSeasonKind(2);
|
|
|
+ count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
+ data.put("firstRainInspectionCount", count);
|
|
|
+ if (rainKind == 2) {
|
|
|
+ remaininspectionrtus = rtus - count;
|
|
|
+ }
|
|
|
+ inspectionReportDTO.setRainSeasonKind(3);
|
|
|
+ count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
+ data.put("sencodRainInspectionCount", count);
|
|
|
+ if (rainKind == 3) {
|
|
|
+ remaininspectionrtus = rtus - count;
|
|
|
+ }
|
|
|
+ data.put("remaininspectionrtus", remaininspectionrtus);
|
|
|
+
|
|
|
+ return R.data(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 填报状态
|
|
|
+ */
|
|
|
+ @GetMapping("/reportStatus")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
|
|
|
+ public R<EquipmentInspectionInfoVO> getReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
+ if (null == equipmentInspectionInfoEntity.getId()) {
|
|
|
+ return R.fail("参数错误");
|
|
|
+ }
|
|
|
+ EquipmentInspectionInfoEntity detail = equipmentInspectionService.getById(equipmentInspectionInfoEntity.getId());
|
|
|
+ return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 填报状态
|
|
|
+ */
|
|
|
+ @GetMapping("/rtu/reportStatus")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
|
|
|
+ public R<EquipmentInspectionInfoVO> getRtuReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
+ if (null == equipmentInspectionInfoEntity.getRtuCode()) {
|
|
|
+ return R.fail("参数错误");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
|
|
|
+ wrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
|
|
|
+ wrapper.eq(EquipmentInspectionInfoEntity::getRtuCode, equipmentInspectionInfoEntity.getRtuCode());
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ wrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ wrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
|
|
|
+ EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(wrapper);
|
|
|
+ if (null == detail) {
|
|
|
+ detail = new EquipmentInspectionInfoEntity();
|
|
|
+ detail.setBeforeRainSeasonStatus(0);
|
|
|
+ detail.setRainSeasonFirstStatus(0);
|
|
|
+ detail.setRainSeasonSecondStatus(0);
|
|
|
+ }
|
|
|
+ return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
|
|
|
+ public R<EquipmentInspectionInfoVO> detail(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
+ if (null == equipmentInspectionInfoEntity.getId()) {
|
|
|
+ return R.fail("参数错误");
|
|
|
+ }
|
|
|
+ EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(Condition.getQueryWrapper(equipmentInspectionInfoEntity));
|
|
|
+ return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "新增", notes = "传入orderProcessInfoEntity")
|
|
|
+ public R save(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
+ return R.status(equipmentInspectionService.save(equipmentInspectionInfoEntity));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
|
|
|
+ public R update(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
+ return R.status(equipmentInspectionService.updateById(equipmentInspectionInfoEntity));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增或修改
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "新增或修改", notes = "传入orderProcessInfoEntity")
|
|
|
+ public R submit(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
|
|
|
+ return R.status(equipmentInspectionService.saveOrUpdate(equipmentInspectionInfoEntity));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
|
|
|
+ public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
|
|
|
+ boolean temp = equipmentInspectionService.deleteLogic(Func.toLongList(ids));
|
|
|
+ return R.status(temp);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 巡检统计
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/person/statistics")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "统计表格")
|
|
|
+ public R<List<EquipmentInspectionStatisticsVO>> inspectionStatistics() {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ LambdaQueryWrapper<User> userQueryWrapper = Wrappers.<User>query().lambda();
|
|
|
+ userQueryWrapper.eq(User::getIsDeleted, 0);
|
|
|
+ userQueryWrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ List<User> list = userService.list(userQueryWrapper);
|
|
|
+ List<EquipmentInspectionStatisticsVO> countList = new LinkedList<>();
|
|
|
+ for (User u : list) {
|
|
|
+ EquipmentInspectionStatisticsVO vo = new EquipmentInspectionStatisticsVO();
|
|
|
+ vo.setUserId(u.getId());
|
|
|
+ vo.setServicePersonName(u.getRealName());
|
|
|
+ EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ inspectionInfoDTO.setBeforeRainSeasonReportUser(u.getId());
|
|
|
+ long count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
+ vo.setBeforeRainInspectionCount(count);
|
|
|
+ inspectionInfoDTO.setBeforeRainSeasonReportUser(null);
|
|
|
+ inspectionInfoDTO.setRainSeasonFirstReportUser(u.getId());
|
|
|
+ count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
+ vo.setFirstRainInspectionCount(count);
|
|
|
+ inspectionInfoDTO.setRainSeasonFirstReportUser(null);
|
|
|
+ inspectionInfoDTO.setRainSeasonSecondReportUser(u.getId());
|
|
|
+ count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
+ vo.setSencodRainInspectionCount(count);
|
|
|
+ countList.add(vo);
|
|
|
+ }
|
|
|
+ return R.data(countList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 巡检统计
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/org/statistics")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "统计表格")
|
|
|
+ public R<List<OrgEquipmentInspectionStatisticsVO>> orgInspectionStatistics() {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ List<Dept> root = new LinkedList<>();
|
|
|
+ List<OrgEquipmentInspectionStatisticsVO> list = new LinkedList<>();
|
|
|
+ if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ Dept dept = deptService.getById(Func.toLong(user.getDeptId()));
|
|
|
+ root.add(dept);
|
|
|
+ } else {
|
|
|
+ LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
|
|
|
+ wrapper.eq(Dept::getIsDeleted, 0);
|
|
|
+ wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
|
|
|
+ root = this.deptService.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Dept dept : root) {
|
|
|
+ OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
|
|
|
+ orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
|
|
|
+ orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
|
|
|
+ Long count = rtuBaseInfoService.rtuCount(deptRegionEntity.getAdcd());
|
|
|
+ orgEquipmentInspectionStatisticsVO.setRtuCount(count);
|
|
|
+ EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
|
|
|
+ orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
|
|
|
+ EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
|
|
|
+ inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ inspectionReportDTO.setRainSeasonKind(1);
|
|
|
+ count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
+ orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
|
|
|
+ inspectionReportDTO.setRainSeasonKind(2);
|
|
|
+ count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
+ orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
|
|
|
+ inspectionReportDTO.setRainSeasonKind(3);
|
|
|
+ count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
|
|
|
+ orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
|
|
|
+ list.add(orgEquipmentInspectionStatisticsVO);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 未完成巡检设备清单信息列表,分页
|
|
|
+ */
|
|
|
+ @GetMapping("/unfinished/page")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
|
|
|
+ @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
|
|
|
+ })
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "未完成巡检设备清单信息列表")
|
|
|
+ public R<IPage<EquipmentInspectionInfoVO>> unfinishedInspectionEquipmentPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
+ inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
+ } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ }
|
|
|
+ Date now = new Date();
|
|
|
+ if (inspectionInfoDTO.getInspectionYear() != null) {
|
|
|
+ Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(year);
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ } else {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
+ //处理汛期类别
|
|
|
+ LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
|
|
|
+ wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
|
|
|
+ wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
|
|
|
+ List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ EquipmentInspectionPlanEntity entity = list.get(0);
|
|
|
+
|
|
|
+ Calendar dt = Calendar.getInstance();
|
|
|
+ Calendar calendarStart = Calendar.getInstance();
|
|
|
+ Calendar calendarEnd = Calendar.getInstance();
|
|
|
+ dt.setTime(now);
|
|
|
+ //汛前上报
|
|
|
+ calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
|
|
|
+ calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
|
|
|
+ if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
+ inspectionInfoDTO.setRainSeasonKind(1);
|
|
|
+ }
|
|
|
+ //汛中第一次上报
|
|
|
+ calendarStart.setTime(entity.getRainSeasonFirstStartTime());
|
|
|
+ calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
|
|
|
+ if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
+ inspectionInfoDTO.setRainSeasonKind(2);
|
|
|
+ }
|
|
|
+ //汛中第二次上报
|
|
|
+ calendarStart.setTime(entity.getRainSeasonSecondStartTime());
|
|
|
+ calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
|
|
|
+ if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
+ inspectionInfoDTO.setRainSeasonKind(3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //没在当年任意一个汛期,直接返回
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
+ return R.data(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectUnfinishedInspectionEquipmentPage(Condition.getPage(query), inspectionInfoDTO);
|
|
|
+ List<EquipmentInspectionInfoVO> volist = pages.getRecords();
|
|
|
+ for (EquipmentInspectionInfoVO vo : volist) {
|
|
|
+ EquipmentInspectionWrapper.build().entityVO(vo);
|
|
|
+ }
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 未完成巡检设备清单信息导出
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/unfinished/export")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "未完成巡检设备清单导出", notes = "")
|
|
|
+ public R<Map<String, Object>> unfinishedInspectionEquipmentExport(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
|
|
|
+ inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
|
|
|
+ } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
|
|
|
+ deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
|
|
|
+ DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
|
|
|
+ inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
|
|
|
+ }
|
|
|
+ //文件标题
|
|
|
+ String title = "";
|
|
|
+ //当前时间
|
|
|
+ Date now = new Date();
|
|
|
+ if (inspectionInfoDTO.getInspectionYear() != null) {
|
|
|
+ Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(year);
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+ title += Func.formatDate(year) + "年";
|
|
|
+
|
|
|
+ } else {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(now);
|
|
|
+ calendar.set(Calendar.MONTH, 0);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
|
|
|
+
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
|
|
|
+
|
|
|
+ title += Func.formatDate(now) + "年";
|
|
|
+
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
+ //处理汛期类别
|
|
|
+ LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
|
|
|
+ wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
|
|
|
+ wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
|
|
|
+ List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ EquipmentInspectionPlanEntity entity = list.get(0);
|
|
|
+
|
|
|
+ Calendar dt = Calendar.getInstance();
|
|
|
+ Calendar calendarStart = Calendar.getInstance();
|
|
|
+ Calendar calendarEnd = Calendar.getInstance();
|
|
|
+ dt.setTime(now);
|
|
|
+ //汛前上报
|
|
|
+ calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
|
|
|
+ calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
|
|
|
+ if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
+ inspectionInfoDTO.setRainSeasonKind(1);
|
|
|
+ title += "汛前";
|
|
|
+ }
|
|
|
+ //汛中第一次上报
|
|
|
+ calendarStart.setTime(entity.getRainSeasonFirstStartTime());
|
|
|
+ calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
|
|
|
+ if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
+ inspectionInfoDTO.setRainSeasonKind(2);
|
|
|
+ title += "汛中第一次";
|
|
|
+ }
|
|
|
+ //汛中第二次上报
|
|
|
+ calendarStart.setTime(entity.getRainSeasonSecondStartTime());
|
|
|
+ calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
|
|
|
+ if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
|
|
|
+ inspectionInfoDTO.setRainSeasonKind(3);
|
|
|
+ title += "汛中第二次";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //没在当年任意一个汛期,直接返回
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() == null) {
|
|
|
+ List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
|
|
|
+ Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
|
|
|
+ return R.data(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() != null) {
|
|
|
+ if (inspectionInfoDTO.getRainSeasonKind() == 1) {
|
|
|
+ title += "汛前";
|
|
|
+ } else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
|
|
|
+ title += "汛中第一次";
|
|
|
+ } else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
|
|
|
+ title += "汛中第二次";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<EquipmentInspectionInfoVO> equipmentInspectionInfoVOList = equipmentInspectionService.selectUnfinishedInspectionEquipmentList(inspectionInfoDTO);
|
|
|
+ //生成数据
|
|
|
+ List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
|
|
|
+ if (null != equipmentInspectionInfoVOList && equipmentInspectionInfoVOList.size() > 0) {
|
|
|
+ int index = 1;
|
|
|
+ for (EquipmentInspectionInfoVO entity : equipmentInspectionInfoVOList) {
|
|
|
+ UnfinishedInspectionEquipmentExportEntity exportEntity = new UnfinishedInspectionEquipmentExportEntity();
|
|
|
+ exportEntity.setIndex(index);
|
|
|
+ if (entity.getAdCity() != null) {
|
|
|
+ exportEntity.setAdCity(entity.getAdCity());
|
|
|
+ } else {
|
|
|
+ exportEntity.setAdCity("");
|
|
|
+ }
|
|
|
+ if (entity.getAdDist() != null) {
|
|
|
+ exportEntity.setAdDist(entity.getAdDist());
|
|
|
+ } else {
|
|
|
+ exportEntity.setAdDist("");
|
|
|
+ }
|
|
|
+ if (entity.getRtuName() != null) {
|
|
|
+ exportEntity.setRtuName(entity.getRtuName());
|
|
|
+ } else {
|
|
|
+ exportEntity.setRtuName("");
|
|
|
+ }
|
|
|
+ exportEntity.setRtuCode(entity.getRtuCode());
|
|
|
+ String rtuKindDesc = "";
|
|
|
+ if (entity.getIsRain() != null && entity.getIsRain() == 1) {
|
|
|
+ rtuKindDesc += "雨量站";
|
|
|
+ }
|
|
|
+ if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
|
|
|
+ if (rtuKindDesc.length() > 0) {
|
|
|
+ rtuKindDesc += "/";
|
|
|
+ }
|
|
|
+ rtuKindDesc += "水位站";
|
|
|
+ }
|
|
|
+ if (entity.getIsGround() != null && entity.getIsGround() == 1) {
|
|
|
+ if (rtuKindDesc.length() > 0) {
|
|
|
+ rtuKindDesc += "/";
|
|
|
+ }
|
|
|
+ rtuKindDesc += "墒情站";
|
|
|
+ }
|
|
|
+ if (entity.getIsVideo() != null && entity.getIsVideo() == 1) {
|
|
|
+ if (rtuKindDesc.length() > 0) {
|
|
|
+ rtuKindDesc += "/";
|
|
|
+ }
|
|
|
+ rtuKindDesc += "视频站";
|
|
|
+ }
|
|
|
+ exportEntity.setRtuKindDesc(rtuKindDesc);
|
|
|
+
|
|
|
+ if (entity.getLng() != null) {
|
|
|
+ exportEntity.setLng(entity.getLng());
|
|
|
+ } else {
|
|
|
+ exportEntity.setLng("");
|
|
|
+ }
|
|
|
+ if (entity.getLat() != null) {
|
|
|
+ exportEntity.setLat(entity.getLat());
|
|
|
+ } else {
|
|
|
+ exportEntity.setLat("");
|
|
|
+ }
|
|
|
+ if (entity.getLocationDesc() != null) {
|
|
|
+ exportEntity.setLocationDesc(entity.getLocationDesc());
|
|
|
+ } else {
|
|
|
+ exportEntity.setLocationDesc("");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entity.getBeforeRainSeasonStatus() != null) {
|
|
|
+ if (entity.getBeforeRainSeasonStatus() == 0) {
|
|
|
+ exportEntity.setBeforeRainSeasonStatus("");
|
|
|
+ } else if (entity.getBeforeRainSeasonStatus() == 1) {
|
|
|
+ exportEntity.setBeforeRainSeasonStatus("已填报");
|
|
|
+ } else {
|
|
|
+ exportEntity.setBeforeRainSeasonStatus("");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ exportEntity.setBeforeRainSeasonStatus("");
|
|
|
+ }
|
|
|
+ if (entity.getRainSeasonFirstStatus() != null) {
|
|
|
+ if (entity.getRainSeasonFirstStatus() == 0) {
|
|
|
+ exportEntity.setRainSeasonFirstStatus("");
|
|
|
+ } else if (entity.getRainSeasonFirstStatus() == 1) {
|
|
|
+ exportEntity.setRainSeasonFirstStatus("已填报");
|
|
|
+ } else {
|
|
|
+ exportEntity.setRainSeasonFirstStatus("");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ exportEntity.setRainSeasonFirstStatus("");
|
|
|
+ }
|
|
|
+ if (entity.getRainSeasonSecondStatus() != null) {
|
|
|
+ if (entity.getRainSeasonSecondStatus() == 0) {
|
|
|
+ exportEntity.setRainSeasonSecondStatus("");
|
|
|
+ } else if (entity.getRainSeasonSecondStatus() == 1) {
|
|
|
+ exportEntity.setRainSeasonSecondStatus("已填报");
|
|
|
+ } else {
|
|
|
+ exportEntity.setRainSeasonSecondStatus("");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ exportEntity.setRainSeasonSecondStatus("");
|
|
|
+ }
|
|
|
+ unfinishedInspectionEquipmentExportEntities.add(exportEntity);
|
|
|
+ index += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
|
|
|
+ return R.data(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> exportUnfinishedInspectionEquipmentExcel(String title, List<UnfinishedInspectionEquipmentExportEntity> list) {
|
|
|
+ //当前时间
|
|
|
+ //Calendar dt = Calendar.getInstance();
|
|
|
+ //dt.setTime(new Date());
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("status", 0);
|
|
|
+ String templateFilePath = this.workDir + File.separator + this.inspectionUnfinishedTemplate;
|
|
|
+ String outpath = this.workDir + File.separator + Func.formatDate(new Date());
|
|
|
+ File dir = new File(outpath);
|
|
|
+ if (!dir.exists()) {
|
|
|
+ if (!dir.mkdir()) {
|
|
|
+ data.put("error", "目录创建失败");
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String outFileName = Func.randomUUID() + ".xlsx";
|
|
|
+ outpath += File.separator + outFileName;
|
|
|
+ ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
|
|
|
+ WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
|
|
|
+ excelWriter.write(list, writeSheet);
|
|
|
+ excelWriter.finish();
|
|
|
+ try {
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(new File(outpath));
|
|
|
+ BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
|
|
|
+ String ossPath = bladeFile.getName();
|
|
|
+ //String p = bladeFile.getDomain();
|
|
|
+ data.put("name", ossPath);
|
|
|
+ data.put("url", ossPath);
|
|
|
+ data.put("filename", "未完成巡检设备(" + title + ")统计清单表");
|
|
|
+ data.put("status", 1);
|
|
|
+
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ data.put("error", "导出失败!");
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
}
|