Merge remote-tracking branch 'origin/dev' into dev_
3 files deleted
11 files modified
| | |
| | | import com.moral.api.pojo.form.sysDictType.SysDictTypeDeleteForm; |
| | | import com.moral.api.pojo.form.sysDictType.SysDictTypeInsertForm; |
| | | import com.moral.api.pojo.form.sysDictType.SysDictTypeUpdateForm; |
| | | import com.moral.api.pojo.vo.sysDictData.SysDictDataDeleteVO; |
| | | import com.moral.api.pojo.vo.sysDictData.SysDictDataInsertVO; |
| | | import com.moral.api.pojo.vo.sysDictData.SysDictDataUpdateVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeDeleteVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeInsertVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeQueryVO; |
| | |
| | | //处理插入业务 |
| | | SysDictDataDTO dto = sysDictDataService.insertData(form); |
| | | |
| | | //转换前端所需参数 |
| | | SysDictDataInsertVO vo = SysDictDataInsertVO.convert(dto); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), vo); |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), null); |
| | | } |
| | | |
| | | @PostMapping("data/update") |
| | |
| | | //处理更新业务 |
| | | SysDictDataDTO dto = sysDictDataService.updateData(form); |
| | | |
| | | //转换前端所需参数 |
| | | SysDictDataUpdateVO vo = SysDictDataUpdateVO.convert(dto); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), vo); |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), null); |
| | | } |
| | | |
| | | @PostMapping("data/delete") |
| | |
| | | //处理删除业务 |
| | | SysDictDataDTO dto = sysDictDataService.deleteData(form); |
| | | |
| | | //转换前端所需参数 |
| | | SysDictDataDeleteVO vo = SysDictDataDeleteVO.convert(dto); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), vo); |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), null); |
| | | } |
| | | |
| | | @GetMapping("type/query") |
| | |
| | | //处理插入业务 |
| | | SysDictTypeDTO dto = sysDictTypeService.insertType(form); |
| | | |
| | | //转换前端所需参数 |
| | | SysDictTypeInsertVO vo = SysDictTypeInsertVO.convert(dto); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), vo); |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(),null); |
| | | } |
| | | |
| | | @PostMapping("type/update") |
| | |
| | | |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.pojo.dto.manageLog.ManageLogQueryDTO; |
| | | import com.moral.api.pojo.dto.sysDictData.SysDictDataDTO; |
| | | import com.moral.api.pojo.dto.sysDictType.SysDictTypeDTO; |
| | | import com.moral.api.pojo.dto.sysDictType.SysDictTypeQueryDTO; |
| | | import com.moral.api.pojo.form.sysDictData.SysDictDataDeleteForm; |
| | | import com.moral.api.pojo.form.sysDictData.SysDictDataInsertForm; |
| | | import com.moral.api.pojo.form.sysDictData.SysDictDataUpdateForm; |
| | | import com.moral.api.pojo.form.sysDictType.SysDictTypeDeleteForm; |
| | | import com.moral.api.pojo.form.sysDictType.SysDictTypeInsertForm; |
| | | import com.moral.api.pojo.form.sysDictType.SysDictTypeUpdateForm; |
| | | |
| | | import com.moral.api.pojo.form.manageLog.*; |
| | | import com.moral.api.pojo.vo.sysDictData.SysDictDataDeleteVO; |
| | | import com.moral.api.pojo.vo.sysDictData.SysDictDataInsertVO; |
| | | import com.moral.api.pojo.vo.sysDictData.SysDictDataUpdateVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeDeleteVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeInsertVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeQueryVO; |
| | | import com.moral.api.pojo.vo.sysDictType.SysDictTypeUpdateVO; |
| | | import com.moral.api.pojo.vo.manageLog.*; |
| | | import com.moral.api.service.ManageLogService; |
| | | import com.moral.api.service.SysAreaService; |
| | | import com.moral.api.service.SysDictDataService; |
| | | import com.moral.api.service.SysDictTypeService; |
| | | |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * @ClassName SystemController |
| | |
| | | @TableField(exist = false) |
| | | private String unitKey; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer maxValue; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer minValue; |
| | | |
| | | } |
| | |
| | | private Integer versionId; |
| | | |
| | | /** |
| | | * 因子code |
| | | * 因子Id |
| | | */ |
| | | private String sensorCode; |
| | | private Integer sensorId; |
| | | |
| | | /** |
| | | * 单位字典key |
| | |
| | | /* |
| | | * 上限值 |
| | | * */ |
| | | private Integer maxValue; |
| | | private Double upper; |
| | | |
| | | /* |
| | | * 下限值 |
| | | * */ |
| | | private Integer minValue; |
| | | private Double lower; |
| | | |
| | | /** |
| | | * 创建时间 |
| | |
| | | private String value; |
| | | |
| | | public boolean valid() { |
| | | if (ObjectUtils.isEmpty(id) || |
| | | ObjectUtils.isEmpty(key) || |
| | | ObjectUtils.isEmpty(value)) |
| | | if (ObjectUtils.isEmpty(id)) |
| | | return false; |
| | | return true; |
| | | } |
| | |
| | | private static SensorVO convertToSensorVO(Sensor sensor) { |
| | | SensorVO vo = new SensorVO(); |
| | | vo.setName(sensor.getName()); |
| | | vo.setCode(sensor.getCode()); |
| | | vo.setId(sensor.getId()); |
| | | vo.setUnit(sensor.getUnit()); |
| | | vo.setMaxValue(sensor.getMaxValue()); |
| | | vo.setMinValue(sensor.getMinValue()); |
| | | vo.setUpper(sensor.getUpper()); |
| | | vo.setLower(sensor.getLower()); |
| | | vo.setUnitKey(sensor.getUnitKey()); |
| | | return vo; |
| | | } |
| | |
| | | * @Version TODO |
| | | **/ |
| | | @Data |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | public class SensorVO { |
| | | private Integer id; |
| | | |
| | |
| | | |
| | | private String unitKey; |
| | | |
| | | private Integer maxValue; |
| | | private Double upper; |
| | | |
| | | private Integer minValue; |
| | | private Double lower; |
| | | |
| | | } |
| | |
| | | content = content+"因子名:"+oldSensor.getName()+"->"+updateSensorMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("code")&&updateSensorMap.get(key)!=null){ |
| | | QueryWrapper<VersionSensorUnit> wrapper_Version = new QueryWrapper<>(); |
| | | /*QueryWrapper<VersionSensorUnit> wrapper_Version = new QueryWrapper<>(); |
| | | wrapper_Version.eq("sensor_code",oldSensor.getCode()); |
| | | wrapper_Version.eq("is_delete","0"); |
| | | VersionSensorUnit versionSensorUnit = new VersionSensorUnit(); |
| | | versionSensorUnit.setSensorCode(updateSensorMap.get(key).toString()); |
| | | versionSensorUnitMapper.update(versionSensorUnit,wrapper_Version); |
| | | versionSensorUnitMapper.update(versionSensorUnit,wrapper_Version);*/ |
| | | content = content+"编号:"+oldSensor.getCode()+"->"+updateSensorMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("desc")&&updateSensorMap.get(key)!=null){ |
| | |
| | | deleteSensor.setIsDelete(Constants.DELETE); |
| | | sensorMapper.update(deleteSensor,wrapper); |
| | | QueryWrapper<VersionSensorUnit> wrapper_Version = new QueryWrapper<>(); |
| | | wrapper_Version.eq("sensor_code",sensor.getCode()); |
| | | wrapper_Version.eq("sensor_id",sensor.getId()); |
| | | wrapper_Version.eq("is_delete","0"); |
| | | VersionSensorUnit versionSensorUnit = new VersionSensorUnit(); |
| | | versionSensorUnit.setIsDelete(Constants.DELETE); |
| | |
| | | SysDictDataDTO dto = new SysDictDataDTO(); |
| | | //取参 |
| | | Integer id = form.getId(); |
| | | //判断是否存在 |
| | | //查询要删除的数据,用于插入日志 |
| | | QueryWrapper existWrapper = new QueryWrapper(); |
| | | existWrapper.eq("is_delete", Constants.NOT_DELETE); |
| | | existWrapper.eq("id", id); |
| | |
| | | //删除缓存 |
| | | CacheUtils.clearDictionariesCache(); |
| | | //封装返回对象 |
| | | dto.setSysDictData(existData); |
| | | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return dto; |
| | |
| | | SysDictData existData = sysDictDataMapper.selectOne(existWrapper); |
| | | //判断key是否重复 |
| | | String key = sysDictData.getDataKey(); |
| | | if (!ObjectUtils.isEmpty(key)) { |
| | | QueryWrapper<SysDictData> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_delete", Constants.NOT_DELETE); |
| | | wrapper.eq("dataKey", key); |
| | |
| | | dto.setMsg(ResponseCodeEnum.DICTDATA_KEY_EXIST.getMsg()); |
| | | return dto; |
| | | } |
| | | } |
| | | //执行更新 |
| | | sysDictDataMapper.updateById(sysDictData); |
| | | //清除缓存 |
| | | CacheUtils.clearDictionariesCache(); |
| | | //封装返回结果 |
| | | dto.setSysDictData(sysDictData); |
| | | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return dto; |
| | |
| | | SysDictDataDTO dto = new SysDictDataDTO(); |
| | | //取参 |
| | | SysDictData sysDictData = form.formConvertEntity(); |
| | | //判断类型是否存在 |
| | | //取出类型用于插入日志使用 |
| | | SysDictType type = sysDictTypeService.getDictTypeById(sysDictData.getDictTypeId()); |
| | | if (ObjectUtils.isEmpty(type)) { |
| | | dto.setCode(ResponseCodeEnum.DICTTYPE_NOT_EXIST.getCode()); |
| | |
| | | //清除缓存 |
| | | CacheUtils.clearDictionariesCache(); |
| | | //封装返回结果 |
| | | dto.setSysDictData(sysDictData); |
| | | dto.setSysDictType(type); |
| | | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return dto; |
| | |
| | | //清除缓存 |
| | | CacheUtils.clearDictionariesCache(); |
| | | //封装返回对象 |
| | | dto.setSysDictType(sysDictType); |
| | | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return dto; |
| | |
| | | <collection property="sensors" column="id" ofType="com.moral.api.entity.Sensor"> |
| | | <id property="id" column="sid"></id> |
| | | <result property="name" column="sname"></result> |
| | | <result property="code" column="scode"></result> |
| | | <result property="unitKey" column="dataKey"></result> |
| | | <result property="unit" column="dataValue"></result> |
| | | <result property="maxValue" column="max_value"></result> |
| | | <result property="minValue" column="min_value"></result> |
| | | <result property="upper" column="vupper"></result> |
| | | <result property="lower" column="vlower"></result> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="queryVersionsAndSensorUnitByIds" resultMap="VersionSensorUnitMap"> |
| | | SELECT |
| | | v.`id`,v.`name`,v.`desc`,v.`create_time`,v.`update_time`,s.`id` AS sid,s.`code` as scode,s.`name` AS sname ,u.dataKey,u.dataValue,vsu.`max_value` ,vsu.`min_value` |
| | | v.`id`,v.`name`,v.`desc`,v.`create_time`,v.`update_time`,s.`id` AS sid,s.`name` AS sname ,u.dataKey,u.dataValue,vsu.`upper` AS vupper ,vsu.`lower` AS vlower |
| | | FROM |
| | | `version` v |
| | | LEFT JOIN |
| | |
| | | LEFT JOIN |
| | | sensor s |
| | | ON |
| | | s.`code` = vsu.`sensor_code` AND s.`is_delete` = 0 |
| | | s.`id` = vsu.`sensor_id` AND s.`is_delete` = 0 |
| | | LEFT JOIN |
| | | ( |
| | | SELECT |