Commit 0557a7f6 by zzrdark

修改bug 设备可以添加多个相同的IMEI 产品系列可以添加多个相同的系列

parent 4f90a0d6
......@@ -287,3 +287,10 @@ CREATE TABLE `sys_user_func` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 489 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '功能与角色映射表' ROW_FORMAT = Dynamic;
-- 2020-05-06 加唯一索引
ALTER TABLE `cneeds_server`.`device_info`
ADD UNIQUE INDEX `IMEI_UNIQUE`(`imei`) USING BTREE COMMENT 'imei唯一';
ALTER TABLE `cneeds_server`.`product_series`
ADD UNIQUE INDEX `SERIES_NUM_UNIQUE`(`series_num`) USING BTREE COMMENT '系列号唯一';
\ No newline at end of file
......@@ -7,12 +7,28 @@ package com.mx.cneeds.common.constant;
* @Description TODO
**/
public class ResultCode {
//没有发现IMEI
/**
* 没有发现IMEI
*/
public static Integer NOTFOUND_IMEI = 1;
//没有设置渠道商
/**
* 没有设置渠道商
*/
public static Integer NOTSET_CHANNEL = 2;
// 参数有误
/**
* 参数有误
*/
public static Integer PARAMERROR = 3;
/**
* 没找到对应的Log日志信息
*/
public static Integer NOTFOUNDLOG = 4;
/**
* 数据重复
* 可表示imei,系列号 重复
*/
public static Integer DATA_REPEATITION = 5;
}
......@@ -33,6 +33,9 @@ public interface DeviceClient {
@PostMapping("/device/series/save")
void addSeries(@RequestBody SeriesDto dto);
@PostMapping("/device/series/querySeriesDto")
SeriesDto querySeries(@RequestBody String seriesNum);
@PostMapping("/device/series/update")
void updateSeries(@RequestBody SeriesDto dto);
......
......@@ -40,7 +40,12 @@ public interface LogFileClient {
@PostMapping(value = "/log/upload/queryLogFileByLogid")
DeviceLogDto queryLogFileByLogid(@RequestBody Long logId);
@PostMapping(value = "/log/upload/queryLogFileByLogAcceptId")
DeviceLogDto queryLogFileByLogAcceptId(@RequestBody String logAcceptId);
@PostMapping(value = "/log/upload/wechatUploadAloneFile")
void wechatUploadAloneFile(@RequestBody WechatFileDto wechatFileDto);
}
......@@ -109,6 +109,11 @@ public class DeviceController {
@PostMapping("/series/add")
public R addSeries(SeriesVo seriesVo){
SeriesDto querySeries = deviceClient.querySeries(seriesVo.getSeriesNum());
if (querySeries != null){
return R.error(ResultCode.DATA_REPEATITION,"系列号重复");
}
SeriesDto seriesDto = new SeriesDto();
BeanUtils.copyProperties(seriesVo,seriesDto);
......
......@@ -115,9 +115,31 @@ public class LogFlieController {
return R.ok();
}
@PostMapping("/logfile/proDeviceUploadLogFile")
@ResponseBody
public R proDeviceUploadLogFile(DeviceLogFileVo vo){
DeviceLogFileDto dto = new DeviceLogFileDto();
BeanUtils.copyProperties(vo, dto);
log.debug(vo.toString());
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei());
if (deviceInfoDto == null){
log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei");
}
DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId());
if ( deviceLogDto == null ){
log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG);
return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息");
}
return R.ok();
}
@PostMapping("/logfile/DeviceLogFileUpload")
@ResponseBody
public R uploadLogFile(DeviceLogFileVo vo, MultipartFile file) throws IOException {
public R deviceUploadLogFile(DeviceLogFileVo vo, MultipartFile file) throws IOException {
DeviceLogFileDto dto = new DeviceLogFileDto();
BeanUtils.copyProperties(vo, dto);
......@@ -128,6 +150,13 @@ public class LogFlieController {
log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei");
}
DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId());
if ( deviceLogDto == null ){
log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG);
return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息");
}
// 把图片存入oos 返回路径
StringBuffer dir = new StringBuffer(FilePath.LogFilePath);
dir.append(vo.getLogAcceptId());
......
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-datashow
server:
......
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0b251b6b"],{aa98:function(e,n,t){"use strict";t.d(n,"b",(function(){return i})),t.d(n,"c",(function(){return c})),t.d(n,"e",(function(){return l})),t.d(n,"a",(function(){return s})),t.d(n,"d",(function(){return u}));t("55dd");var a=t("b775");function i(e){return Object(a["a"])({url:"/device/device/list",method:"post",params:{page:e.page,pageSize:e.pageSize,sort:e.sort}})}function c(e){return Object(a["a"])({url:"/device/device/importDevice",method:"post",data:e})}function l(e){return Object(a["a"])({url:"/device/device/updateDeviceSeriesBatch",method:"post",data:e})}function s(e){return Object(a["a"])({url:"/device/device/delete",method:"post",data:{ids:e}})}function u(e){return Object(a["a"])({url:"/device/device/saveChannel",method:"post",data:e})}},ee85:function(e,n,t){"use strict";t.r(n);var a=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("el-container",[t("el-main",[t("el-form",{ref:"setChannel",attrs:{model:e.device,rules:e.rules,"label-width":"80px"}},[t("el-form-item",{attrs:{prop:"channelNumsMessage",label:"终端提示文字"}},[t("el-input",{model:{value:e.device.channelNumsMessage,callback:function(n){e.$set(e.device,"channelNumsMessage",n)},expression:"device.channelNumsMessage"}})],1),e._v(" "),t("el-form-item",{attrs:{prop:"channelRules",label:"规则"}},[t("el-select",{attrs:{placeholder:"选择"},model:{value:e.device.channelRules,callback:function(n){e.$set(e.device,"channelRules",n)},expression:"device.channelRules"}},[t("el-option",{attrs:{label:"黑名单",value:"0"}}),e._v(" "),t("el-option",{attrs:{label:"白名单",value:"1"}})],1)],1),e._v(" "),e._l(e.device.channelNums,(function(n,a){return t("el-form-item",{key:a,attrs:{label:"第"+(a+1)+"个渠道号: ",prop:"channelNums."+a+".value","label-width":"20"}},[t("el-row",[t("el-col",{attrs:{span:14}},[t("el-input",{model:{value:n.value,callback:function(t){e.$set(n,"value",t)},expression:"channelNum.value"}})],1),e._v(" "),t("el-col",{attrs:{span:5}},[t("el-button",{on:{click:function(t){return t.preventDefault(),e.removeChannelNums(n)}}},[e._v("\n 删除\n ")])],1)],1)],1)})),e._v(" "),t("el-form-item",[t("el-button",{on:{click:e.addChannelNums}},[e._v("新增渠道号")]),e._v(" "),t("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("修改")]),e._v(" "),t("el-button",{on:{click:e.toDeviceList}},[e._v("取消")])],1)],2)],1)],1)},i=[],c=(t("456d"),t("ac6a"),t("96cf"),t("3b8d")),l=t("aa98"),s={channelNumsMessage:"终端提示文字",channelRules:"规则"},u={data:function(){var e=function(e,n,t){void 0===n||null===n||0===n.length?t(new Error(s[e.field]+"必须填写")):t()};return{loading:!1,device:{channelNums:[{value:""}],channelNumsMessage:"",channelRules:"",imeis:[]},rules:{channelNumsMessage:[{validator:e}],channelRules:[{validator:e}]},selectSeriesOptions:[]}},mounted:function(){this.device.imeis=this.$route.query.imeis,this.getFormData()},methods:{getFormData:function(){var e=Object(c["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}(),setDefault:function(){this.$refs.device=[]},onSubmit:function(){var e=this;this.loading||(this.loading=!0,this.$refs.setChannel.validate((function(n,t){if(n){var a=e.device.channelNums;e.device.channelNums=[],a.forEach((function(n){e.device.channelNums.push(n.value)})),Object(l["d"])(e.device).then((function(n){var t=n.msg;e.$notify({title:"操作成功",message:t,type:"success",duration:2e3}),e.setDefault(),e.toDeviceList(),e.loading=!1})).catch((function(){e.loading=!1}))}else{var i=t[Object.keys(t)[0]][0].message;e.$message({message:i,type:"error"}),e.loading=!1}})))},toDeviceList:function(){this.$router.push({path:"/deviceManagement/device"})},addChannelNums:function(){this.device.channelNums.push({value:""})},removeChannelNums:function(e){var n=this.device.channelNums.indexOf(e);-1!==n&&this.device.channelNums.splice(n,1)}}},r=u,o=t("2877"),d=Object(o["a"])(r,a,i,!1,null,"6cae8d7a",null);n["default"]=d.exports}}]);
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0b251b6b"],{aa98:function(e,n,t){"use strict";t.d(n,"b",(function(){return i})),t.d(n,"c",(function(){return c})),t.d(n,"e",(function(){return l})),t.d(n,"a",(function(){return s})),t.d(n,"d",(function(){return u}));t("55dd");var a=t("b775");function i(e){return Object(a["a"])({url:"/device/device/list",method:"post",params:{page:e.page,pageSize:e.pageSize,sort:e.sort}})}function c(e){return Object(a["a"])({url:"/device/device/importDevice",method:"post",data:e})}function l(e){return Object(a["a"])({url:"/device/device/updateDeviceSeriesBatch",method:"post",data:e})}function s(e){return Object(a["a"])({url:"/device/device/delete",method:"post",data:{ids:e}})}function u(e){return Object(a["a"])({url:"/device/device/saveChannel",method:"post",data:e})}},ee85:function(e,n,t){"use strict";t.r(n);var a=function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("el-container",[t("el-main",[t("el-form",{ref:"setChannel",attrs:{model:e.device,rules:e.rules,"label-width":"80px"}},[t("el-form-item",{attrs:{prop:"channelNumsMessage",label:"终端提示文字"}},[t("el-input",{model:{value:e.device.channelNumsMessage,callback:function(n){e.$set(e.device,"channelNumsMessage",n)},expression:"device.channelNumsMessage"}})],1),e._v(" "),t("el-form-item",{attrs:{prop:"channelRules",label:"规则"}},[t("el-select",{attrs:{placeholder:"选择"},model:{value:e.device.channelRules,callback:function(n){e.$set(e.device,"channelRules",n)},expression:"device.channelRules"}},[t("el-option",{attrs:{label:"白名单",value:"0"}}),e._v(" "),t("el-option",{attrs:{label:"黑名单",value:"1"}})],1)],1),e._v(" "),e._l(e.device.channelNums,(function(n,a){return t("el-form-item",{key:a,attrs:{label:"第"+(a+1)+"个渠道号: ",prop:"channelNums."+a+".value","label-width":"20"}},[t("el-row",[t("el-col",{attrs:{span:14}},[t("el-input",{model:{value:n.value,callback:function(t){e.$set(n,"value",t)},expression:"channelNum.value"}})],1),e._v(" "),t("el-col",{attrs:{span:5}},[t("el-button",{on:{click:function(t){return t.preventDefault(),e.removeChannelNums(n)}}},[e._v("\n 删除\n ")])],1)],1)],1)})),e._v(" "),t("el-form-item",[t("el-button",{on:{click:e.addChannelNums}},[e._v("新增渠道号")]),e._v(" "),t("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("修改")]),e._v(" "),t("el-button",{on:{click:e.toDeviceList}},[e._v("取消")])],1)],2)],1)],1)},i=[],c=(t("456d"),t("ac6a"),t("96cf"),t("3b8d")),l=t("aa98"),s={channelNumsMessage:"终端提示文字",channelRules:"规则"},u={data:function(){var e=function(e,n,t){void 0===n||null===n||0===n.length?t(new Error(s[e.field]+"必须填写")):t()};return{loading:!1,device:{channelNums:[{value:""}],channelNumsMessage:"",channelRules:"",imeis:[]},rules:{channelNumsMessage:[{validator:e}],channelRules:[{validator:e}]},selectSeriesOptions:[]}},mounted:function(){this.device.imeis=this.$route.query.imeis,this.getFormData()},methods:{getFormData:function(){var e=Object(c["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}(),setDefault:function(){this.$refs.device=[]},onSubmit:function(){var e=this;this.loading||(this.loading=!0,this.$refs.setChannel.validate((function(n,t){if(n){var a=e.device.channelNums;e.device.channelNums=[],a.forEach((function(n){e.device.channelNums.push(n.value)})),Object(l["d"])(e.device).then((function(n){var t=n.msg;e.$notify({title:"操作成功",message:t,type:"success",duration:2e3}),e.setDefault(),e.toDeviceList(),e.loading=!1})).catch((function(){e.loading=!1}))}else{var i=t[Object.keys(t)[0]][0].message;e.$message({message:i,type:"error"}),e.loading=!1}})))},toDeviceList:function(){this.$router.push({path:"/deviceManagement/device"})},addChannelNums:function(){this.device.channelNums.push({value:""})},removeChannelNums:function(e){var n=this.device.channelNums.indexOf(e);-1!==n&&this.device.channelNums.splice(n,1)}}},r=u,o=t("2877"),d=Object(o["a"])(r,a,i,!1,null,"4506f574",null);n["default"]=d.exports}}]);
\ No newline at end of file
......@@ -24,5 +24,7 @@ public interface ProductSeriesService extends IService<ProductSeriesEntity> {
List<ProductSeriesEntity> queryList(Map<String, Object> params);
ProductSeriesEntity queryOne(Long seriesId);
ProductSeriesEntity queryBySeriesNum(String seriesNum);
}
......@@ -49,5 +49,12 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesDao, Prod
return seriesEntity;
}
@Override
public ProductSeriesEntity queryBySeriesNum(String seriesNum){
ProductSeriesEntity seriesEntity =
getOne(new QueryWrapper<ProductSeriesEntity>().eq("series_num", seriesNum));
return seriesEntity;
}
}
......@@ -150,11 +150,14 @@ public class DeviceInfoController {
List<DeviceInfoEntity> deviceInfoEntityList = new LinkedList<>();
if (devicesDto.getImeis() != null && devicesDto.getImeis().size() != 0) {
devicesDto.getImeis().forEach(str -> {
DeviceInfoEntity deviceInfoEntity = new DeviceInfoEntity();
deviceInfoEntity.setImei(str);
deviceInfoEntity.setSeriesId(devicesDto.getSeriesId());
deviceInfoEntity.setDeptId(devicesDto.getDeptId());
deviceInfoEntityList.add(deviceInfoEntity);
DeviceInfoEntity queryDeviceByImei = deviceInfoService.queryDeviceByImei(str);
if (queryDeviceByImei == null){
DeviceInfoEntity deviceInfoEntity = new DeviceInfoEntity();
deviceInfoEntity.setImei(str);
deviceInfoEntity.setSeriesId(devicesDto.getSeriesId());
deviceInfoEntity.setDeptId(devicesDto.getDeptId());
deviceInfoEntityList.add(deviceInfoEntity);
}
});
}
deviceInfoService.updateBatchByImei(deviceInfoEntityList);
......
......@@ -87,6 +87,21 @@ public class ProductSeriesController {
return R.ok();
}
@RequestMapping("/querySeriesDto")
public SeriesDto querySeriesDto(@RequestBody String seriesNum){
ProductSeriesEntity seriesEntity = productSeriesService.queryBySeriesNum(seriesNum);
if (seriesEntity==null){
return null;
}
SeriesDto dto = new SeriesDto();
BeanUtils.copyProperties(seriesEntity,dto);
return dto;
}
/**
* 修改
*/
......
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-device
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mx.cneeds.common.dto.DeviceLogDto;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceLogDao;
......@@ -56,13 +57,12 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogDao, DeviceLogEnt
public Long wechatUploadLog(DeviceLogEntity deviceLogEntity){
DeviceLogEntity logEntity = queryOneBylogAcceptId(deviceLogEntity.getLogAcceptId());
if(logEntity != null){
//未处理状态
/*//未处理状态
deviceLogEntity.setStatus(0);
deviceLogEntity.setLogfileStatus(1);
getBaseMapper().update(deviceLogEntity,
new UpdateWrapper<DeviceLogEntity>()
.eq("log_accept_id", deviceLogEntity.getLogAcceptId()));
.eq("log_accept_id", deviceLogEntity.getLogAcceptId()));*/
}else {
deviceLogEntity.setCreateTime(new Date());
deviceLogEntity.setStatus(-1);
......@@ -86,11 +86,12 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogDao, DeviceLogEnt
getBaseMapper().update(deviceLogEntity,
new UpdateWrapper<DeviceLogEntity>()
.eq("log_accept_id", deviceLogEntity.getLogAcceptId()));
}else {
}
/*else {
deviceLogEntity.setCreateTime(new Date());
deviceLogEntity.setStatus(-1);
getBaseMapper().insert(deviceLogEntity);
}
}*/
}
@Override
......@@ -98,4 +99,5 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogDao, DeviceLogEnt
return getBaseMapper().selectOne(new QueryWrapper<DeviceLogEntity>()
.eq("log_accept_id",logAcceptId));
}
}
......@@ -45,10 +45,6 @@ public class LogUploadController {
deviceLogEntity.setRepetitionProbability(dto.getProbability());
deviceLogEntity.setRepetitionSteps(dto.getSteps());
Long logId = deviceLogService.wechatUploadLog(deviceLogEntity);
/*if (dto.getFileMap()!=null && dto.getFileMap().size() != 0){
deviceLogMediaService.savewechatMedias(logId, dto.getFileMap());
}*/
}
@RequestMapping("/wechatUploadAloneFile")
......@@ -71,6 +67,14 @@ public class LogUploadController {
return dto;
}
@RequestMapping("/queryLogFileByLogAcceptId")
public DeviceLogDto queryLogFileByLogAcceptId(@RequestBody String logAcceptId){
DeviceLogEntity deviceLogEntity = deviceLogService.queryOneBylogAcceptId(logAcceptId);
DeviceLogDto dto = new DeviceLogDto();
BeanUtils.copyProperties(deviceLogEntity, dto);
return dto;
}
@RequestMapping("/uploadLogFile")
public void uploadLogFile(@RequestBody DeviceLogFileDto dto){
......@@ -114,4 +118,5 @@ public class LogUploadController {
}
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-logupload
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment