feat:旷世接口定义
This commit is contained in:
1 parent
281c05e2c4
commit
7fedecc3bd
44 files changed
+1013
-25
No files matched your search
+6
@@ -38,6 +38,12 @@ public class HardDoorManagerEntity extends Model<HardDoorManagerEntity> {
|
||||
@Schema(description = "设备编号")
|
||||
private Long hardId;
|
||||
|
||||
/**
|
||||
* 内置设备编号
|
||||
*/
|
||||
@Schema(description = "内置设备编号")
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 设备 IMEI 号(15 位)
|
||||
*/
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public class HardDoorManagerController {
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardDoorManager_add')")
|
||||
public R bind(@RequestBody HardDoorManagerEntity dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getImei())) throw new RuntimeException("设备IMEI卡号不能为空");
|
||||
if (ObjectUtil.isEmpty(dto.getDeviceCode())) throw new RuntimeException("设备内置设备编号不能为空");
|
||||
hardDoorManagerService.bind(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
+47
-5
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.manager;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
@@ -8,14 +9,27 @@ import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardDoorManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorManagerService;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdDoorApiService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorBindDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorRegisterDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorBindVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorRegisterVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 智能柜设置
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMapper, HardDoorManagerEntity> implements HardDoorManagerService {
|
||||
|
||||
private final RemoterThirdDoorApiService thirdDoorApiService;
|
||||
|
||||
@Override
|
||||
public Page<HardDoorManagerVo> scopePageJoin(Page page, HardDoorManagerDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
@@ -34,10 +48,38 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
*/
|
||||
@Override
|
||||
public void bind(HardDoorManagerEntity dto) {
|
||||
HardDoorManagerEntity saveOrUpdate = new HardDoorManagerEntity();
|
||||
saveOrUpdate.setId(dto.getId());
|
||||
saveOrUpdate.setHardId(dto.getHardId());
|
||||
saveOrUpdate.setImei(dto.getImei());
|
||||
baseMapper.insertOrUpdate(saveOrUpdate);
|
||||
// 查询设备
|
||||
HardDoorManagerVo hardDoorDetail = getByHardId(dto.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
HardDoorManagerEntity saveOrUpdate = new HardDoorManagerEntity();
|
||||
saveOrUpdate.setHardId(dto.getHardId());
|
||||
saveOrUpdate.setImei(dto.getImei());
|
||||
saveOrUpdate.setDeviceCode(dto.getDeviceCode());
|
||||
baseMapper.insert(saveOrUpdate);
|
||||
} else {
|
||||
HardDoorManagerEntity saveOrUpdate = new HardDoorManagerEntity();
|
||||
saveOrUpdate.setId(hardDoorDetail.getId());
|
||||
saveOrUpdate.setHardId(dto.getHardId());
|
||||
saveOrUpdate.setImei(dto.getImei());
|
||||
saveOrUpdate.setDeviceCode(dto.getDeviceCode());
|
||||
baseMapper.updateById(saveOrUpdate);
|
||||
}
|
||||
// 设备绑定
|
||||
DoorBindDto bindDto = new DoorBindDto();
|
||||
bindDto.setImei(dto.getImei());
|
||||
bindDto.setDeviceCode(dto.getDeviceCode());
|
||||
bindDto.setOutDeviceCode(String.valueOf(dto.getHardId()));
|
||||
DoorBindVo bindVo = thirdDoorApiService.bind(bindDto).getData();
|
||||
if (!bindVo.isSuccess()) {
|
||||
throw new RuntimeException(bindVo.getMessage());
|
||||
}
|
||||
// 设备注册
|
||||
DoorRegisterDto registerDto = new DoorRegisterDto();
|
||||
registerDto.setImei(dto.getImei());
|
||||
registerDto.setOutDeviceCode(String.valueOf(dto.getHardId()));
|
||||
DoorRegisterVo registerVo = thirdDoorApiService.register(registerDto).getData();
|
||||
if (!registerVo.isSuccess()) {
|
||||
throw new RuntimeException(registerVo.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -6,6 +6,7 @@
|
||||
<id property="id" column="id"/>
|
||||
<result property="hardId" column="hard_id"/>
|
||||
<result property="imei" column="imei"/>
|
||||
<result property="deviceCode" column="device_code"/>
|
||||
<result property="cabinetNum" column="cabinet_num"/>
|
||||
<result property="cabinetCameraNum" column="cabinet_camera_num"/>
|
||||
<result property="cabinetWeightUnitNum" column="cabinet_weight_unit_num"/>
|
||||
@@ -29,6 +30,7 @@
|
||||
select a.id,
|
||||
a.hard_id,
|
||||
a.imei,
|
||||
a.device_code,
|
||||
a.cabinet_num,
|
||||
a.cabinet_camera_num,
|
||||
a.cabinet_weight_unit_num,
|
||||
@@ -56,6 +58,9 @@
|
||||
<if test="dto.imei != null and dto.imei != '' ">
|
||||
and a.imei like concat('%', #{dto.imei}, '%')
|
||||
</if>
|
||||
<if test="dto.deviceCode != null and dto.deviceCode != '' ">
|
||||
and a.device_code like concat('%', #{dto.deviceCode}, '%')
|
||||
</if>
|
||||
<if test="dto.powerStatus != null">
|
||||
and a.power_status = #{dto.powerStatus}
|
||||
</if>
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
group by DATE_FORMAT(a.create_time, '%Y-%d-%m')
|
||||
group by DATE_FORMAT(a.create_time, '%Y-%m-%d')
|
||||
</select>
|
||||
|
||||
<select id="listOrerPayType" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderPayTypeVo">
|
||||
|
||||
Reference in new issue
Block a user