From 54c7e81473bbd931162a11ec325889f01be849cb Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 5 Jul 2024 10:32:53 +0800 Subject: [PATCH] =?UTF-8?q?#mybatis-plus=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=8F=82=E6=95=B0=E4=B8=BA-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/controller/EmModelController.java | 13 +++++ .../inspect/ai/controller/ClockTypeController.java | 15 ++++++ .../hzinfo/inspect/obj/services/ObjectService.java | 2 + .../inspect/obj/services/ObjectUserService.java | 3 ++ .../obj/services/impl/ObjectServiceImpl.java | 34 +++++++++++-- .../obj/services/impl/ObjectUserServiceImpl.java | 58 +++++++++++++++++++++- .../hzinfo/inspect/obj/web/ObjectController.java | 17 +++++++ .../inspect/obj/web/ObjectUserController.java | 12 +++++ .../inspect/plan/controller/RouteController.java | 12 +++++ .../weather/service/impl/StationServiceImpl.java | 3 ++ 10 files changed, 162 insertions(+), 7 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmModelController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmModelController.java index bc7e1cc..fbd9e1e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmModelController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmModelController.java @@ -18,6 +18,7 @@ import springfox.documentation.annotations.ApiIgnore; import com.hnac.hzims.equipment.entity.EmModelEntity; import com.hnac.hzims.equipment.service.IEmModelService; +import java.util.List; import java.util.Map; /** @@ -58,6 +59,18 @@ public class EmModelController extends BladeController { return R.data(pages); } + + /** + * 分页 代码自定义代号 + */ + @GetMapping("/models") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "查询列表", notes = "传入em_model") + public R> models(@RequestParam Map em_model) { + QueryWrapper queryWrapper = Condition.getQueryWrapper( em_model, EmModelEntity.class); + return R.data(em_modelService.list(queryWrapper)); + } + /** * 新增 代码自定义代号 */ diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/ClockTypeController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/ClockTypeController.java index 285a4c6..c57bc94 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/ClockTypeController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/ClockTypeController.java @@ -20,6 +20,7 @@ import springfox.documentation.annotations.ApiIgnore; import com.hnac.hzinfo.inspect.ai.entity.ClockTypeEntity; import com.hnac.hzinfo.inspect.ai.service.IClockTypeService; +import java.util.List; import java.util.Map; /** @@ -64,6 +65,20 @@ public class ClockTypeController extends BladeController { return R.data(pages); } + @GetMapping("/clockTypes") + @ApiOperationSupport(order = 8) + @ApiOperation(value = "查询表盘类型列表", notes = "传入st_clock_type") + @ApiImplicitParams({ + }) + @OperationAnnotation(moduleName = "巡检管理", title = "智能巡检配置", + operatorType = OperatorType.MOBILE, + businessType = BusinessType.GENCODE, + action = "查询表盘类型列表") + public R> clockTypes(@ApiIgnore @RequestParam Map st_clock_type) { + QueryWrapper queryWrapper = Condition.getQueryWrapper( st_clock_type, ClockTypeEntity.class); + return R.data(st_clock_typeService.list(queryWrapper)); + } + /** * 新增 代码自定义代号 */ diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java index 0b91d4d..4225045 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java @@ -57,4 +57,6 @@ public interface ObjectService extends IService { * @return */ Boolean submit(ObjectEntity object); + + List objects(ObjectEntity entity); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectUserService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectUserService.java index 1905c5f..0032c8e 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectUserService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectUserService.java @@ -3,6 +3,7 @@ package com.hnac.hzinfo.inspect.obj.services; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListQuery; +import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListVO; import java.util.List; @@ -15,4 +16,6 @@ import java.util.List; public interface ObjectUserService extends IService { List getPageList(ObjectUserListQuery user); + + List users(ObjectUserListQuery content); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java index 339ec98..3df38bc 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java @@ -3,28 +3,29 @@ package com.hnac.hzinfo.inspect.obj.services.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; import com.google.zxing.BarcodeFormat; import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.obj.ObjectConstants; import com.hnac.hzinfo.inspect.obj.entity.*; +import com.hnac.hzinfo.inspect.obj.mapper.InspectObjectMapper; import com.hnac.hzinfo.inspect.obj.services.*; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; -import com.hnac.hzinfo.inspect.obj.vo.*; +import com.hnac.hzinfo.inspect.obj.vo.ObjectDto; +import com.hnac.hzinfo.inspect.obj.vo.ObjectExcelInputVo; +import com.hnac.hzinfo.inspect.obj.vo.ObjectOfflineVO; +import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto; import com.hnac.hzinfo.inspect.plan.PlanContants; import com.hnac.hzinfo.inspect.utils.HtmlModule; import com.hnac.hzinfo.inspect.utils.HtmltoPdf; import com.hnac.hzinfo.inspect.utils.ZxingGenCode; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; - -import com.hnac.hzinfo.inspect.obj.mapper.InspectObjectMapper; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; @@ -242,6 +243,29 @@ public class ObjectServiceImpl extends ServiceImpl objects(ObjectEntity entity) { + List objects = this.baseMapper.getList(entity); + if(CollectionUtil.isEmpty(objects)){ + return new ArrayList<>(); + } + return objects.stream().map(object ->{ + ObjectEntity vo = BeanUtil.copy(object, ObjectEntity.class); + if(Func.isNotEmpty(object.getRealId())){ + vo.setName(object.getOtherName()); + vo.setAddress(Optional.ofNullable(object.getOtherAddress()).orElse(vo.getAddress())); + vo.setLgtd(Optional.ofNullable(object.getOtherLgtd()).orElse(vo.getLgtd())); + vo.setLttd(Optional.ofNullable(object.getOtherLttd()).orElse(vo.getLttd())); + } + return vo; + }).collect(Collectors.toList()); + } + + /** * 根据巡检对象生成一条同名巡检模板 * @param object 巡检对象 */ diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java index 12cdc0a..e51682b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectUserServiceImpl.java @@ -1,13 +1,26 @@ package com.hnac.hzinfo.inspect.obj.services.impl; -import com.hnac.hzinfo.inspect.obj.mapper.ObjectUserMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ObjectUserMapper; import com.hnac.hzinfo.inspect.obj.services.ObjectUserService; import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListQuery; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzinfo.inspect.obj.vo.ObjectUserListVO; +import lombok.RequiredArgsConstructor; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.constant.BladeConstant; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 服务实现类 @@ -15,10 +28,51 @@ import java.util.List; * @author Chill */ @Service +@RequiredArgsConstructor public class ObjectUserServiceImpl extends ServiceImpl implements ObjectUserService { + private final IUserClient userClient; + + @Override public List getPageList(ObjectUserListQuery user){ return this.baseMapper.getPageList(user); } + + /** + * 查询列表 + * @param content + * @return + */ + @Override + public List users(ObjectUserListQuery content) { + if(!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)){ + content.setTenantId(AuthUtil.getTenantId()); + } + List objectUsers = this.getPageList(content); + if(objectUsers.isEmpty()){ + return new ArrayList<>(); + } + R> users = userClient.userListByCodeAndNameAndAccount(AuthUtil.getTenantId(),content.getUserCode(),content.getUserName(),content.getLoginName()); + if(!users.isSuccess() || CollectionUtil.isEmpty(users.getData())){ + return new ArrayList<>(); + } + Map userMap = users.getData().stream().collect(Collectors.toMap(User::getId, Function.identity())); + return objectUsers.stream().map(objectUser->{ + ObjectUserListVO builder = new ObjectUserListVO(); + builder.setId(objectUser.getId()); + builder.setObjCode(objectUser.getObjCode()); + builder.setObjName(objectUser.getObjName()); + builder.setTempCode(objectUser.getTempCode()); + builder.setTempName(objectUser.getTempName()); + User user = userMap.get(objectUser.getUserId()); + if(ObjectUtil.isNotEmpty(user)){ + builder.setUserCode(user.getCode()); + builder.setUserName(user.getRealName()); + builder.setLoginName(user.getAccount()); + builder.setUserId(user.getId()); + } + return builder; + }).collect(Collectors.toList()); + } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java index fd4a570..ded2951 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java @@ -100,6 +100,23 @@ public class ObjectController extends BladeController { return R.data(pages); } + @GetMapping("/objects") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "巡检对象列表", notes = "巡检对象列表") + @Operate(label="查询巡检对象分页列表",type = BusinessType.QUERY,ignore = false) + public R> objects(ObjectListQueryVO object) { + ObjectEntity entity = new ObjectEntity(); + if(!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)){ + entity.setTenantId(AuthUtil.getTenantId()); + } + entity.setCode(object.getCode()); + entity.setName(object.getName()); + entity.setStatus(object.getStatus()); + entity.setCreateDept(object.getCreateDept()); + entity.setSupportAutoVideo(object.getSupportAutoVideo()); + return R.data(objectService.objects(entity)); + } + @GetMapping("/other_list_page") @ApiOperationSupport(order = 2) @ApiOperation(value = "其他巡检对象列表-分页", notes = "其他巡检对象列表,分页") diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectUserController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectUserController.java index aefa78b..40098e7 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectUserController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectUserController.java @@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -105,6 +106,17 @@ public class ObjectUserController { return R.data(resultPage); } + @GetMapping("/users") + @OperationAnnotation(moduleName = "巡检管理", title = "巡检配置", + operatorType = OperatorType.MOBILE, + businessType = BusinessType.GENCODE, + action = "查询巡检对象人员管理列表") + @ApiOperation(value = "巡检对象用户列表", notes = "巡检对象用户列表(跨服务查询)") + public R> users(ObjectUserListQuery content) { + return R.data(objectUserService.users(content)); + } + + /** * 新增 */ diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/RouteController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/RouteController.java index ab8c6f3..f93c8b1 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/RouteController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/RouteController.java @@ -71,6 +71,18 @@ public class RouteController extends BladeController { return R.data(pages); } + @GetMapping("/routes") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "查询巡检路径列表", notes = "传入st_re_route") + @ApiImplicitParams({ + }) + @Operate(label = "查询巡检路径列表",type = BusinessType.QUERY,ignore = false) + public R> list(@ApiIgnore @RequestParam Map st_re_route) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(st_re_route, RouteEntity.class); + queryWrapper.orderByDesc("create_time", "update_time"); + return R.data(st_re_routeService.list(queryWrapper)); + } + /** * 新增 代码自定义代号 */ diff --git a/hzims-service/weather/src/main/java/com/hnac/hzims/weather/service/impl/StationServiceImpl.java b/hzims-service/weather/src/main/java/com/hnac/hzims/weather/service/impl/StationServiceImpl.java index 210d897..c54a566 100644 --- a/hzims-service/weather/src/main/java/com/hnac/hzims/weather/service/impl/StationServiceImpl.java +++ b/hzims-service/weather/src/main/java/com/hnac/hzims/weather/service/impl/StationServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.hzimsweather.entity.VStationEntity; import com.hnac.hzims.weather.mapper.StationMapper; import com.hnac.hzims.weather.service.IStationService; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.StringUtil; @@ -18,6 +19,7 @@ import java.util.List; * @author hx */ @Service +@Slf4j public class StationServiceImpl extends ServiceImpl implements IStationService { @Override @@ -28,6 +30,7 @@ public class StationServiceImpl extends ServiceImpl stationEntityList = this.list(lqw); Assert.isTrue(CollectionUtil.isNotEmpty(stationEntityList),()->{ + log.error("station_enetity :{}",stationCodes); throw new ServiceException("站点编码对应站点未找到经纬度,查询失败!"); }); return stationEntityList;