diff --git a/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/controller/WorkStationController.java b/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/controller/WorkStationController.java index b03116ff..c533aeb9 100644 --- a/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/controller/WorkStationController.java +++ b/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/controller/WorkStationController.java @@ -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 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 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 util = new ExcelUtil(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 params = new HashMap<>(); params.put("tenantId", logUser.getTenantId()); return R.ok(userService.getDeptAndUserByMap(params)); } + } diff --git a/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkOrderServiceImpl.java b/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkOrderServiceImpl.java index 656f171b..8bd576e2 100644 --- a/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkOrderServiceImpl.java +++ b/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkOrderServiceImpl.java @@ -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 userDomains = new ArrayList<>(); if(domain.getUserList() != null){ - List 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 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); diff --git a/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkStationServiceImpl.java b/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkStationServiceImpl.java index 3a29cde4..a6137581 100644 --- a/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkStationServiceImpl.java +++ b/xhpc-modules/xhpc-workorder/src/main/java/com/xhpc/workorder/service/impl/WorkStationServiceImpl.java @@ -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> stationDomainList = stationMapper.selectMapListByParams(stationParams); for (Map 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> resultData = deviceMapper.selectStationGunDeviceTreeByParams(params); for (Map resultMap: resultData){ - List> childData = deviceMapper.selectStationGunDeviceTreeByParent(resultMap.get("deviceId").toString()); + List> childData = deviceMapper.selectStationGunDeviceTreeByParent(resultMap.get("id").toString()); if(childData != null){ resultMap.put("children", childData); } } + stationMap.put("children", resultData); } - - - - return stationDomainList; } diff --git a/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcStationDeviceMapper.xml b/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcStationDeviceMapper.xml index 008c4899..e4e881e7 100644 --- a/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcStationDeviceMapper.xml +++ b/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcStationDeviceMapper.xml @@ -96,14 +96,13 @@ @@ -163,17 +173,15 @@ diff --git a/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcWorkStationMapper.xml b/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcWorkStationMapper.xml index eba91709..b27b8026 100644 --- a/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcWorkStationMapper.xml +++ b/xhpc-modules/xhpc-workorder/src/main/resources/mapper/XhpcWorkStationMapper.xml @@ -62,7 +62,7 @@