图形化-设备监控
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package org.nl.modules.logicflow.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.modules.logicflow.service.StageService;
|
||||
import org.nl.modules.logicflow.service.dto.StageDto;
|
||||
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 java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 舞台管理
|
||||
* @Date: 2022-07-29 10:49
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台管理")
|
||||
@RequestMapping("/api/stage")
|
||||
@Slf4j
|
||||
public class StageController {
|
||||
private final StageService 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);
|
||||
}
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选舞台")
|
||||
@ApiOperation("下拉选舞台")
|
||||
//@PreAuthorize("@el.check('routePlan:list')")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageService.selectList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/addNewStage")
|
||||
@Log("保存舞台数据")
|
||||
@ApiOperation("保存舞台数据")
|
||||
public ResponseEntity<Object> addNewStage(@Validated @RequestBody StageDto dto) {
|
||||
log.info("dto{}",dto);
|
||||
stageService.addNewStage(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/getNewStageDataByCode")
|
||||
@Log("根据stage_code获取舞台数据")
|
||||
@ApiOperation("根据stage_code获取舞台数据")
|
||||
public ResponseEntity<Object> getNewStageDataByCode(@RequestBody String code) {
|
||||
return new ResponseEntity<>(stageService.findByCode(code), HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.nl.modules.logicflow.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.modules.logicflow.service.StageImageService;
|
||||
import org.nl.modules.logicflow.service.dto.StageImageDto;
|
||||
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 java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 舞台图标控制层
|
||||
* @Date: 2022-07-29
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "舞台管理")
|
||||
@RequestMapping("/api/stageImage")
|
||||
@Slf4j
|
||||
public class StageImageController {
|
||||
private final StageImageService 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);
|
||||
}
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选设备图标")
|
||||
@ApiOperation("下拉选设备图标")
|
||||
//@PreAuthorize("@el.check('routePlan:list')")
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(stageImageService.selectList(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.modules.logicflow.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.modules.logicflow.service.dto.StageImageDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 舞台图标的服务层
|
||||
* @Date: 2022-07-29
|
||||
*/
|
||||
public interface StageImageService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(StageImageDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(StageImageDto dto);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param image_uuid ID
|
||||
* @return StageImage
|
||||
*/
|
||||
StageImageDto findById(String image_uuid);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 前端舞台编辑选择设备图标下拉选列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectList();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.modules.logicflow.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.modules.logicflow.service.dto.StageDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2022-07-29 10:50
|
||||
*/
|
||||
public interface StageService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(StageDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(StageDto dto);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param stage_uuid ID
|
||||
* @return Stage
|
||||
*/
|
||||
StageDto findById(String stage_uuid);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 前端舞台下拉选列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectList();
|
||||
|
||||
/**
|
||||
* 新增舞台信息
|
||||
* 将数据保存到remark---保存数据
|
||||
* @param dto
|
||||
*/
|
||||
void addNewStage(StageDto dto);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Stage
|
||||
*/
|
||||
StageDto findByCode(String code);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.modules.logicflow.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 舞台数据的Dto
|
||||
* @Date: 2022-07-29 13:28
|
||||
*/
|
||||
@Data
|
||||
public class StageDto implements Serializable {
|
||||
/**
|
||||
* 舞台标识
|
||||
*/
|
||||
private String stage_uuid;
|
||||
|
||||
/**
|
||||
* 舞台编码
|
||||
*/
|
||||
private String stage_code;
|
||||
|
||||
/**
|
||||
* 舞台名字
|
||||
*/
|
||||
private String stage_name;
|
||||
|
||||
/**
|
||||
* 舞台数据
|
||||
*/
|
||||
private String stage_data;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
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,68 @@
|
||||
package org.nl.modules.logicflow.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 设备图标dto
|
||||
* @Date: 2022-07-29
|
||||
*/
|
||||
@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,110 @@
|
||||
package org.nl.modules.logicflow.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.exception.BadRequestException;
|
||||
import org.nl.modules.logicflow.service.StageImageService;
|
||||
import org.nl.modules.logicflow.service.dto.StageImageDto;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 舞台图标的服务实现
|
||||
* @Date: 2022-07-29
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class StageImageServiceImpl implements StageImageService {
|
||||
@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("stage_image");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@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("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("stage_image");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageImageDto findById(String image_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("stage_image");
|
||||
JSONObject json = wo.query("image_uuid ='" + image_uuid + "'").uniqueResult(0);
|
||||
final StageImageDto obj = json.toJavaObject(StageImageDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("stage_image");
|
||||
for (String image_uuid : ids) {
|
||||
wo.delete("image_uuid = '" + image_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray selectList() {
|
||||
//设备基础信息表【acs_stage_image】
|
||||
JSONArray arr = WQLObject.getWQLObject("stage_image").query("is_delete= '0' AND is_active= '1'", "update_time desc").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("image_uuid", obj.getString("image_uuid"));
|
||||
json.put("image_code", obj.getString("image_code"));
|
||||
json.put("image_name", obj.getString("image_code").toString().split("-")[0]);
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package org.nl.modules.logicflow.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.exception.BadRequestException;
|
||||
import org.nl.modules.logicflow.service.StageService;
|
||||
import org.nl.modules.logicflow.service.dto.StageDto;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2022-07-29 10:51
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class StageServiceImpl implements StageService {
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
log.info("分页查找");
|
||||
WQLObject wo = WQLObject.getWQLObject("stage");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@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("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("stage");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageDto findById(String stage_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("stage");
|
||||
JSONObject json = wo.query("stage_uuid ='" + stage_uuid + "'").uniqueResult(0);
|
||||
final StageDto obj = json.toJavaObject(StageDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("stage");
|
||||
for (String stage_uuid : ids) {
|
||||
wo.delete("stage_uuid = '" + stage_uuid + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray selectList() {
|
||||
//设备基础信息表【stage】
|
||||
JSONArray arr = WQLObject.getWQLObject("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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewStage(StageDto dto) {
|
||||
// 根据dto的code找到数据
|
||||
StageDto stageDto = this.findByCode(dto.getStage_code());
|
||||
// 设置内容
|
||||
stageDto.setStage_data(dto.getStage_data());
|
||||
// 获取当前用户与时间
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
stageDto.setUpdate_time(now);
|
||||
stageDto.setUpdate_by(currentUsername);
|
||||
System.out.println(stageDto);
|
||||
WQLObject wo = WQLObject.getWQLObject("stage");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(stageDto);
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("stage");
|
||||
JSONObject json = wo.query("stage_code ='" + code + "'").uniqueResult(0);
|
||||
final StageDto obj = json.toJavaObject(StageDto.class);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -75,4 +75,11 @@ public class ParamController {
|
||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
paramService.download(paramService.queryAll(whereJson), response);
|
||||
}
|
||||
|
||||
@PostMapping("/getStageCodeByCode")
|
||||
@Log("根据编码获取舞台编码")
|
||||
@ApiOperation("根据编码获取舞台编码")
|
||||
public ResponseEntity<Object> getStageCodeByCode(@RequestBody String code) {
|
||||
return new ResponseEntity<>(paramService.findByCode(code), HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user