Commit 7f3645d4 authored by zhuangzhuang's avatar zhuangzhuang

5.17--springboot整合国际化,优化公司查询接口

parent 7b679b6f
...@@ -20,6 +20,8 @@ public class CircuitMessageVo { ...@@ -20,6 +20,8 @@ public class CircuitMessageVo {
private String SN;//网关编号 private String SN;//网关编号
private String battery;
private List<ResultCityVo> list; private List<ResultCityVo> list;
private List<ResultAlarmLog> alarmLogList; private List<ResultAlarmLog> alarmLogList;
...@@ -59,7 +61,7 @@ public class CircuitMessageVo { ...@@ -59,7 +61,7 @@ public class CircuitMessageVo {
public CircuitMessageVo() { public CircuitMessageVo() {
} }
public CircuitMessageVo(String transportationNo, String routeName, String cargoName, String plateNo, String transportation, String evaluate, String alarmType, String SN, List<ResultAlarmLog> alarmLogList) { public CircuitMessageVo(String transportationNo, String routeName, String cargoName, String plateNo, String transportation, String evaluate, String alarmType, String SN, List<ResultAlarmLog> alarmLogList) {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
this.routeName = routeName; this.routeName = routeName;
this.cargoName = cargoName; this.cargoName = cargoName;
...@@ -111,14 +113,6 @@ public class CircuitMessageVo { ...@@ -111,14 +113,6 @@ public class CircuitMessageVo {
this.transportation = transportation; this.transportation = transportation;
} }
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getEvaluate() { public String getEvaluate() {
return evaluate; return evaluate;
} }
...@@ -127,6 +121,14 @@ public class CircuitMessageVo { ...@@ -127,6 +121,14 @@ public class CircuitMessageVo {
this.evaluate = evaluate; this.evaluate = evaluate;
} }
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getSN() { public String getSN() {
return SN; return SN;
} }
...@@ -135,6 +137,14 @@ public class CircuitMessageVo { ...@@ -135,6 +137,14 @@ public class CircuitMessageVo {
this.SN = SN; this.SN = SN;
} }
public String getBattery() {
return battery;
}
public void setBattery(String battery) {
this.battery = battery;
}
public List<ResultCityVo> getList() { public List<ResultCityVo> getList() {
return list; return list;
} }
......
package com.example.tdl.domain.vo;
public class CircuitResultVo {
private String transportationNo;
private String cargoNo;//货物编号
private String cargoName;
private String startCity;
private Long startTime;
private String endCity;
private Long endTime;
private Integer circuitState;
private String alarmType;
private String alarm;
private String evaluate;
private String transportation;
private String plateNo;
private String gSN;
private String gType;
public String getTransportationNo() {
return transportationNo;
}
public void setTransportationNo(String transportationNo) {
this.transportationNo = transportationNo;
}
public String getCargoNo() {
return cargoNo;
}
public void setCargoNo(String cargoNo) {
this.cargoNo = cargoNo;
}
public String getCargoName() {
return cargoName;
}
public void setCargoName(String cargoName) {
this.cargoName = cargoName;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public Integer getCircuitState() {
return circuitState;
}
public void setCircuitState(Integer circuitState) {
this.circuitState = circuitState;
}
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getAlarm() {
return alarm;
}
public void setAlarm(String alarm) {
this.alarm = alarm;
}
public String getEvaluate() {
return evaluate;
}
public void setEvaluate(String evaluate) {
this.evaluate = evaluate;
}
public String getTransportation() {
return transportation;
}
public void setTransportation(String transportation) {
this.transportation = transportation;
}
public String getPlateNo() {
return plateNo;
}
public void setPlateNo(String plateNo) {
this.plateNo = plateNo;
}
public String getgSN() {
return gSN;
}
public void setgSN(String gSN) {
this.gSN = gSN;
}
public String getgType() {
return gType;
}
public void setgType(String gType) {
this.gType = gType;
}
}
package com.example.tdl.domain.vo;
public class GatewaySNVo {
private String SN;
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
}
...@@ -2,10 +2,19 @@ package com.example.tdl.domain.vo; ...@@ -2,10 +2,19 @@ package com.example.tdl.domain.vo;
public class HistogramData { public class HistogramData {
private String classify; private String classify;
private Integer count; private Integer count;
public HistogramData() {
}
public HistogramData(String classify, Integer count) {
this.classify = classify;
this.count = count;
}
public String getClassify() { public String getClassify() {
return classify; return classify;
} }
......
package com.example.tdl.domain.vo;
public class OnlineVo {
private Integer online;
public Integer getOnline() {
return online;
}
public void setOnline(Integer online) {
this.online = online;
}
}
package com.example.tdl.domain.vo;
public class TdlSNVo {
private String TDLSN;
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
}
...@@ -20,7 +20,11 @@ public class AlarmLog { ...@@ -20,7 +20,11 @@ public class AlarmLog {
private String classify; private String classify;
public AlarmLog( String transportationNo, String startCity, String endCity, String TDLSN, String description, Float data, Long alarmTime, String classify) { private String desp;
private Integer alarmNo;
public AlarmLog( String transportationNo, String startCity, String endCity, String TDLSN, String description, Float data, Long alarmTime, String classify, String desp, Integer alarmNo) {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
this.startCity = startCity; this.startCity = startCity;
this.endCity = endCity; this.endCity = endCity;
...@@ -29,6 +33,8 @@ public class AlarmLog { ...@@ -29,6 +33,8 @@ public class AlarmLog {
this.data = data; this.data = data;
this.alarmTime = alarmTime; this.alarmTime = alarmTime;
this.classify = classify; this.classify = classify;
this.desp = desp;
this.alarmNo = alarmNo;
} }
public Integer getId() { public Integer getId() {
...@@ -102,4 +108,20 @@ public class AlarmLog { ...@@ -102,4 +108,20 @@ public class AlarmLog {
public void setClassify(String classify) { public void setClassify(String classify) {
this.classify = classify; this.classify = classify;
} }
public String getDesp() {
return desp;
}
public void setDesp(String desp) {
this.desp = desp;
}
public Integer getAlarmNo() {
return alarmNo;
}
public void setAlarmNo(Integer alarmNo) {
this.alarmNo = alarmNo;
}
} }
...@@ -42,7 +42,7 @@ public class LoginInterceptor implements HandlerInterceptor { ...@@ -42,7 +42,7 @@ public class LoginInterceptor implements HandlerInterceptor {
ps.write("{\"code\":2,\"message\":\"用户登录过期,请重新登录\"}".getBytes("UTF-8")); ps.write("{\"code\":2,\"message\":\"用户登录过期,请重新登录\"}".getBytes("UTF-8"));
return false; return false;
} }
redisService.refeshTimeOut("TOKEN_" +token,60 * 30); redisService.refeshTimeOut("TOKEN_" +token,60 * 60 *24);
return true; return true;
} }
......
...@@ -9,7 +9,7 @@ import java.util.Map; ...@@ -9,7 +9,7 @@ import java.util.Map;
@Mapper @Mapper
public interface CircuitMapper { public interface CircuitMapper {
List<ResultCircuitVo> getAll(String companyName); List<CircuitResultVo> getAll(String companyName);
List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo); List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo);
......
package com.example.tdl.mapper; package com.example.tdl.mapper;
import com.example.tdl.domain.vo.GatewaySNVo;
import com.example.tdl.domain.vo.GatewayState; import com.example.tdl.domain.vo.GatewayState;
import com.example.tdl.domain.vo.ResultGatewayVo; import com.example.tdl.domain.vo.ResultGatewayVo;
import com.example.tdl.domain.vo.UpdateGatewayVo; import com.example.tdl.domain.vo.UpdateGatewayVo;
...@@ -30,4 +31,6 @@ public interface GatewayMapper { ...@@ -30,4 +31,6 @@ public interface GatewayMapper {
Integer updateState(GatewayState gatewayState); Integer updateState(GatewayState gatewayState);
String getTransportationNo(@Param("SN") String SN,@Param("type") String type); String getTransportationNo(@Param("SN") String SN,@Param("type") String type);
List<GatewaySNVo> getUnusedGateway(String SN);
} }
package com.example.tdl.mapper; package com.example.tdl.mapper;
import com.example.tdl.domain.vo.AddTDLDeviceVo; import com.example.tdl.domain.vo.*;
import com.example.tdl.domain.vo.ResultTDLDeviceVo;
import com.example.tdl.domain.vo.TDLDeviceTermVo;
import com.example.tdl.domain.vo.UpdateTDLDeviceVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -29,4 +26,6 @@ public interface TDLDeviceMapper { ...@@ -29,4 +26,6 @@ public interface TDLDeviceMapper {
List<String> getTdlSN(@Param("SN") String SN, @Param("type") String type); List<String> getTdlSN(@Param("SN") String SN, @Param("type") String type);
String getTdl(@Param("SN") String SN, @Param("type") String type); String getTdl(@Param("SN") String SN, @Param("type") String type);
List<TdlSNVo> getUnusedTDL(String TDLSN);
} }
...@@ -15,6 +15,9 @@ public interface UserMapper { ...@@ -15,6 +15,9 @@ public interface UserMapper {
List<ResultUserVo> getAll(String companyName); List<ResultUserVo> getAll(String companyName);
List<ResultUserVo> getAllUser();
List<ResultUserVo> getByTerm(UserTermVo userTermVo); List<ResultUserVo> getByTerm(UserTermVo userTermVo);
ResultUserVo getByPhone(@Param("phone") String phone,@Param("companyName") String companyName); ResultUserVo getByPhone(@Param("phone") String phone,@Param("companyName") String companyName);
......
...@@ -214,13 +214,17 @@ public class MqttListener implements MqttCallback { ...@@ -214,13 +214,17 @@ public class MqttListener implements MqttCallback {
return 0;//休眠 return 0;//休眠
} }
CheckInVo checkInVo = new Gson().fromJson(message,CheckInVo.class); CheckInVo checkInVo = new Gson().fromJson(message,CheckInVo.class);
if(checkInVo.getDevList().size()==0){ ConfigCMDVo configCMDVo = new Gson().fromJson(configVo.getMessage(),ConfigCMDVo.class);
if(configCMDVo == null){
return 0;//休眠
}
if(checkInVo.getDevList().size()==0 && configCMDVo !=null ){
return 1;//重发 return 1;//重发
} }
if(configVo.getUntie() && StringUtils.isEmpty(configVo.getMessage()) ){ if(configVo.getUntie() && StringUtils.isEmpty(configVo.getMessage()) ){
return 2;//解绑 return 2;//解绑
} }
ConfigCMDVo configCMDVo = new Gson().fromJson(configVo.getMessage(),ConfigCMDVo.class);
//判断两者的devList是否一致 //判断两者的devList是否一致
if (configCMDVo.getDevList().containsAll(checkInVo.getDevList()) if (configCMDVo.getDevList().containsAll(checkInVo.getDevList())
&& checkInVo.getDevList().containsAll(configCMDVo.getDevList()) && checkInVo.getDevList().containsAll(configCMDVo.getDevList())
......
...@@ -14,7 +14,7 @@ public class CircuitService { ...@@ -14,7 +14,7 @@ public class CircuitService {
@Autowired @Autowired
private CircuitMapper circuitMapper; private CircuitMapper circuitMapper;
public List<ResultCircuitVo> getAll(String companyName){ public List<CircuitResultVo> getAll(String companyName){
return circuitMapper.getAll(companyName); return circuitMapper.getAll(companyName);
} }
......
...@@ -54,4 +54,8 @@ public class GatewayService { ...@@ -54,4 +54,8 @@ public class GatewayService {
public String getTransportationNo(String SN,String type){ public String getTransportationNo(String SN,String type){
return gatewayMapper.getTransportationNo(SN,type); return gatewayMapper.getTransportationNo(SN,type);
} }
public List<GatewaySNVo> getUnusedGateway(String SN){
return gatewayMapper.getUnusedGateway(SN);
}
} }
package com.example.tdl.service; package com.example.tdl.service;
import com.example.tdl.domain.vo.AddTDLDeviceVo; import com.example.tdl.domain.vo.*;
import com.example.tdl.domain.vo.ResultTDLDeviceVo;
import com.example.tdl.domain.vo.TDLDeviceTermVo;
import com.example.tdl.domain.vo.UpdateTDLDeviceVo;
import com.example.tdl.mapper.TDLDeviceMapper; import com.example.tdl.mapper.TDLDeviceMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -50,4 +47,8 @@ public class TDLDeviceService { ...@@ -50,4 +47,8 @@ public class TDLDeviceService {
public String getTdl(String SN,String type){ public String getTdl(String SN,String type){
return tdlDeviceMapper.getTdl(SN,type); return tdlDeviceMapper.getTdl(SN,type);
} }
public List<TdlSNVo> getUnusedTDL(String TDLSN){
return tdlDeviceMapper.getUnusedTDL(TDLSN);
}
} }
...@@ -34,6 +34,10 @@ public class UserService { ...@@ -34,6 +34,10 @@ public class UserService {
return userMapper.getAll(companyName); return userMapper.getAll(companyName);
} }
public List<ResultUserVo> getAllUser(){
return userMapper.getAllUser();
}
public List<ResultUserVo> getByTerm(UserTermVo userTermVo){ public List<ResultUserVo> getByTerm(UserTermVo userTermVo){
return userMapper.getByTerm(userTermVo); return userMapper.getByTerm(userTermVo);
} }
......
...@@ -42,6 +42,9 @@ public class AlarmController { ...@@ -42,6 +42,9 @@ public class AlarmController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询所有预警信息 //查询所有预警信息
@ApiOperation(value = "查询所有预警信息",notes = "查询所有预警信息,返回值说明:" + @ApiOperation(value = "查询所有预警信息",notes = "查询所有预警信息,返回值说明:" +
" alarmType:预警类型," + " alarmType:预警类型," +
...@@ -55,6 +58,7 @@ public class AlarmController { ...@@ -55,6 +58,7 @@ public class AlarmController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(HttpServletRequest request){
...@@ -77,6 +81,7 @@ public class AlarmController { ...@@ -77,6 +81,7 @@ public class AlarmController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getAllByAlarmType",method = RequestMethod.POST) @RequestMapping(value="/getAllByAlarmType",method = RequestMethod.POST)
public Object getAllByAlarmType(@RequestBody String alarmType,HttpServletRequest request){ public Object getAllByAlarmType(@RequestBody String alarmType,HttpServletRequest request){
...@@ -101,70 +106,72 @@ public class AlarmController { ...@@ -101,70 +106,72 @@ public class AlarmController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/addAlarm",method = RequestMethod.POST) @RequestMapping(value="/addAlarm",method = RequestMethod.POST)
public Object addAlarm(@RequestBody AddAlarmVo addAlarmVo,HttpServletRequest request){ public Object addAlarm(@RequestBody AddAlarmVo addAlarmVo,HttpServletRequest request){
String port =request.getHeader("AccountLanguage");
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
if (StringUtils.isEmpty(addAlarmVo.getAlarmType())){ if (StringUtils.isEmpty(addAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警类型不能为空"); fb.setMessage(i18n.getMessage(request,"alarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addAlarmVo.getAlarmScene())){ if (StringUtils.isEmpty(addAlarmVo.getAlarmScene())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警场景不能为空"); fb.setMessage(i18n.getMessage(request,"alarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (!addAlarmVo.getAlarmScene().equals("仓库")&&!addAlarmVo.getAlarmScene().equals("运输")){ if (!addAlarmVo.getAlarmScene().equals("仓库")&&!addAlarmVo.getAlarmScene().equals("运输")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("请选择正确的预警场景"); fb.setMessage(i18n.getMessage(request,"wrongAlarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addAlarmVo.getTemMax()== null){ if (addAlarmVo.getTemMax()== null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("温度上限不能为空"); fb.setMessage(i18n.getMessage(request,"temMax"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addAlarmVo.getTemMin()== null){ if (addAlarmVo.getTemMin()== null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("温度下限不能为空"); fb.setMessage(i18n.getMessage(request,"temMin"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addAlarmVo.getHumidityMax()==null){ if (addAlarmVo.getHumidityMax()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("湿度上限不能为空"); fb.setMessage(i18n.getMessage(request,"humidityMax"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addAlarmVo.getHumidityMin()==null){ if (addAlarmVo.getHumidityMin()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("湿度下限不能为空"); fb.setMessage(i18n.getMessage(request,"humidityMin"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addAlarmVo.getTilt()==null){ if (addAlarmVo.getTilt()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("倾斜度不能为空"); fb.setMessage(i18n.getMessage(request,"tilt"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addAlarmVo.getShock()==null){ if (addAlarmVo.getShock()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("震度不能为空"); fb.setMessage(i18n.getMessage(request,"shock"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (alarmService.getByTypeAndScene(addAlarmVo.getAlarmType(),addAlarmVo.getAlarmScene(),user.getCompanyName())!=null){ if (alarmService.getByTypeAndScene(addAlarmVo.getAlarmType(),addAlarmVo.getAlarmScene(),user.getCompanyName())!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的预警类型在该场景中已存在"); fb.setMessage(i18n.getMessage(request,"alarmExist"));
return gson.toJson(fb); return gson.toJson(fb);
} }
addAlarmVo.setCompanyName(user.getCompanyName()); addAlarmVo.setCompanyName(user.getCompanyName());
int a=alarmService.addAlarm(addAlarmVo); int a=alarmService.addAlarm(addAlarmVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("添加预警信息成功"); fb.setMessage(i18n.getMessage(request,"addSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加预警信息失败"); fb.setMessage(i18n.getMessage(request,"addFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -184,74 +191,84 @@ public class AlarmController { ...@@ -184,74 +191,84 @@ public class AlarmController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updateAlarm",method = RequestMethod.POST) @RequestMapping(value="/updateAlarm",method = RequestMethod.POST)
public Object updateAlarm(@RequestBody UpdateAlarmVo updateAlarmVo,HttpServletRequest request){ public Object updateAlarm(@RequestBody UpdateAlarmVo updateAlarmVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(updateAlarmVo.getOldAlarmType())){ if (StringUtils.isEmpty(updateAlarmVo.getOldAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要修改的预警类型不能为空"); if(!StringUtils.isEmpty(port) &&port.equals("en")){
fb.setMessage("The type of early warning that needs to be modified can not be empty");
}else if(!StringUtils.isEmpty(port) && port .equals("jp")){
fb.setMessage("アラームタイプを入力してください。");
}else{
fb.setMessage("需要修改的预警类型不能为空");
}
fb.setMessage(i18n.getMessage(request,"modifiedAlarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateAlarmVo.getOldAlarmScene())){ if (StringUtils.isEmpty(updateAlarmVo.getOldAlarmScene())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要修改的预警场景不能为空"); fb.setMessage(i18n.getMessage(request,"modifiedAlarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
}else if (!updateAlarmVo.getOldAlarmScene().equals("仓库")&&!updateAlarmVo.getOldAlarmScene().equals("运输")){ }
if (!updateAlarmVo.getOldAlarmScene().equals("仓库")&&!updateAlarmVo.getOldAlarmScene().equals("运输")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("请输入正确的需要修改预警场景"); fb.setMessage(i18n.getMessage(request,"modifiedWrongAlarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateAlarmVo.getAlarmType())){ if (StringUtils.isEmpty(updateAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警类型不能为空"); fb.setMessage(i18n.getMessage(request,"alarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateAlarmVo.getAlarmScene())){ if (StringUtils.isEmpty(updateAlarmVo.getAlarmScene())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警场景不能为空"); fb.setMessage(i18n.getMessage(request,"alarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (!updateAlarmVo.getAlarmScene().equals("仓库")&&!updateAlarmVo.getAlarmScene().equals("运输")){ if (!updateAlarmVo.getAlarmScene().equals("仓库")&&!updateAlarmVo.getAlarmScene().equals("运输")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("请选择正确的预警场景"); fb.setMessage(i18n.getMessage(request,"wrongAlarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateAlarmVo.getTemMax()==null){ if (updateAlarmVo.getTemMax()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("温度上限不能为空"); fb.setMessage(i18n.getMessage(request,"temMax"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateAlarmVo.getTemMin()==null){ if (updateAlarmVo.getTemMin()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("温度下限不能为空"); fb.setMessage(i18n.getMessage(request,"temMin"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateAlarmVo.getHumidityMax()==null){ if (updateAlarmVo.getHumidityMax()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("湿度上限不能为空"); fb.setMessage(i18n.getMessage(request,"humidityMax"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateAlarmVo.getHumidityMin()==null){ if (updateAlarmVo.getHumidityMin()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("湿度下限不能为空"); fb.setMessage(i18n.getMessage(request,"humidityMin"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateAlarmVo.getTilt()==null){ if (updateAlarmVo.getTilt()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("倾斜度不能为空"); fb.setMessage(i18n.getMessage(request,"tilt"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateAlarmVo.getShock()==null){ if (updateAlarmVo.getShock()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("震度不能为空"); fb.setMessage(i18n.getMessage(request,"shock"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (alarmService.getByTypeAndScene(updateAlarmVo.getAlarmType(),updateAlarmVo.getAlarmType(),user.getCompanyName())!=null&&!updateAlarmVo.getAlarmType().equals(updateAlarmVo.getAlarmType())&&!updateAlarmVo.getAlarmScene().equals(updateAlarmVo.getAlarmScene())){ if (alarmService.getByTypeAndScene(updateAlarmVo.getAlarmType(),updateAlarmVo.getAlarmType(),user.getCompanyName())!=null&&!updateAlarmVo.getAlarmType().equals(updateAlarmVo.getAlarmType())&&!updateAlarmVo.getAlarmScene().equals(updateAlarmVo.getAlarmScene())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的预警类型在该场景中已存在"); fb.setMessage(i18n.getMessage(request,"modifiedAlarmExist"));
return gson.toJson(fb); return gson.toJson(fb);
} }
updateAlarmVo.setCompanyName(user.getCompanyName()); updateAlarmVo.setCompanyName(user.getCompanyName());
...@@ -259,9 +276,10 @@ public class AlarmController { ...@@ -259,9 +276,10 @@ public class AlarmController {
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("修改预警信息成功"); fb.setMessage("修改预警信息成功");
fb.setMessage(i18n.getMessage(request,"modifiedSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改预警信息失败"); fb.setMessage(i18n.getMessage(request,"modifiedFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
...@@ -273,35 +291,37 @@ public class AlarmController { ...@@ -273,35 +291,37 @@ public class AlarmController {
" alarmScene:需要删除的预警场景" ) " alarmScene:需要删除的预警场景" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/delAlarm",method = RequestMethod.POST) @RequestMapping(value="/delAlarm",method = RequestMethod.POST)
public Object delAlarm(@RequestBody DelAlarmVo delAlarmVo,HttpServletRequest request){ public Object delAlarm(@RequestBody DelAlarmVo delAlarmVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(delAlarmVo.getAlarmScene())){ if (StringUtils.isEmpty(delAlarmVo.getAlarmScene())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要删除的预警场景不能为空"); fb.setMessage(i18n.getMessage(request,"deletedAlarmScene"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(delAlarmVo.getAlarmType())){ if (StringUtils.isEmpty(delAlarmVo.getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要删除的预警类型不能为空"); fb.setMessage(i18n.getMessage(request,"deletedAlarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
delAlarmVo.setCompanyName(user.getCompanyName()); delAlarmVo.setCompanyName(user.getCompanyName());
if (warehouseService.getByAlarm(delAlarmVo).size()>0){ if (warehouseService.getByAlarm(delAlarmVo).size()>0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该预警正在被使用"); fb.setMessage(i18n.getMessage(request,"dusedAlarm"));
return gson.toJson(fb); return gson.toJson(fb);
} }
int a=alarmService.delAlarm(delAlarmVo); int a=alarmService.delAlarm(delAlarmVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("删除预警信息成功"); fb.setMessage(i18n.getMessage(request,"deletedSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("删除预警信息失败"); fb.setMessage(i18n.getMessage(request,"deletedFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -310,6 +330,7 @@ public class AlarmController { ...@@ -310,6 +330,7 @@ public class AlarmController {
@ApiOperation(value = "查询仓库场景下的预警类型",notes = "查询仓库场景下的预警类型") @ApiOperation(value = "查询仓库场景下的预警类型",notes = "查询仓库场景下的预警类型")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getForWarehouse",method = RequestMethod.GET) @RequestMapping(value="/getForWarehouse",method = RequestMethod.GET)
public Object getForWarehouse(HttpServletRequest request){ public Object getForWarehouse(HttpServletRequest request){
...@@ -324,6 +345,7 @@ public class AlarmController { ...@@ -324,6 +345,7 @@ public class AlarmController {
@ApiOperation(value = "查询运输场景下的预警类型",notes = "查询运输场景下的预警类型") @ApiOperation(value = "查询运输场景下的预警类型",notes = "查询运输场景下的预警类型")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getForTransportation",method = RequestMethod.GET) @RequestMapping(value="/getForTransportation",method = RequestMethod.GET)
public Object getForTransportation(HttpServletRequest request){ public Object getForTransportation(HttpServletRequest request){
......
...@@ -47,6 +47,9 @@ public class AlarmLogController { ...@@ -47,6 +47,9 @@ public class AlarmLogController {
@Autowired @Autowired
private CompanyService companyService; private CompanyService companyService;
@Autowired
private I18nController i18n;
//获取报警信息 //获取报警信息
@ApiOperation(value = "获取报警信息",notes = "获取报警信息" + @ApiOperation(value = "获取报警信息",notes = "获取报警信息" +
" transportationNo:运输编号" + " transportationNo:运输编号" +
...@@ -63,6 +66,7 @@ public class AlarmLogController { ...@@ -63,6 +66,7 @@ public class AlarmLogController {
" alarmTime:报警时间" ) " alarmTime:报警时间" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@PostMapping("/getAlarm") @PostMapping("/getAlarm")
public Object getAlarm(@RequestBody AlarmTermVo alarmTermVo ,HttpServletRequest request){ public Object getAlarm(@RequestBody AlarmTermVo alarmTermVo ,HttpServletRequest request){
...@@ -99,6 +103,7 @@ public class AlarmLogController { ...@@ -99,6 +103,7 @@ public class AlarmLogController {
"alarmTime:报警时间" ) "alarmTime:报警时间" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@PostMapping("/getRealTimeAlarm") @PostMapping("/getRealTimeAlarm")
public Object getRealTimeAlarm(HttpServletRequest request){ public Object getRealTimeAlarm(HttpServletRequest request){
...@@ -114,6 +119,7 @@ public class AlarmLogController { ...@@ -114,6 +119,7 @@ public class AlarmLogController {
"password:密码" ) "password:密码" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@GetMapping("/getAlarmMessage") @GetMapping("/getAlarmMessage")
public String getAlarmMessage(HttpServletRequest request){ public String getAlarmMessage(HttpServletRequest request){
...@@ -158,26 +164,30 @@ public class AlarmLogController { ...@@ -158,26 +164,30 @@ public class AlarmLogController {
String transportationNo = gatewayService.getTransportationNo(addAlarmLogVo.getGsn(),addAlarmLogVo.getGtype()); String transportationNo = gatewayService.getTransportationNo(addAlarmLogVo.getGsn(),addAlarmLogVo.getGtype());
//获取终点,起点 //获取终点,起点
ResultCircuitVo resultCircuitVo = circuitService.getCircuit(transportationNo); ResultCircuitVo resultCircuitVo = circuitService.getCircuit(transportationNo);
for(int i = 0;i<addAlarmLogVo.getAlarm().size();i++){ for(int i = 0,length=addAlarmLogVo.getAlarm().size();i<length;i++){
if(addAlarmLogVo.getAlarm().get(i).getAlarmno() !=null && addAlarmLogVo.getAlarm().get(i).getAlarmno() == 0){
continue;
}
String classify=""; String classify="";
String desp = ""; String desp = "";
if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("T")){ if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("T")){
desp = "温度" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno()); desp = "温度" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "1"; classify = "1";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("h")){ } else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("h")){
desp = "湿度" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno()); desp = "湿度" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "2"; classify = "2";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("a0")){ } else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("a0")){
desp = "震动" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno()); desp = "震动" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "3"; classify = "3";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("ta")){ } else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("ta")) {
desp = "倾角" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno()); desp = "倾角" + map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "4"; classify = "4";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("离线")){
desp = addAlarmLogVo.getAlarm().get(i).getTdlsn()+"离线";
classify = "6";
} }
AlarmLog alarmLog = new AlarmLog(transportationNo,resultCircuitVo.getStartCity(),resultCircuitVo.getEndCity(),addAlarmLogVo.getAlarm().get(i).getTdlsn().replace("TDL-","").trim(),desp,addAlarmLogVo.getAlarm().get(i).getValue(),addAlarmLogVo.getAlarm().get(i).getTs()*1000,classify); // else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("离线")){
// desp = addAlarmLogVo.getAlarm().get(i).getTdlsn()+"离线";
// classify = "6";
// }
AlarmLog alarmLog = new AlarmLog(transportationNo,resultCircuitVo.getStartCity(),resultCircuitVo.getEndCity(),addAlarmLogVo.getAlarm().get(i).getTdlsn().replace("TDL-","").trim(),desp,addAlarmLogVo.getAlarm().get(i).getValue(),addAlarmLogVo.getAlarm().get(i).getTs()*1000,classify,addAlarmLogVo.getAlarm().get(i).getDesp(),addAlarmLogVo.getAlarm().get(i).getAlarmno());
int a = alarmLogServcie.addAlarmLog(alarmLog); int a = alarmLogServcie.addAlarmLog(alarmLog);
if(a == 0){ if(a == 0){
fb.setCode(0); fb.setCode(0);
...@@ -189,5 +199,4 @@ public class AlarmLogController { ...@@ -189,5 +199,4 @@ public class AlarmLogController {
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
} }
...@@ -77,6 +77,9 @@ public class CircuitController { ...@@ -77,6 +77,9 @@ public class CircuitController {
@Autowired @Autowired
private InfluxDBTemplate influxDBTemplate; private InfluxDBTemplate influxDBTemplate;
@Autowired
private I18nController i18n;
private final static String database ="original"; private final static String database ="original";
List<String> list = new ArrayList<String>(){{ List<String> list = new ArrayList<String>(){{
...@@ -97,17 +100,51 @@ public class CircuitController { ...@@ -97,17 +100,51 @@ public class CircuitController {
" endTime:目的时间," + " endTime:目的时间," +
" circuitState:线路状态(0未开始,1运输中,2完成)," + " circuitState:线路状态(0未开始,1运输中,2完成)," +
" alarmType:预警类型," + " alarmType:预警类型," +
" alarm:报警详情(比如:温度,湿度,震动)" + " alarm:报警详情(1-温度,2-湿度,3-震动,4-倾角,5-延误,6-离线,7--在线)" +
" evaluate:运输评价") " evaluate:运输评价" +
" transportation:运输方式" +
" plateNo:车牌号")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
return circuitService.getAll(user.getCompanyName()); List<CircuitResultVo> list = circuitService.getAll(user.getCompanyName());
for(int i = 0,length=list.size();i<length;i++){
if(list.get(i).getCircuitState() == 1){
//获取设备在线情况
Object data = infoRedisService.getHash("DeviceOnline",list.get(i).getgType()+"_"+list.get(i).getgSN());
if(data == null){
if(StringUtils.isEmpty(list.get(i).getAlarm())){
list.get(i).setAlarm("6");
}else{
list.get(i).setAlarm(list.get(i).getAlarm()+",6");
}
}else{
OnlineVo onlineVo = gson.fromJson(data.toString(),OnlineVo.class);
if(onlineVo.getOnline() == 0){
if(StringUtils.isEmpty(list.get(i).getAlarm())){
list.get(i).setAlarm("6");
}else{
list.get(i).setAlarm(list.get(i).getAlarm()+",6");
}
}else if(onlineVo.getOnline() == 1) {
if(StringUtils.isEmpty(list.get(i).getAlarm())){
list.get(i).setAlarm("7");
}else{
list.get(i).setAlarm(list.get(i).getAlarm()+",7");
}
}
}
}else{
continue;
}
}
return list;
} }
...@@ -127,6 +164,7 @@ public class CircuitController { ...@@ -127,6 +164,7 @@ public class CircuitController {
" evaluate:运输评价") " evaluate:运输评价")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByTransportationNo",method = RequestMethod.POST) @RequestMapping(value="/getByTransportationNo",method = RequestMethod.POST)
public Object getByTransportationNo(@RequestBody String transportationNo, HttpServletRequest request){ public Object getByTransportationNo(@RequestBody String transportationNo, HttpServletRequest request){
...@@ -156,6 +194,7 @@ public class CircuitController { ...@@ -156,6 +194,7 @@ public class CircuitController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByTransportationNoForApp",method = RequestMethod.POST) @RequestMapping(value="/getByTransportationNoForApp",method = RequestMethod.POST)
public Object getByTransportationNoForApp(@RequestBody String transportationNo,HttpServletRequest request){ public Object getByTransportationNoForApp(@RequestBody String transportationNo,HttpServletRequest request){
...@@ -192,6 +231,7 @@ public class CircuitController { ...@@ -192,6 +231,7 @@ public class CircuitController {
" evaluate:运输评价") " evaluate:运输评价")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByTerm",method = RequestMethod.POST) @RequestMapping(value="/getByTerm",method = RequestMethod.POST)
public Object getByTerm(@RequestBody CircuitTermVo circuitTermVo,HttpServletRequest request){ public Object getByTerm(@RequestBody CircuitTermVo circuitTermVo,HttpServletRequest request){
...@@ -212,7 +252,7 @@ public class CircuitController { ...@@ -212,7 +252,7 @@ public class CircuitController {
} }
if(circuitTermVo.getStartTime()!=null && circuitTermVo.getEndTime()!=null && circuitTermVo.getStartTime()>circuitTermVo.getEndTime()){ if(circuitTermVo.getStartTime()!=null && circuitTermVo.getEndTime()!=null && circuitTermVo.getStartTime()>circuitTermVo.getEndTime()){
fb.setCode(0); fb.setCode(0);
fb.setMessage("开始时间不能大于结束时间"); fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(circuitTermVo.getTime())){ if(StringUtils.isEmpty(circuitTermVo.getTime())){
...@@ -226,6 +266,278 @@ public class CircuitController { ...@@ -226,6 +266,278 @@ public class CircuitController {
//根据线路编号获取线路详细信息
@ApiOperation(value = "根据线路编号获取线路详细信息",notes = "根据线路编号获取线路详细信息,传值说明:" +
" transportationNo:运输编号; " +
"返回值说明:" +
" transportationNo:运输编号," +
" routeName:线路," +
" cargoName:货物别名," +
" transportation:运输方式," +
" evaluate:评价," +
" alarmType:预警类型," +
" SN:gateway序列号," +
" tdlList:{" +
" tdlsn:TDLSN序列号" +
" batteryVoltage:电池电压}," +
" list:{" +
" city:城市;" +
" time:到达时间/发车时间;" +
" last:运行时长;" +
" alarmCount:报警数;" +
" type:1--出发时间;2--目的时间}," +
" alarmLogList:{" +
" transportationNo:运输编号;" +
" TDLSN:tag序列号;" +
" description:报警描述;" +
" data:数值;" +
" alarmTime:报警时间;" +
" classify:分类}" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@PostMapping("/getDetails")
public Object getDetails(@RequestBody String transportationNo,HttpServletRequest request) {
String port = request.getHeader("AccountLanguage");
if(StringUtils.isEmpty(transportationNo)){
fb.setCode(0);
if(!StringUtils.isEmpty(port) &&port.equals("en")){
fb.setMessage("The number of goods can not be empty");
}else if(!StringUtils.isEmpty(port) &&port.equals("jp")) {
fb.setMessage("輸送番号 を入力してください。");
}else{
fb.setMessage("线路编号不能为空");
}
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=(String)jsonObject.get("transportationNo");
//获取线路信息
CircuitMessage circuitVo = circuitService.getMessage(transportationNo);
if(circuitVo == null){
fb.setCode(0);
if(!StringUtils.isEmpty(port) &&port.equals("en")){
fb.setMessage("There is no such line");
} else if(!StringUtils.isEmpty(port) &&port.equals("jp")){
fb.setMessage("ルートが存在していません");
}else{
fb.setMessage("没有该线路");
}
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb);
}
//获取gateway信息
TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo == null){
fb.setCode(0);
if(!StringUtils.isEmpty(port) &&port.equals("en")){
fb.setMessage("There is no such line");
} else if(!StringUtils.isEmpty(port) &&port.equals("jp")){
fb.setMessage("ルートが存在していません");
}else{
fb.setMessage("没有该线路");
}
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb);
}
List<ResultAlarmLog> alarmLogList= alarmLogService.getByTransportationNo(transportationNo);
CircuitMessageVo messageVo = new CircuitMessageVo(circuitVo.getTransportationNo(),circuitVo.getRouteName(),circuitVo.getCargoName(),circuitVo.getPlateNo(),circuitVo.getTransportation(),circuitVo.getEvaluate(),circuitVo.getAlarmType(),gatewayVo.getgSN(),alarmLogList);
String sql ="";
if (circuitVo.getEndTime() != null && circuitVo.getEndTime() != 0) {
sql = "SELECT \"battery\" FROM \"tdl_policy\".\"" + gatewayVo.getgType() + "_" + gatewayVo.getgSN() + "\" where time >=" + circuitVo.getStartTime() + " and time<=" + circuitVo.getEndTime() * 1000000l + " ORDER BY time desc limit 1";
} else {
sql = "SELECT \"battery\" FROM \"tdl_policy\".\"" + gatewayVo.getgType() + "_" + gatewayVo.getgSN() + "\" where time >=" + circuitVo.getStartTime() + " ORDER BY time desc limit 1";
}
QueryResult queryResult = influxDBTemplate.query(new Query(sql, database));
if (queryResult.getResults().get(0).getSeries() == null) {
messageVo.setBattery("");
}else{
DecimalFormat df = new DecimalFormat("######0.0");
String value = queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1) == null ? "" : queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString();
messageVo.setBattery(df.format(Double.valueOf(value)));
}
List<String> TDL= tdlLogService.getTdlSN(transportationNo);
if(TDL.size() == 0){
fb.setCode(0);
if(!StringUtils.isEmpty(port) &&port.equals("en")){
fb.setMessage("There is no such line");
} else if(!StringUtils.isEmpty(port) &&port.equals("jp")){
fb.setMessage("ルートが存在していません");
}else{
fb.setMessage("没有该线路");
}
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb);
}
List<CircuitMessageVo.TDL> tdlList = new ArrayList<>();
for(int i=0;i<TDL.size();i++){
CircuitMessageVo.TDL tdl = new CircuitMessageVo.TDL();
tdl.setTdlsn(TDL.get(i).replace("TDL-", "").trim());
if(circuitVo.getStartTime() == null || circuitVo.getStartTime() == 0){
tdl.setBatteryVoltage("");
}else {
String sql1 ="";
if (circuitVo.getEndTime() != null && circuitVo.getEndTime() != 0) {
sql1= "SELECT \"b\" FROM \"tdl_policy\".\"" + gatewayVo.getgType() + "_" + gatewayVo.getgSN() + "\" where \"tdl\"='" + TDL.get(i) + "' and time >=" + circuitVo.getStartTime() + " and time<=" + circuitVo.getEndTime() * 1000000l + " ORDER BY time desc limit 1";
} else {
sql1 = "SELECT \"b\" FROM \"tdl_policy\".\"" + gatewayVo.getgType() + "_" + gatewayVo.getgSN() + "\" where \"tdl\"='" + TDL.get(i) + "' and time >=" + circuitVo.getStartTime() + " ORDER BY time desc limit 1";
}
QueryResult queryResult1 = influxDBTemplate.query(new Query(sql1, database));
if (queryResult1.getResults().get(0).getSeries() == null) {
tdl.setBatteryVoltage("");
}else{
DecimalFormat df = new DecimalFormat("######0.0");
String value = queryResult1.getResults().get(0).getSeries().get(0).getValues().get(0).get(1) == null ? "" : queryResult1.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString();
tdl.setBatteryVoltage(df.format(Double.valueOf(value)));
}
}
tdlList.add(tdl);
}
messageVo.setTdlList(tdlList);
//获取线路情况
List<CircuitTransferVo> list =circuitTransferService.getCity(transportationNo);
List<ResultCityVo> cityVoList = new ArrayList<>();
if(list == null){
fb.setCode(0);
if(port.equals("en")){
fb.setMessage("There is no such line");
} else if(port.equals("jp")){
fb.setMessage("ルートが存在していません");
}else{
fb.setMessage("没有该线路");
}
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb);
}
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getSequence() == 1) {
ResultCityVo cityVo = new ResultCityVo();
cityVo.setCity(list.get(i).getCity());
cityVo.setAddress(list.get(i).getAddress());
cityVo.setType(1);
if(list.get(i).getStartTime() == null || list.get(i).getStartTime() == 0 ){
cityVo.setTime(0l);
cityVo.setLast("0");
cityVo.setAlarmCount(0);
}else{
cityVo.setTime(list.get(i).getStartTime());
if(list.get(i + 1).getArrivalTime() !=null && list.get(i + 1).getArrivalTime() !=0){
//根据时间和运输编号获取报警信息
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), list.get(i + 1).getArrivalTime());
cityVo.setAlarmCount(count);
cityVo.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime()));
}else{
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), System.currentTimeMillis());
cityVo.setAlarmCount(count);
cityVo.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime()));
}
}
cityVoList.add(cityVo);
}else if(list.get(i).getSequence() == list.size()){
ResultCityVo cityVo = new ResultCityVo();
cityVo.setCity(list.get(i).getCity());
cityVo.setAddress(list.get(i).getAddress());
if(list.get(i).getArrivalTime() == null || list.get(i).getArrivalTime() == 0){
cityVo.setTime(0l);
}else {
cityVo.setTime(list.get(i).getArrivalTime());
}
cityVo.setType(2);
cityVoList.add(cityVo);
}else{
ResultCityVo cityVo2 = new ResultCityVo();
cityVo2.setCity(list.get(i).getCity());
cityVo2.setAddress(list.get(i).getAddress());
cityVo2.setType(2);
if(list.get(i).getArrivalTime() == null ||list.get(i).getArrivalTime() ==0){
cityVo2.setTime(0l);
cityVo2.setAlarmCount(0);
cityVo2.setLast("0");
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
cityVo1.setAddress(list.get(i).getAddress());
cityVo1.setTime(0l);
cityVo1.setType(1);
cityVo1.setAlarmCount(0);
cityVo1.setLast("0");
cityVoList.add(cityVo1);
}else{
cityVo2.setTime(list.get(i).getArrivalTime());
//根据时间和运输编号获取报警信息
if(list.get(i).getStartTime() == null ||list.get(i).getStartTime() ==0){
Integer count2 = alarmLogService.getByTime(transportationNo, list.get(i).getArrivalTime(), System.currentTimeMillis());
cityVo2.setAlarmCount(count2);
cityVo2.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getArrivalTime()));
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
cityVo1.setAddress(list.get(i).getAddress());
cityVo1.setTime(0l);
cityVo1.setType(1);
cityVo1.setAlarmCount(0);
cityVo1.setLast("0");
cityVoList.add(cityVo1);
}else{
Integer count2 = alarmLogService.getByTime(transportationNo, list.get(i).getArrivalTime(), list.get(i).getStartTime());
cityVo2.setAlarmCount(count2);
cityVo2.setLast(getMistiming(list.get(i ).getStartTime(),list.get(i).getArrivalTime()));
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
cityVo1.setAddress(list.get(i).getAddress());
cityVo1.setTime(list.get(i).getStartTime());
cityVo1.setType(1);
if(list.get(i + 1).getArrivalTime() == null ||list.get(i + 1).getArrivalTime() ==0){
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), System.currentTimeMillis());
cityVo1.setAlarmCount(count);
cityVo1.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime()));
cityVoList.add(cityVo1);
}else {
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), list.get(i + 1).getArrivalTime());
cityVo1.setAlarmCount(count);
cityVo1.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime()));
cityVoList.add(cityVo1);
}
}
}
}
}
messageVo.setList(cityVoList);
return gson.toJson(messageVo);
}
//根据车牌号查线路
@ApiOperation(value = "根据车牌号查线路---mobile",notes = "根据车牌号查线路,返回值说明:" +
" transportationNo:运输编号," +
" cargoNo:货物编号" +
" cargoName:货物别名" +
" startCity:起运城市," +
" startTime:起运时间," +
" endCity:目的城市," +
" endTime:目的时间," +
" alarmType:预警类型," +
" circuitState:线路状态(0未开始,1运输中,2完成)," +
" alarm:报警详情(比如:温度,湿度,震动)" +
" evaluate:运输评价")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@RequestMapping(value="/getByPlateNo",method = RequestMethod.POST)
public Object getByPlateNo(@RequestBody String plateNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
JSONObject jsonObject= JSON.parseObject(plateNo);
plateNo=(String)jsonObject.get("plateNo");
return circuitService.getByPlateNo(plateNo,user.getCompanyName());
}
//添加线路信息 //添加线路信息
@ApiOperation(value = "添加线路信息",notes = "添加线路信息," + @ApiOperation(value = "添加线路信息",notes = "添加线路信息," +
" startAddressVo: 线路集合,包含" + " startAddressVo: 线路集合,包含" +
...@@ -272,6 +584,7 @@ public class CircuitController { ...@@ -272,6 +584,7 @@ public class CircuitController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/addCircuit",method = RequestMethod.POST) @RequestMapping(value="/addCircuit",method = RequestMethod.POST)
public Object addCircuit(@RequestBody AddCircuitVo addCircuitVo,HttpServletRequest request){ public Object addCircuit(@RequestBody AddCircuitVo addCircuitVo,HttpServletRequest request){
...@@ -279,49 +592,50 @@ public class CircuitController { ...@@ -279,49 +592,50 @@ public class CircuitController {
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
ResultCompanyVo companyVo = companyService.getByCompanyName(user.getCompanyName()); ResultCompanyVo companyVo = companyService.getByCompanyName(user.getCompanyName());
String port = request.getHeader("AccountLanguage");
if(StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCountry())){ if(StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发国家不能为空"); fb.setMessage(i18n.getMessage(request,"startCountry"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCity())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发城市不能为空"); fb.setMessage(i18n.getMessage(request,"startCity"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getAddressDetail())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发具体地址不能为空"); fb.setMessage(i18n.getMessage(request,"startAddressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLat())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地纬度不能为空"); fb.setMessage(i18n.getMessage(request,"startLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getStartAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if(!addCircuitVo.getStartAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"wrongStartLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLng())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地经度不能为空"); fb.setMessage(i18n.getMessage(request,"startLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getStartAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addCircuitVo.getStartAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongStartLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getPostCode())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getPostCode())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地邮编不能为空"); fb.setMessage(i18n.getMessage(request,"startPostCode"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getStartAddressVo().getExpTime()==null){ if (addCircuitVo.getStartAddressVo().getExpTime()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地预计出发时间不能为空"); fb.setMessage(i18n.getMessage(request,"starExpTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Long time = System.currentTimeMillis(); Long time = System.currentTimeMillis();
...@@ -338,69 +652,69 @@ public class CircuitController { ...@@ -338,69 +652,69 @@ public class CircuitController {
if(addCircuitVo.getAddressVoList() != null){ if(addCircuitVo.getAddressVoList() != null){
if(addCircuitVo.getAddressVoList().size()>3){ if(addCircuitVo.getAddressVoList().size()>3){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地不能超过3个"); fb.setMessage(i18n.getMessage(request,"addressVoList"));
return gson.toJson(fb); return gson.toJson(fb);
} }
for(int i =0,length=addCircuitVo.getAddressVoList().size();i<length;i++){ for(int i =0,length=addCircuitVo.getAddressVoList().size();i<length;i++){
if(StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getCountry())){ if(StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地国家不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoCountry"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getCity())){ if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地城市不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoCity"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getAddressDetail())){ if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地具体地址不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoAddressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getLat())){ if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地纬度不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getAddressVoList().get(i).getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if(!addCircuitVo.getAddressVoList().get(i).getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"wrongAddressVoLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getLng())){ if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地经度不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getAddressVoList().get(i).getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addCircuitVo.getAddressVoList().get(i).getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongaddressVoLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getPostCode())){ if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getPostCode())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地邮编不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoPostCode"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getAddressVoList().get(i).getExpTime() == null){ if (addCircuitVo.getAddressVoList().get(i).getExpTime() == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地预计出发时间不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoExpTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getAddressVoList().get(i).getCompTime() == null){ if (addCircuitVo.getAddressVoList().get(i).getCompTime() == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地预计到达时间不能为空"); fb.setMessage(i18n.getMessage(request,"addressVoCompTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getAddressVoList().get(i).getCompTime() <=addCircuitVo.getAddressVoList().get(i).getExpTime()){ if (addCircuitVo.getAddressVoList().get(i).getCompTime() <=addCircuitVo.getAddressVoList().get(i).getExpTime()){
fb.setCode(0); fb.setCode(0);
fb.setMessage("途径地预计到达时间不能小于途径地预计出发时间"); fb.setMessage(i18n.getMessage(request,"wrongAddressVoCompTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(i<addCircuitVo.getAddressVoList().size()-1){ if(i<addCircuitVo.getAddressVoList().size()-1){
if (addCircuitVo.getAddressVoList().get(i).getCompTime() >=addCircuitVo.getAddressVoList().get(i +1).getExpTime()){ if (addCircuitVo.getAddressVoList().get(i).getCompTime() >=addCircuitVo.getAddressVoList().get(i +1).getExpTime()){
fb.setCode(0); fb.setCode(0);
fb.setMessage("当前途径地预计到达时间不能大于下一个途径地预计出发时间"); fb.setMessage(i18n.getMessage(request,"wrongAddressVoExpTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
} }
...@@ -428,57 +742,57 @@ public class CircuitController { ...@@ -428,57 +742,57 @@ public class CircuitController {
arrivalTimeVar = arrivalTimeVar +"0 "; arrivalTimeVar = arrivalTimeVar +"0 ";
if(StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCountry())){ if(StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地国家不能为空"); fb.setMessage(i18n.getMessage(request,"endCountry"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCity())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地城市不能为空"); fb.setMessage(i18n.getMessage(request,"endCity"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getAddressDetail())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地具体地址不能为空"); fb.setMessage(i18n.getMessage(request,"endAddressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLat())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地纬度不能为空"); fb.setMessage(i18n.getMessage(request,"endLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getEndAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if(!addCircuitVo.getEndAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"wrongEndLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLng())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地经度不能为空"); fb.setMessage(i18n.getMessage(request,"endLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getEndAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addCircuitVo.getEndAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongEndLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getPostCode())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getPostCode())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地邮编不能为空"); fb.setMessage(i18n.getMessage(request,"endPostCode"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getEndAddressVo().getCompTime()==null){ if (addCircuitVo.getEndAddressVo().getCompTime()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地预计到达时间不能为空"); fb.setMessage(i18n.getMessage(request,"endCompTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(addCircuitVo.getEndAddressVo().getCompTime()<=addCircuitVo.getStartAddressVo().getExpTime()){ if(addCircuitVo.getEndAddressVo().getCompTime()<=addCircuitVo.getStartAddressVo().getExpTime()){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地预计到达时间不能小于出发地的预计出发时间"); fb.setMessage(i18n.getMessage(request,"wrongEndCompTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getSN())){ if(StringUtils.isEmpty(addCircuitVo.getSN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("网关序列号不能为空"); fb.setMessage(i18n.getMessage(request,"gateway"));
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -486,19 +800,19 @@ public class CircuitController { ...@@ -486,19 +800,19 @@ public class CircuitController {
//判断当前gateWay是否存在 //判断当前gateWay是否存在
if(StringUtils.isEmpty(type)){ if(StringUtils.isEmpty(type)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该网关序不存在"); fb.setMessage(i18n.getMessage(request,"gatewayExist"));
return gson.toJson(fb); return gson.toJson(fb);
} }
ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(addCircuitVo.getSN(),type); ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(addCircuitVo.getSN(),type);
if(!resultGatewayVo.getState()){ if(!resultGatewayVo.getState()){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该网关为挂载"); fb.setMessage(i18n.getMessage(request,"gatewayMounted"));
return gson.toJson(fb); return gson.toJson(fb);
} }
//获取gateway的场景 //获取gateway的场景
if(resultGatewayVo.getUseScene()== 2){ if(resultGatewayVo.getUseScene()== 2){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该网关的使用场景与当前不符"); fb.setMessage(i18n.getMessage(request,"gatewayConsistent"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String alarmTypeVar=""; String alarmTypeVar="";
...@@ -507,25 +821,27 @@ public class CircuitController { ...@@ -507,25 +821,27 @@ public class CircuitController {
for(int j = 0,length =addCircuitVo.getTdlAlarmList().size();j<length;j++){ for(int j = 0,length =addCircuitVo.getTdlAlarmList().size();j<length;j++){
if(StringUtils.isEmpty(addCircuitVo.getTdlAlarmList().get(j).getTDLSN())){ if(StringUtils.isEmpty(addCircuitVo.getTdlAlarmList().get(j).getTDLSN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("tag序列号不能为空"); fb.setMessage(i18n.getMessage(request,"tdl"));
return gson.toJson(fb); return gson.toJson(fb);
} }
//判断当前tdl是否存在 //判断当前tdl是否存在
ResultTDLDeviceVo tdlDeviceVo = tdlDeviceService.getByTDLSN(addCircuitVo.getTdlAlarmList().get(j).getTDLSN()); ResultTDLDeviceVo tdlDeviceVo = tdlDeviceService.getByTDLSN(addCircuitVo.getTdlAlarmList().get(j).getTDLSN());
if(tdlDeviceVo == null){ if(tdlDeviceVo == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage(addCircuitVo.getTdlAlarmList().get(j).getTDLSN() +"不存在"); Object[] args ={addCircuitVo.getTdlAlarmList().get(j).getTDLSN()};
fb.setMessage(i18n.getMessage(request, args,"tdlExist"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!StringUtils.isEmpty(tdlDeviceVo.getGatewaySN())){ if(!StringUtils.isEmpty(tdlDeviceVo.getGatewaySN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("序列号为"+addCircuitVo.getTdlAlarmList().get(j).getTDLSN() +"的TDL已经被使用"); Object[] args ={addCircuitVo.getTdlAlarmList().get(j).getTDLSN()};
fb.setMessage(i18n.getMessage(request,args,"tdlUsed"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getTdlAlarmList().get(j).getAlarmType())){ if(StringUtils.isEmpty(addCircuitVo.getTdlAlarmList().get(j).getAlarmType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("预警类型"); fb.setMessage(i18n.getMessage(request,"alarmType"));
return gson.toJson(fb); return gson.toJson(fb);
} }
alarmTypeVar =alarmTypeVar + addCircuitVo.getTdlAlarmList().get(j).getAlarmType() +" "; alarmTypeVar =alarmTypeVar + addCircuitVo.getTdlAlarmList().get(j).getAlarmType() +" ";
...@@ -535,17 +851,17 @@ public class CircuitController { ...@@ -535,17 +851,17 @@ public class CircuitController {
} }
if(StringUtils.isEmpty(addCircuitVo.getCargoNo())){ if(StringUtils.isEmpty(addCircuitVo.getCargoNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("货物编号不能为空"); fb.setMessage(i18n.getMessage(request,"cargoNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getPlateNo())){ if(StringUtils.isEmpty(addCircuitVo.getPlateNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("车牌号不能为空"); fb.setMessage(i18n.getMessage(request,"plateNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getCargoName())){ if(StringUtils.isEmpty(addCircuitVo.getCargoName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("货物别名不能为空"); fb.setMessage(i18n.getMessage(request,"cargoName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
//根据sn获取type //根据sn获取type
...@@ -591,13 +907,13 @@ public class CircuitController { ...@@ -591,13 +907,13 @@ public class CircuitController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("添加线路成功")){ if (msg.get("msg").equals("添加线路成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("添加线路成功"); fb.setMessage(i18n.getMessage(request,"circuitSuccess"));
//增加配置(公司以及线路信息) //增加配置(公司以及线路信息)
AlarmMqttConfig alarmMqttConfig = new AlarmMqttConfig(transportationNo,companyVo.getCompanyNo()); AlarmMqttConfig alarmMqttConfig = new AlarmMqttConfig(transportationNo,companyVo.getCompanyNo());
infoRedisService.hmSet("AlarmMqttConfig",type+"_"+addCircuitVo.getSN(),gson.toJson(alarmMqttConfig)); infoRedisService.hmSet("AlarmMqttConfig",type+"_"+addCircuitVo.getSN(),gson.toJson(alarmMqttConfig));
}else { }else {
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"circuitFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -634,130 +950,287 @@ public class CircuitController { ...@@ -634,130 +950,287 @@ public class CircuitController {
" remark:备注,") " remark:备注,")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/add",method = RequestMethod.POST) @RequestMapping(value="/add",method = RequestMethod.POST)
public Object add(@RequestBody AddCircuit addCircuitVo,HttpServletRequest request){ public Object add(@RequestBody AddCircuit addCircuitVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
int port = request.getServerPort();
if(StringUtils.isEmpty(addCircuitVo.getCargoNo())){ if(StringUtils.isEmpty(addCircuitVo.getCargoNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("货物编号不能为空"); if(port == 58080){
fb.setMessage("货物编号不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getPlateNo())){ if(StringUtils.isEmpty(addCircuitVo.getPlateNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("车牌号不能为空"); if(port == 58080){
fb.setMessage("车牌号不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getCargoName())){ if(StringUtils.isEmpty(addCircuitVo.getCargoName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("货物别名不能为空"); if(port == 58080){
fb.setMessage("货物别名不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getTransportation())){ if(StringUtils.isEmpty(addCircuitVo.getTransportation())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输方式不能为空"); if(port == 58080){
fb.setMessage("运输方式不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCountry())){ if(StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发国家不能为空"); if(port == 58080){
fb.setMessage("出发国家不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCity())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发城市不能为空"); if(port == 58080){
fb.setMessage("出发城市不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getAddressDetail())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发具体地址不能为空"); if(port == 58080){
return gson.toJson(fb); fb.setMessage("出发具体地址不能为空");
} }else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLat())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地纬度不能为空"); if(port == 58080){
fb.setMessage("出发地纬度不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getStartAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if(!addCircuitVo.getStartAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地纬度的范围为-90~90"); if(port == 58080){
fb.setMessage("出发地纬度的范围为-90~90");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLng())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地经度不能为空"); if(port == 58080){
fb.setMessage("出发地经度不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getStartAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addCircuitVo.getStartAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地经度的范围为-180~180"); if(port == 58080){
fb.setMessage("出发地纬度的范围为-90~90");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getPostCode())){ if (StringUtils.isEmpty(addCircuitVo.getStartAddressVo().getPostCode())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地邮编不能为空"); if(port == 58080){
fb.setMessage("出发地邮编不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getStartAddressVo().getExpTime()==null){ if (addCircuitVo.getStartAddressVo().getExpTime()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("出发地预计出发时间不能为空"); if(port == 58080){
fb.setMessage("出发地预计出发时间不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCountry())){ if(StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地国家不能为空"); if(port == 58080){
fb.setMessage("目的地国家不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCity())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地城市不能为空"); if(port == 58080){
fb.setMessage("目的地城市不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getAddressDetail())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地具体地址不能为空"); if(port == 58080){
fb.setMessage("目的地具体地址不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLat())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地纬度不能为空"); if(port == 58080){
fb.setMessage("目的地纬度不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getEndAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if(!addCircuitVo.getEndAddressVo().getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地纬度的范围为-90~90"); if(port == 58080){
fb.setMessage("目的地纬度的范围为-90~90");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLng())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地经度不能为空"); if(port == 58080){
fb.setMessage("目的地经度不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addCircuitVo.getEndAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addCircuitVo.getEndAddressVo().getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地经度的范围为-180~180"); if(port == 58080){
fb.setMessage("目的地经度的范围为-180~180");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getPostCode())){ if (StringUtils.isEmpty(addCircuitVo.getEndAddressVo().getPostCode())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地邮编不能为空"); if(port == 58080){
fb.setMessage("目的地邮编不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getEndAddressVo().getCompTime()==null){ if (addCircuitVo.getEndAddressVo().getCompTime()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("目的地预计到达时间不能为空"); if(port == 58080){
fb.setMessage("目的地预计到达时间不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getDeliveryAddress())){ if(StringUtils.isEmpty(addCircuitVo.getDeliveryAddress())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("交付地点不能为空"); if(port == 58080){
fb.setMessage("交付地点不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addCircuitVo.getTransportationType())){ if(StringUtils.isEmpty(addCircuitVo.getTransportationType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输类型不能为空"); if(port == 58080){
fb.setMessage("运输类型不能为空");
}else if(port == 58081){
}else if (port == 58082){
}
return gson.toJson(fb); return gson.toJson(fb);
} }
Long time = System.currentTimeMillis(); Long time = System.currentTimeMillis();
...@@ -801,10 +1274,24 @@ public class CircuitController { ...@@ -801,10 +1274,24 @@ public class CircuitController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("线路添加成功")){ if (msg.get("msg").equals("线路添加成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("添加线路成功"); if(port == 58080){
fb.setMessage("添加线路成功");
}else if(port == 58081){
}else if (port == 58082){
}
}else { }else {
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); if(port == 58080){
fb.setMessage(msg.get("msg").toString());
}else if(port == 58081){
}else if (port == 58082){
}
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -817,29 +1304,32 @@ public class CircuitController { ...@@ -817,29 +1304,32 @@ public class CircuitController {
" endTime:到达时间 " ) " endTime:到达时间 " )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updateEndTime",method = RequestMethod.POST) @RequestMapping(value="/updateEndTime",method = RequestMethod.POST)
public Object updateEndTime(@RequestBody UpdateCircuitVo updateCircuitVo,HttpServletRequest request){ public Object updateEndTime(@RequestBody UpdateCircuitVo updateCircuitVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
ResultCompanyVo companyVo = companyService.getByCompanyName(user.getCompanyName()); ResultCompanyVo companyVo = companyService.getByCompanyName(user.getCompanyName());
if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName())==null){ if (StringUtils.isEmpty(updateCircuitVo.getTransportationNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有该线路"); fb.setMessage(i18n.getMessage(request,"transportationNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCircuitVo.getTransportationNo())){ if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName())==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输编号不能为空"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateCircuitVo.getEndTime()==null){ if (updateCircuitVo.getEndTime()==null){
updateCircuitVo.setEndTime(System.currentTimeMillis()); updateCircuitVo.setEndTime(System.currentTimeMillis());
} }
if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName()).getCircuitState() ==0){ if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName()).getCircuitState() ==0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("线路未开始"); fb.setMessage(i18n.getMessage(request,"notStarted"));
return gson.toJson(fb); return gson.toJson(fb);
} }
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName());
...@@ -847,37 +1337,37 @@ public class CircuitController { ...@@ -847,37 +1337,37 @@ public class CircuitController {
TDLLogVo tdlLogVo = tdlLogService.getByTransportationNo(updateCircuitVo.getTransportationNo()); TDLLogVo tdlLogVo = tdlLogService.getByTransportationNo(updateCircuitVo.getTransportationNo());
if(tdlLogVo == null){ if(tdlLogVo == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定网关或者tdl"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
} }
List<String> dev = tdlLogService.getTdlSN(updateCircuitVo.getTransportationNo()); List<String> dev = tdlLogService.getTdlSN(updateCircuitVo.getTransportationNo());
if(tdlLogVo == null){ if(dev == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定网关或者tdl"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
} }
List<String> devList = tdlDeviceService.getByGatewaySN(tdlLogVo.getgSN(),tdlLogVo.getgType()); List<String> devList = tdlDeviceService.getByGatewaySN(tdlLogVo.getgSN(),tdlLogVo.getgType());
if(devList == null){ if(devList == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定tdl"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String tdl = tdlDeviceService.getTdl(tdlLogVo.getgSN(),tdlLogVo.getgType()); String tdl = tdlDeviceService.getTdl(tdlLogVo.getgSN(),tdlLogVo.getgType());
if(tdl == null){ if(tdl == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定tdl"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
} }
ConfigCMDVo configCMDVo; ConfigCMDVo configCMDVo;
ConfigVo configVo =configService.getConfig(tdlLogVo.getgSN(),tdlLogVo.getgType()); ConfigVo configVo =configService.getConfig(tdlLogVo.getgSN(),tdlLogVo.getgType());
if(configVo == null){ if(configVo == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定网关或者tdl"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(configVo.getMessage())){ if(StringUtils.isEmpty(configVo.getMessage())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定网关或者tdl"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
}else{ }else{
ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class); ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class);
...@@ -901,46 +1391,18 @@ public class CircuitController { ...@@ -901,46 +1391,18 @@ public class CircuitController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("修改成功")){ if (msg.get("msg").equals("修改成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"endCircuitSuccess"));
String key ="TDL/"+tdlLogVo.getgType()+"/" +tdlLogVo.getgSN() +"/Data"; String key ="TDL/"+tdlLogVo.getgType()+"/" +tdlLogVo.getgSN() +"/Data";
alarmRedisService.delKey(key); alarmRedisService.delKey(key);
//AlarmMqttConfig alarmMqttConfig = new AlarmMqttConfig(updateCircuitVo.getTransportationNo(),companyVo.getCompanyNo());
infoRedisService.delHashKey("AlarmMqttConfig",tdlLogVo.getgType()+"_"+tdlLogVo.getgSN()); infoRedisService.delHashKey("AlarmMqttConfig",tdlLogVo.getgType()+"_"+tdlLogVo.getgSN());
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"endCircuitFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
//根据车牌号查线路
@ApiOperation(value = "根据车牌号查线路---mobile",notes = "根据车牌号查线路,返回值说明:" +
" transportationNo:运输编号," +
" cargoNo:货物编号" +
" cargoName:货物别名" +
" startCity:起运城市," +
" startTime:起运时间," +
" endCity:目的城市," +
" endTime:目的时间," +
" alarmType:预警类型," +
" circuitState:线路状态(0未开始,1运输中,2完成)," +
" alarm:报警详情(比如:温度,湿度,震动)" +
" evaluate:运输评价")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getByPlateNo",method = RequestMethod.POST)
public Object getByPlateNo(@RequestBody String plateNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
JSONObject jsonObject= JSON.parseObject(plateNo);
plateNo=(String)jsonObject.get("plateNo");
return circuitService.getByPlateNo(plateNo,user.getCompanyName());
}
//评价 //评价
@ApiOperation(value = "评价---mobile",notes = "评价线路传值说明:" + @ApiOperation(value = "评价---mobile",notes = "评价线路传值说明:" +
...@@ -949,39 +1411,42 @@ public class CircuitController { ...@@ -949,39 +1411,42 @@ public class CircuitController {
" evaluateRemark:评分备注") " evaluateRemark:评分备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updateEvaluate",method = RequestMethod.POST) @RequestMapping(value="/updateEvaluate",method = RequestMethod.POST)
public Object updateEvaluate(@RequestBody UpdateEvaluateVo updateEvaluateVo,HttpServletRequest request){ public Object updateEvaluate(@RequestBody UpdateEvaluateVo updateEvaluateVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo(),user.getCompanyName())==null){ String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(updateEvaluateVo.getTransportationNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有该线路"); fb.setMessage(i18n.getMessage(request,"transportationNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateEvaluateVo.getEvaluate()==null){ if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo(),user.getCompanyName())==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("评价的等级不能为空"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateEvaluateVo.getTransportationNo())){ if (updateEvaluateVo.getEvaluate()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要评价的线路编号不能为空"); fb.setMessage(i18n.getMessage(request,"evaluate"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo(),user.getCompanyName()).getCircuitState()!=2){ if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo(),user.getCompanyName()).getCircuitState()!=2){
fb.setCode(0); fb.setCode(0);
fb.setMessage("线路完成运输才能评价"); fb.setMessage(i18n.getMessage(request,"completedCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
int a = circuitService.updateEvaluate(updateEvaluateVo); int a = circuitService.updateEvaluate(updateEvaluateVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("评价成功"); fb.setMessage(i18n.getMessage(request,"evaluateSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("评价失败"); fb.setMessage(i18n.getMessage(request,"evaluateFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -1004,15 +1469,17 @@ public class CircuitController { ...@@ -1004,15 +1469,17 @@ public class CircuitController {
" transportation:运输方式") " transportation:运输方式")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByCircuitState",method = RequestMethod.POST) @RequestMapping(value="/getByCircuitState",method = RequestMethod.POST)
public Object getByCircuitState(@RequestBody Map map,HttpServletRequest request){ public Object getByCircuitState(@RequestBody Map map,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (!map.containsKey("circuitState")){ if (!map.containsKey("circuitState")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要查询的线路状态不能为空"); fb.setMessage(i18n.getMessage(request,"circuitState"));
return gson.toJson(fb); return gson.toJson(fb);
} }
return circuitService.getByCircuitState(Integer.valueOf(map.get("circuitState").toString()),user.getCompanyName()); return circuitService.getByCircuitState(Integer.valueOf(map.get("circuitState").toString()),user.getCompanyName());
...@@ -1024,27 +1491,30 @@ public class CircuitController { ...@@ -1024,27 +1491,30 @@ public class CircuitController {
" transportationNo:运输编号" ) " transportationNo:运输编号" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/delCircuit",method = RequestMethod.POST) @RequestMapping(value="/delCircuit",method = RequestMethod.POST)
public Object delCircuit(@RequestBody String transportationNo,HttpServletRequest request){ public Object delCircuit(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
JSONObject jsonObject= JSON.parseObject(transportationNo); String port = request.getHeader("AccountLanguage");
transportationNo=(String)jsonObject.get("transportationNo");
if (StringUtils.isEmpty(transportationNo)){ if (StringUtils.isEmpty(transportationNo)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输编号不能为空"); fb.setMessage(i18n.getMessage(request,"transportationNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (circuitService.getByTransportationNo(transportationNo,user.getCompanyName())==null){ JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=(String)jsonObject.get("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
if (resultCircuitVo==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有该线路"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (circuitService.getByTransportationNo(transportationNo,user.getCompanyName()).getCircuitState()!=0){ if (resultCircuitVo.getCircuitState()!=0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路在运输中或已经完成运输"); fb.setMessage(i18n.getMessage(request,"inTransit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
TDLLogVo tdlLogVo = tdlLogService.getByTransportationNo(transportationNo); TDLLogVo tdlLogVo = tdlLogService.getByTransportationNo(transportationNo);
...@@ -1052,26 +1522,26 @@ public class CircuitController { ...@@ -1052,26 +1522,26 @@ public class CircuitController {
List<String> dev = tdlLogService.getTdlSN(transportationNo); List<String> dev = tdlLogService.getTdlSN(transportationNo);
if(dev == null){ if(dev == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定tdl"); fb.setMessage(i18n.getMessage(request,"bindTDL"));
return gson.toJson(fb); return gson.toJson(fb);
} }
List<String> devList = tdlDeviceService.getByGatewaySN(tdlLogVo.getgSN(),tdlLogVo.getgType()); List<String> devList = tdlDeviceService.getByGatewaySN(tdlLogVo.getgSN(),tdlLogVo.getgType());
if(dev == null){ if(dev == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定tdl"); fb.setMessage(i18n.getMessage(request,"bindTDL"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String tdl = tdlDeviceService.getTdl(tdlLogVo.getgSN(),tdlLogVo.getgType()); String tdl = tdlDeviceService.getTdl(tdlLogVo.getgSN(),tdlLogVo.getgType());
if(StringUtils.isEmpty(tdl)){ if(StringUtils.isEmpty(tdl)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定tdl"); fb.setMessage(i18n.getMessage(request,"bindTDL"));
return gson.toJson(fb); return gson.toJson(fb);
} }
ConfigCMDVo configCMDVo; ConfigCMDVo configCMDVo;
ConfigVo configVo =configService.getConfig(tdlLogVo.getgSN(),tdlLogVo.getgType()); ConfigVo configVo =configService.getConfig(tdlLogVo.getgSN(),tdlLogVo.getgType());
if(configVo ==null ){ if(configVo ==null ){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定网关"); fb.setMessage(i18n.getMessage(request,"bindGateway"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(configVo.getMessage())){ if(StringUtils.isEmpty(configVo.getMessage())){
...@@ -1096,263 +1566,70 @@ public class CircuitController { ...@@ -1096,263 +1566,70 @@ public class CircuitController {
Map<Object,Object> msg=new HashMap<>(); Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("解除网关成功")){ if (msg.get("msg").equals("解除网关成功")){
fb.setCode(1); fb.setMessage(i18n.getMessage(request,"circuitDeleteSuccess"));
fb.setMessage(msg.get("msg").toString());
String key ="TDL/"+tdlLogVo.getgType()+"/" +tdlLogVo.getgSN() +"/Data"; String key ="TDL/"+tdlLogVo.getgType()+"/" +tdlLogVo.getgSN() +"/Data";
alarmRedisService.delKey(key); alarmRedisService.delKey(key);
infoRedisService.delHashKey("AlarmMqttConfig",tdlLogVo.getgType()+"_"+tdlLogVo.getgSN()); infoRedisService.delHashKey("AlarmMqttConfig",tdlLogVo.getgType()+"_"+tdlLogVo.getgSN());
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"circuitDeleteFailure"));
} }
}else { }else {
int a = circuitService.delCircuit(transportationNo); int a = circuitService.delCircuit(transportationNo);
try { try {
if (a > 0) { if (a > 0) {
fb.setCode(1); fb.setCode(1);
fb.setMessage("删除线路成功"); fb.setMessage(i18n.getMessage(request,"circuitDeleteSuccess"));
infoRedisService.delHashKey("AlarmMqttConfig",tdlLogVo.getgType()+"_"+tdlLogVo.getgSN()); infoRedisService.delHashKey("AlarmMqttConfig",tdlLogVo.getgType()+"_"+tdlLogVo.getgSN());
} else { } else {
fb.setCode(0); fb.setCode(0);
fb.setMessage("删除线路失败"); fb.setMessage(i18n.getMessage(request,"circuitDeleteFailure"));
} }
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); e.printStackTrace();
logger.info(e.toString()); logger.info(e.toString());
fb.setCode(0); fb.setCode(0);
fb.setMessage("删除线路失败"); fb.setMessage(i18n.getMessage(request,"circuitDeleteFailure"));
} }
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
//根据线路编号获取线路详细信息
@ApiOperation(value = "根据线路编号获取线路详细信息",notes = "根据线路编号获取线路详细信息,传值说明:" +
" transportationNo:运输编号; " +
"返回值说明:" +
" transportationNo:运输编号," +
" routeName:线路," +
" cargoName:货物别名," +
" transportation:运输方式," +
" evaluate:评价," +
" alarmType:预警类型," +
" SN:gateway序列号," +
" tdlList:{" +
" tdlsn:TDLSN序列号" +
" batteryVoltage:电池电压}," +
" list:{" +
" city:城市;" +
" time:到达时间/发车时间;" +
" last:运行时长;" +
" alarmCount:报警数;" +
" type:1--出发时间;2--目的时间}," +
" alarmLogList:{" +
" transportationNo:运输编号;" +
" TDLSN:tag序列号;" +
" description:报警描述;" +
" data:数值;" +
" alarmTime:报警时间;" +
" classify:分类}" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@PostMapping("/getDetails")
public Object getDetails(@RequestBody String transportationNo) {
if(StringUtils.isEmpty(transportationNo)){
fb.setCode(0);
fb.setMessage("线路编号不能为空");
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=(String)jsonObject.get("transportationNo");
//获取线路信息
CircuitMessage circuitVo = circuitService.getMessage(transportationNo);
if(circuitVo == null){
fb.setCode(0);
fb.setMessage("该线路不存在");
return gson.toJson(fb);
}
//获取gateway信息
TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo == null){
fb.setCode(0);
fb.setMessage("该线路不存在");
return gson.toJson(fb);
}
List<ResultAlarmLog> alarmLogList= alarmLogService.getByTransportationNo(transportationNo);
CircuitMessageVo messageVo = new CircuitMessageVo(circuitVo.getTransportationNo(),circuitVo.getRouteName(),circuitVo.getCargoName(),circuitVo.getPlateNo(),circuitVo.getTransportation(),circuitVo.getEvaluate(),circuitVo.getAlarmType(),gatewayVo.getgSN(),alarmLogList);
List<String> TDL= tdlLogService.getTdlSN(transportationNo);
if(TDL.size() == 0){
fb.setCode(0);
fb.setMessage("该线路不存在");
return gson.toJson(fb);
}
List<CircuitMessageVo.TDL> tdlList = new ArrayList<>();
for(int i=0;i<TDL.size();i++){
CircuitMessageVo.TDL tdl = new CircuitMessageVo.TDL();
tdl.setTdlsn(TDL.get(i).replace("TDL-", "").trim());
if(circuitVo.getStartTime() == null || circuitVo.getStartTime() == 0){
tdl.setBatteryVoltage("");
}else {
String sql ="";
if (circuitVo.getEndTime() != null && circuitVo.getEndTime() != 0) {
sql = "SELECT \"b\" FROM \"tdl_policy\".\"" + gatewayVo.getgType() + "_" + gatewayVo.getgSN() + "\" where \"tdl\"='" + TDL.get(i) + "' and time >=" + circuitVo.getStartTime() + " and time<=" + circuitVo.getEndTime() * 1000000l + " ORDER BY time desc limit 1";
} else {
sql = "SELECT \"b\" FROM \"tdl_policy\".\"" + gatewayVo.getgType() + "_" + gatewayVo.getgSN() + "\" where \"tdl\"='" + TDL.get(i) + "' and time >=" + circuitVo.getStartTime() + " ORDER BY time desc limit 1";
}
QueryResult queryResult = influxDBTemplate.query(new Query(sql, database));
if (queryResult.getResults().get(0).getSeries() == null) {
tdl.setBatteryVoltage("");
}else{
DecimalFormat df = new DecimalFormat("######0.0");
String value = queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1) == null ? "" : queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString();
tdl.setBatteryVoltage(df.format(Double.valueOf(value)));
}
}
tdlList.add(tdl);
}
messageVo.setTdlList(tdlList);
//获取线路情况
List<CircuitTransferVo> list =circuitTransferService.getCity(transportationNo);
List<ResultCityVo> cityVoList = new ArrayList<>();
if(list == null){
fb.setCode(0);
fb.setMessage("该线路不存在");
return gson.toJson(fb);
}
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getSequence() == 1) {
ResultCityVo cityVo = new ResultCityVo();
cityVo.setCity(list.get(i).getCity());
cityVo.setAddress(list.get(i).getAddress());
cityVo.setType(1);
if(list.get(i).getStartTime() == null || list.get(i).getStartTime() == 0 ){
cityVo.setTime(0l);
cityVo.setLast("0");
cityVo.setAlarmCount(0);
}else{
cityVo.setTime(list.get(i).getStartTime());
if(list.get(i + 1).getArrivalTime() !=null && list.get(i + 1).getArrivalTime() !=0){
//根据时间和运输编号获取报警信息
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), list.get(i + 1).getArrivalTime());
cityVo.setAlarmCount(count);
cityVo.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime()));
}else{
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), System.currentTimeMillis());
cityVo.setAlarmCount(count);
cityVo.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime()));
}
}
cityVoList.add(cityVo);
}else if(list.get(i).getSequence() == list.size()){
ResultCityVo cityVo = new ResultCityVo();
cityVo.setCity(list.get(i).getCity());
cityVo.setAddress(list.get(i).getAddress());
if(list.get(i).getArrivalTime() == null || list.get(i).getArrivalTime() == 0){
cityVo.setTime(0l);
}else {
cityVo.setTime(list.get(i).getArrivalTime());
}
cityVo.setType(2);
cityVoList.add(cityVo);
}else{
ResultCityVo cityVo2 = new ResultCityVo();
cityVo2.setCity(list.get(i).getCity());
cityVo2.setAddress(list.get(i).getAddress());
cityVo2.setType(2);
if(list.get(i).getArrivalTime() == null ||list.get(i).getArrivalTime() ==0){
cityVo2.setTime(0l);
cityVo2.setAlarmCount(0);
cityVo2.setLast("0");
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
cityVo1.setAddress(list.get(i).getAddress());
cityVo1.setTime(0l);
cityVo1.setType(1);
cityVo1.setAlarmCount(0);
cityVo1.setLast("0");
cityVoList.add(cityVo1);
}else{
cityVo2.setTime(list.get(i).getArrivalTime());
//根据时间和运输编号获取报警信息
if(list.get(i).getStartTime() == null ||list.get(i).getStartTime() ==0){
Integer count2 = alarmLogService.getByTime(transportationNo, list.get(i).getArrivalTime(), System.currentTimeMillis());
cityVo2.setAlarmCount(count2);
cityVo2.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getArrivalTime()));
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
cityVo1.setAddress(list.get(i).getAddress());
cityVo1.setTime(0l);
cityVo1.setType(1);
cityVo1.setAlarmCount(0);
cityVo1.setLast("0");
cityVoList.add(cityVo1);
}else{
Integer count2 = alarmLogService.getByTime(transportationNo, list.get(i).getArrivalTime(), list.get(i).getStartTime());
cityVo2.setAlarmCount(count2);
cityVo2.setLast(getMistiming(list.get(i ).getStartTime(),list.get(i).getArrivalTime()));
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
cityVo1.setAddress(list.get(i).getAddress());
cityVo1.setTime(list.get(i).getStartTime());
cityVo1.setType(1);
if(list.get(i + 1).getArrivalTime() == null ||list.get(i + 1).getArrivalTime() ==0){
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), System.currentTimeMillis());
cityVo1.setAlarmCount(count);
cityVo1.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime()));
cityVoList.add(cityVo1);
}else {
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), list.get(i + 1).getArrivalTime());
cityVo1.setAlarmCount(count);
cityVo1.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime()));
cityVoList.add(cityVo1);
}
}
}
}
}
messageVo.setList(cityVoList);
return gson.toJson(messageVo);
}
//开始运输 //开始运输
@ApiOperation(value = "开始运输",notes = "开始运输" + @ApiOperation(value = "开始运输",notes = "开始运输" +
"startTime:开始时间(13位时间戳)" + "startTime:开始时间(13位时间戳)" +
"transportationNo:运输编号") "transportationNo:运输编号")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@PostMapping("/startTransportation") @PostMapping("/startTransportation")
public Object startTransportation(@RequestBody StartCircuitVo startCircuitVo,HttpServletRequest request){ public Object startTransportation(@RequestBody StartCircuitVo startCircuitVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(startCircuitVo.getTransportationNo())){ if (StringUtils.isEmpty(startCircuitVo.getTransportationNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输编号不能为空"); fb.setMessage(i18n.getMessage(request,"transportationNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (circuitService.getByTransportationNo(startCircuitVo.getTransportationNo(),user.getCompanyName())==null){ if (circuitService.getByTransportationNo(startCircuitVo.getTransportationNo(),user.getCompanyName())==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有该线路"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (startCircuitVo.getStartTime()==null){ if (startCircuitVo.getStartTime()==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("线路开始时间不能为空"); fb.setMessage(i18n.getMessage(request,"startTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
//判断该线路是否绑定 //判断该线路是否绑定
ResultGatewayVo gatewayVo = tdlLogService.getByNo(startCircuitVo.getTransportationNo()); ResultGatewayVo gatewayVo = tdlLogService.getByNo(startCircuitVo.getTransportationNo());
if(gatewayVo == null){ if(gatewayVo == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未绑定tdl和gateway"); fb.setMessage(i18n.getMessage(request,"notBound"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
...@@ -1363,10 +1640,10 @@ public class CircuitController { ...@@ -1363,10 +1640,10 @@ public class CircuitController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("修改成功")){ if (msg.get("msg").equals("修改成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("线路开始运输"); fb.setMessage(i18n.getMessage(request,"startCircuitSuccess"));
}else { }else {
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"startCircuitFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -1441,19 +1718,18 @@ public class CircuitController { ...@@ -1441,19 +1718,18 @@ public class CircuitController {
alarmRuleVo.setMode("twoway"); alarmRuleVo.setMode("twoway");
alarmRuleVo.setPriority("1"); alarmRuleVo.setPriority("1");
}else if(alias.equals("ta")){ }else if(alias.equals("ta")){
alarmRuleVo.setMinval(String.valueOf(alarmVo.getTilt())); alarmRuleVo.setMaxval(String.valueOf(alarmVo.getTilt()));
alarmRuleVo.setMode("equal"); alarmRuleVo.setMode("greater");
alarmRuleVo.setPriority("1"); alarmRuleVo.setPriority("1");
}else if(alias.equals("a0")){ }else if(alias.equals("a0")){
alarmRuleVo.setMinval(String.valueOf(alarmVo.getShock())); alarmRuleVo.setMaxval(String.valueOf(alarmVo.getShock()));
alarmRuleVo.setMode("equal"); alarmRuleVo.setMode("greater");
alarmRuleVo.setPriority("1"); alarmRuleVo.setPriority("1");
} }
alarmRuleVos.add(alarmRuleVo); alarmRuleVos.add(alarmRuleVo);
//向redis中写入报警信息 //向redis中写入报警信息
alarmRedisService.hmSet(topic,"TDL-" +TDLSN+"_" +alias,gson.toJson(alarmRuleVos)); alarmRedisService.hmSet(topic,"TDL-" +TDLSN+"_" +alias,gson.toJson(alarmRuleVos));
} }
} }
//获取已有线路 //获取已有线路
......
...@@ -37,6 +37,9 @@ public class CircuitTransferController { ...@@ -37,6 +37,9 @@ public class CircuitTransferController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//修改线路途径地到达时间 //修改线路途径地到达时间
@ApiOperation(value = "修改线路途径地到达时间",notes = "修改线路途径地到达时间,修改所需要传的参数:" + @ApiOperation(value = "修改线路途径地到达时间",notes = "修改线路途径地到达时间,修改所需要传的参数:" +
......
...@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSON; ...@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback; import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.AddCompanyVo; import com.example.tdl.domain.vo.AddCompanyVo;
import com.example.tdl.domain.vo.ResultCompanyVo;
import com.example.tdl.domain.vo.UpdateCompanyVo; import com.example.tdl.domain.vo.UpdateCompanyVo;
import com.example.tdl.domain.vo.UserRedisVo;
import com.example.tdl.service.CompanyService; import com.example.tdl.service.CompanyService;
import com.example.tdl.service.RoleService; import com.example.tdl.service.RoleService;
import com.example.tdl.service.redis.TokenRedisService; import com.example.tdl.service.redis.TokenRedisService;
...@@ -22,10 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -22,10 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.Map;
@RestController @RestController
...@@ -44,6 +45,9 @@ public class CompanyController { ...@@ -44,6 +45,9 @@ public class CompanyController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询所有公司信息 //查询所有公司信息
@ApiOperation(value = "查询所有公司信息",notes = "查询所有公司信息,返回值说明:" + @ApiOperation(value = "查询所有公司信息",notes = "查询所有公司信息,返回值说明:" +
...@@ -56,10 +60,21 @@ public class CompanyController { ...@@ -56,10 +60,21 @@ public class CompanyController {
" manager:负责人") " manager:负责人")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(){ public Object getAll(HttpServletRequest request){
return companyService.getAll(); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
if(user.getCompanyName().equals("上海辉度")){
return companyService.getAll();
}else {
List<ResultCompanyVo> companyVoList = new ArrayList<>();
ResultCompanyVo companyVo = companyService.getByCompanyName(user.getCompanyName());
companyVoList.add(companyVo);
return companyVoList;
}
} }
//添加公司信息 //添加公司信息
...@@ -72,47 +87,49 @@ public class CompanyController { ...@@ -72,47 +87,49 @@ public class CompanyController {
" manager:负责人") " manager:负责人")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/addCompany",method = RequestMethod.POST) @RequestMapping(value="/addCompany",method = RequestMethod.POST)
public Object addCompany(@RequestBody AddCompanyVo addCompanyVo){ public Object addCompany(@RequestBody AddCompanyVo addCompanyVo,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(addCompanyVo.getCompanyName())){ if (StringUtils.isEmpty(addCompanyVo.getCompanyName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司名"); fb.setMessage(i18n.getMessage(request,"companyName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCompanyVo.getCountry())){ if (StringUtils.isEmpty(addCompanyVo.getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司所在国家"); fb.setMessage(i18n.getMessage(request,"country"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCompanyVo.getCity())){ if (StringUtils.isEmpty(addCompanyVo.getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司所在城市"); fb.setMessage(i18n.getMessage(request,"city"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCompanyVo.getAddressDetail())){ if (StringUtils.isEmpty(addCompanyVo.getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司所在具体地址不能为空"); fb.setMessage(i18n.getMessage(request,"addressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCompanyVo.getTel())){ if (StringUtils.isEmpty(addCompanyVo.getTel())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司联系电话不能为空"); fb.setMessage(i18n.getMessage(request,"tel"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addCompanyVo.getManager())){ if (StringUtils.isEmpty(addCompanyVo.getManager())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司负责人不能为空"); fb.setMessage(i18n.getMessage(request,"manager"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if( !addCompanyVo.getTel().matches("^1[34578]\\d{9}$")){ if( !addCompanyVo.getTel().matches("^1[34578]\\d{9}$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("手机号不规范"); fb.setMessage(i18n.getMessage(request,"wrongTel"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (companyService.getByCompanyName(addCompanyVo.getCompanyName())!=null){ if (companyService.getByCompanyName(addCompanyVo.getCompanyName())!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的公司名不能重复"); fb.setMessage(i18n.getMessage(request,"repeateCompanyName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Date day=new Date(); Date day=new Date();
...@@ -128,10 +145,10 @@ public class CompanyController { ...@@ -128,10 +145,10 @@ public class CompanyController {
int a = companyService.addCompany(addCompanyVo); int a = companyService.addCompany(addCompanyVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("添加公司成功"); fb.setMessage(i18n.getMessage(request,"addCompanySuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加公司失败"); fb.setMessage(i18n.getMessage(request,"addCompanyFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -147,61 +164,64 @@ public class CompanyController { ...@@ -147,61 +164,64 @@ public class CompanyController {
" manager:负责人") " manager:负责人")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updateCompany",method = RequestMethod.POST) @RequestMapping(value="/updateCompany",method = RequestMethod.POST)
public Object updateCompany(@RequestBody UpdateCompanyVo updateCompanyVo){ public Object updateCompany(@RequestBody UpdateCompanyVo updateCompanyVo,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(updateCompanyVo.getCompanyNo())){ if (StringUtils.isEmpty(updateCompanyVo.getCompanyNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要修改的公司的公司编号"); fb.setMessage(i18n.getMessage(request,"companyNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCompanyVo.getCompanyName())){ if (StringUtils.isEmpty(updateCompanyVo.getCompanyName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司名"); fb.setMessage(i18n.getMessage(request,"companyName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCompanyVo.getCountry())){ if (StringUtils.isEmpty(updateCompanyVo.getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司所在国家"); fb.setMessage(i18n.getMessage(request,"country"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCompanyVo.getCity())){ if (StringUtils.isEmpty(updateCompanyVo.getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司所在城市"); fb.setMessage(i18n.getMessage(request,"city"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCompanyVo.getAddressDetail())){ if (StringUtils.isEmpty(updateCompanyVo.getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司所在具体地址不能为空"); fb.setMessage(i18n.getMessage(request,"addressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCompanyVo.getTel())){ if (StringUtils.isEmpty(updateCompanyVo.getTel())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司联系电话不能为空"); fb.setMessage(i18n.getMessage(request,"tel"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateCompanyVo.getManager())){ if( !updateCompanyVo.getTel().matches("^1[34578]\\d{9}$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司负责人不能为空"); fb.setMessage(i18n.getMessage(request,"wrongTel"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if( !updateCompanyVo.getTel().matches("^1[34578]\\d{9}$")){ if (StringUtils.isEmpty(updateCompanyVo.getManager())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("手机号不规范"); fb.setMessage(i18n.getMessage(request,"manager"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (companyService.getByCompanyName(updateCompanyVo.getCompanyName())!=null&&!companyService.getByCompanyNo(updateCompanyVo.getCompanyNo()).getCompanyName().equals(updateCompanyVo.getCompanyName())){ if (companyService.getByCompanyName(updateCompanyVo.getCompanyName())!=null&&!companyService.getByCompanyNo(updateCompanyVo.getCompanyNo()).getCompanyName().equals(updateCompanyVo.getCompanyName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的公司名不能重复"); fb.setMessage(i18n.getMessage(request,"repeateCompanyName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
int a = companyService.updateCompany(updateCompanyVo); int a = companyService.updateCompany(updateCompanyVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("修改公司成功"); fb.setMessage(i18n.getMessage(request,"modifyCompanySuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改公司失败"); fb.setMessage(i18n.getMessage(request,"modifyCompanyFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -210,9 +230,16 @@ public class CompanyController { ...@@ -210,9 +230,16 @@ public class CompanyController {
@ApiOperation(value = "删除公司",notes = "删除公司,传值说明:companyName:公司编号") @ApiOperation(value = "删除公司",notes = "删除公司,传值说明:companyName:公司编号")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/delCompany",method = RequestMethod.POST) @RequestMapping(value="/delCompany",method = RequestMethod.POST)
public Object delCompany(@RequestBody String companyNo){ public Object delCompany(@RequestBody String companyNo,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
if(StringUtils.isEmpty(companyNo)){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"companyNo"));
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(companyNo); JSONObject jsonObject= JSON.parseObject(companyNo);
companyNo=(String) jsonObject.get("companyNo"); companyNo=(String) jsonObject.get("companyNo");
Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
...@@ -223,9 +250,10 @@ public class CompanyController { ...@@ -223,9 +250,10 @@ public class CompanyController {
if (msg.get("msg").equals("删除公司成功")){ if (msg.get("msg").equals("删除公司成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("删除公司成功"); fb.setMessage("删除公司成功");
fb.setMessage(i18n.getMessage(request,"deleteCompanySuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"deleteCompanyFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
......
...@@ -66,6 +66,9 @@ public class DataController { ...@@ -66,6 +66,9 @@ public class DataController {
@Autowired @Autowired
private ProbesService probesService; private ProbesService probesService;
@Autowired
private I18nController i18n;
private final static String database ="original"; private final static String database ="original";
private List<String> list = new ArrayList<String>(){{ private List<String> list = new ArrayList<String>(){{
...@@ -83,7 +86,8 @@ public class DataController { ...@@ -83,7 +86,8 @@ public class DataController {
" lat: 纬度.") " lat: 纬度.")
@PostMapping("/getLocation") @PostMapping("/getLocation")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
public Object getLocation(@RequestBody String transportationNo,HttpServletRequest request){ public Object getLocation(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
...@@ -182,12 +186,14 @@ public class DataController { ...@@ -182,12 +186,14 @@ public class DataController {
" ") " ")
@PostMapping("/getHistoryData") @PostMapping("/getHistoryData")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
public Object getHistoryData(@RequestBody String transportationNo,HttpServletRequest request){ public Object getHistoryData(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
logger.info("" +System.currentTimeMillis()); logger.info("" +System.currentTimeMillis());
logger.info("" + Calendar.getInstance().getTimeInMillis()); logger.info("" + Calendar.getInstance().getTimeInMillis());
JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
...@@ -195,18 +201,18 @@ public class DataController { ...@@ -195,18 +201,18 @@ public class DataController {
List<DataVo> dataVoList = new ArrayList<>(); List<DataVo> dataVoList = new ArrayList<>();
if(StringUtils.isEmpty(transportationNo)){ if(StringUtils.isEmpty(transportationNo)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("运输编号不能为空"); fb.setMessage(i18n.getMessage(request,"transportationNo"));
return gson.toJson(fb); return gson.toJson(fb);
} }
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
if(resultCircuitVo ==null){ if(resultCircuitVo ==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该运输编号不存在"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(resultCircuitVo.getStartTime() == null || resultCircuitVo.getStartTime() == 0){ if(resultCircuitVo.getStartTime() == null || resultCircuitVo.getStartTime() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该线路未开始运输"); fb.setMessage(i18n.getMessage(request,"notStarted"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Long startTime = resultCircuitVo.getStartTime() *1000000l; Long startTime = resultCircuitVo.getStartTime() *1000000l;
...@@ -216,7 +222,7 @@ public class DataController { ...@@ -216,7 +222,7 @@ public class DataController {
TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo); TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo == null){ if(gatewayVo == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该运输编号不存在"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN(); String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
...@@ -224,7 +230,7 @@ public class DataController { ...@@ -224,7 +230,7 @@ public class DataController {
List<String> devList= tdlLogService.getTdlSN(transportationNo); List<String> devList= tdlLogService.getTdlSN(transportationNo);
if(devList.size() == 0){ if(devList.size() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有数据"); fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
...@@ -252,7 +258,7 @@ public class DataController { ...@@ -252,7 +258,7 @@ public class DataController {
List<HistoryData> historyData = new ArrayList<>(); List<HistoryData> historyData = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
//解析数据 //解析数据
historyData = getHistoryData(queryResult); historyData = getHistoryData(queryResult,list.get(j));
} }
historyDataVo.setDataList(historyData); historyDataVo.setDataList(historyData);
historyDataVoList.add(historyDataVo); historyDataVoList.add(historyDataVo);
...@@ -269,6 +275,7 @@ public class DataController { ...@@ -269,6 +275,7 @@ public class DataController {
} }
} }
//获取温度数据 //获取温度数据
@ApiOperation(value = "获取温度数据",notes = "获取温度数据:" + @ApiOperation(value = "获取温度数据",notes = "获取温度数据:" +
" TDLSN:tdl编号," + " TDLSN:tdl编号," +
...@@ -277,7 +284,7 @@ public class DataController { ...@@ -277,7 +284,7 @@ public class DataController {
" value:温度数据.") " value:温度数据.")
@PostMapping("/getTemperature") @PostMapping("/getTemperature")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
public Object getTemperature(@RequestBody String transportationNo,HttpServletRequest request){ public Object getTemperature(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
...@@ -319,11 +326,12 @@ public class DataController { ...@@ -319,11 +326,12 @@ public class DataController {
return gson.toJson(temperatures); return gson.toJson(temperatures);
} }
//获取湿度数据 //获取湿度数据
@ApiOperation(value = "获取湿度数据",notes = "获取湿度数据:") @ApiOperation(value = "获取湿度数据",notes = "获取湿度数据:")
@PostMapping("/getHumidity") @PostMapping("/getHumidity")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
public Object getHumidity(@RequestBody String transportationNo,HttpServletRequest request){ public Object getHumidity(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
...@@ -365,11 +373,12 @@ public class DataController { ...@@ -365,11 +373,12 @@ public class DataController {
return gson.toJson(humidities); return gson.toJson(humidities);
} }
//获取倾斜度数据 //获取倾斜度数据
@ApiOperation(value = "获取倾斜度数据",notes = "获取倾斜度数据") @ApiOperation(value = "获取倾斜度数据",notes = "获取倾斜度数据")
@PostMapping("/getTiltAngle") @PostMapping("/getTiltAngle")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
public Object getTiltAngle(@RequestBody String transportationNo,HttpServletRequest request){ public Object getTiltAngle(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
...@@ -410,6 +419,8 @@ public class DataController { ...@@ -410,6 +419,8 @@ public class DataController {
return gson.toJson(tiltAngles); return gson.toJson(tiltAngles);
} }
//获取震动能量 //获取震动能量
@ApiOperation(value = "获取震动能量",notes = "获取震动能量") @ApiOperation(value = "获取震动能量",notes = "获取震动能量")
@PostMapping("/getShockEnergy") @PostMapping("/getShockEnergy")
...@@ -463,22 +474,35 @@ public class DataController { ...@@ -463,22 +474,35 @@ public class DataController {
List<LocationDataVo> historyDataList = new ArrayList<>(); List<LocationDataVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){ for(List<Object> value:values){
LocationDataVo historyData = new LocationDataVo(); LocationDataVo historyData = new LocationDataVo();
historyData.setTime(parseTime(value.get(0).toString())); if(value.get(1).toString().equals("0.0")){
historyData.setLng(Double.parseDouble(value.get(1).toString())); continue;
historyData.setLat(Double.parseDouble(value.get(2).toString())); }else{
historyData.setError(0); historyData.setTime(parseTime(value.get(0).toString()));
historyData.setLng(Double.parseDouble(value.get(1).toString()));
historyData.setLat(Double.parseDouble(value.get(2).toString()));
historyData.setError(0);
}
historyDataList.add(historyData); historyDataList.add(historyData);
} }
return historyDataList; return historyDataList;
} }
public List<HistoryData> getHistoryData(QueryResult queryResult){ public List<HistoryData> getHistoryData(QueryResult queryResult,String alias){
List<List<Object>> values = getValues(queryResult); List<List<Object>> values = getValues(queryResult);
List<HistoryData> historyDataList = new ArrayList<>(); List<HistoryData> historyDataList = new ArrayList<>();
for(List<Object> value:values){ for(List<Object> value:values){
HistoryData historyData = new HistoryData(); HistoryData historyData = new HistoryData();
historyData.setTime(parseTime(value.get(0).toString())); historyData.setTime(parseTime(value.get(0).toString()));
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString()); if(alias.contains("a0")){
if(value.get(1)!=null && Double.valueOf(value.get(1).toString()) >0 && Double.valueOf(value.get(1).toString())<588897){
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
}else{
continue;
}
}else{
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
}
historyDataList.add(historyData); historyDataList.add(historyData);
} }
return historyDataList; return historyDataList;
...@@ -918,6 +942,4 @@ public class DataController { ...@@ -918,6 +942,4 @@ public class DataController {
// } // }
// return gson.toJson(liveDataVos); // return gson.toJson(liveDataVos);
// } // }
} }
\ No newline at end of file
...@@ -57,6 +57,9 @@ public class EquipmentBindingController { ...@@ -57,6 +57,9 @@ public class EquipmentBindingController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
List<String> list = new ArrayList<String>(){{ List<String> list = new ArrayList<String>(){{
add("T"); add("T");
add("h"); add("h");
...@@ -125,7 +128,7 @@ public class EquipmentBindingController { ...@@ -125,7 +128,7 @@ public class EquipmentBindingController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("配置网关成功")){ if (msg.get("msg").equals("配置网关成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage(msg.get("msg").toString()); fb.setMessage("配置网关成功");
//根据报警类型货报警信息 //根据报警类型货报警信息
ResultAlarmVo alarmVo = alarmService.getByTypeAndScene(bindingVo.getAlarmType(),"运输",user.getCompanyName()); ResultAlarmVo alarmVo = alarmService.getByTypeAndScene(bindingVo.getAlarmType(),"运输",user.getCompanyName());
for(String alias :list){ for(String alias :list){
...@@ -142,12 +145,12 @@ public class EquipmentBindingController { ...@@ -142,12 +145,12 @@ public class EquipmentBindingController {
alarmRuleVo.setMode("twoway"); alarmRuleVo.setMode("twoway");
alarmRuleVo.setPriority("1"); alarmRuleVo.setPriority("1");
}else if(alias.equals("ta")){ }else if(alias.equals("ta")){
alarmRuleVo.setMinval(String.valueOf(alarmVo.getTilt())); alarmRuleVo.setMaxval(String.valueOf(alarmVo.getTilt()));
alarmRuleVo.setMode("equal"); alarmRuleVo.setMode("greater");
alarmRuleVo.setPriority("1"); alarmRuleVo.setPriority("1");
}else if(alias.equals("a0")){ }else if(alias.equals("a0")){
alarmRuleVo.setMinval(String.valueOf(alarmVo.getShock())); alarmRuleVo.setMaxval(String.valueOf(alarmVo.getShock()));
alarmRuleVo.setMode("equal"); alarmRuleVo.setMode("greater");
alarmRuleVo.setPriority("1"); alarmRuleVo.setPriority("1");
} }
alarmRuleVos.add(alarmRuleVo); alarmRuleVos.add(alarmRuleVo);
...@@ -168,6 +171,11 @@ public class EquipmentBindingController { ...@@ -168,6 +171,11 @@ public class EquipmentBindingController {
}) })
@PostMapping("/untie") @PostMapping("/untie")
public Object untie(@RequestBody String TDLSN){ public Object untie(@RequestBody String TDLSN){
if(StringUtils.isEmpty(TDLSN)){
fb.setCode(0);
fb.setMessage("TDL序列号不能为空");
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(TDLSN); JSONObject jsonObject= JSON.parseObject(TDLSN);
TDLSN=(String)jsonObject.get("TDLSN"); TDLSN=(String)jsonObject.get("TDLSN");
//判断当前tdl是否有网关在使用 //判断当前tdl是否有网关在使用
...@@ -194,12 +202,14 @@ public class EquipmentBindingController { ...@@ -194,12 +202,14 @@ public class EquipmentBindingController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("解除网关成功")){ if (msg.get("msg").equals("解除网关成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
fb.setMessage("解除网关成功");
String key ="TDL/"+resultTDLDeviceVo.getGatewayType()+"/" +resultTDLDeviceVo.getGatewaySN() +"/Data"; String key ="TDL/"+resultTDLDeviceVo.getGatewayType()+"/" +resultTDLDeviceVo.getGatewaySN() +"/Data";
alarmRedisService.delKey(key); alarmRedisService.delKey(key);
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
fb.setMessage("解除网关失败");
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
......
package com.example.tdl.web; package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback; import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.service.*; import com.example.tdl.service.*;
...@@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -54,6 +57,9 @@ public class GatewayController { ...@@ -54,6 +57,9 @@ public class GatewayController {
@Autowired @Autowired
private TopicConfigService topicConfigService; private TopicConfigService topicConfigService;
@Autowired
private I18nController i18n;
//查询所有网关信息 //查询所有网关信息
@ApiOperation(value = "查询所有网关信息",notes = "查询所有网关信息:" + @ApiOperation(value = "查询所有网关信息",notes = "查询所有网关信息:" +
...@@ -88,7 +94,7 @@ public class GatewayController { ...@@ -88,7 +94,7 @@ public class GatewayController {
} }
if(!addGatewayVo.getSN().matches("^[0-9]{8}$")){ if(!addGatewayVo.getSN().matches("^[0-9]{8}$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("gateway编号必须是数字"); fb.setMessage("gateway编号必须是8位数字");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addGatewayVo.getName())){ if (StringUtils.isEmpty(addGatewayVo.getName())){
...@@ -149,22 +155,22 @@ public class GatewayController { ...@@ -149,22 +155,22 @@ public class GatewayController {
public Object updateGateway(@RequestBody UpdateGatewayVo updateGatewayVo){ public Object updateGateway(@RequestBody UpdateGatewayVo updateGatewayVo){
if (StringUtils.isEmpty(updateGatewayVo.getSN())){ if (StringUtils.isEmpty(updateGatewayVo.getSN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的SN不能为空"); fb.setMessage("编号不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateGatewayVo.getName())){ if (StringUtils.isEmpty(updateGatewayVo.getName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的名字不能为空"); fb.setMessage("名字不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateGatewayVo.getType())){ if (StringUtils.isEmpty(updateGatewayVo.getType())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的类型不能为空"); fb.setMessage("类型不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (gatewayService.getBySNAndType(updateGatewayVo.getSN(),updateGatewayVo.getType())==null){ if (gatewayService.getBySNAndType(updateGatewayVo.getSN(),updateGatewayVo.getType())==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的设备不存在"); fb.setMessage("该网关不存在");
return gson.toJson(fb); return gson.toJson(fb);
} }
// ResultGatewayVo resultGatewayVo=gatewayService.getBySNAndType(updateGatewayVo.getSN(),updateGatewayVo.getType()); // ResultGatewayVo resultGatewayVo=gatewayService.getBySNAndType(updateGatewayVo.getSN(),updateGatewayVo.getType());
...@@ -276,7 +282,7 @@ public class GatewayController { ...@@ -276,7 +282,7 @@ public class GatewayController {
boolean state = gatewayService.getBySNAndType(deployProbesVo.getSN(),deployProbesVo.getType()).getState(); boolean state = gatewayService.getBySNAndType(deployProbesVo.getSN(),deployProbesVo.getType()).getState();
if(state){ if(state){
fb.setCode(0); fb.setCode(0);
fb.setMessage("设备在挂载,请先卸载设备"); fb.setMessage("设备在挂载");
return gson.toJson(fb); return gson.toJson(fb);
} }
Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
...@@ -309,14 +315,14 @@ public class GatewayController { ...@@ -309,14 +315,14 @@ public class GatewayController {
public String setState(@RequestBody GatewayState device){ public String setState(@RequestBody GatewayState device){
if (device.getbConfig() == false) { if (device.getbConfig() == false) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("该设备未配置通道。"); fb.setMessage("该网关未配置通道");
return gson.toJson(fb); return gson.toJson(fb);
} }
//根据设备的SN,TYPE获取所有通道 //根据设备的SN,TYPE获取所有通道
List<ResultProbesVo> list = probesService.getProbesByGateway(device.getSN(),device.getType()); List<ResultProbesVo> list = probesService.getProbesByGateway(device.getSN(),device.getType());
if (list.size() == 0) { if (list.size() == 0) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("该设备没有通道,请先增加通道。"); fb.setMessage("该网关未配置通道");
return gson.toJson(fb); return gson.toJson(fb);
} }
DeviceConfigVo deviceConfig = new DeviceConfigVo(); DeviceConfigVo deviceConfig = new DeviceConfigVo();
...@@ -388,4 +394,23 @@ public class GatewayController { ...@@ -388,4 +394,23 @@ public class GatewayController {
return gson.toJson(fb); return gson.toJson(fb);
} }
//获取未使用的网关
@ApiOperation(value = "获取未使用的网关",notes = "获取未使用的网关,传值说明:" +
" gSN:需要查询的网关序列号")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value = "/getUnusedGateway",method = RequestMethod.POST)
public Object getUnusedGateway(@RequestBody String gSN, HttpServletRequest request){
if(StringUtils.isEmpty(gSN)){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"gateway"));
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(gSN);
gSN=(String)jsonObject.get("gSN");
return gatewayService.getUnusedGateway(gSN);
}
} }
...@@ -8,6 +8,7 @@ import com.example.tdl.service.AlarmLogService; ...@@ -8,6 +8,7 @@ import com.example.tdl.service.AlarmLogService;
import com.example.tdl.service.CircuitService; import com.example.tdl.service.CircuitService;
import com.example.tdl.service.TDLLogService; import com.example.tdl.service.TDLLogService;
import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.TokenRedisService; import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -52,8 +53,15 @@ public class HomePageController { ...@@ -52,8 +53,15 @@ public class HomePageController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private InfoRedisService infoRedisService;
private final static String database ="original"; private final static String database ="original";
@Autowired
private I18nController i18n;
//获取当天所有的设备数据 //获取当天所有的设备数据
@ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" + @ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" +
"sum:总数量;" + "sum:总数量;" +
...@@ -84,6 +92,7 @@ public class HomePageController { ...@@ -84,6 +92,7 @@ public class HomePageController {
@PostMapping("/getAll") @PostMapping("/getAll")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
public Object getAll(@RequestBody String time, HttpServletRequest request){ public Object getAll(@RequestBody String time, HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
...@@ -103,10 +112,10 @@ public class HomePageController { ...@@ -103,10 +112,10 @@ public class HomePageController {
dataVo.setBump(alarmLogServcie.getBumpCount(time,user.getCompanyName())); //获取颠簸数量 dataVo.setBump(alarmLogServcie.getBumpCount(time,user.getCompanyName())); //获取颠簸数量
dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time,user.getCompanyName()));//报警列表 dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time,user.getCompanyName()));//报警列表
List<HistogramData> list = alarmLogServcie.getByCount(time,user.getCompanyName());//获取报警柱状图 List<HistogramData> list = alarmLogServcie.getByCount(time,user.getCompanyName());//获取报警柱状图
dataVo.setHistogramDataList(list);
//获取设备的当前位置 //获取设备的当前位置
List<ResultCircuitVo> circuitVos = circuitService.getByTime(user.getCompanyName()); List<ResultCircuitVo> circuitVos = circuitService.getByTime(user.getCompanyName());
List<CircuitVo> circuitList = new ArrayList<>(); List<CircuitVo> circuitList = new ArrayList<>();
Integer num = 0;
for(int i = 0;i<circuitVos.size();i++){ for(int i = 0;i<circuitVos.size();i++){
CircuitVo circuitVo = new CircuitVo(); CircuitVo circuitVo = new CircuitVo();
circuitVo.setTransportationNo(circuitVos.get(i).getTransportationNo()); circuitVo.setTransportationNo(circuitVos.get(i).getTransportationNo());
...@@ -115,19 +124,21 @@ public class HomePageController { ...@@ -115,19 +124,21 @@ public class HomePageController {
circuitVo.setEndCity(circuitVos.get(i).getEndCity()); circuitVo.setEndCity(circuitVos.get(i).getEndCity());
circuitVo.setStartTime(circuitVos.get(i).getStartTime()); circuitVo.setStartTime(circuitVos.get(i).getStartTime());
circuitVo.setEndTime(circuitVos.get(i).getEndTime()); circuitVo.setEndTime(circuitVos.get(i).getEndTime());
ResultGatewayVo gatewayVo = new ResultGatewayVo(); ResultGatewayVo gatewayVo = tdlLogService.getByNo(circuitVos.get(i).getTransportationNo());
String device = gatewayVo.getType() + "_" + gatewayVo.getSN();
Object data = infoRedisService.getHash("DeviceOnline", device );
if(data !=null){
OnlineVo onlineVo = gson.fromJson(data.toString(),OnlineVo.class);
if(onlineVo.getOnline() == 0){
num =num +1;
}
}
if (circuitVos.get(i).getStartTime() == null || circuitVos.get(i).getStartTime() == 0) { if (circuitVos.get(i).getStartTime() == null || circuitVos.get(i).getStartTime() == 0) {
circuitList.add(circuitVo); circuitList.add(circuitVo);
} else { } else {
if(circuitVos.get(i).getEndTime() == null ||circuitVos.get(i).getEndTime() == 0 ){
gatewayVo = circuitService.getByNo(circuitVos.get(i).getTransportationNo());
}else{
gatewayVo = tdlLogService.getByNo(circuitVos.get(i).getTransportationNo());
}
if(gatewayVo==null){ if(gatewayVo==null){
circuitList.add(circuitVo); circuitList.add(circuitVo);
}else { }else {
String device = gatewayVo.getType() + "_" + gatewayVo.getSN();
Long startTime = circuitVos.get(i).getStartTime() * 1000000l; Long startTime = circuitVos.get(i).getStartTime() * 1000000l;
String sql = ""; String sql = "";
if (circuitVos.get(i).getEndTime() == null || circuitVos.get(i).getEndTime() == 0) { if (circuitVos.get(i).getEndTime() == null || circuitVos.get(i).getEndTime() == 0) {
...@@ -137,7 +148,6 @@ public class HomePageController { ...@@ -137,7 +148,6 @@ public class HomePageController {
} }
QueryResult queryResult = influxDBTemplate.query(new Query(sql, database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql, database));
if (queryResult.getResults().get(0).getSeries() != null) { if (queryResult.getResults().get(0).getSeries() != null) {
circuitVo.setTime(parseTime(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString())); circuitVo.setTime(parseTime(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString()));
circuitVo.setLng(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); circuitVo.setLng(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString());
circuitVo.setLat(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString()); circuitVo.setLat(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString());
...@@ -146,6 +156,8 @@ public class HomePageController { ...@@ -146,6 +156,8 @@ public class HomePageController {
} }
} }
} }
list.add(new HistogramData("6",num));
dataVo.setHistogramDataList(list);
dataVo.setCircuitList(circuitList); dataVo.setCircuitList(circuitList);
return gson.toJson(dataVo); return gson.toJson(dataVo);
} }
...@@ -160,6 +172,7 @@ public class HomePageController { ...@@ -160,6 +172,7 @@ public class HomePageController {
@PostMapping("/getAllForAPP") @PostMapping("/getAllForAPP")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
public Object getAllForAPP(HttpServletRequest request){ public Object getAllForAPP(HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
......
package com.example.tdl.web;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.stereotype.Controller;
@Controller
public class I18nController {
private static final Logger LOGGER = LoggerFactory.getLogger(I18nController.class);
private MessageSource messageSource;
@Value("${spring.messages.basename}")
private String basename;
@Value("${spring.messages.cache-seconds}")
private long cacheMillis;
@Value("${spring.messages.encoding}")
private String encoding;
/**
* 初始化
* @return
*/
private MessageSource initMessageSource() {
ReloadableResourceBundleMessageSource messageSource=new ReloadableResourceBundleMessageSource();
LOGGER.info("baseName====>:" + this.basename);
messageSource.setBasename(basename);
messageSource.setDefaultEncoding(encoding);
messageSource.setCacheMillis(cacheMillis);
return messageSource;
}
public Locale getLocale(HttpServletRequest request){
String lauage=request.getHeader("AccountLanguage");
//默认没有就是请求地区的语言
Locale locale=null;
if(lauage == null){
locale=Locale.CHINA;
} else if("jp".equals(lauage)){
locale=Locale.JAPANESE;
} else if("en".equals(lauage)){
locale=Locale.ENGLISH;
} else if("cn".equals(lauage)){
locale=Locale.CHINA;
} else{
locale=Locale.CHINA;
}
return locale;
}
/**
* 设置当前的返回信息
* @param request
* @param code
* @return
*/
public String getMessage(HttpServletRequest request, String code){
if(messageSource==null){
messageSource=initMessageSource();
}
String result=null;
try {
result = messageSource.getMessage(code, null, getLocale(request));
} catch (NoSuchMessageException e) {
e.printStackTrace();
LOGGER.error("Cannot find the error message of internationalization, return the original error message.");
}
if(result==null){
return code;
}
return result;
}
public String getMessage(HttpServletRequest request,Object[] args, String code){
if(messageSource==null){
messageSource=initMessageSource();
}
try {
return messageSource.getMessage(code, args,getLocale(request));
} catch (NoSuchMessageException e) {
e.printStackTrace();
LOGGER.error("Cannot find the error message of internationalization, return the original error message.");
return code;
}
}
}
...@@ -46,20 +46,27 @@ public class LoginController { ...@@ -46,20 +46,27 @@ public class LoginController {
@Autowired @Autowired
private LoginLogService loginLogService; private LoginLogService loginLogService;
@Autowired
private I18nController i18n;
//使用token登录 //使用token登录
@ApiOperation(value = "使用token登录",notes = "使用token登录:" + @ApiOperation(value = "使用token登录",notes = "使用token登录:" +
" userName: 用户名," + " userName: 用户名," +
" password: 密码") " password: 密码")
@RequestMapping(value = "/loginForToken", method = RequestMethod.POST) @RequestMapping(value = "/loginForToken", method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = true, dataType = "String"),
})
public String loginForToken(@RequestBody LoginUserVo loginUserVo, HttpServletRequest request, HttpServletResponse response) { public String loginForToken(@RequestBody LoginUserVo loginUserVo, HttpServletRequest request, HttpServletResponse response) {
String port =request.getHeader("AccountLanguage");
if(StringUtils.isEmpty(loginUserVo.getUserName())){ if(StringUtils.isEmpty(loginUserVo.getUserName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("用户名不能为空"); fb.setMessage(i18n.getMessage(request,"userName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(loginUserVo.getPassword())){ if(StringUtils.isEmpty(loginUserVo.getPassword())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("密码不能为空"); fb.setMessage(i18n.getMessage(request,"password"));
return gson.toJson(fb); return gson.toJson(fb);
} }
try { try {
...@@ -70,7 +77,7 @@ public class LoginController { ...@@ -70,7 +77,7 @@ public class LoginController {
String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName()); String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyName()); UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyName());
//将用户数据保存到redis中 //将用户数据保存到redis中
tokenRedisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 30); tokenRedisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 60 *24);
String ip = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr(); String ip = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr();
int a=loginLogService.addLoginLog(new LoginLog(loginUserVo.getUserName(),System.currentTimeMillis(),ip)); int a=loginLogService.addLoginLog(new LoginLog(loginUserVo.getUserName(),System.currentTimeMillis(),ip));
if (a>0){ if (a>0){
...@@ -78,13 +85,13 @@ public class LoginController { ...@@ -78,13 +85,13 @@ public class LoginController {
fb.setMessage(token); fb.setMessage(token);
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加日志失败"); fb.setMessage(i18n.getMessage(request,"addLogFailure"));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.info(e.toString()); logger.info(e.toString());
fb.setCode(0); fb.setCode(0);
fb.setMessage("用户名或密码错误"); fb.setMessage(i18n.getMessage(request,"login"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -104,39 +111,9 @@ public class LoginController { ...@@ -104,39 +111,9 @@ public class LoginController {
} }
@ApiOperation(value="登录",notes = "登录") // @ApiOperation(value="登录",notes = "登录")
@RequestMapping(value = "/login", method = RequestMethod.POST) // @RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@RequestBody LoginUserVo loginUserVo,HttpServletRequest request,HttpServletResponse response){ // public String login(@RequestBody LoginUserVo loginUserVo,HttpServletRequest request,HttpServletResponse response){
if(StringUtils.isEmpty(loginUserVo.getUserName())){
fb.setCode(0);
fb.setMessage("用户名不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(loginUserVo.getPassword())){
fb.setCode(0);
fb.setMessage("密码不能为空");
return gson.toJson(fb);
}
String token = userService.getUser(loginUserVo);
if(token == null){
fb.setCode(0);
fb.setMessage("账号或者密码错误");
}else{
CookieUtils.setCookie(request,response,"Account_token",token);
fb.setCode(1);
fb.setMessage(token);
}
return gson.toJson(fb);
}
//登录功能
// @ApiOperation(value = "登录功能",notes = "登录功能:" +
// " userName: 用户名," +
// " password: 密码")
// @RequestMapping(value = "/doLogin", method = RequestMethod.POST)
// public String login(@RequestBody LoginUserVo loginUserVo) {
// if(StringUtils.isEmpty(loginUserVo.getUserName())){ // if(StringUtils.isEmpty(loginUserVo.getUserName())){
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage("用户名不能为空"); // fb.setMessage("用户名不能为空");
...@@ -147,27 +124,18 @@ public class LoginController { ...@@ -147,27 +124,18 @@ public class LoginController {
// fb.setMessage("密码不能为空"); // fb.setMessage("密码不能为空");
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
// if(userService.getByUserName(loginUserVo.getUserName()) == null){ // String token = userService.getUser(loginUserVo);
// if(token == null){
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage("该用户不存在"); // fb.setMessage("账号或者密码错误");
// return gson.toJson(fb); // }else{
// } // CookieUtils.setCookie(request,response,"Account_token",token);
//
// //实现登录过程,封装用户在页面上提交的用户和密码
// UsernamePasswordToken token = new UsernamePasswordToken(loginUserVo.getUserName(), loginUserVo.getPassword());
// //将封装好的用户名和密码交给shiro安全框架并实现登陆
// try {
// SecurityUtils.getSubject().login(token);
// fb.setCode(1); // fb.setCode(1);
// fb.setMessage("登录成功"); // fb.setMessage(token);
// } catch (Exception e) {
//// e.printStackTrace();
//// logger.info(e.toString());
// fb.setCode(0);
// fb.setMessage("登录失败");
// } // }
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
//
//
} }
...@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -37,6 +38,10 @@ public class LoginLogController { ...@@ -37,6 +38,10 @@ public class LoginLogController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询登录日志 //查询登录日志
@ApiOperation(value = "查询登录日志",notes = "查询登录日志,返回值说明:" + @ApiOperation(value = "查询登录日志",notes = "查询登录日志,返回值说明:" +
" userName:用户名," + " userName:用户名," +
...@@ -63,6 +68,7 @@ public class LoginLogController { ...@@ -63,6 +68,7 @@ public class LoginLogController {
" ipAddress:登录地址。") " ipAddress:登录地址。")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByTime",method = RequestMethod.POST) @RequestMapping(value="/getByTime",method = RequestMethod.POST)
public Object getByTime(@RequestBody LoginLogTermVo loginLogTermVo, HttpServletRequest request){ public Object getByTime(@RequestBody LoginLogTermVo loginLogTermVo, HttpServletRequest request){
...@@ -71,12 +77,17 @@ public class LoginLogController { ...@@ -71,12 +77,17 @@ public class LoginLogController {
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
if (loginLogTermVo.getStartTime() == null){ if (loginLogTermVo.getStartTime() == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("查询开始时间不能为空"); fb.setMessage(i18n.getMessage(request,"logStartTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (loginLogTermVo.getStopTime() == null){ if (loginLogTermVo.getStopTime() == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("查询结束时间不能为空"); fb.setMessage(i18n.getMessage(request,"logEndTime"));
return gson.toJson(fb);
}
if(loginLogTermVo.getStopTime() < loginLogTermVo.getStartTime()){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb); return gson.toJson(fb);
} }
return loginLogService.getByTime(loginLogTermVo.getStartTime(),loginLogTermVo.getStopTime(),user.getCompanyName()); return loginLogService.getByTime(loginLogTermVo.getStartTime(),loginLogTermVo.getStopTime(),user.getCompanyName());
......
...@@ -3,6 +3,7 @@ package com.example.tdl.web; ...@@ -3,6 +3,7 @@ package com.example.tdl.web;
import com.example.tdl.domain.dto.CommFeedback; import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.RoleNameVo;
import com.example.tdl.service.RoleService; import com.example.tdl.service.RoleService;
import com.example.tdl.service.redis.TokenRedisService; import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
@RequestMapping("/role") @RequestMapping("/role")
...@@ -36,6 +39,9 @@ public class RoleController { ...@@ -36,6 +39,9 @@ public class RoleController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询本公司的用户 //查询本公司的用户
@ApiOperation(value = "查询所有角色名",notes = "查询所有角色名") @ApiOperation(value = "查询所有角色名",notes = "查询所有角色名")
...@@ -44,7 +50,11 @@ public class RoleController { ...@@ -44,7 +50,11 @@ public class RoleController {
}) })
@RequestMapping(value="/getAllRoleName",method = RequestMethod.GET) @RequestMapping(value="/getAllRoleName",method = RequestMethod.GET)
public Object getAllRoleName(){ public Object getAllRoleName(){
return roleService.getAllRoleName(); List<RoleNameVo> roleNameVoList = roleService.getAllRoleName();
for(int i = 0,length = roleNameVoList.size();i<length;i++){
}
return roleNameVoList;
} }
......
...@@ -19,6 +19,9 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -19,6 +19,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import retrofit2.http.HTTP;
import javax.servlet.http.HttpServletRequest;
@RestController @RestController
...@@ -37,6 +40,10 @@ public class TDLDeviceController { ...@@ -37,6 +40,10 @@ public class TDLDeviceController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询TDL信息 //查询TDL信息
@ApiOperation(value = "查询TDL信息",notes = "查询TDL信息,返回值说明:" + @ApiOperation(value = "查询TDL信息",notes = "查询TDL信息,返回值说明:" +
" TDLName:TDL名字," + " TDLName:TDL名字," +
...@@ -171,4 +178,21 @@ public class TDLDeviceController { ...@@ -171,4 +178,21 @@ public class TDLDeviceController {
return gson.toJson(fb); return gson.toJson(fb);
} }
@ApiOperation(value = "获取未被使用的TDL序列号",notes = "获取未被使用的TDL序列号,传值说明:" +
" TDLSN:需要查询的TDL序列号")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value = "/getUnusedTDL",method = RequestMethod.POST)
public Object getUnusedTDL(@RequestBody String TDLSN, HttpServletRequest request){
if (StringUtils.isEmpty(TDLSN)){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"tdl"));
return gson.toJson(fb);
}
JSONObject jsonObject=JSON.parseObject(TDLSN);
TDLSN=(String)jsonObject.get("TDLSN");
return tdlDeviceService.getUnusedTDL(TDLSN);
}
} }
...@@ -43,6 +43,9 @@ public class UserAddressController { ...@@ -43,6 +43,9 @@ public class UserAddressController {
@Autowired @Autowired
private TokenRedisService tokenRedisService; private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//根据用户编号查询用户常用地址 //根据用户编号查询用户常用地址
@ApiOperation(value = "根据用户编号查询用户常用地址",notes = "根据用户编号查询用户常用地址,返回值说明:" + @ApiOperation(value = "根据用户编号查询用户常用地址",notes = "根据用户编号查询用户常用地址,返回值说明:" +
...@@ -57,6 +60,7 @@ public class UserAddressController { ...@@ -57,6 +60,7 @@ public class UserAddressController {
" remark:备注。") " remark:备注。")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByUserNumber",method = RequestMethod.GET) @RequestMapping(value="/getByUserNumber",method = RequestMethod.GET)
public Object getByUserNumber(HttpServletRequest request){ public Object getByUserNumber(HttpServletRequest request){
...@@ -78,55 +82,57 @@ public class UserAddressController { ...@@ -78,55 +82,57 @@ public class UserAddressController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/addUserAddress",method = RequestMethod.POST) @RequestMapping(value="/addUserAddress",method = RequestMethod.POST)
public Object addUserAddress(@RequestBody AddUserAddressVo addUserAddressVo, HttpServletRequest request){ public Object addUserAddress(@RequestBody AddUserAddressVo addUserAddressVo, HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(addUserAddressVo.getName())){ if (StringUtils.isEmpty(addUserAddressVo.getName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的别名不能为空"); fb.setMessage(i18n.getMessage(request,"name"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addUserAddressVo.getCountry())){ if(StringUtils.isEmpty(addUserAddressVo.getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("国家不能为空"); fb.setMessage(i18n.getMessage(request,"country"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addUserAddressVo.getCity())){ if (StringUtils.isEmpty(addUserAddressVo.getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("城市不能为空"); fb.setMessage(i18n.getMessage(request,"city"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addUserAddressVo.getAddressDetail())){ if (StringUtils.isEmpty(addUserAddressVo.getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的详细地址不能为空"); fb.setMessage(i18n.getMessage(request,"addressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addUserAddressVo.getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if (StringUtils.isEmpty(addUserAddressVo.getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"lat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addUserAddressVo.getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addUserAddressVo.getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addUserAddressVo.getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if (StringUtils.isEmpty(addUserAddressVo.getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"lng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!addUserAddressVo.getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!addUserAddressVo.getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (userAddressService.getByUserNumberAndName(user.getUserNumber(),addUserAddressVo.getName())!=null){ if (userAddressService.getByUserNumberAndName(user.getUserNumber(),addUserAddressVo.getName())!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的常用地址别名不能重复"); fb.setMessage(i18n.getMessage(request,"repeatedName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
...@@ -144,10 +150,10 @@ public class UserAddressController { ...@@ -144,10 +150,10 @@ public class UserAddressController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("添加用户常用地址成功")){ if (msg.get("msg").equals("添加用户常用地址成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("添加用户常用地址成功"); fb.setMessage(i18n.getMessage(request,"addAddressSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"addAddressFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -165,62 +171,65 @@ public class UserAddressController { ...@@ -165,62 +171,65 @@ public class UserAddressController {
" remark:备注") " remark:备注")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updateUserAddress",method = RequestMethod.POST) @RequestMapping(value="/updateUserAddress",method = RequestMethod.POST)
public Object updateUserAddress(@RequestBody UpdateUserAddressVo updateUserAddressVo, HttpServletRequest request){ public Object updateUserAddress(@RequestBody UpdateUserAddressVo updateUserAddressVo, HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(updateUserAddressVo.getOldName())){ if (StringUtils.isEmpty(updateUserAddressVo.getOldName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要修改的常用地址别名不能为空"); fb.setMessage(i18n.getMessage(request,"modifiedName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateUserAddressVo.getName())){ if (StringUtils.isEmpty(updateUserAddressVo.getName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的别名不能为空"); fb.setMessage(i18n.getMessage(request,"modifiedNewName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(updateUserAddressVo.getCountry())){ if(StringUtils.isEmpty(updateUserAddressVo.getCountry())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("国家不能为空"); fb.setMessage(i18n.getMessage(request,"country"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateUserAddressVo.getCity())){ if (StringUtils.isEmpty(updateUserAddressVo.getCity())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("城市不能为空"); fb.setMessage(i18n.getMessage(request,"city"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateUserAddressVo.getAddressDetail())){ if (StringUtils.isEmpty(updateUserAddressVo.getAddressDetail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加的详细地址不能为空"); fb.setMessage(i18n.getMessage(request,"addressDetail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!updateUserAddressVo.getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if (StringUtils.isEmpty(updateUserAddressVo.getLat())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"lat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!updateUserAddressVo.getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!updateUserAddressVo.getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongLat"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!updateUserAddressVo.getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){ if (StringUtils.isEmpty(updateUserAddressVo.getLng())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("纬度的范围为-90~90"); fb.setMessage(i18n.getMessage(request,"lng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!updateUserAddressVo.getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) { if(!updateUserAddressVo.getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("经度的范围为-180~180"); fb.setMessage(i18n.getMessage(request,"wrongLng"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (userAddressService.getByUserNumberAndName(user.getUserNumber(), updateUserAddressVo.getName())!=null&&!updateUserAddressVo.getOldName().equals(updateUserAddressVo.getName())){ if (!updateUserAddressVo.getOldName().equals(updateUserAddressVo.getName()) && userAddressService.getByUserNumberAndName(user.getUserNumber(),updateUserAddressVo.getName())!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的常用地址别名不能重复"); fb.setMessage(i18n.getMessage(request,"modifiedRepeatedName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
map.put("userNumber",user.getUserNumber()); map.put("userNumber",user.getUserNumber());
map.put("oldName", updateUserAddressVo.getOldName()); map.put("oldName", updateUserAddressVo.getOldName());
...@@ -237,10 +246,10 @@ public class UserAddressController { ...@@ -237,10 +246,10 @@ public class UserAddressController {
msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("修改用户常用地址成功")){ if (msg.get("msg").equals("修改用户常用地址成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("修改用户常用地址成功"); fb.setMessage(i18n.getMessage(request,"modifiedAddressSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage(msg.get("msg").toString()); fb.setMessage(i18n.getMessage(request,"modifiedAddressFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -249,6 +258,7 @@ public class UserAddressController { ...@@ -249,6 +258,7 @@ public class UserAddressController {
@ApiOperation(value = "删除用户常用地址",notes = "删除用户常用地址,只用传需要删除的地址名") @ApiOperation(value = "删除用户常用地址",notes = "删除用户常用地址,只用传需要删除的地址名")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/delUserAddress",method = RequestMethod.POST) @RequestMapping(value="/delUserAddress",method = RequestMethod.POST)
public Object delUserAddress(@RequestBody String name, HttpServletRequest request){ public Object delUserAddress(@RequestBody String name, HttpServletRequest request){
...@@ -257,19 +267,19 @@ public class UserAddressController { ...@@ -257,19 +267,19 @@ public class UserAddressController {
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(name)){ if (StringUtils.isEmpty(name)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要删除的别名不能为空"); fb.setMessage(i18n.getMessage(request,"deletedName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
int a = userAddressService.delUserAddress(user.getUserNumber(),name); int a = userAddressService.delUserAddress(user.getUserNumber(),name);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("删除用户常用地址成功"); fb.setMessage(i18n.getMessage(request,"deletedAddressSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("删除用户常用地址失败"); fb.setMessage(i18n.getMessage(request,"deletedAddressFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
......
...@@ -57,6 +57,9 @@ public class UserController { ...@@ -57,6 +57,9 @@ public class UserController {
@Autowired @Autowired
private CompanyService companyService; private CompanyService companyService;
@Autowired
private I18nController i18n;
//获取所有用户信息 //获取所有用户信息
@ApiOperation(value = "获取所有用户信息",notes = "获取所有用户信息:" + @ApiOperation(value = "获取所有用户信息",notes = "获取所有用户信息:" +
...@@ -69,13 +72,18 @@ public class UserController { ...@@ -69,13 +72,18 @@ public class UserController {
" companyName:公司名.") " companyName:公司名.")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getAll",method = RequestMethod.GET) @RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(HttpServletRequest request){ public Object getAll(HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
return userService.getAll(user.getCompanyName()); if(user.getCompanyName().equals("上海辉度")){
return userService.getAllUser();
}else{
return userService.getAll(user.getCompanyName());
}
} }
//根据条件查询 //根据条件查询
...@@ -93,13 +101,18 @@ public class UserController { ...@@ -93,13 +101,18 @@ public class UserController {
" roleName:角色名。") " roleName:角色名。")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/getByTerm",method = RequestMethod.POST) @RequestMapping(value="/getByTerm",method = RequestMethod.POST)
public Object getByTerm(@RequestBody UserTermVo userTermVo,HttpServletRequest request){ public Object getByTerm(@RequestBody UserTermVo userTermVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
userTermVo.setCompanyName(user.getCompanyName()); if(user.getCompanyName().equals("")){
userTermVo.setCompanyName(null);
}else{
userTermVo.setCompanyName(user.getCompanyName());
}
return userService.getByTerm(userTermVo); return userService.getByTerm(userTermVo);
} }
...@@ -114,87 +127,89 @@ public class UserController { ...@@ -114,87 +127,89 @@ public class UserController {
" companyName:用户所属公司") " companyName:用户所属公司")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/addUser",method = RequestMethod.POST) @RequestMapping(value="/addUser",method = RequestMethod.POST)
public Object addUser(@RequestBody AddUserVo userVo){ public Object addUser(@RequestBody AddUserVo userVo,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(userVo.getUserName())){ if (StringUtils.isEmpty(userVo.getUserName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("用户名不能为空"); fb.setMessage(i18n.getMessage(request,"userName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (!userVo.getUserName().matches("^[a-zA-Z][a-zA-Z0-9_]{5,19}$")) { if (!userVo.getUserName().matches("^[a-zA-Z][a-zA-Z0-9_]{5,19}$")) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("用户名以字母开头,可包含数字和_,6-20个字符"); fb.setMessage(i18n.getMessage(request,"usernameRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(userService.getByUserName(userVo.getUserName()) !=null){ if(userService.getByUserName(userVo.getUserName()) !=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("用户名已被占用"); fb.setMessage(i18n.getMessage(request,"repeatedUserName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(userVo.getPassword())){ if(StringUtils.isEmpty(userVo.getPassword())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("密码不能为空"); fb.setMessage(i18n.getMessage(request,"password"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(!userVo.getPassword().matches("^[a-zA-Z\\d_]{6,20}$")){ if(!userVo.getPassword().matches("^[a-zA-Z\\d_]{6,20}$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("密码必须是6-20位的数字、字母和_"); fb.setMessage(i18n.getMessage(request,"passwordRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(userVo.getNickName())){ if (StringUtils.isEmpty(userVo.getNickName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("昵称不能为空"); fb.setMessage(i18n.getMessage(request,"nickName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(userVo.getPhone())){ if(StringUtils.isEmpty(userVo.getPhone())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("电话不能为空"); fb.setMessage(i18n.getMessage(request,"phone"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if( !userVo.getPhone().matches("^1[34578]\\d{9}$")){ if( !userVo.getPhone().matches("^1[34578]\\d{9}$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("手机号不规范"); fb.setMessage(i18n.getMessage(request,"phoneRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if ((userService.getByPhone(userVo.getPhone(),userVo.getCompanyName()))!=null){ if ((userService.getByPhone(userVo.getPhone(),userVo.getCompanyName()))!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该手机号已被注册"); fb.setMessage(i18n.getMessage(request,"repeatedRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(userVo.getEmail())){ if(StringUtils.isEmpty(userVo.getEmail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("邮箱不能为空"); fb.setMessage(i18n.getMessage(request,"email"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if( !userVo.getEmail().matches("\\w+(\\.\\w*)*@\\w+(\\.\\w{2,3}){1,3}")){ if( !userVo.getEmail().matches("\\w+(\\.\\w*)*@\\w+(\\.\\w{2,3}){1,3}")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("邮箱格式不规范"); fb.setMessage(i18n.getMessage(request,"emailRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if ((userService.getByEmail(userVo.getEmail(),userVo.getCompanyName()))!=null){ if ((userService.getByEmail(userVo.getEmail(),userVo.getCompanyName()))!=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该邮箱已被注册"); fb.setMessage(i18n.getMessage(request,"repeatedEmail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(userVo.getRoleName())){ if (StringUtils.isEmpty(userVo.getRoleName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("角色名不能为空"); fb.setMessage(i18n.getMessage(request,"roleName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (roleService.getByRoleName(userVo.getRoleName())==0){ if (roleService.getByRoleName(userVo.getRoleName())==0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有该角色"); fb.setMessage(i18n.getMessage(request,"existRoleName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(userVo.getCompanyName())){ if (StringUtils.isEmpty(userVo.getCompanyName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("公司名不能为空"); fb.setMessage(i18n.getMessage(request,"companyName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (companyService.getByCompanyName(userVo.getCompanyName())==null){ if (companyService.getByCompanyName(userVo.getCompanyName())==null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有该公司"); fb.setMessage(i18n.getMessage(request,"existCompany"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String userNumber="U"+System.currentTimeMillis(); String userNumber="U"+System.currentTimeMillis();
...@@ -205,14 +220,15 @@ public class UserController { ...@@ -205,14 +220,15 @@ public class UserController {
int a=userService.addUser(userVo); int a=userService.addUser(userVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("添加用户成功"); fb.setMessage(i18n.getMessage(request,"addUserSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("添加用户失败"); fb.setMessage(i18n.getMessage(request,"addUserFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
//修改用户 //修改用户
@ApiOperation(value = "修改用户",notes = "修改用户都要传" + @ApiOperation(value = "修改用户",notes = "修改用户都要传" +
" userNumber:用户编号," + " userNumber:用户编号," +
...@@ -223,71 +239,73 @@ public class UserController { ...@@ -223,71 +239,73 @@ public class UserController {
" roleName:角色名") " roleName:角色名")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updateUser",method = RequestMethod.POST) @RequestMapping(value="/updateUser",method = RequestMethod.POST)
public Object updateUser(@RequestBody UpdateUserVo userVo,HttpServletRequest request){ public Object updateUser(@RequestBody UpdateUserVo userVo,HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(userVo.getUserNumber())){ if (StringUtils.isEmpty(userVo.getUserNumber())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("用户编号不能为空"); fb.setMessage(i18n.getMessage(request,"userNumber"));
return gson.toJson(fb); return gson.toJson(fb);
} }
ResultUserVo userInfo=userService.getByUserNumber(userVo.getUserNumber()); ResultUserVo userInfo=userService.getByUserNumber(userVo.getUserNumber());
if (StringUtils.isEmpty(userVo.getNickName())){ if (StringUtils.isEmpty(userVo.getNickName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("昵称不能为空"); fb.setMessage(i18n.getMessage(request,"nickName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(userVo.getPhone())){ if(StringUtils.isEmpty(userVo.getPhone())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("电话不能为空"); fb.setMessage(i18n.getMessage(request,"phone"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if( !userVo.getPhone().matches("^1[34578]\\d{9}$")){ if( !userVo.getPhone().matches("^1[34578]\\d{9}$")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("手机号不规范"); fb.setMessage(i18n.getMessage(request,"phoneRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (userInfo!=null&& !userInfo.getPhone().equals(userVo.getPhone()) && userService.getByPhone(user.getPhone(),userInfo.getCompanyName()) !=null){ if (userInfo!=null&& !userInfo.getPhone().equals(userVo.getPhone()) && userService.getByPhone(user.getPhone(),userInfo.getCompanyName()) !=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该手机号已被注册"); fb.setMessage(i18n.getMessage(request,"repeatedRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(userVo.getEmail())){ if(StringUtils.isEmpty(userVo.getEmail())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("邮箱不能为空"); fb.setMessage(i18n.getMessage(request,"email"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if( !userVo.getEmail().matches("\\w+(\\.\\w*)*@\\w+(\\.\\w{2,3}){1,3}")){ if( !userVo.getEmail().matches("\\w+(\\.\\w*)*@\\w+(\\.\\w{2,3}){1,3}")){
fb.setCode(0); fb.setCode(0);
fb.setMessage("邮箱格式不规范"); fb.setMessage(i18n.getMessage(request,"emailRule"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (userInfo!=null && !userInfo.getEmail().equals(userVo.getEmail()) && userService.getByEmail(userVo.getEmail(),userInfo.getCompanyName()) !=null){ if (userInfo!=null && !userInfo.getEmail().equals(userVo.getEmail()) && userService.getByEmail(userVo.getEmail(),userInfo.getCompanyName()) !=null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该邮箱已被注册"); fb.setMessage(i18n.getMessage(request,"repeatedEmail"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(userVo.getRoleName())){ if (StringUtils.isEmpty(userVo.getRoleName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("角色名不能为空"); fb.setMessage(i18n.getMessage(request,"roleName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (roleService.getByRoleName(userVo.getRoleName())==0){ if (roleService.getByRoleName(userVo.getRoleName())==0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的角色名不存在"); fb.setMessage(i18n.getMessage(request,"existRoleName"));
return gson.toJson(fb); return gson.toJson(fb);
} }
int a=userService.updateUser(userVo); int a=userService.updateUser(userVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("修改用户成功"); fb.setMessage(i18n.getMessage(request,"modifiedUserSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改用户失败"); fb.setMessage(i18n.getMessage(request,"modifiedUserFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -296,23 +314,26 @@ public class UserController { ...@@ -296,23 +314,26 @@ public class UserController {
@ApiOperation(value = "删除用户",notes = "删除用户") @ApiOperation(value = "删除用户",notes = "删除用户")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/delUser",method = RequestMethod.POST) @RequestMapping(value="/delUser",method = RequestMethod.POST)
public Object delUser(@RequestBody String userNumber){ public Object delUser(@RequestBody String userNumber,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
JSONObject jsonObject= JSON.parseObject(userNumber); JSONObject jsonObject= JSON.parseObject(userNumber);
userNumber=jsonObject.getString("userNumber"); userNumber=jsonObject.getString("userNumber");
if (StringUtils.isEmpty(userNumber)){ if (StringUtils.isEmpty(userNumber)){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要删除的用户编号不能为空"); fb.setMessage(i18n.getMessage(request,"userNumber"));
return gson.toJson(fb); return gson.toJson(fb);
} }
int a = userService.delUser(userNumber); int a = userService.delUser(userNumber);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("删除用户成功"); fb.setMessage(i18n.getMessage(request,"deleteUserSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("删除用户失败"); fb.setMessage(i18n.getMessage(request,"deleteUserFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -321,24 +342,26 @@ public class UserController { ...@@ -321,24 +342,26 @@ public class UserController {
@ApiOperation(value = "重置密码",notes = "重置密码") @ApiOperation(value = "重置密码",notes = "重置密码")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/resetPassword",method = RequestMethod.POST) @RequestMapping(value="/resetPassword",method = RequestMethod.POST)
public Object resetPassword(@RequestBody String userNumber){ public Object resetPassword(@RequestBody String userNumber,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
JSONObject jsonObject= JSON.parseObject(userNumber); JSONObject jsonObject= JSON.parseObject(userNumber);
userNumber=jsonObject.getString("userNumber"); userNumber=jsonObject.getString("userNumber");
if (StringUtils.isEmpty(userNumber)) { if (StringUtils.isEmpty(userNumber)) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要重置密码的用户编号不能为空"); fb.setMessage(i18n.getMessage(request,"userNumber"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String pwd=DigestUtils.sha256Hex("Witium123"); String pwd=DigestUtils.sha256Hex("Witium123");
int a = userService.updatePassword(new UpdatePasswordVo(userNumber,pwd)); int a = userService.updatePassword(new UpdatePasswordVo(userNumber,pwd));
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("重置密码成功"); fb.setMessage(i18n.getMessage(request,"resetPasswordSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("重置密码失败"); fb.setMessage(i18n.getMessage(request,"resetPasswordFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -347,17 +370,19 @@ public class UserController { ...@@ -347,17 +370,19 @@ public class UserController {
@ApiOperation(value = "修改密码",notes = "修改密码") @ApiOperation(value = "修改密码",notes = "修改密码")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@RequestMapping(value="/updatePassword",method = RequestMethod.POST) @RequestMapping(value="/updatePassword",method = RequestMethod.POST)
public Object updatePassword(@RequestBody UpdatePasswordVo updatePasswordVo){ public Object updatePassword(@RequestBody UpdatePasswordVo updatePasswordVo,HttpServletRequest request){
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(updatePasswordVo.getUserNumber())) { if (StringUtils.isEmpty(updatePasswordVo.getUserNumber())) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要重置密码的用户编号不能为空"); fb.setMessage(i18n.getMessage(request,"userNumber"));
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updatePasswordVo.getPassword())) { if (StringUtils.isEmpty(updatePasswordVo.getPassword())) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改的密码不能为空"); fb.setMessage(i18n.getMessage(request,"password"));
return gson.toJson(fb); return gson.toJson(fb);
} }
String pwd=DigestUtils.sha256Hex(updatePasswordVo.getPassword()); String pwd=DigestUtils.sha256Hex(updatePasswordVo.getPassword());
...@@ -365,10 +390,10 @@ public class UserController { ...@@ -365,10 +390,10 @@ public class UserController {
int a = userService.updatePassword(updatePasswordVo); int a = userService.updatePassword(updatePasswordVo);
if (a>0){ if (a>0){
fb.setCode(1); fb.setCode(1);
fb.setMessage("修改密码成功"); fb.setMessage(i18n.getMessage(request,"modifiedPasswordSuccess"));
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改密码失败"); fb.setMessage(i18n.getMessage(request,"modifiedPasswordFailure"));
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -380,6 +405,7 @@ public class UserController { ...@@ -380,6 +405,7 @@ public class UserController {
"ipAddres:ip") "ipAddres:ip")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
}) })
@GetMapping(value="/getUserName") @GetMapping(value="/getUserName")
public Object getUserName(HttpServletRequest request) { public Object getUserName(HttpServletRequest request) {
......
...@@ -14,24 +14,21 @@ management.security.enabled=false ...@@ -14,24 +14,21 @@ management.security.enabled=false
mybatis.type-aliases-package=com.example.demo.entity mybatis.type-aliases-package=com.example.demo.entity
mybatis.config-location=classpath:mybatis-config.xml mybatis.config-location=classpath:mybatis-config.xml
#message-source
spring.messages.basename=classpath:i18n/messages
#-1 no expried
spring.messages.cache-seconds= 3600
spring.messages.encoding=UTF-8
# Redis服务器地址
tdl.redis.host=192.168.1.16 tdl.redis.host=192.168.1.16
# Redis数据库索引(默认为0)
tdl.redis.index=0 tdl.redis.index=0
# Redis服务器连接端口
tdl.redis.port=6379 tdl.redis.port=6379
# Redis服务器连接密码(默认为空)
tdl.redis.password= tdl.redis.password=
# 连接池最大连接数(使用负值表示没有限制)
tdl.redis.poolmaxactive=8 tdl.redis.poolmaxactive=8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
tdl.redis.poolmaxwait=-1 tdl.redis.poolmaxwait=-1
# 连接池中的最大空闲连接
tdl.redis.poolmaxidle=8 tdl.redis.poolmaxidle=8
# 连接池中的最小空闲连接
tdl.redis.poolminidle=0 tdl.redis.poolminidle=0
# 连接超时时间(毫秒)
tdl.redis.timeout=0 tdl.redis.timeout=0
...@@ -51,6 +48,7 @@ tdl.mqtt.cacrt = ca.crt ...@@ -51,6 +48,7 @@ tdl.mqtt.cacrt = ca.crt
tdl.mqtt.clientkey = witcd.pem tdl.mqtt.clientkey = witcd.pem
tdl.mqtt.clientcrt = witcd.crt tdl.mqtt.clientcrt = witcd.crt
# InfluxDB # InfluxDB
spring.influxdb.username=admin spring.influxdb.username=admin
spring.influxdb.password=37774020 spring.influxdb.password=37774020
......
#
alarmType=Early warning type can not be empty
alarmScene=Early warning scene can not be empty
wrongAlarmScene=Please choose the right warning scene
temMax=The upper limit of temperature can not be empty
temMin=The lower temperature limit can not be empty
humidityMax=The upper limit of humidity can not be empty
humidityMin=The lower limit of humidity can not be empty
tilt=Inclination can not be empty
shock=Vibration can not be empty
alarmExist=The added early warning type has already existed in this scene
addSuccess=You have added the warning information successfully
addFailure=Failed to add early warning information
modifiedAlarmType=The type of early warning that needs to be modified can not be empty
modifiedAlarmScene=The scene of early warning that needs to be modified can not be empty
modifiedWrongAlarmScene=The early warning scene that needs to be modified is not correct
modifiedAlarmExist=The modified early warning type has already existed in this scene
modifiedSuccess=You have modified the warning information successfully
modifiedFailure=Failed to modify early warning information
deletedAlarmType=The early warning scene that needs to be deleted can not empty
deletedAlarmScene=The early warning type that needs to be deleted can not empty
dusedAlarm=The early warning is being used
deletedSuccess=You have deleted the warning information successfully
deletedFailure=Failed to delete early warning information
transportationNo=The number of goods can not be empty
noCircuit=There is no such line
startCountry=The departure country can not be empty
startCity=The departure city can not be empty
startAddressDetail=The specific departure address can not be empty
startLat=The latitude of departure can not be empty
wrongStartLat=The latitude of departure ranges from -90 to 90
startLng=The longitude of departure can not be empty
wrongStartLng=he longitude of departure ranges from -180 to 180
startPostCode=The zip code of departure can not be empty
starExpTime=The expected departure time can not be empty
endCountry=The destination country can not be empty
endCity=The destination city can not be empty
endAddressDetail=The specific destination address can not be empty
endLat=The latitude of destination can not be empty
wrongEndLat=The latitude of destination ranges from -90 to 90
endLng=The longitude of destination can not be empty
wrongEndLng=The longitude of destination ranges from -180 to 180
endPostCode=The zip code of destination can not be empty
endCompTime=The expected arrival time of destination can not be empty
wrongEndCompTime=The estimated arrival time of the destination can not be less than the expected departure time
gateway=The gateway serial number can not be empty
gatewayExist=The gateway serial number does not exist
gatewayMounted=The gateway is mounted
gatewayConsistent=The usage scene of the gateway is not consistent with the current
tdl=Tag sequence number can not be empty
tdlExist=The TDL with a serial number of {0} does not exist
tdlUsed=The TDL with a serial number of {0} has been used
cargoNo=The number of goods can not be empty
plateNo=The number plate can not be empty
cargoName=The alias of the goods can not be empty
circuitSuccess=You have added line successfully
circuitFailure=Failed to added line
notStarted=The line has not started shipping
notBound=The line is not bound to the gateway or tdl
endCircuitSuccess=Successfully modified
endCircuitFailure=Failure to modify
evaluate=The rating of the evaluation can not be empty
completedCircuit=The line can be evaluated when the transportation has been completed
evaluateSuccess=Evaluation is successful
evaluateFailure=Evaluation failed
circuitState=The transport number cannot be empty
inTransit=The line is in transit or has been shipped
bindTDL=The line is not bound to tdl
bindGateway=The line is not bound to the gateway
circuitDeleteSuccess=You have deleted the line successfully
circuitDeleteFailure=Failed to delete the line
startTime=The start time of the line can not be empty
startCircuitSuccess=The line was successfully transported
startCircuitFailure=Failure of the line to start transportation
companyName=The company name can not be empty
country=The country can not be empty
city=The city can not be empty
addressDetail=The detailed address can not be empty
tel=The contact phone can not be empty
manager=The person in charge can not be empty
wrongTel=The phone number is invalid
repeateCompanyName=The company name can not be repeated
addCompanySuccess=You have added the company successfully
addCompanyFailure=Failed to add the company
companyNo=The company number can not be empty
modifyCompanySuccess=You have modified the company successfully
modifyCompanyFailure=Failed to modify the company
deleteCompanySuccess=You have deleted the company successfully
deleteCompanyFailure=Fail to delete company
userName=The username can not be empty
password=The password can not be empty
addLogFailure=Failed to add log
login=Incorrect username or password
loginout=Withdraw from success
logStartTime=The startTime can not be empty
logEndTime=The endTime can not be empty
wrongTime=The start time is not greater than the end time
name=Alias can not be empty
lat=Latitudes cannot be empty
wrongLat=The latitude ranges from -90 to 90
lng=The longitude can not be empty
wrongLng=The longitude ranges from -180 to 180
repeatedName=The added common address alias cannot be repeated
addAddressSuccess=You have added the commonly used address successfully
addAddressFailure=Fail to add the commonly used address
modifiedName=The commonly used address alias that need to be modified can not be empty
modifiedNewName=The new alias can't be empty
modifiedRepeatedName=The modified commonly used address alias cannot be repeated
modifiedAddressSuccess=Modify the user commonly used address successfully
modifiedAddressFailure=Modify the failure of the user's common address
deletedName=The alias that needs to be deleted can not be empty
deletedAddressSuccess=You have deleted the commonly used address successfully
deletedAddressFailure=Failed to delete the commonly used address
usernameRule=The username starts with a letter, which can contain numbers,_and 6-20 characters
repeatedUserName=Username has been existed
passwordRule=The password must be 6-20 characters,which contain numbers,letters and _
nickName=The nickname can not be empty
phone=The phone number can not be empty
phoneRule=The phone number is invalid
repeatedRule=The phone number has been registered
email=The mail can not be empty
emailRule=The email address is invalid
repeatedEmail=The mail has been registered
roleName=The role name can not be empty
existRoleName=The role name does not existed
existCompany=The company name does not existed
addUserSuccess=You have added the user successfully
addUserFailure=Failed to add a user
userNumber=The user number can not be empty
modifiedUserSuccess=You have modified the user successfully
modifiedUserFailure=Failed to modify the user
deleteUserSuccess=You have deleted the user successfully
deleteUserFailure=Failed to delete the user
resetPasswordSuccess=You have reseted the password successfully
resetPasswordFailure=Failed to reset the password
modifiedPasswordSuccess=You have modified the password successfully
modifiedPasswordFailure=Failed to modify the password
addressVoList=There are no more than three stopovers
addressVoCountry=The stopover country can not be empty
addressVoCity=The stopover city can not be empty
addressVoAddressDetail=The specific stopover address can not be empty
addressVoLat=The latitude of stopover can not be empty
wrongAddressVoLat=The latitude of stopover ranges from -90 to 90
addressVoLng=The longitude of stopover can not be empty
wrongaddressVoLng=The longitude of stopover ranges from -180 to 180
addressVoPostCode=The zip code of stopover can not be empty
addressVoExpTime=The expected departure time of stopover can not be empty
addressVoCompTime=The expected arrival time of stopover can not be empty
wrongAddressVoCompTime=The estimated arrival time of the stopover can not be less than the expected departure time
wrongAddressVoExpTime=The estimated arrival time of the current stopover cannot be greater than the expected departure time of the next stopover
systemManage=System Administrator
superManage=Super Administrator
warehouse=Warehouse Manager
transportManage=Transport Manager
\ No newline at end of file
alarmType=\u30A2\u30E9\u30FC\u30E0\u30BF\u30A4\u30D7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
alarmScene=\u30A2\u30E9\u30FC\u30E0\u30B7\u30FC\u30F3\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongAlarmScene=\u30A2\u30E9\u30FC\u30E0\u30B7\u30FC\u30F3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044
temMax=\u6E29\u5EA6\u306E\u4E0A\u9650 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
temMin=\u6E29\u5EA6\u306E\u4E0B\u9650 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
humidityMax=\u6E7F\u5EA6\u306E\u4E0A\u9650\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
humidityMin=\u6E7F\u5EA6\u306E\u4E0B\u9650\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
tilt=\u56DE\u8EE2\u306E\u4E0A\u9650 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
shock=\u9707\u52D5\u306E\u4E0A\u9650 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
alarmExist=\u30A2\u30E9\u30FC\u30E0\u30BF\u30A4\u30D7\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
addSuccess=\u30A2\u30E9\u30FC\u30E0\u8FFD\u52A0\u6210\u529F
addFailure=\u30A2\u30E9\u30FC\u30E0\u8FFD\u52A0\u5931\u6557
modifiedAlarmType=\u30A2\u30E9\u30FC\u30E0\u30BF\u30A4\u30D7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
modifiedAlarmScene=\u30A2\u30E9\u30FC\u30E0\u30B7\u30FC\u30F3\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
modifiedWrongAlarmScene=\u30A2\u30E9\u30FC\u30E0\u30B7\u30FC\u30F3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044
modifiedAlarmExist=\u30A2\u30E9\u30FC\u30E0\u30BF\u30A4\u30D7\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
modifiedSuccess=\u30A2\u30E9\u30FC\u30E0\u4FEE\u6B63\u6210\u529F
modifiedFailure=\u30A2\u30E9\u30FC\u30E0\u4FEE\u6B63\u5931\u6557
deletedAlarmType=\u30A2\u30E9\u30FC\u30E0\u30B7\u30FC\u30F3\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
deletedAlarmScene=\u30A2\u30E9\u30FC\u30E0\u30BF\u30A4\u30D7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
dusedAlarm=\u30A2\u30E9\u30FC\u30E0\u30BF\u30A4\u30D7\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
deletedSuccess=\u30A2\u30E9\u30FC\u30E0\u524A\u9664\u65E2\u6210\u529F
deletedFailure=\u30A2\u30E9\u30FC\u30E0\u524A\u9664\u65E2\u5931\u6557
transportationNo=\u8F38\u9001\u756A\u53F7 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
noCircuit=\u30EB\u30FC\u30C8\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u305B\u3093
startCountry=\u56FD\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
startCity=\u90FD\u9053\u5E9C\u770C\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
startAddressDetail=\u4F4F\u6240\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
startLat=\u7DEF\u5EA6 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongStartLat=\u7DEF\u5EA6 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
startLng=\u7D4C\u5EA6\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongStartLng=\u7D4C\u5EA6\u306E\u7BC4\u56F2\u304A\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044
startPostCode=\u90F5\u4FBF\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
starExpTime=\u958B\u59CB\u6642\u9593 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
endCountry=\u56FD\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
endCity=\u90FD\u9053\u5E9C\u770C\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
endAddressDetail=\u4F4F\u6240\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
endLat=\u7DEF\u5EA6 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongEndLat=\u7DEF\u5EA6 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
endLng=\u7D4C\u5EA6\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongEndLng=\u7D4C\u5EA6\u306E\u7BC4\u56F2\u304A\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044
endPostCode=\u90F5\u4FBF\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
endCompTime=\u5230\u7740\u6642\u9593 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongEndCompTime=\u958B\u59CB\u6642\u9593\u3068\u5230\u7740\u6642\u9593\u304A\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044
gateway=\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
gatewayExist=\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
gatewayMounted=\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u30A6\u30A8\u30D6\u3068\u63A5\u7D9A\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
gatewayConsistent=\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
tdl=TDL\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
tdlExist={0}\u756A\u53F7\u306ETDL\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
tdlUsed={0}\u756A\u53F7\u306ETDL\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
cargoNo=\u8CA8\u7269\u756A\u53F7 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
plateNo=\u30CA\u30F3\u30D0\u30FC\u30D7\u30EC\u30FC\u30C8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
cargoName=\u8CA8\u7269\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
circuitSuccess=\u8DEF\u7DDA\u3092\u8FFD\u52A0\u3057\u3066\u6210\u529F\u3059\u308B
circuitFailure=\u30E9\u30A4\u30F3\u8FFD\u52A0\u5931\u6557
notStarted=\u30EB\u30FC\u30C8\u304C\u958B\u59CB\u3057\u3066\u3044\u307E\u305B\u3093
notBound=\u30EB\u30FC\u30C8\u304CTDL\u3001\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u30A6\u30A8\u30D6\u3068\u63A5\u7D9A\u3057\u3066\u3044\u307E\u305B\u3093
endCircuitSuccess=\u8DEF\u7DDA\u304C\u7D42\u308F\u3063\u3066\u6210\u529F\u3059\u308B
endCircuitFailure=\u8DEF\u7DDA\u7D42\u4E86\u306E\u5931\u6557
evaluate=\u8A55\u4FA1\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
completedCircuit=\u30EB\u30FC\u30C8\u5B8C\u6210\u3057\u305F\u304B\u3089\u8A55\u4FA1\u3067\u304D\u307E\u3059
evaluateSuccess=\u8A55\u4FA1\u6210\u529F
evaluateFailure=\u8A55\u4FA1\u5931\u6557
circuitState=\u30EB\u30FC\u30C8\u72B6\u614B\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
inTransit=\u30EB\u30FC\u30C8\u304C\u5229\u7528\u3057\u3066\u3044\u307E\u3059
bindTDL=\u30EB\u30FC\u30C8\u3068TDL\u3068\u63A5\u7D9A\u3057\u3066\u3044\u307E\u305B\u3093
bindGateway=\u30EB\u30FC\u30C8\u3068\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u3068\u63A5\u7D9A\u3057\u3066\u3044\u307E\u305B\u3093
circuitDeleteSuccess=\u30EB\u30FC\u30C8\u524A\u9664\u6210\u529F
circuitDeleteFailure=\u30EB\u30FC\u30C8\u524A\u9664\u5931\u6557
startTime=\u30EB\u30FC\u30C8\u958B\u59CB\u6642\u9593\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
startCircuitSuccess=\u30EB\u30FC\u30C8\u958B\u59CB\u6210\u529F
startCircuitFailure=\u30EB\u30FC\u30C8\u958B\u59CB\u5931\u6557
companyName=\u4F1A\u793E\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
country=\u56FD\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
city=\u90FD\u9053\u5E9C\u770C\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
tel=\u96FB\u8A71\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
manager=\u7BA1\u7406\u8005\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongTel=\u96FB\u8A71\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
repeateCompanyName=\u4F1A\u793E\u540D\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
addCompanySuccess=\u4F1A\u793E\u540D\u306E\u8FFD\u52A0\u6210\u529F
addCompanyFailure=\u4F1A\u793E\u540D\u306E\u8FFD\u52A0\u5931\u6557
companyNo=\u4F1A\u793E\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
modifyCompanySuccess=\u4F1A\u793E\u540D\u306E\u4FEE\u6B63\u6210\u529F
modifyCompanyFailure=\u4F1A\u793E\u540D\u306E\u4FEE\u6B63\u5931\u6557
deleteCompanySuccess=\u4F1A\u793E\u540D\u306E\u524A\u9664\u6210\u529F
deleteCompanyFailure=\u4F1A\u793E\u540D\u306E\u524A\u9664\u5931\u6557
userName=\u30E6\u30FC\u30B6\u30FC\u540D \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
password=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
addLogFailure=LOG\u8FFD\u52A0\u5931\u6557
login=\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u6B63\u3057\u304F\u3042\u3093\u308A\u307E\u305B\u3093
loginout=\u6210\u529F\u3092\u9000\u3051\u308B
logStartTime=\u958B\u59CB\u6642\u9593\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
logEndTime=\u7D42\u4E86\u6642\u9593\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
name=\u30CB\u30C3\u30AF\u30CD\u30FC\u30E0 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
lat=\u7DEF\u5EA6 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongLat=\u7DEF\u5EA6 \u306E\u7BC4\u56F2\u304A\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044
lng=\u7D4C\u5EA6\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongLng=\u7D4C\u5EA6\u306E\u7BC4\u56F2\u304A\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044
repeatedName=\u30A2\u30C9\u30EC\u30B9\u306E\u540D\u524D\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
addAddressSuccess=\u30A2\u30C9\u30EC\u30B9\u3092\u8FFD\u52A0\u6210\u529F
addAddressFailure=\u30A2\u30C9\u30EC\u30B9\u3092\u8FFD\u52A0\u5931\u6557
modifiedName=\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
modifiedNewName=\u65B0\u3057\u3044\u30CB\u30C3\u30AF\u30CD\u30FC\u30E0 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
modifiedRepeatedName=\u5909\u66F4\u3055\u308C\u305F\u30A2\u30C9\u30EC\u30B9\u306F\u5225\u540D\u3092\u7E70\u308A\u8FD4\u3059\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
modifiedAddressSuccess=\u30A2\u30C9\u30EC\u30B9\u306E\u4FEE\u6B63\u6210\u529F
modifiedAddressFailure=\u30A2\u30C9\u30EC\u30B9\u306E\u4FEE\u6B63\u5931\u6557
deletedName=\u30CB\u30C3\u30AF\u30CD\u30FC\u30E0 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
deletedAddressSuccess=\u30A2\u30C9\u30EC\u30B9\u306E\u524A\u9664\u6210\u529F
deletedAddressFailure=\u30A2\u30C9\u30EC\u30B9\u306E\u524A\u9664\u5931\u6557
usernameRule=\u30E6\u30FC\u30B6\u30FC\u540D\u306F\u30A2\u30EB\u30D5\u30A1\u30D9\u30C3\u30C8\u3067\u59CB\u307E\u308A\u3001\u6570\u5B57\u3068\u30DC\u30C7\u30A3\u30FC\u30016 -20\u500B\u306E\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
repeatedUserName=\u30E6\u30FC\u30B6\u30FC\u540D \u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
passwordRule=\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u30A2\u30EB\u30D5\u30A1\u30D9\u30C3\u30C8\u3067\u59CB\u307E\u308A\u3001\u6570\u5B57\u3068\u30DC\u30C7\u30A3\u30FC\u30016 - 20\u500B\u306E\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
nickName=\u30CB\u30C3\u30AF\u30CD\u30FC\u30E0 \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
phone=\u643A\u5E2F\u96FB\u8A71\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
phoneRule=\u643A\u5E2F\u96FB\u8A71\u3092\u30C1\u30A7\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044
repeatedRule=\u643A\u5E2F\u96FB\u8A71\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
email=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
emailRule=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u30C1\u30A7\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044
repeatedEmail=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
roleName=\u30ED\u30FC\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
existRoleName=\u30ED\u30FC\u30EB\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u305B\u3093
existCompany=\u4F1A\u793E\u540D\u304C\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u305B\u3093
addUserSuccess=\u30E6\u30FC\u30B6\u30FC\u540D\u306E\u8FFD\u52A0\u6210\u529F
addUserFailure=\u30E6\u30FC\u30B6\u30FC\u540D\u306E\u8FFD\u52A0\u5931\u6557
userNumber=\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
modifiedUserSuccess=\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u4FEE\u6B63\u6210\u529F
modifiedUserFailure=\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u4FEE\u6B63\u5931\u6557
deleteUserSuccess=\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u524A\u9664\u6210\u529F
deleteUserFailure=\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u524A\u9664\u5931\u6557
resetPasswordSuccess=\u30D1\u30B9\u30EF\u30FC\u30C9\u30EA\u30BB\u30C3\u30C8\u6210\u529F
resetPasswordFailure=\u30D1\u30B9\u30EF\u30FC\u30C9\u30EA\u30BB\u30C3\u30C8\u5931\u6557
modifiedPasswordSuccess=\u30D1\u30B9\u30EF\u30FC\u30C9\u4FEE\u6B63\u6210\u529F
modifiedPasswordFailure=\u30D1\u30B9\u30EF\u30FC\u30C9\u4FEE\u6B63\u5931\u6557
addressDetail=\u4F4F\u6240\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
wrongTime=\u958B\u59CB\u6642\u9593\u306F\u7D42\u4E86\u6642\u9593\u3088\u308A\u9577\u304F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
addressVoList=\u30EB\u30FC\u30C8\u306F3\u3064\u3092\u8D85\u3048\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
addressVoCountry=\u9053\u306E\u56FD\u306F\u7A7A\u3067\u306F\u306A\u3044
addressVoCity=\u9053\u306E\u8857\u306F\u7A7A\u3067\u306F\u306A\u3044
addressVoAddressDetail=\u9053\u306E\u5177\u4F53\u7684\u306A\u4F4F\u6240\u306F\u6687\u3067\u306F\u3042\u308A\u307E\u305B\u3093
addressVoLat=\u9053\u306E\u7DEF\u5EA6\u306F\u7A7A\u3051\u3066\u306F\u306A\u3089\u306A\u3044
wrongAddressVoLat=\u30EB\u30FC\u30C8\u306E\u7DEF\u5EA6\u306E\u7BC4\u56F2\u306F- 90\uFF5E90
addressVoLng=\u9053\u306E\u7D4C\u5EA6\u306F\u7A7A\u3063\u307D\u306B\u306A\u3089\u306A\u3044
wrongaddressVoLng=\u30EB\u30FC\u30C8\u306E\u7D4C\u5EA6\u306E\u7BC4\u56F2\u306F- 180\uFF5E180
addressVoPostCode=\u30EB\u30FC\u30C8\u306E\u30DD\u30B9\u30C8\u306F\u7A7A\u3051\u3066\u306F\u3044\u3051\u306A\u3044
addressVoExpTime=\u30EB\u30FC\u30C8\u3067\u306F\u51FA\u767A\u6642\u9593\u304C\u7A7A\u3044\u3066\u3044\u306A\u3044\u3068\u4E88\u60F3\u3055\u308C\u3066\u3044\u307E\u3059
addressVoCompTime=\u30EB\u30FC\u30C8\u306F\u6642\u9593\u304C\u7A7A\u3044\u3066\u3044\u306A\u3044\u3068\u4E88\u60F3\u3055\u308C\u3066\u3044\u307E\u3059
wrongAddressVoCompTime=\u30EB\u30FC\u30C8\u5730\u306F\u3001\u5230\u7740\u6642\u9593\u304C\u7D4C\u904E\u3057\u3066\u3044\u306A\u3044\u4E88\u5B9A\u306E\u51FA\u767A\u6642\u9593\u3092\u4E88\u5B9A\u3057\u3066\u3044\u307E\u3059
wrongAddressVoExpTime=\u73FE\u5728\u306E\u30EB\u30FC\u30C8\u306E\u5230\u7740\u6642\u9593\u306F\u3001\u6B21\u306E\u30EB\u30FC\u30C8\u3067\u51FA\u767A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
systemManage=\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005
superManage=\u30B9\u30FC\u30D1\u30FC\u7BA1\u7406\u8005
warehouse=\u5009\u5EAB\u7BA1\u7406\u8005
transportManage=\u904B\u8F38\u7BA1\u7406\u8005
\ No newline at end of file
#\u9884\u8B66\u7C7B\u578B
alarmType = \u9884\u8B66\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
alarmScene = \u9884\u8B66\u573A\u666F\u4E0D\u80FD\u4E3A\u7A7A
wrongAlarmScene = \u8BF7\u9009\u62E9\u6B63\u786E\u7684\u9884\u8B66\u573A\u666F
temMax = \u6E29\u5EA6\u4E0A\u9650\u4E0D\u80FD\u4E3A\u7A7A
temMin = \u6E29\u5EA6\u4E0B\u9650\u4E0D\u80FD\u4E3A\u7A7A
humidityMax = \u6E7F\u5EA6\u4E0A\u9650\u4E0D\u80FD\u4E3A\u7A7A
humidityMin = \u6E7F\u5EA6\u4E0B\u9650\u4E0D\u80FD\u4E3A\u7A7A
tilt = \u503E\u659C\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
shock = \u9707\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
alarmExist = \u6DFB\u52A0\u7684\u9884\u8B66\u7C7B\u578B\u5728\u8BE5\u573A\u666F\u4E2D\u5DF2\u5B58\u5728
addSuccess = \u6DFB\u52A0\u9884\u8B66\u4FE1\u606F\u6210\u529F
addFailure = \u6DFB\u52A0\u9884\u8B66\u4FE1\u606F\u5931\u8D25
modifiedAlarmType = \u9700\u8981\u4FEE\u6539\u7684\u9884\u8B66\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
modifiedAlarmScene = \u9700\u8981\u4FEE\u6539\u7684\u9884\u8B66\u573A\u666F\u4E0D\u80FD\u4E3A\u7A7A
modifiedWrongAlarmScene = \u9700\u8981\u4FEE\u6539\u7684\u9884\u8B66\u573A\u666F\u4E0D\u6B63\u786E
modifiedAlarmExist = \u4FEE\u6539\u7684\u9884\u8B66\u7C7B\u578B\u5728\u8BE5\u573A\u666F\u4E2D\u5DF2\u5B58\u5728
modifiedSuccess = \u4FEE\u6539\u9884\u8B66\u4FE1\u606F\u6210\u529F
modifiedFailure = \u4FEE\u6539\u9884\u8B66\u4FE1\u606F\u5931\u8D25
deletedAlarmType = \u9700\u8981\u5220\u9664\u7684\u9884\u8B66\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
deletedAlarmScene = \u9700\u8981\u5220\u9664\u7684\u9884\u8B66\u573A\u666F\u4E0D\u80FD\u4E3A\u7A7A
dusedAlarm = \u8BE5\u9884\u8B66\u6B63\u5728\u88AB\u4F7F\u7528
deletedSuccess = \u5220\u9664\u9884\u8B66\u4FE1\u606F\u6210\u529F
deletedFailure = \u5220\u9664\u9884\u8B66\u4FE1\u606F\u5931\u8D25
#\u7EBF\u8DEF
transportationNo = \u7EBF\u8DEF\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A
noCircuit = \u6CA1\u6709\u8BE5\u7EBF\u8DEF
startCountry = \u51FA\u53D1\u56FD\u5BB6\u4E0D\u80FD\u4E3A\u7A7A
startCity = \u51FA\u53D1\u57CE\u5E02\u4E0D\u80FD\u4E3A\u7A7A
startAddressDetail = \u51FA\u53D1\u5177\u4F53\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A
startLat = \u51FA\u53D1\u5730\u7EAC\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongStartLat = \u51FA\u53D1\u5730\u7EAC\u5EA6\u7684\u8303\u56F4\u4E3A-90~90
startLng = \u51FA\u53D1\u5730\u7ECF\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongStartLng = \u51FA\u53D1\u5730\u7ECF\u5EA6\u7684\u8303\u56F4\u4E3A-180~180
startPostCode = \u51FA\u53D1\u5730\u90AE\u7F16\u4E0D\u80FD\u4E3A\u7A7A
starExpTime = \u51FA\u53D1\u5730\u9884\u8BA1\u51FA\u53D1\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
addressVoList = \u9014\u5F84\u5730\u4E0D\u80FD\u8D85\u8FC73\u4E2A
addressVoCountry = \u9014\u5F84\u5730\u56FD\u5BB6\u4E0D\u80FD\u4E3A\u7A7A
addressVoCity = \u9014\u5F84\u5730\u57CE\u5E02\u4E0D\u80FD\u4E3A\u7A7A
addressVoAddressDetail = \u9014\u5F84\u5730\u5177\u4F53\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A
addressVoLat = \u9014\u5F84\u5730\u7EAC\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongAddressVoLat = \u9014\u5F84\u5730\u7EAC\u5EA6\u7684\u8303\u56F4\u4E3A-90~90
addressVoLng = \u9014\u5F84\u5730\u7ECF\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongaddressVoLng = \u9014\u5F84\u5730\u7ECF\u5EA6\u7684\u8303\u56F4\u4E3A-180~180
addressVoPostCode = \u9014\u5F84\u5730\u90AE\u7F16\u4E0D\u80FD\u4E3A\u7A7A
addressVoExpTime = \u9014\u5F84\u5730\u9884\u8BA1\u51FA\u53D1\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
addressVoCompTime = \u9014\u5F84\u5730\u9884\u8BA1\u5230\u8FBE\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
wrongAddressVoCompTime = \u9014\u5F84\u5730\u9884\u8BA1\u5230\u8FBE\u65F6\u95F4\u4E0D\u80FD\u5C0F\u4E8E\u9014\u5F84\u5730\u9884\u8BA1\u51FA\u53D1\u65F6\u95F4
wrongAddressVoExpTime = \u5F53\u524D\u9014\u5F84\u5730\u9884\u8BA1\u5230\u8FBE\u65F6\u95F4\u4E0D\u80FD\u5927\u4E8E\u4E0B\u4E00\u4E2A\u9014\u5F84\u5730\u9884\u8BA1\u51FA\u53D1\u65F6\u95F4
endCountry = \u76EE\u7684\u5730\u56FD\u5BB6\u4E0D\u80FD\u4E3A\u7A7A
endCity = \u76EE\u7684\u5730\u57CE\u5E02\u4E0D\u80FD\u4E3A\u7A7A
endAddressDetail = \u76EE\u7684\u5730\u5177\u4F53\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A
endLat =\u76EE\u7684\u5730\u7EAC\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongEndLat =\u76EE\u7684\u5730\u7EAC\u5EA6\u7684\u8303\u56F4\u4E3A-90~90
endLng =\u76EE\u7684\u5730\u7ECF\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongEndLng = \u76EE\u7684\u5730\u7ECF\u5EA6\u7684\u8303\u56F4\u4E3A-180~180
endPostCode = \u76EE\u7684\u5730\u90AE\u7F16\u4E0D\u80FD\u4E3A\u7A7A
endCompTime = \u76EE\u7684\u5730\u9884\u8BA1\u5230\u8FBE\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
wrongEndCompTime = \u76EE\u7684\u5730\u9884\u8BA1\u5230\u8FBE\u65F6\u95F4\u4E0D\u80FD\u5C0F\u4E8E\u51FA\u53D1\u5730\u7684\u9884\u8BA1\u51FA\u53D1\u65F6\u95F4
gateway = \u7F51\u5173\u5E8F\u5217\u53F7\u4E0D\u80FD\u4E3A\u7A7A
gatewayExist = \u8BE5\u7F51\u5173\u5E8F\u5217\u53F7\u4E0D\u5B58\u5728
gatewayMounted = \u8BE5\u7F51\u5173\u672A\u6302\u8F7D
gatewayConsistent = \u8BE5\u7F51\u5173\u7684\u4F7F\u7528\u573A\u666F\u4E0E\u5F53\u524D\u4E0D\u7B26
tdl = TDL\u5E8F\u5217\u53F7\u4E0D\u80FD\u4E3A\u7A7A
tdlExist={0}TDL\u4E0D\u5B58\u5728
tdlUsed={0}\u7684TDL\u5DF2\u7ECF\u88AB\u4F7F\u7528
cargoNo = \u8D27\u7269\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A
plateNo = \u8F66\u724C\u53F7\u4E0D\u80FD\u4E3A\u7A7A
cargoName = \u8D27\u7269\u522B\u540D\u4E0D\u80FD\u4E3A\u7A7A
circuitSuccess = \u6DFB\u52A0\u7EBF\u8DEF\u6210\u529F
circuitFailure = \u6DFB\u52A0\u7EBF\u8DEF\u5931\u8D25
notStarted = \u7EBF\u8DEF\u672A\u5F00\u59CB\u8FD0\u8F93
notBound = \u8BE5\u7EBF\u8DEF\u672A\u7ED1\u5B9A\u7F51\u5173\u6216\u8005tdl
endCircuitSuccess =\u7EBF\u8DEF\u7ED3\u675F\u6210\u529F
endCircuitFailure =\u7EBF\u8DEF\u7ED3\u675F\u5931\u8D25
evaluate = \u8BC4\u4EF7\u7684\u7B49\u7EA7\u4E0D\u80FD\u4E3A\u7A7A
completedCircuit = \u7EBF\u8DEF\u5B8C\u6210\u8FD0\u8F93\u624D\u80FD\u8BC4\u4EF7
evaluateSuccess = \u8BC4\u4EF7\u6210\u529F
evaluateFailure =\u8BC4\u4EF7\u5931\u8D25
circuitState = \u9700\u8981\u67E5\u8BE2\u7684\u7EBF\u8DEF\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A
inTransit = \u8BE5\u7EBF\u8DEF\u5728\u8FD0\u8F93\u4E2D\u6216\u5DF2\u7ECF\u5B8C\u6210\u8FD0\u8F93
bindTDL = \u8BE5\u7EBF\u8DEF\u672A\u7ED1\u5B9Atdl
bindGateway = \u8BE5\u7EBF\u8DEF\u672A\u7ED1\u5B9A\u7F51\u5173
circuitDeleteSuccess = \u7EBF\u8DEF\u5220\u9664\u6210\u529F
circuitDeleteFailure = \u7EBF\u8DEF\u5220\u9664\u5931\u8D25
startTime = \u7EBF\u8DEF\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
startCircuitSuccess = \u7EBF\u8DEF\u5F00\u59CB\u8FD0\u8F93\u6210\u529F
startCircuitFailure = \u7EBF\u8DEF\u5F00\u59CB\u8FD0\u8F93\u5931\u8D25
#\u516C\u53F8
companyName = \u516C\u53F8\u540D\u4E0D\u80FD\u4E3A\u7A7A
country = \u56FD\u5BB6\u4E0D\u80FD\u4E3A\u7A7A
city = \u57CE\u5E02\u4E0D\u80FD\u4E3A\u7A7A
addressDetail = \u5177\u4F53\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A
tel = \u8054\u7CFB\u7535\u8BDD\u4E0D\u80FD\u4E3A\u7A7A
manager = \u8D1F\u8D23\u4EBA\u4E0D\u80FD\u4E3A\u7A7A
wrongTel = \u624B\u673A\u53F7\u4E0D\u89C4\u8303
repeateCompanyName = \u516C\u53F8\u540D\u4E0D\u80FD\u91CD\u590D
addCompanySuccess = \u6DFB\u52A0\u516C\u53F8\u6210\u529F
addCompanyFailure = \u6DFB\u52A0\u516C\u53F8\u5931\u8D25
companyNo = \u516C\u53F8\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A
modifyCompanySuccess = \u4FEE\u6539\u516C\u53F8\u6210\u529F
modifyCompanyFailure = \u4FEE\u6539\u516C\u53F8\u5931\u8D25
deleteCompanySuccess = \u5220\u9664\u516C\u53F8\u6210\u529F
deleteCompanyFailure = \u5220\u9664\u516C\u53F8\u5931\u8D25
#\u7528\u6237\u767B\u5F55
userName = \u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A
password = \u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A
addLogFailure=\u6DFB\u52A0\u65E5\u5FD7\u5931\u8D25
login = \u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF
loginout = \u6CE8\u9500\u6210\u529F
#\u767B\u9646\u65E5\u5FD7
logStartTime = \u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
logEndTime = \u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A
wrongTime = \u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u5927\u4E8E\u7ED3\u675F\u65F6\u95F4
#\u5E38\u7528\u5730\u5740
name = \u522B\u540D\u4E0D\u80FD\u4E3A\u7A7A
lat = \u7EAC\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongLat = \u7EAC\u5EA6\u7684\u8303\u56F4\u4E3A-90~90
lng = \u7ECF\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
wrongLng = \u7ECF\u5EA6\u7684\u8303\u56F4\u4E3A-180~180
repeatedName = \u6DFB\u52A0\u7684\u5E38\u7528\u5730\u5740\u522B\u540D\u4E0D\u80FD\u91CD\u590D
addAddressSuccess = \u6DFB\u52A0\u7528\u6237\u5E38\u7528\u5730\u5740\u6210\u529F
addAddressFailure = \u6DFB\u52A0\u7528\u6237\u5E38\u7528\u5730\u5740\u5931\u8D25
modifiedName = \u9700\u8981\u4FEE\u6539\u7684\u5E38\u7528\u5730\u5740\u522B\u540D\u4E0D\u80FD\u4E3A\u7A7A
modifiedNewName = \u65B0\u7684\u522B\u540D\u4E0D\u80FD\u4E3A\u7A7A
modifiedRepeatedName = \u4FEE\u6539\u7684\u5E38\u7528\u5730\u5740\u522B\u540D\u4E0D\u80FD\u91CD\u590D
modifiedAddressSuccess = \u4FEE\u6539\u7528\u6237\u5E38\u7528\u5730\u5740\u6210\u529F
modifiedAddressFailure = \u4FEE\u6539\u7528\u6237\u5E38\u7528\u5730\u5740\u5931\u8D25
deletedName = \u9700\u8981\u5220\u9664\u7684\u522B\u540D\u4E0D\u80FD\u4E3A\u7A7A
deletedAddressSuccess = \u5220\u9664\u7528\u6237\u5E38\u7528\u5730\u5740\u6210\u529F
deletedAddressFailure = \u5220\u9664\u7528\u6237\u5E38\u7528\u5730\u5740\u5931\u8D25
#\u7528\u6237
usernameRule = \u7528\u6237\u540D\u4EE5\u5B57\u6BCD\u5F00\u5934,\u53EF\u5305\u542B\u6570\u5B57\u548C_,6-20\u4E2A\u5B57\u7B26
repeatedUserName = \u7528\u6237\u540D\u5DF2\u88AB\u5360\u7528
passwordRule= \u5BC6\u7801\u5FC5\u987B\u662F6-20\u4F4D\u7684\u6570\u5B57\u3001\u5B57\u6BCD\u548C_
nickName = \u6635\u79F0\u4E0D\u80FD\u4E3A\u7A7A
phone=\u624B\u673A\u53F7\u4E0D\u80FD\u4E3A\u7A7A
phoneRule= \u624B\u673A\u53F7\u4E0D\u89C4\u8303
repeatedRule = \u8BE5\u624B\u673A\u53F7\u5DF2\u88AB\u6CE8\u518C
email = \u90AE\u7BB1\u4E0D\u80FD\u4E3A\u7A7A
emailRule = \u90AE\u7BB1\u683C\u5F0F\u4E0D\u89C4\u8303
repeatedEmail = \u8BE5\u90AE\u7BB1\u5DF2\u88AB\u6CE8\u518C
roleName = \u89D2\u8272\u540D\u4E0D\u80FD\u4E3A\u7A7A
existRoleName = \u89D2\u8272\u540D\u4E0D\u5B58\u5728
existCompany=\u6CA1\u6709\u8BE5\u516C\u53F8
addUserSuccess = \u6DFB\u52A0\u7528\u6237\u6210\u529F
addUserFailure = \u6DFB\u52A0\u7528\u6237\u5931\u8D25
userNumber = \u7528\u6237\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A
modifiedUserSuccess = \u4FEE\u6539\u7528\u6237\u6210\u529F
modifiedUserFailure = \u4FEE\u6539\u7528\u6237\u5931\u8D25
deleteUserSuccess = \u5220\u9664\u7528\u6237\u6210\u529F
deleteUserFailure = \u5220\u9664\u7528\u6237\u5931\u8D25
resetPasswordSuccess = \u91CD\u7F6E\u5BC6\u7801\u6210\u529F
resetPasswordFailure = \u91CD\u7F6E\u5BC6\u7801\u5931\u8D25
modifiedPasswordSuccess = \u4FEE\u6539\u5BC6\u7801\u6210\u529F
modifiedPasswordFailure = \u4FEE\u6539\u5BC6\u7801\u5931\u8D25
systemManage = \u7CFB\u7EDF\u7BA1\u7406\u5458
superManage = \u8D85\u7EA7\u7BA1\u7406\u5458
warehouse = \u4ED3\u5E93\u7BA1\u7406\u5458
transportManage = \u8FD0\u8F93\u7BA1\u7406\u5458
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#{description,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT}, #{data,jdbcType=FLOAT},
#{alarmTime,jdbcType=INTEGER}, #{alarmTime,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR} #{classify,jdbcType=VARCHAR},
#{desp,jdbcType=VARCHAR},
#{alarmNo,jdbcType=VARCHAR}
) )
</insert> </insert>
...@@ -70,10 +72,6 @@ ...@@ -70,10 +72,6 @@
SELECT ifnull(classify,"5") classify,count(description) count FROM alarm_log WHERE classify = "5" SELECT ifnull(classify,"5") classify,count(description) count FROM alarm_log WHERE classify = "5"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR})) and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s')) AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"6") classify,count(description) count FROM alarm_log WHERE classify = "6"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
</select> </select>
<select id="getByTime" resultType="java.lang.Integer"> <select id="getByTime" resultType="java.lang.Integer">
...@@ -105,6 +103,7 @@ ...@@ -105,6 +103,7 @@
<if test="endTime!=null"> <if test="endTime!=null">
AND c.endTime &lt;= #{endTime,jdbcType=INTEGER} AND c.endTime &lt;= #{endTime,jdbcType=INTEGER}
</if> </if>
order by al.alarmTime DESC
</select> </select>
<select id="getRealTimeAlarm" parameterType="java.lang.String" resultType="com.example.tdl.domain.vo.AlarmLogVo"> <select id="getRealTimeAlarm" parameterType="java.lang.String" resultType="com.example.tdl.domain.vo.AlarmLogVo">
......
...@@ -2,13 +2,16 @@ ...@@ -2,13 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.CircuitMapper"> <mapper namespace="com.example.tdl.mapper.CircuitMapper">
<!--获取所有线路的信息--> <!--获取所有线路的信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="String"> <select id="getAll" resultType="com.example.tdl.domain.vo.CircuitResultVo" parameterType="String">
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT( DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation (select GROUP_CONCAT( DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation,plateNo,
from circuit c where c.state=1 (select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
from circuit c
where c.state=1
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
order by c.createTime desc
</select> </select>
......
...@@ -82,6 +82,13 @@ ...@@ -82,6 +82,13 @@
AND type=#{type,jdbcType=VARCHAR})) AND type=#{type,jdbcType=VARCHAR}))
</select> </select>
<select id="getUnusedGateway" parameterType="String" resultType="com.example.tdl.domain.vo.GatewaySNVo">
select SN from gateway
where SN like CONCAT(CONCAT('%',#{SN,jdbcType=VARCHAR}), '%')
and useScene = 0
and state = 1
</select>
<!-- <insert id="addGateway" parameterType="com.example.tdl.domain.vo.AddGatewayVo"> <!-- <insert id="addGateway" parameterType="com.example.tdl.domain.vo.AddGatewayVo">
INSERT into gateway VALUES ( INSERT into gateway VALUES (
......
...@@ -76,4 +76,10 @@ ...@@ -76,4 +76,10 @@
and g.SN =#{SN,jdbcType=VARCHAR} and g.SN =#{SN,jdbcType=VARCHAR}
and g.type=#{type,jdbcType=VARCHAR} and g.type=#{type,jdbcType=VARCHAR}
</select> </select>
<select id="getUnusedTDL" resultType="com.example.tdl.domain.vo.TdlSNVo" parameterType="String" >
select TDLSN from tdldevice
where TDLSN like CONCAT(CONCAT('%',#{TDLSN,jdbcType=VARCHAR}), '%')
and useScene = 0
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -27,6 +27,13 @@ ...@@ -27,6 +27,13 @@
AND u.state=1 AND u.state=1
</select> </select>
<select id="getAllUser" resultType="com.example.tdl.domain.vo.ResultUserVo">
select userNumber, userName,password,nickName,phone,email,roleName,c.companyName
from company c,`user` u INNER JOIN role r ON u.role_id=r.id
WHERE u.company_id=c.id
AND u.state=1
</select>
<!--根据条件查询--> <!--根据条件查询-->
<select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultUserVo" parameterType="com.example.tdl.domain.vo.UserTermVo"> <select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultUserVo" parameterType="com.example.tdl.domain.vo.UserTermVo">
select userNumber, userName,password,nickName,phone,email,roleName,c.companyName select userNumber, userName,password,nickName,phone,email,roleName,c.companyName
...@@ -44,7 +51,9 @@ ...@@ -44,7 +51,9 @@
<if test="phone!=null"> <if test="phone!=null">
AND phone like CONCAT(CONCAT('%',#{phone,jdbcType=VARCHAR}), '%') AND phone like CONCAT(CONCAT('%',#{phone,jdbcType=VARCHAR}), '%')
</if> </if>
<if test="companyName!=null">
AND c.companyName=#{companyName,jdbcType=VARCHAR} AND c.companyName=#{companyName,jdbcType=VARCHAR}
</if>
AND u.state=1 AND u.state=1
</select> </select>
......
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