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