更新获取设备树
This commit is contained in:
parent
09751df20f
commit
d70ac317c4
@ -13,7 +13,6 @@ import com.xhpc.workorder.domain.XhpcStationDeviceDomain;
|
|||||||
import com.xhpc.workorder.service.WorkStationService;
|
import com.xhpc.workorder.service.WorkStationService;
|
||||||
import com.xhpc.workorder.service.WorkUserService;
|
import com.xhpc.workorder.service.WorkUserService;
|
||||||
import com.xhpc.workorder.vo.XhpcStationDeviceVo;
|
import com.xhpc.workorder.vo.XhpcStationDeviceVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@ -39,7 +38,8 @@ public class WorkStationController extends BaseController {
|
|||||||
|
|
||||||
@GetMapping("/getPage")
|
@GetMapping("/getPage")
|
||||||
public TableDataInfo getPage(HttpServletRequest request, String stationName,
|
public TableDataInfo getPage(HttpServletRequest request, String stationName,
|
||||||
String terminalName){
|
String terminalName) {
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ public class WorkStationController extends BaseController {
|
|||||||
@GetMapping("/getPageByParent")
|
@GetMapping("/getPageByParent")
|
||||||
public TableDataInfo getPageByParent(HttpServletRequest request,
|
public TableDataInfo getPageByParent(HttpServletRequest request,
|
||||||
String stationId,
|
String stationId,
|
||||||
String deviceType,
|
String deviceType,
|
||||||
String parentId){
|
String parentId) {
|
||||||
startPage();
|
startPage();
|
||||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||||
|
|
||||||
@ -71,7 +71,8 @@ public class WorkStationController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@GetMapping("/getStationPage")
|
@GetMapping("/getStationPage")
|
||||||
public TableDataInfo getStationList(String tenantId){
|
public TableDataInfo getStationList(String tenantId) {
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("tenantId", tenantId);
|
params.put("tenantId", tenantId);
|
||||||
@ -86,7 +87,8 @@ public class WorkStationController extends BaseController {
|
|||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
String deviceName,
|
String deviceName,
|
||||||
String stationName,
|
String stationName,
|
||||||
String terminalName){
|
String terminalName) {
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
@ -99,11 +101,11 @@ public class WorkStationController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "场站设备-导入设备", businessType = BusinessType.INSERT)
|
@Log(title = "场站设备-导入设备", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public R importDevice(MultipartFile file, boolean updateSupport) throws Exception {
|
public R importDevice(MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
if(file == null){
|
|
||||||
|
if (file == null) {
|
||||||
return R.fail("没有可导入的数据文件");
|
return R.fail("没有可导入的数据文件");
|
||||||
}
|
}
|
||||||
ExcelUtil<XhpcStationDeviceDomain> util = new ExcelUtil<XhpcStationDeviceDomain>(XhpcStationDeviceDomain.class);
|
ExcelUtil<XhpcStationDeviceDomain> util = new ExcelUtil<XhpcStationDeviceDomain>(XhpcStationDeviceDomain.class);
|
||||||
@ -115,14 +117,16 @@ public class WorkStationController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public R getDeviceDetail(@RequestParam("deviceId")Long deviceId) throws Exception{
|
public R getDeviceDetail(@RequestParam("deviceId") Long deviceId) throws Exception {
|
||||||
|
|
||||||
return R.ok(stationService.getDeviceDetail(deviceId));
|
return R.ok(stationService.getDeviceDetail(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "场站设备-新增设备", businessType = BusinessType.INSERT)
|
@Log(title = "场站设备-新增设备", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/")
|
@PostMapping("/")
|
||||||
public R insertNewDevice(HttpServletRequest request, @RequestBody XhpcStationDeviceDomain domain) throws Exception{
|
public R insertNewDevice(HttpServletRequest request, @RequestBody XhpcStationDeviceDomain domain) throws Exception {
|
||||||
|
|
||||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||||
domain.setCreateBy(logUser.getUserid().toString());
|
domain.setCreateBy(logUser.getUserid().toString());
|
||||||
domain.setUpdateBy(logUser.getUserid().toString());
|
domain.setUpdateBy(logUser.getUserid().toString());
|
||||||
@ -130,10 +134,10 @@ public class WorkStationController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "场站设备-新增设备(简易)", businessType = BusinessType.INSERT)
|
@Log(title = "场站设备-新增设备(简易)", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/simple")
|
@PostMapping("/simple")
|
||||||
public R insertNewSimpleDevice(HttpServletRequest request, @RequestBody XhpcStationDeviceVo vo) throws Exception{
|
public R insertNewSimpleDevice(HttpServletRequest request, @RequestBody XhpcStationDeviceVo vo) throws Exception {
|
||||||
|
|
||||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||||
vo.setTenantId(logUser.getTenantId());
|
vo.setTenantId(logUser.getTenantId());
|
||||||
vo.setUserId(logUser.getUserid().toString());
|
vo.setUserId(logUser.getUserid().toString());
|
||||||
@ -142,7 +146,7 @@ public class WorkStationController extends BaseController {
|
|||||||
|
|
||||||
@Log(title = "场站设备-维护设备信息", businessType = BusinessType.UPDATE)
|
@Log(title = "场站设备-维护设备信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/detail")
|
@PutMapping("/detail")
|
||||||
public R updateDeviceInfo(@RequestBody XhpcStationDeviceDomain domain){
|
public R updateDeviceInfo(@RequestBody XhpcStationDeviceDomain domain) {
|
||||||
|
|
||||||
return R.ok(stationService.updateDevice(domain));
|
return R.ok(stationService.updateDevice(domain));
|
||||||
}
|
}
|
||||||
@ -151,17 +155,19 @@ public class WorkStationController extends BaseController {
|
|||||||
@Log(title = "场站设备-删除设备信息", businessType = BusinessType.DELETE)
|
@Log(title = "场站设备-删除设备信息", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/detail")
|
@DeleteMapping("/detail")
|
||||||
public R deleteDeviceInfo(@RequestParam("deviceId") Long deviceId) throws Exception {
|
public R deleteDeviceInfo(@RequestParam("deviceId") Long deviceId) throws Exception {
|
||||||
|
|
||||||
return R.ok(stationService.deleteDevice(deviceId));
|
return R.ok(stationService.deleteDevice(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/user")
|
@GetMapping("/user")
|
||||||
public R getDeptAndUser(HttpServletRequest request){
|
public R getDeptAndUser(HttpServletRequest request) {
|
||||||
|
|
||||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||||
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("tenantId", logUser.getTenantId());
|
params.put("tenantId", logUser.getTenantId());
|
||||||
return R.ok(userService.getDeptAndUserByMap(params));
|
return R.ok(userService.getDeptAndUserByMap(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.xhpc.workorder.service.WorkOrderService;
|
|||||||
import com.xhpc.workorder.service.WorkUserService;
|
import com.xhpc.workorder.service.WorkUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -18,6 +19,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class WorkOrderServiceImpl implements WorkOrderService {
|
public class WorkOrderServiceImpl implements WorkOrderService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -118,8 +120,8 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
|||||||
@Override
|
@Override
|
||||||
public Boolean insertOrder(XhpcWorkOrderDomain domain){
|
public Boolean insertOrder(XhpcWorkOrderDomain domain){
|
||||||
|
|
||||||
|
List<XhpcWorkUserDomain> userDomains = new ArrayList<>();
|
||||||
if(domain.getUserList() != null){
|
if(domain.getUserList() != null){
|
||||||
List<XhpcWorkUserDomain> userDomains = new ArrayList<>();
|
|
||||||
for(XhpcWorkUserDomain userDomain: domain.getUserList()){
|
for(XhpcWorkUserDomain userDomain: domain.getUserList()){
|
||||||
userDomain = workUserService.findByPk(userDomain.getWorkUserId());
|
userDomain = workUserService.findByPk(userDomain.getWorkUserId());
|
||||||
userDomains.add(userDomain);
|
userDomains.add(userDomain);
|
||||||
@ -156,9 +158,9 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
|||||||
phoneList = userDomain.getPhone() + "," + phoneList;
|
phoneList = userDomain.getPhone() + "," + phoneList;
|
||||||
}
|
}
|
||||||
|
|
||||||
orderMapper.insertOrderUser(orderUserDomainList);
|
if(orderUserDomainList.size() > 0){
|
||||||
|
orderMapper.insertOrderUser(orderUserDomainList);
|
||||||
|
}
|
||||||
// todo 发送多人短信
|
// todo 发送多人短信
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("orderNo", domain.getWorkOrderId().toString());
|
paramMap.put("orderNo", domain.getWorkOrderId().toString());
|
||||||
@ -182,6 +184,7 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteOrder(Long orderId) throws Exception {
|
public Boolean deleteOrder(Long orderId) throws Exception {
|
||||||
XhpcWorkOrderDomain domain = orderMapper.selectByPrimaryKey(orderId);
|
XhpcWorkOrderDomain domain = orderMapper.selectByPrimaryKey(orderId);
|
||||||
|
|||||||
@ -70,8 +70,6 @@ public class WorkStationServiceImpl implements WorkStationService {
|
|||||||
int pileSerialNumber = getTerminalStatus(map.get("gunSerialNumber").toString());
|
int pileSerialNumber = getTerminalStatus(map.get("gunSerialNumber").toString());
|
||||||
map.put("workStatus",pileSerialNumber);
|
map.put("workStatus",pileSerialNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return deviceList;
|
return deviceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,21 +95,18 @@ public class WorkStationServiceImpl implements WorkStationService {
|
|||||||
|
|
||||||
List<Map<String, Object>> stationDomainList = stationMapper.selectMapListByParams(stationParams);
|
List<Map<String, Object>> stationDomainList = stationMapper.selectMapListByParams(stationParams);
|
||||||
for (Map<String, Object> stationMap: stationDomainList){
|
for (Map<String, Object> stationMap: stationDomainList){
|
||||||
if(StringUtils.isEmpty(params.get("stationName").toString())){
|
if( params.get("stationName") != null && StringUtils.isEmpty(params.get("stationName").toString())){
|
||||||
params.put("stationName", stationMap.get("name"));
|
params.put("stationName", stationMap.get("name"));
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> resultData = deviceMapper.selectStationGunDeviceTreeByParams(params);
|
List<Map<String, Object>> resultData = deviceMapper.selectStationGunDeviceTreeByParams(params);
|
||||||
for (Map<String, Object> resultMap: resultData){
|
for (Map<String, Object> resultMap: resultData){
|
||||||
List<Map<String, Object>> childData = deviceMapper.selectStationGunDeviceTreeByParent(resultMap.get("deviceId").toString());
|
List<Map<String, Object>> childData = deviceMapper.selectStationGunDeviceTreeByParent(resultMap.get("id").toString());
|
||||||
if(childData != null){
|
if(childData != null){
|
||||||
resultMap.put("children", childData);
|
resultMap.put("children", childData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stationMap.put("children", resultData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return stationDomainList;
|
return stationDomainList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,14 +96,13 @@
|
|||||||
|
|
||||||
<select id="selectStationGunDeviceTreeByParams" resultType="map">
|
<select id="selectStationGunDeviceTreeByParams" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
s.`name` as 'stationName',
|
d1.device_id as 'id',
|
||||||
d1.device_id as 'deviceId',
|
d1.device_name as 'name',
|
||||||
d1.device_name as 'deviceName',
|
d1.device_type as 'type',
|
||||||
d1.device_type as 'deviceType',
|
d1.serial_number as 'serialNumber',
|
||||||
d1.serial_number as 'deviceSerialNumber',
|
d1.brand_model as 'brandModel',
|
||||||
d1.brand_model as 'deviceBrandModel',
|
d1.current_type as 'currentType',
|
||||||
d1.current_type as 'deviceCurrentType',
|
d1.sorted as 'sorted'
|
||||||
d1.sorted as 'deviceSorted'
|
|
||||||
from xhpc_station_device d1
|
from xhpc_station_device d1
|
||||||
LEFT JOIN xhpc_work_station s on s.work_station_id=d1.station_id
|
LEFT JOIN xhpc_work_station s on s.work_station_id=d1.station_id
|
||||||
WHERE s.del_flag=0 and d1.del_flag=0
|
WHERE s.del_flag=0 and d1.del_flag=0
|
||||||
@ -113,12 +112,23 @@
|
|||||||
<if test="params.stationName!=null and params.stationName != ''">
|
<if test="params.stationName!=null and params.stationName != ''">
|
||||||
and s.name like concat('%', #{params.stationName}, '%')
|
and s.name like concat('%', #{params.stationName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.stationId!=null and params.stationId != ''">
|
||||||
|
and d1.station_id =#{params.stationId}
|
||||||
|
</if>
|
||||||
<if test="params.terminalName!=null and params.terminalName!=''">
|
<if test="params.terminalName!=null and params.terminalName!=''">
|
||||||
and d1.device_name like concat('%', #{params.terminalName},'%')
|
and d1.device_name like concat('%', #{params.terminalName},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.tenantId!=null and params.tenantId!=''">
|
<if test="params.tenantId!=null and params.tenantId!=''">
|
||||||
and s.tenant_id=#{params.tenantId}
|
and s.tenant_id=#{params.tenantId}
|
||||||
</if>
|
</if>
|
||||||
|
<choose>
|
||||||
|
<when test="params.parentDeviceId!=null and params.parentDeviceId!=''">
|
||||||
|
and d1.parent_device_id=#{params.parentDeviceId}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and d1.parent_device_id is null
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
order by d1.station_id, d1.device_type, d1.sorted
|
order by d1.station_id, d1.device_type, d1.sorted
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -163,17 +173,15 @@
|
|||||||
|
|
||||||
<select id="selectStationGunDeviceTreeByParent" resultType="map">
|
<select id="selectStationGunDeviceTreeByParent" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
s.`name` as 'stationName',
|
d1.device_id as 'id',
|
||||||
d1.device_id as 'deviceId',
|
d1.device_name as 'name',
|
||||||
d1.device_name as 'deviceName',
|
d1.device_type as 'type',
|
||||||
d1.device_type as 'deviceType',
|
d1.serial_number as 'serialNumber',
|
||||||
d1.serial_number as 'deviceSerialNumber',
|
d1.brand_model as 'brandModel',
|
||||||
d1.brand_model as 'deviceBrandModel',
|
d1.current_type as 'currentType',
|
||||||
d1.current_type as 'deviceCurrentType',
|
d1.sorted as 'sorted'
|
||||||
d1.sorted as 'deviceSorted'
|
|
||||||
from xhpc_station_device d1
|
from xhpc_station_device d1
|
||||||
LEFT JOIN xhpc_work_station s on s.work_station_id=d1.station_id
|
WHERE d1.del_flag=0
|
||||||
WHERE s.del_flag=0 and d1.del_flag=0
|
|
||||||
and d1.parent_device_id=#{parentDeviceId}
|
and d1.parent_device_id=#{parentDeviceId}
|
||||||
order by d1.device_type, d1.sorted
|
order by d1.device_type, d1.sorted
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
<select id="selectMapListByParams" resultType="map">
|
<select id="selectMapListByParams" resultType="map">
|
||||||
select
|
select
|
||||||
work_station_id as 'workStationId',
|
work_station_id as 'id',
|
||||||
name as 'name',
|
name as 'name',
|
||||||
type as 'type',
|
type as 'type',
|
||||||
address as 'address',
|
address as 'address',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user