增加标准地址业务及数据库

This commit is contained in:
gaoben 2021-04-06 17:09:53 +08:00
parent 54db89a719
commit 8b4490d21d
7 changed files with 40219 additions and 49 deletions

View File

@ -6,7 +6,7 @@
Source Server Version : 50733
Source Host : 192.168.50.232:3306
Source Schema : cell_db_tcp
456
Target Server Type : MySQL
Target Server Version : 50733
File Encoding : 65001

40097
cell_db_tcp-20210406.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -77,6 +77,7 @@ public class SysDeviceController {
return R.error("设备类型不能为空");
if (StringUtils.isEmpty(sysDevice.getSn()))
return R.error("设备sn不能为空");
sysDevice.setSn(sysDevice.getSn().trim());
this.sysDeviceService.save(sysDevice);
return R.ok();
}
@ -88,8 +89,8 @@ public class SysDeviceController {
@RequiresPermissions("sys:device")
@ApiOperation(value = "修改")
public R update(@RequestBody SysDeviceEntity sysDevice){
sysDevice.setSn(sysDevice.getSn().trim());
sysDeviceService.updateById(sysDevice);
return R.ok();
}

View File

@ -1,15 +1,17 @@
package net.shapelight.modules.ten.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.shapelight.common.utils.StringUtils;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.service.TenCellService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import net.shapelight.modules.ten.entity.TenAddressEntity;
import net.shapelight.modules.ten.service.TenAddressService;
@ -17,9 +19,7 @@ import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
/**
*
*
*/
@RestController
@ -27,61 +27,81 @@ import net.shapelight.common.utils.R;
public class TenAddressController {
@Autowired
private TenAddressService tenAddressService;
@Autowired
private TenCellService tenCellService;
/**
* 列表
*/
@RequestMapping("/list")
@RequiresPermissions("ten:address:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = tenAddressService.queryPage(params);
return R.ok().put("data", page);
}
// @GetMapping("/list")
// @RequiresPermissions("ten:address:list")
// public R list(@RequestParam Map<String, Object> params) {
// PageUtils page = tenAddressService.queryPage(params);
//
// return R.ok().put("data", page);
// }
/**
* 信息
*/
@RequestMapping("/info/{pId}")
@RequiresPermissions("ten:address:info")
public R info(@PathVariable("pId") Long pId){
TenAddressEntity tenAddress = tenAddressService.getById(pId);
return R.ok().put("data", tenAddress);
}
// @GetMapping("/info/{pId}")
// @RequiresPermissions("ten:address:info")
// public R info(@PathVariable("pId") Long pId) {
// TenAddressEntity tenAddress = tenAddressService.getById(pId);
//
// return R.ok().put("data", tenAddress);
// }
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("ten:address:save")
public R save(@RequestBody TenAddressEntity tenAddress){
tenAddressService.save(tenAddress);
return R.ok();
}
// @PostMapping("/save")
// @RequiresPermissions("ten:address:save")
// public R save(@RequestBody TenAddressEntity tenAddress) {
// tenAddressService.save(tenAddress);
//
// return R.ok();
// }
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("ten:address:update")
public R update(@RequestBody TenAddressEntity tenAddress){
tenAddressService.updateById(tenAddress);
return R.ok();
}
// @PostMapping("/update")
// @RequiresPermissions("ten:address:update")
// public R update(@RequestBody TenAddressEntity tenAddress) {
// tenAddressService.updateById(tenAddress);
//
// return R.ok();
// }
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("ten:address:delete")
public R delete(@RequestBody Long[] pIds){
tenAddressService.removeByIds(Arrays.asList(pIds));
// @PostMapping("/delete")
// @RequiresPermissions("ten:address:delete")
// public R delete(@RequestBody Long[] pIds) {
// tenAddressService.removeByIds(Arrays.asList(pIds));
//
// return R.ok();
// }
return R.ok();
/**
* 选择对接地址
*/
@GetMapping("/selectRoomAddress/{cellId}")
@RequiresPermissions("ten:address:info")
public R selectRoomAddress(@PathVariable("cellId") Long cellId) {
TenCellEntity cellEntity = tenCellService.getById(cellId);
String xqid = cellEntity.getThirdId();
List<TenAddressEntity> selectAdds = new ArrayList<>();
if (!StringUtils.isEmpty(xqid)) {
selectAdds = tenAddressService.list(
new QueryWrapper<TenAddressEntity>()
.eq("xqid", xqid)
.eq("dzjb","14")
);
}
return R.ok().put("data", selectAdds);
}
}

View File

@ -7,8 +7,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.common.utils.*;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
@ -18,10 +17,6 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
/**
* 户室表
@ -43,6 +38,8 @@ public class TenRoomController extends AbstractController {
private TenPersonService tenPersonService;
@Autowired
private TenDoorCardService tenDoorCardService;
@Autowired
private TenAddressService tenAddressService;
/**
* 列表
@ -80,6 +77,14 @@ public class TenRoomController extends AbstractController {
@ApiOperation(value = "查询小区信息",response = TenRoomEntity.class)
public R info(@PathVariable("roomId") Long roomId,@PathVariable("cellId") Long cellId){
TenRoomEntity tenRoom0 = tenRoomService.getById(roomId,cellId);
if(tenRoom0.getPId()!=null){
TenAddressEntity addressEntity = tenAddressService.getById(tenRoom0.getPId());
if(addressEntity!=null){
tenRoom0.setAddress(addressEntity.getDzqc());
}else{
tenRoom0.setAddress("");
}
}
return R.ok().put("data", tenRoom0);
}
@ -289,4 +294,32 @@ public class TenRoomController extends AbstractController {
// return R.ok();
// }
/**
* 选择对接地址
*/
@GetMapping("/selectRoomAddress/{cellId}")
@RequiresPermissions("ten:room")
@ApiOperation(value = "选择标准地址")
public R selectRoomAddress(@PathVariable("cellId") Long cellId) {
TenCellEntity cellEntity = tenCellService.getById(cellId);
String xqid = cellEntity.getThirdId();
// List<TenAddressEntity> selectAdds = new ArrayList<>();
// if (!StringUtils.isEmpty(xqid)) {
// selectAdds = tenAddressService.list(
// new QueryWrapper<TenAddressEntity>()
// .eq("xqid", xqid)
// .eq("dzjb","14")
// );
// }
List<Map<String,Object>> addressMaps = new ArrayList<>();
if (!StringUtils.isEmpty(xqid)) {
addressMaps = tenAddressService.listMaps(new QueryWrapper<TenAddressEntity>()
.select("p_id","dzqc")
.eq("xqid", xqid)
.eq("dzjb","14"));
}
return R.ok().put("data", addressMaps);
}
}

View File

@ -141,4 +141,8 @@ public class TenRoomEntity extends BaseEntity implements Serializable {
@ApiModelProperty("地址编码")
private String dzbm;
@TableField(exist=false)
@ApiModelProperty("标准地址")
private String address;
}

View File

@ -1,7 +1,9 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.shapelight.modules.ten.entity.TenAddressEntity;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.service.TenAddressService;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPersonService;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +34,8 @@ public class TenRoomServiceImpl implements TenRoomService {
private TenCellService tenCellService;
@Autowired
private TenPersonService tenPersonService;
@Autowired
private TenAddressService tenAddressService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
@ -67,6 +71,17 @@ public class TenRoomServiceImpl implements TenRoomService {
for(TenRoomEntity rec : page.getRecords()){
int pc = tenPersonService.findRoomCount(rec.getCellId(),rec.getRoomId());
if(rec.getPId()!=null){
TenAddressEntity addressEntity = tenAddressService.getById(rec.getPId());
if(addressEntity!=null){
rec.setAddress(addressEntity.getDzqc());
}else{
rec.setAddress("");
}
}else{
rec.setAddress("");
}
rec.setPersonCount(pc);
}