@@ -0,0 +1,106 @@
|
||||
|
||||
package org.nl.acs.stage.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.stage.service.NewStageActorService;
|
||||
import org.nl.acs.stage.service.dto.StageActorDto;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author jlm
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台演员管理")
|
||||
@RequestMapping("/api/new/stageActor")
|
||||
@Slf4j
|
||||
public class NewStageActorController {
|
||||
|
||||
private final NewStageActorService stageActorService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询舞台演员")
|
||||
@ApiOperation("查询舞台演员")
|
||||
//@PreAuthorize("@el.check('stageActor:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(stageActorService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增舞台演员")
|
||||
@ApiOperation("新增舞台演员")
|
||||
//@PreAuthorize("@el.check('stageActor:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StageActorDto dto) {
|
||||
stageActorService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改舞台演员")
|
||||
@ApiOperation("修改舞台演员")
|
||||
//@PreAuthorize("@el.check('stageActor:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StageActorDto dto) {
|
||||
stageActorService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除舞台演员")
|
||||
@ApiOperation("删除舞台演员")
|
||||
//@PreAuthorize("@el.check('stageActor:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
stageActorService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出舞台演员")
|
||||
@ApiOperation("导出舞台演员")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('stageActor:list')")
|
||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
stageActorService.download(stageActorService.queryAll(whereJson), response);
|
||||
}
|
||||
|
||||
@PostMapping("/saveData")
|
||||
@Log("保存舞台演员")
|
||||
@ApiOperation("修改舞台演员")
|
||||
//@PreAuthorize("@el.check('stageActor:edit')")
|
||||
public ResponseEntity<Object> saveData(@RequestBody Map map) throws IOException {
|
||||
String stage_code = (String) map.get("stage_code");
|
||||
String grid_width = String.valueOf(map.get("grid_width"));
|
||||
String grid_length = String.valueOf(map.get("grid_length"));
|
||||
JSONArray actors = JSONArray.parseArray(JSON.toJSONString(map.get("list")));
|
||||
JSONObject mstForm = new JSONObject();
|
||||
mstForm.put("stage_code", stage_code);
|
||||
mstForm.put("grid_width", grid_width);
|
||||
mstForm.put("grid_length", grid_length);
|
||||
stageActorService.saveData(mstForm, actors);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@GetMapping("/queryStageActor/{stage_code}")
|
||||
@Log("查询舞台演员")
|
||||
@ApiOperation("查询舞台演员")
|
||||
//@PreAuthorize("@el.check('stageActor:list')")
|
||||
public ResponseEntity<Object> queryStageActor(@PathVariable String stage_code) throws Exception {
|
||||
return new ResponseEntity<>(stageActorService.queryStageActorByStageCode(stage_code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
package org.nl.acs.stage.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.stage.service.NewStageService;
|
||||
import org.nl.acs.stage.service.dto.StageDto;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台管理")
|
||||
@RequestMapping("/api/new/stage")
|
||||
@Slf4j
|
||||
public class NewStageController {
|
||||
|
||||
private final NewStageService stageService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询舞台")
|
||||
@ApiOperation("查询舞台")
|
||||
//@PreAuthorize("@el.check('stage:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(stageService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增舞台")
|
||||
@ApiOperation("新增舞台")
|
||||
//@PreAuthorize("@el.check('stage:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StageDto dto) {
|
||||
stageService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改舞台")
|
||||
@ApiOperation("修改舞台")
|
||||
//@PreAuthorize("@el.check('stage:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StageDto dto) {
|
||||
stageService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除舞台")
|
||||
@ApiOperation("删除舞台")
|
||||
//@PreAuthorize("@el.check('stage:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
stageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出舞台")
|
||||
@ApiOperation("导出舞台")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('stage:list')")
|
||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
stageService.download(stageService.queryAll(whereJson), response);
|
||||
}
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选舞台")
|
||||
@ApiOperation("下拉选舞台")
|
||||
//@PreAuthorize("@el.check('routePlan:list')")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageService.selectList(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
package org.nl.acs.stage.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.stage.service.NewStageImageService;
|
||||
import org.nl.acs.stage.service.dto.StageImageDto;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @date 2021-04-06
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台管理")
|
||||
@RequestMapping("/api/new/stageImage")
|
||||
@Slf4j
|
||||
public class NewStageImageController {
|
||||
|
||||
private final NewStageImageService stageImageService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询舞台")
|
||||
@ApiOperation("查询舞台")
|
||||
//@PreAuthorize("@el.check('stageImage:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(stageImageService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增舞台")
|
||||
@ApiOperation("新增舞台")
|
||||
//@PreAuthorize("@el.check('stageImage:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StageImageDto dto) {
|
||||
stageImageService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改舞台")
|
||||
@ApiOperation("修改舞台")
|
||||
//@PreAuthorize("@el.check('stageImage:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StageImageDto dto) {
|
||||
stageImageService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除舞台")
|
||||
@ApiOperation("删除舞台")
|
||||
//@PreAuthorize("@el.check('stageImage:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
stageImageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出舞台")
|
||||
@ApiOperation("导出舞台")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('stageImage:list')")
|
||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
stageImageService.download(stageImageService.queryAll(whereJson), response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.acs.stage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.opc.Device;
|
||||
|
||||
|
||||
public interface IDriverService {
|
||||
/**
|
||||
* 获取设备监控信息
|
||||
* @param device
|
||||
* @return
|
||||
*/
|
||||
JSONObject getDeviceInfo(Device device);
|
||||
|
||||
/**
|
||||
* 获取db值
|
||||
*/
|
||||
Integer getDbValue(Device device,String dbName);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
|
||||
package org.nl.acs.stage.service;
|
||||
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.stage.service.dto.StageActorDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务接口
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
public interface NewStageActorService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<StageActorDto>
|
||||
*/
|
||||
List<StageActorDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param actor_uuid ID
|
||||
* @return StageActor
|
||||
*/
|
||||
StageActorDto findById(String actor_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return StageActor
|
||||
*/
|
||||
StageActorDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(StageActorDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(StageActorDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<StageActorDto> dtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 舞台编辑时候保存数据
|
||||
*
|
||||
* @param mstForm 舞台编码
|
||||
* @param array 舞台演员明细
|
||||
* @throws IOException
|
||||
*/
|
||||
void saveData(JSONObject mstForm, JSONArray array) throws IOException;
|
||||
|
||||
/**
|
||||
* 根据舞台编码查询舞台演员
|
||||
*
|
||||
* @param stage_code 舞台编码
|
||||
* @return
|
||||
*/
|
||||
JSONObject queryStageActorByStageCode(String stage_code) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
package org.nl.acs.stage.service;
|
||||
|
||||
import org.nl.acs.stage.service.dto.StageImageDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @description 服务接口
|
||||
* @date 2021-04-06
|
||||
**/
|
||||
public interface NewStageImageService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<StageImageDto>
|
||||
*/
|
||||
List<StageImageDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param image_uuid ID
|
||||
* @return StageImage
|
||||
*/
|
||||
StageImageDto findById(String image_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return StageImage
|
||||
*/
|
||||
StageImageDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(StageImageDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(StageImageDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<StageImageDto> dtos, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
package org.nl.acs.stage.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.acs.stage.service.dto.StageDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务接口
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
public interface NewStageService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<StageDto>
|
||||
*/
|
||||
List<StageDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param stage_uuid ID
|
||||
* @return Stage
|
||||
*/
|
||||
StageDto findById(String stage_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Stage
|
||||
*/
|
||||
StageDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(StageDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(StageDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<StageDto> dtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* 前端舞台下拉选列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectList();
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.nl.acs.stage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description /
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
@Data
|
||||
public class StageActorDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 图标标识
|
||||
*/
|
||||
private String actor_uuid;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 图标名字
|
||||
*/
|
||||
private String device_name;
|
||||
|
||||
/**
|
||||
* 图标名字
|
||||
*/
|
||||
private String image_name;
|
||||
|
||||
/**
|
||||
* 图标名字
|
||||
*/
|
||||
private String angle;
|
||||
|
||||
/**
|
||||
* 舞台标识
|
||||
*/
|
||||
private String stage_uuid;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 数组下标
|
||||
*/
|
||||
private BigDecimal index_seq;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.acs.stage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description /
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
@Data
|
||||
public class StageDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 舞台标识
|
||||
*/
|
||||
private String stage_uuid;
|
||||
|
||||
/**
|
||||
* 舞台编码
|
||||
*/
|
||||
private String stage_code;
|
||||
|
||||
/**
|
||||
* 舞台名字
|
||||
*/
|
||||
private String stage_name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.acs.stage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @description /
|
||||
* @date 2021-04-06
|
||||
**/
|
||||
@Data
|
||||
public class StageImageDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 设备标识
|
||||
*/
|
||||
private String image_uuid;
|
||||
|
||||
/**
|
||||
* 设备名字
|
||||
*/
|
||||
private String image_name;
|
||||
|
||||
/**
|
||||
* 适用驱动
|
||||
*/
|
||||
private String driver_code_json;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 图标编码
|
||||
*/
|
||||
private String image_code;
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
|
||||
package org.nl.acs.stage.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.StorageCellService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.stage.service.NewStageActorService;
|
||||
import org.nl.acs.stage.service.dto.StageActorDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.BindException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务实现
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class NewStageActorServiceImpl implements NewStageActorService {
|
||||
private final RedisUtils redisUtils;
|
||||
private final StorageCellService storageCellService;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StageActorDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<StageActorDto> list = arr.toJavaList(StageActorDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageActorDto findById(String actor_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
JSONObject json = wo.query("actor_uuid ='" + actor_uuid + "'").uniqueResult(0);
|
||||
final StageActorDto obj = json.toJavaObject(StageActorDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageActorDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final StageActorDto obj = json.toJavaObject(StageActorDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(StageActorDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setActor_uuid(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StageActorDto dto) {
|
||||
StageActorDto entity = this.findById(dto.getActor_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
|
||||
for (String actor_uuid : ids) {
|
||||
wo.delete("actor_uuid = '" + actor_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<StageActorDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (StageActorDto stageActor : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("设备编码", stageActor.getDevice_code());
|
||||
map.put("图标名字", stageActor.getDevice_name());
|
||||
map.put("图标名字", stageActor.getImage_name());
|
||||
map.put("图标名字", stageActor.getAngle());
|
||||
map.put("舞台标识", stageActor.getStage_uuid());
|
||||
map.put("备注", stageActor.getRemark());
|
||||
map.put("是否启用", stageActor.getIs_active());
|
||||
map.put("是否删除", stageActor.getIs_delete());
|
||||
map.put("创建者", stageActor.getCreate_by());
|
||||
map.put("创建时间", stageActor.getCreate_time());
|
||||
map.put("修改者", stageActor.getUpdate_by());
|
||||
map.put("修改时间", stageActor.getUpdate_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(JSONObject mstForm, JSONArray array) throws IOException {
|
||||
String stage_code = mstForm.getString("stage_code");
|
||||
String grid_width = mstForm.getString("grid_width");
|
||||
String grid_length = mstForm.getString("grid_length");
|
||||
//舞台主表【acs_stage】
|
||||
WQLObject stageTab = WQLObject.getWQLObject("acs_stage");
|
||||
JSONObject stageObj = stageTab.query("is_delete ='0' and stage_code = '" + stage_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNull(stageObj)) {
|
||||
throw new BindException("舞台为找到,操作失败!");
|
||||
}
|
||||
stageObj.put("grid_width", grid_width);
|
||||
stageObj.put("grid_length", grid_length);
|
||||
stageTab.update(stageObj);
|
||||
//舞台实时监控表【acs_stage_actor】
|
||||
WQLObject actorTab = WQLObject.getWQLObject("acs_stage_actor");
|
||||
|
||||
String stage_uuid = stageObj.getString("stage_uuid");
|
||||
actorTab.delete("stage_uuid = '" + stage_uuid + "'");
|
||||
JSONArray actors = new JSONArray();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject json = array.getJSONObject(i);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("actor_uuid", IdUtil.simpleUUID());
|
||||
param.put("device_code", json.getString("device_code"));
|
||||
param.put("device_name", json.getString("name"));
|
||||
param.put("image_name", json.getString("img2"));
|
||||
param.put("index_seq", json.getString("index"));
|
||||
param.put("angle", json.getString("angle"));
|
||||
param.put("stage_uuid", stage_uuid);
|
||||
actors.add(param);
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
param.put("create_by", currentUsername);
|
||||
param.put("create_time", now);
|
||||
param.put("update_by", currentUsername);
|
||||
param.put("update_time", now);
|
||||
|
||||
|
||||
actorTab.insert(param);
|
||||
}
|
||||
|
||||
redisUtils.del("stage:mst:" + stage_code);
|
||||
redisUtils.del("stage:dtl:" + stage_code);
|
||||
redisUtils.set("stage:mst:" + stage_code, stageObj.toString());
|
||||
redisUtils.set("stage:dtl:" + stage_code, actors.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryStageActorByStageCode(String stage_code) throws Exception {
|
||||
//舞台主表【acs_stage】
|
||||
WQLObject stageTab = WQLObject.getWQLObject("acs_stage");
|
||||
|
||||
JSONObject stageObj;
|
||||
//先从缓存查找
|
||||
stageObj = JSON.parseObject(redisUtils.get("stage:mst:" + stage_code) == null ? (String) redisUtils.get("stage:mst:" + stage_code) : redisUtils.get("stage:mst:" + stage_code).toString());
|
||||
//缓存没找到去数据库查找
|
||||
if (MapUtil.isEmpty(stageObj)) {
|
||||
stageObj = stageTab.query("is_delete ='0' and stage_code = '" + stage_code + "'").uniqueResult(0);
|
||||
}
|
||||
|
||||
if (MapUtil.isEmpty(stageObj)) {
|
||||
throw new BindException("舞台为找到,操作失败!");
|
||||
}
|
||||
//舞台实时监控表【acs_stage_actor】
|
||||
WQLObject actorTab = WQLObject.getWQLObject("acs_stage_actor");
|
||||
|
||||
String stage_uuid = stageObj.getString("stage_uuid");
|
||||
|
||||
JSONArray arr = new JSONArray();
|
||||
JSONArray list = new JSONArray();
|
||||
|
||||
String dtl = (String) redisUtils.get("stage:dtl:" + stage_code);
|
||||
if (StrUtil.isNotEmpty(dtl)) {
|
||||
list = JSONArray.parseArray(dtl);
|
||||
}
|
||||
if (ObjectUtil.isNull(list) || list.size() < 1) {
|
||||
list = actorTab.query("stage_uuid = '" + stage_uuid + "'", "index_seq").getResultJSONArray(0);
|
||||
}
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
for (int i = 0, j = list.size(); i < j; i++) {
|
||||
JSONObject json = list.getJSONObject(i);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("id", json.getInteger("index"));
|
||||
obj.put("index", json.getInteger("index_seq"));
|
||||
obj.put("device_code", json.getString("device_code"));
|
||||
String device_code = json.getString("device_code");
|
||||
if (!StrUtil.isEmpty(device_code)) {
|
||||
if (!StrUtil.isEmpty(json.getString("device_code")) || json.getString("device_code").length() > 0) {
|
||||
JSONObject jo = new JSONObject();
|
||||
Device device = appService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isNull(device)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (ObjectUtil.isNotEmpty(device.getDeviceDriver())) {
|
||||
//
|
||||
//// IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
|
||||
// obj.put("device_name", device.getDevice_name());
|
||||
//// jo = driverService.getDeviceInfo(device);
|
||||
//
|
||||
// }
|
||||
if (device.getDeviceDriver() instanceof DeviceStageMonitor) {
|
||||
DeviceStageMonitor monitorService = (DeviceStageMonitor) device.getDeviceDriver();
|
||||
jo = monitorService.getDeviceStatusName();
|
||||
}
|
||||
obj.put("data", jo);
|
||||
}
|
||||
}
|
||||
obj.put("img2", json.getString("image_name"));
|
||||
obj.put("angle", json.getString("angle"));
|
||||
arr.add(obj);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("form", stageObj);
|
||||
result.put("detail", arr);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
|
||||
package org.nl.acs.stage.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.stage.service.NewStageImageService;
|
||||
import org.nl.acs.stage.service.dto.StageImageDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @description 服务实现
|
||||
* @date 2021-04-06
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class NewStageImageServiceImpl implements NewStageImageService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = "1=1";
|
||||
if (whereJson.get("device_type") != null) {
|
||||
where = "driver_code_json like ('%" + whereJson.get("device_type") + "%')";
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StageImageDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<StageImageDto> list = arr.toJavaList(StageImageDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageImageDto findById(String image_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
JSONObject json = wo.query("image_uuid ='" + image_uuid + "'").uniqueResult(0);
|
||||
final StageImageDto obj = json.toJavaObject(StageImageDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageImageDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final StageImageDto obj = json.toJavaObject(StageImageDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(StageImageDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setImage_uuid(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StageImageDto dto) {
|
||||
StageImageDto entity = this.findById(dto.getImage_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
|
||||
for (String image_uuid : ids) {
|
||||
wo.delete("image_uuid = '" + image_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<StageImageDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (StageImageDto stageImage : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("设备名字", stageImage.getImage_name());
|
||||
map.put("适用驱动", stageImage.getDriver_code_json());
|
||||
map.put("备注", stageImage.getRemark());
|
||||
map.put("是否启用", stageImage.getIs_active());
|
||||
map.put("是否删除", stageImage.getIs_delete());
|
||||
map.put("创建者", stageImage.getCreate_by());
|
||||
map.put("创建时间", stageImage.getCreate_time());
|
||||
map.put("修改者", stageImage.getUpdate_by());
|
||||
map.put("修改时间", stageImage.getUpdate_time());
|
||||
map.put("图标编码", stageImage.getImage_code());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
|
||||
package org.nl.acs.stage.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.stage.service.NewStageService;
|
||||
import org.nl.acs.stage.service.dto.StageDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务实现
|
||||
* @date 2021-04-12
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class NewStageServiceImpl implements NewStageService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StageDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<StageDto> list = JSONObject.parseArray(arr.toJSONString(), StageDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageDto findById(String stage_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
JSONObject json = wo.query("stage_uuid ='" + stage_uuid + "'").uniqueResult(0);
|
||||
final StageDto obj = json.toJavaObject(StageDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final StageDto obj = json.toJavaObject(StageDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(StageDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setStage_uuid(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StageDto dto) {
|
||||
StageDto entity = this.findById(dto.getStage_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_stage");
|
||||
for (String stage_uuid : ids) {
|
||||
wo.delete("stage_uuid = '" + stage_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<StageDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (StageDto stage : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("舞台编码", stage.getStage_code());
|
||||
map.put("舞台名字", stage.getStage_name());
|
||||
map.put("备注", stage.getRemark());
|
||||
map.put("是否启用", stage.getIs_active());
|
||||
map.put("是否删除", stage.getIs_delete());
|
||||
map.put("创建者", stage.getCreate_by());
|
||||
map.put("创建时间", stage.getCreate_time());
|
||||
map.put("修改者", stage.getUpdate_by());
|
||||
map.put("修改时间", stage.getUpdate_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray selectList() {
|
||||
//设备基础信息表【acs_stage】
|
||||
JSONArray arr = WQLObject.getWQLObject("acs_stage").query("is_delete= '0' AND is_active= '1'").getResultJSONArray(0);
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("stage_id", obj.getString("stage_id"));
|
||||
json.put("stage_code", obj.getString("stage_code"));
|
||||
json.put("stage_name", obj.getString("stage_name"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package org.nl.acs.stage.service.utils;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.nl.acs.device.service.dto.StorageCellDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class StageActorUtil {
|
||||
|
||||
public static String getMode(int mode){
|
||||
if (mode == 1){
|
||||
return "联机";
|
||||
}
|
||||
return "未联机";
|
||||
}
|
||||
|
||||
public static String getMode(int mode,int i){
|
||||
if (mode == 0) {
|
||||
return "未联机";
|
||||
} else if (mode == 1) {
|
||||
return "单机";
|
||||
} else if (mode == 2) {
|
||||
return "联机";
|
||||
} else if (mode == 3) {
|
||||
return "运行中";
|
||||
} else if (mode == 4) {
|
||||
return "申请叫料";
|
||||
} else if (mode == 5) {
|
||||
return "申请空盘";
|
||||
} else if (mode == 6) {
|
||||
return "空盘入库";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getMove(int move){
|
||||
if (move == 0){
|
||||
return "无货";
|
||||
} else if (move == 1){
|
||||
return "有货";
|
||||
}
|
||||
return "有托盘有货";
|
||||
}
|
||||
|
||||
public static String getCacheMove(int move){
|
||||
if (move == 0){
|
||||
return "无货";
|
||||
} else if (move == 1) {
|
||||
return "空料斗";
|
||||
}
|
||||
return "满料斗";
|
||||
}
|
||||
|
||||
public static Boolean getIsOnline(int mode){
|
||||
if (mode == 0){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getHasGoods(int move){
|
||||
if (move == 0){
|
||||
return 0;
|
||||
} else if (move == 2){
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int getHasGoods(int move, int empty){
|
||||
if (move == 0){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static String getAddress(StorageCellDto storageCellDto){
|
||||
if (ObjectUtil.isNotEmpty(storageCellDto)){
|
||||
return storageCellDto.getStorage_code();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getRequireSucess(Boolean requireSucess){
|
||||
if (requireSucess == false){
|
||||
return "0";
|
||||
}
|
||||
return "1";
|
||||
}
|
||||
|
||||
public static String getRequestSucess(Boolean requireSucess){
|
||||
if (requireSucess == false){
|
||||
return "否";
|
||||
}
|
||||
return "是";
|
||||
}
|
||||
|
||||
public static String getIsOrNo(int i){
|
||||
if (i == 0){
|
||||
return "否";
|
||||
}
|
||||
return "是";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
[交易说明]
|
||||
交易名: 根据设备查询舞台编码
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
//设备编码
|
||||
输入.device_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
stage_code
|
||||
FROM
|
||||
acs_stage
|
||||
WHERE
|
||||
stage_uuid IN (
|
||||
SELECT
|
||||
stage_uuid
|
||||
FROM
|
||||
acs_stage_actor
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.device_code <> ""
|
||||
device_code = 输入.device_code
|
||||
ENDOPTION
|
||||
)
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user