diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/FrameRecordEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/FrameRecordEntity.java index 90dead1..14445e5 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/FrameRecordEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/FrameRecordEntity.java @@ -23,9 +23,12 @@ public class FrameRecordEntity extends TenantEntity { @ApiModelProperty("站点名称") private String stationName; - @ApiModelProperty("实时画面保存配置ID,用逗号分割") - private String frameids; + @ApiModelProperty("实时画面ID") + private String frameId; - @ApiModelProperty("实时画面保存名称,用逗号分割") - private String frameNames; + @ApiModelProperty("实时画面名称") + private String frameName; + + @ApiModelProperty("实时画面地址") + private String frameAddress; } \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/UserDeptConfigEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/UserDeptConfigEntity.java new file mode 100644 index 0000000..bc1b7fc --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/UserDeptConfigEntity.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.operational.station.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springblade.core.tenant.mp.TenantEntity; + + +/** + * @author ysj + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hzims_user_dept_config") +public class UserDeptConfigEntity extends TenantEntity { + + @ApiModelProperty("机构Id") + private Long deptId; + + @ApiModelProperty("机构名称") + private String deptName; + + @ApiModelProperty("机构类别: 4-站点 3-区域 2,1-集团") + private Integer deptCategory; + + @ApiModelProperty("站点ID") + private String stationId; + + @ApiModelProperty("站点名称") + private String stationName; +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java new file mode 100644 index 0000000..b4baff8 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java @@ -0,0 +1,47 @@ +package com.hnac.hzims.operational.station.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.operational.station.entity.UserDeptConfigEntity; +import com.hnac.hzims.operational.station.entity.VideoRecordEntity; +import com.hnac.hzims.operational.station.service.UserDeptConfigService; +import com.hnac.hzims.operational.station.service.VideoRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * @author ysj + */ +@RestController +@RequestMapping("/userDept/config") +@RequiredArgsConstructor +@Api(value = "用户机构配置保存记录", tags = "用户机构配置保存记录") +public class UserDeptConfigController extends BladeController { + + private final UserDeptConfigService userDeptConfigService; + + @PostMapping("/submit") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增或修改用户机构配置记录", notes = "传入UserDeptConfigEntity") + public R submit(@Valid @RequestBody UserDeptConfigEntity entity) { + return R.status(userDeptConfigService.submit(entity)); + } + + @GetMapping("/query") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "查询站点用户机构配置保存记录", notes = "传入userId") + public R query(@RequestParam("userId") String userId) { + return R.data(userDeptConfigService.getOne(Wrappers.lambdaQuery() + .eq(UserDeptConfigEntity::getCreateUser,userId) + )); + } + + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/UserDeptConfigConfigMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/UserDeptConfigConfigMapper.xml new file mode 100644 index 0000000..9c0737f --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/UserDeptConfigConfigMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/UserDeptConfigMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/UserDeptConfigMapper.java new file mode 100644 index 0000000..a3774ab --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/UserDeptConfigMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.operational.station.mapper; + +import com.hnac.hzims.operational.station.entity.UserDeptConfigEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + + +/** + * @author ysj + */ +public interface UserDeptConfigMapper extends UserDataScopeBaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java new file mode 100644 index 0000000..7da046f --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.operational.station.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.operational.station.entity.UserDeptConfigEntity; + +/** + * @author ysj + */ +public interface UserDeptConfigService extends IService { + boolean submit(UserDeptConfigEntity entity); +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java new file mode 100644 index 0000000..75849f0 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java @@ -0,0 +1,64 @@ +package com.hnac.hzims.operational.station.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.entity.UserDeptConfigEntity; +import com.hnac.hzims.operational.station.mapper.UserDeptConfigMapper; +import com.hnac.hzims.operational.station.service.IStationService; +import com.hnac.hzims.operational.station.service.UserDeptConfigService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; +import org.springframework.stereotype.Service; + +/** + * @author 86187 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class UserDeptConfigServiceImpl extends ServiceImpl implements UserDeptConfigService { + + private final ISysClient sysClient; + + private final IStationService stationService; + + /** + * 保存用户机构配置 + * @param entity + * @return + */ + @Override + public boolean submit(UserDeptConfigEntity entity) { + if(ObjectUtil.isEmpty(entity.getDeptId())){ + return false; + } + R dept = sysClient.getDept(entity.getDeptId()); + if(!dept.isSuccess() || ObjectUtil.isEmpty(dept.getData())){ + return false; + } + entity.setDeptName(dept.getData().getDeptName()); + entity.setDeptCategory(dept.getData().getDeptCategory()); + if(dept.getData().getDeptCategory() == 4){ + StationEntity station = stationService.getOne(Wrappers.lambdaQuery() + .eq(StationEntity::getRefDept,dept.getData().getId()) + ); + if(ObjectUtil.isNotEmpty(station)){ + entity.setStationId(station.getCode()); + entity.setStationName(station.getName()); + }else{ + entity.setStationId(null); + entity.setStationName(null); + } + }else{ + entity.setStationId(null); + entity.setStationName(null); + } + + return super.saveOrUpdate(entity); + } +} \ No newline at end of file