Commit 162ac3ef authored by zhuangzhuang's avatar zhuangzhuang

4.13-- 增加开始线路,结束线路

parent 47563980
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,6 +16,10 @@ public class CircuitMessageVo { ...@@ -16,6 +16,10 @@ public class CircuitMessageVo {
private String evaluate; private String evaluate;
private String SN;
private String TDLSN;
private List<ResultCityVo> list; private List<ResultCityVo> list;
private List<ResultAlarmLog> alarmLogList; private List<ResultAlarmLog> alarmLogList;
...@@ -23,13 +27,15 @@ public class CircuitMessageVo { ...@@ -23,13 +27,15 @@ public class CircuitMessageVo {
public CircuitMessageVo() { public CircuitMessageVo() {
} }
public CircuitMessageVo(String transportationNo, String cargoNo, String startCity, String endCity, Integer circuitState, String evaluate, List<ResultAlarmLog> alarmLogList) { public CircuitMessageVo(String transportationNo, String cargoNo, String startCity, String endCity, Integer circuitState, String evaluate, String SN, String TDLSN, List<ResultAlarmLog> alarmLogList) {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
this.cargoNo = cargoNo; this.cargoNo = cargoNo;
this.startCity = startCity; this.startCity = startCity;
this.endCity = endCity; this.endCity = endCity;
this.circuitState = circuitState; this.circuitState = circuitState;
this.evaluate = evaluate; this.evaluate = evaluate;
this.SN = SN;
this.TDLSN = TDLSN;
this.alarmLogList = alarmLogList; this.alarmLogList = alarmLogList;
} }
...@@ -81,6 +87,22 @@ public class CircuitMessageVo { ...@@ -81,6 +87,22 @@ public class CircuitMessageVo {
this.evaluate = evaluate; this.evaluate = evaluate;
} }
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public List<ResultCityVo> getList() { public List<ResultCityVo> getList() {
return list; return list;
} }
......
...@@ -19,6 +19,8 @@ public class HomePageDataVo { ...@@ -19,6 +19,8 @@ public class HomePageDataVo {
private List<CircuitVo> circuitList; private List<CircuitVo> circuitList;
private List<HistogramData> histogramDataList;
public Integer getSum() { public Integer getSum() {
return sum; return sum;
} }
...@@ -74,4 +76,12 @@ public class HomePageDataVo { ...@@ -74,4 +76,12 @@ public class HomePageDataVo {
public void setCircuitList(List<CircuitVo> circuitList) { public void setCircuitList(List<CircuitVo> circuitList) {
this.circuitList = circuitList; this.circuitList = circuitList;
} }
public List<HistogramData> getHistogramDataList() {
return histogramDataList;
}
public void setHistogramDataList(List<HistogramData> histogramDataList) {
this.histogramDataList = histogramDataList;
}
} }
...@@ -47,7 +47,7 @@ public class LocationDataVo { ...@@ -47,7 +47,7 @@ public class LocationDataVo {
return "{" + return "{" +
"\"time\""+":\"" + time + '\"' + "\"time\""+":\"" + time + '\"' +
",\"lng\""+":" + lng + ",\"lng\""+":" + lng +
",\" lat\""+":" + lat + ",\"lat\""+":" + lat +
", \"error\""+":" + error + ", \"error\""+":" + error +
'}'; '}';
} }
......
...@@ -17,15 +17,11 @@ public class ResultCircuitForAppVo { ...@@ -17,15 +17,11 @@ public class ResultCircuitForAppVo {
private String transportationType; private String transportationType;
private String remark; private String SN;
public Long getStartTime() { private String TDLSN;
return startTime;
}
public void setStartTime(Long startTime) { private String remark;
this.startTime = startTime;
}
public String getTransportationNo() { public String getTransportationNo() {
return transportationNo; return transportationNo;
...@@ -43,6 +39,14 @@ public class ResultCircuitForAppVo { ...@@ -43,6 +39,14 @@ public class ResultCircuitForAppVo {
this.city = city; this.city = city;
} }
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public String getCargoNo() { public String getCargoNo() {
return cargoNo; return cargoNo;
} }
...@@ -83,6 +87,22 @@ public class ResultCircuitForAppVo { ...@@ -83,6 +87,22 @@ public class ResultCircuitForAppVo {
this.transportationType = transportationType; this.transportationType = transportationType;
} }
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getRemark() { public String getRemark() {
return remark; return remark;
} }
......
...@@ -23,6 +23,10 @@ public class ResultCircuitVo { ...@@ -23,6 +23,10 @@ public class ResultCircuitVo {
private String transportation; private String transportation;
private String SN;
private String TDLSN;
public String getTransportationNo() { public String getTransportationNo() {
return transportationNo; return transportationNo;
} }
...@@ -110,4 +114,20 @@ public class ResultCircuitVo { ...@@ -110,4 +114,20 @@ public class ResultCircuitVo {
public void setTransportation(String transportation) { public void setTransportation(String transportation) {
this.transportation = transportation; this.transportation = transportation;
} }
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
} }
\ No newline at end of file
package com.example.tdl.domain.vo;
public class StartCircuitVo {
private Long startTime;
private String transportationNo;
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public String getTransportationNo() {
return transportationNo;
}
public void setTransportationNo(String transportationNo) {
this.transportationNo = transportationNo;
}
}
package com.example.tdl.domain.vo;
public class TDLLogVo {
private String gSN;
private String gType;
private String TDLSN;
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;
}
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
}
package com.example.tdl.domain.vo; package com.example.tdl.domain.vo;
public class UpdateCircuitVo { public class UpdateCircuitVo {
private Long endTime; private Long endTime;
private String transportationNo; private String transportationNo;
......
...@@ -4,11 +4,14 @@ public class UserNameVo { ...@@ -4,11 +4,14 @@ public class UserNameVo {
private String UserName; private String UserName;
private String time;
public UserNameVo() { public UserNameVo() {
} }
public UserNameVo(String userName) { public UserNameVo(String userName, String time) {
UserName = userName; UserName = userName;
this.time = time;
} }
public String getUserName() { public String getUserName() {
...@@ -18,4 +21,12 @@ public class UserNameVo { ...@@ -18,4 +21,12 @@ public class UserNameVo {
public void setUserName(String userName) { public void setUserName(String userName) {
UserName = userName; UserName = userName;
} }
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
} }
...@@ -21,6 +21,8 @@ public interface CircuitMapper { ...@@ -21,6 +21,8 @@ public interface CircuitMapper {
int updateEndTime(UpdateCircuitVo updateCircuitVo); int updateEndTime(UpdateCircuitVo updateCircuitVo);
int updateStartTime(StartCircuitVo startCircuitVo);
int delCircuit(String transportationNo); int delCircuit(String transportationNo);
ResultCircuitVo getByTransportationNo(@Param("transportationNo") String transportationNo,@Param("companyName") String companyName); ResultCircuitVo getByTransportationNo(@Param("transportationNo") String transportationNo,@Param("companyName") String companyName);
......
...@@ -26,6 +26,7 @@ public interface TDLDeviceMapper { ...@@ -26,6 +26,7 @@ public interface TDLDeviceMapper {
List<String> getByGatewaySN(@Param("SN") String SN, @Param("type") String type); List<String> getByGatewaySN(@Param("SN") String SN, @Param("type") String type);
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);
} }
package com.example.tdl.mapper; package com.example.tdl.mapper;
import com.example.tdl.domain.vo.ResultGatewayVo; import com.example.tdl.domain.vo.ResultGatewayVo;
import com.example.tdl.domain.vo.TDLLogVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface TDLLogMapper { public interface TDLLogMapper {
ResultGatewayVo getByNo(String transportationNo); ResultGatewayVo getByNo(String transportationNo);
TDLLogVo getByTransportationNo(String transportationNo);
List<String> getTdlSN(String transportationNo);
} }
...@@ -21,7 +21,7 @@ public interface UserMapper { ...@@ -21,7 +21,7 @@ public interface UserMapper {
ResultUserVo getByEmail(@Param("email") String email,@Param("companyName") String companyName); ResultUserVo getByEmail(@Param("email") String email,@Param("companyName") String companyName);
ResultUserVo getByUserNumber(@Param("userNumber") String userNumber,@Param("companyName") String companyName); ResultUserVo getByUserNumber(String userNumber);
int addUser(AddUserVo addUserVo); int addUser(AddUserVo addUserVo);
......
...@@ -39,6 +39,10 @@ public class CircuitService { ...@@ -39,6 +39,10 @@ public class CircuitService {
return circuitMapper.updateEndTime(updateCircuitVo); return circuitMapper.updateEndTime(updateCircuitVo);
} }
public int updateStartTime(StartCircuitVo startCircuitVo){
return circuitMapper.updateStartTime(startCircuitVo);
}
public int delCircuit(String transportationNo){ public int delCircuit(String transportationNo){
return circuitMapper.delCircuit(transportationNo); return circuitMapper.delCircuit(transportationNo);
} }
......
...@@ -46,4 +46,8 @@ public class TDLDeviceService { ...@@ -46,4 +46,8 @@ public class TDLDeviceService {
public List<String> getTdlSN(String SN,String type){ public List<String> getTdlSN(String SN,String type){
return tdlDeviceMapper.getTdlSN(SN,type); return tdlDeviceMapper.getTdlSN(SN,type);
} }
public String getTdl(String SN,String type){
return tdlDeviceMapper.getTdl(SN,type);
}
} }
...@@ -2,10 +2,13 @@ package com.example.tdl.service; ...@@ -2,10 +2,13 @@ package com.example.tdl.service;
import com.example.tdl.domain.vo.ResultGatewayVo; import com.example.tdl.domain.vo.ResultGatewayVo;
import com.example.tdl.domain.vo.TDLLogVo;
import com.example.tdl.mapper.TDLLogMapper; import com.example.tdl.mapper.TDLLogMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
public class TDLLogService { public class TDLLogService {
...@@ -16,4 +19,12 @@ public class TDLLogService { ...@@ -16,4 +19,12 @@ public class TDLLogService {
return tdlLogMapper.getByNo(transportationNo); return tdlLogMapper.getByNo(transportationNo);
} }
public TDLLogVo getByTransportationNo(String transportationNo){
return tdlLogMapper.getByTransportationNo(transportationNo);
}
public List<String> getTdlSN(String transportationNo){
return tdlLogMapper.getTdlSN(transportationNo);
}
} }
...@@ -46,8 +46,8 @@ public class UserService { ...@@ -46,8 +46,8 @@ public class UserService {
return userMapper.getByEmail(email,companyName); return userMapper.getByEmail(email,companyName);
} }
public ResultUserVo getByUserNumber(String userNumber,String companyName){ public ResultUserVo getByUserNumber(String userNumber){
return userMapper.getByUserNumber(userNumber,companyName); return userMapper.getByUserNumber(userNumber);
} }
public int addUser(AddUserVo addUserVo){ public int addUser(AddUserVo addUserVo){
...@@ -66,7 +66,6 @@ public class UserService { ...@@ -66,7 +66,6 @@ public class UserService {
return userMapper.updatePassword(updatePasswordVo); return userMapper.updatePassword(updatePasswordVo);
} }
//登录 //登录
public String getUser(LoginUserVo loginUserVo) { public String getUser(LoginUserVo loginUserVo) {
//获取用户信息 //获取用户信息
......
...@@ -56,6 +56,12 @@ public class CircuitController { ...@@ -56,6 +56,12 @@ public class CircuitController {
@Autowired @Autowired
private AlarmService alarmService; private AlarmService alarmService;
@Autowired
private TDLLogService tdlLogService;
@Autowired
private ConfigService configService;
List<String> list = new ArrayList<String>(){{ List<String> list = new ArrayList<String>(){{
add("T"); add("T");
add("h"); add("h");
...@@ -121,6 +127,8 @@ public class CircuitController { ...@@ -121,6 +127,8 @@ public class CircuitController {
" deliveryAddress:交付地点," + " deliveryAddress:交付地点," +
" transportation:运输方式," + " transportation:运输方式," +
" transportationType:运输类型," + " transportationType:运输类型," +
" SN:gateway序列号" +
" TDLSN:TDLSN序列号" +
" 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"),
...@@ -343,6 +351,18 @@ public class CircuitController { ...@@ -343,6 +351,18 @@ public class CircuitController {
fb.setMessage("途径地预计到达时间不能为空"); fb.setMessage("途径地预计到达时间不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (addCircuitVo.getAddressVoList().get(i).getCompTime() <=addCircuitVo.getAddressVoList().get(i).getExpTime()){
fb.setCode(0);
fb.setMessage("途径地预计到达时间不能小于途径地预计出发时间");
return gson.toJson(fb);
}
if(i<addCircuitVo.getAddressVoList().size()-1){
if (addCircuitVo.getAddressVoList().get(i).getCompTime() >=addCircuitVo.getAddressVoList().get(i +1).getExpTime()){
fb.setCode(0);
fb.setMessage("当前途径地预计到达时间不能大于下一个途径地预计出发时间");
return gson.toJson(fb);
}
}
countryVar=countryVar +addCircuitVo.getAddressVoList().get(i).getCountry() +" "; countryVar=countryVar +addCircuitVo.getAddressVoList().get(i).getCountry() +" ";
cityVar=cityVar +addCircuitVo.getAddressVoList().get(i).getCity() +" "; cityVar=cityVar +addCircuitVo.getAddressVoList().get(i).getCity() +" ";
addressDetailVar =addressDetailVar +addCircuitVo.getAddressVoList().get(i).getAddressDetail() +" "; addressDetailVar =addressDetailVar +addCircuitVo.getAddressVoList().get(i).getAddressDetail() +" ";
...@@ -411,6 +431,11 @@ public class CircuitController { ...@@ -411,6 +431,11 @@ public class CircuitController {
fb.setMessage("目的地预计到达时间不能为空"); fb.setMessage("目的地预计到达时间不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if(addCircuitVo.getEndAddressVo().getCompTime()<=addCircuitVo.getStartAddressVo().getExpTime()){
fb.setCode(0);
fb.setMessage("目的地预计到达时间不能小于出发地的预计出发时间");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addCircuitVo.getSN())){ if(StringUtils.isEmpty(addCircuitVo.getSN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("网关序列号不能为空"); fb.setMessage("网关序列号不能为空");
...@@ -448,7 +473,7 @@ public class CircuitController { ...@@ -448,7 +473,7 @@ public class CircuitController {
} }
if(!StringUtils.isEmpty(tdlDeviceVo.getGatewaySN())){ if(!StringUtils.isEmpty(tdlDeviceVo.getGatewaySN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage(addCircuitVo.getTdlAlarmList().get(j).getTDLSN() +"已经被使用"); fb.setMessage("序列号为"+addCircuitVo.getTdlAlarmList().get(j).getTDLSN() +"的TDL已经被使用");
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -753,26 +778,56 @@ public class CircuitController { ...@@ -753,26 +778,56 @@ public class CircuitController {
} }
if (StringUtils.isEmpty(updateCircuitVo.getTransportationNo())){ if (StringUtils.isEmpty(updateCircuitVo.getTransportationNo())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("需要修改的运输编号不能为空"); fb.setMessage("运输编号不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (updateCircuitVo.getEndTime()==null){ if (updateCircuitVo.getEndTime()==null){
fb.setCode(0); updateCircuitVo.setEndTime(System.currentTimeMillis());
fb.setMessage("线路结束时间不能为空");
return gson.toJson(fb);
} }
if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName()).getCircuitState()!=2){ if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo(),user.getCompanyName()).getCircuitState() ==0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("线路未完成"); fb.setMessage("线路未开始");
return gson.toJson(fb); return gson.toJson(fb);
} }
int a = circuitService.updateEndTime(updateCircuitVo); //获取当前线路的gateway 和tdl信息
if (a>0){ TDLLogVo tdlLogVo = tdlLogService.getByTransportationNo(updateCircuitVo.getTransportationNo());
List<String> dev = tdlLogService.getTdlSN(updateCircuitVo.getTransportationNo());
List<String> devList = tdlDeviceService.getByGatewaySN(tdlLogVo.getgSN(),tdlLogVo.getgType());
String tdl = tdlDeviceService.getTdl(tdlLogVo.getgSN(),tdlLogVo.getgType());
ConfigCMDVo configCMDVo;
ConfigVo configVo =configService.getConfig(tdlLogVo.getgSN(),tdlLogVo.getgType());
ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class);
if(tdl.equals(tdlLogVo.getTDLSN())){
configCMDVo = new ConfigCMDVo();
}else{
devList.remove(dev);
configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l);
}
String TDLSN;
if(tdlLogVo.getTDLSN().contains(",")){
String[] tdlSNList = tdlLogVo.getTDLSN().split(",");
TDLSN = tdlSNList[0];
}else{
TDLSN = tdlLogVo.getTDLSN();
}
Map<Object,Object> map=new HashMap<>();
map.put("gSN",tdlLogVo.getgSN());
map.put("gType",tdlLogVo.getgType());
map.put("message",gson.toJson(configCMDVo));
map.put("untie",true);
map.put("TDLSN",TDLSN);
map.put("endTime",updateCircuitVo.getEndTime());
configService.updateConfig(map);
Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("解除网关成功")){
fb.setCode(1); fb.setCode(1);
fb.setMessage("修改线路结束时间成功"); fb.setMessage(msg.get("msg").toString());
String key ="TDL/"+tdlLogVo.getgType()+"/" +tdlLogVo.getgSN() +"/Data";
alarmRedisService.delKey(key);
}else{ }else{
fb.setCode(0); fb.setCode(0);
fb.setMessage("修改线路结束时间失败"); fb.setMessage(msg.get("msg").toString());
} }
return gson.toJson(fb); return gson.toJson(fb);
} }
...@@ -924,6 +979,8 @@ public class CircuitController { ...@@ -924,6 +979,8 @@ public class CircuitController {
" endCity:目的城市" + " endCity:目的城市" +
" circuitState:线路状态" + " circuitState:线路状态" +
" evaluate:评价" + " evaluate:评价" +
" SN:gateway序列号" +
" TDLSN:TDLSN序列号" +
" list:" + " list:" +
" {city:城市" + " {city:城市" +
" time:到达时间/发车时间" + " time:到达时间/发车时间" +
...@@ -932,16 +989,16 @@ public class CircuitController { ...@@ -932,16 +989,16 @@ public class CircuitController {
" type:1--出发时间;2--目的时间}" + " type:1--出发时间;2--目的时间}" +
" alarmLogList:" + " alarmLogList:" +
" transportationNo:运输编号" + " transportationNo:运输编号" +
" TDLSN:tag序列号" + " TDLSN:tag序列号" +
" description:报警描述" + " description:报警描述" +
" data:数值" + " data:数值" +
" alarmTime:报警时间" + " alarmTime:报警时间" +
" classify:分类" ) " classify:分类" )
@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"),
}) })
@PostMapping("/getDetails") @PostMapping("/getDetails")
public Object getDetails(@RequestBody String transportationNo,HttpServletRequest request){ public Object getDetails(@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);
...@@ -950,7 +1007,7 @@ public class CircuitController { ...@@ -950,7 +1007,7 @@ public class CircuitController {
//获取线路信息 //获取线路信息
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
List<ResultAlarmLog> alarmLogList= alarmLogService.getByTransportationNo(transportationNo); List<ResultAlarmLog> alarmLogList= alarmLogService.getByTransportationNo(transportationNo);
CircuitMessageVo messageVo = new CircuitMessageVo(resultCircuitVo.getTransportationNo(),resultCircuitVo.getCargoNo(),resultCircuitVo.getStartCity(),resultCircuitVo.getEndCity(),resultCircuitVo.getCircuitState(),resultCircuitVo.getEvaluate(),alarmLogList); CircuitMessageVo messageVo = new CircuitMessageVo(resultCircuitVo.getTransportationNo(),resultCircuitVo.getCargoNo(),resultCircuitVo.getStartCity(),resultCircuitVo.getEndCity(),resultCircuitVo.getCircuitState(),resultCircuitVo.getEvaluate(),resultCircuitVo.getSN(),resultCircuitVo.getTDLSN(),alarmLogList);
//获取线路情况 //获取线路情况
List<CircuitTransferVo> list =circuitTransferService.getCity(transportationNo); List<CircuitTransferVo> list =circuitTransferService.getCity(transportationNo);
List<ResultCityVo> cityVoList = new ArrayList<>(); List<ResultCityVo> cityVoList = new ArrayList<>();
...@@ -1047,6 +1104,51 @@ public class CircuitController { ...@@ -1047,6 +1104,51 @@ public class CircuitController {
return gson.toJson(messageVo); return gson.toJson(messageVo);
} }
//开始运输
@ApiOperation(value = "开始运输",notes = "开始运输")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@PostMapping("/startTransportation")
public Object startTransportation(@RequestBody StartCircuitVo startCircuitVo,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
if (StringUtils.isEmpty(startCircuitVo.getTransportationNo())){
fb.setCode(0);
fb.setMessage("运输编号不能为空");
return gson.toJson(fb);
}
if (circuitService.getByTransportationNo(startCircuitVo.getTransportationNo(),user.getCompanyName())==null){
fb.setCode(0);
fb.setMessage("没有该线路");
return gson.toJson(fb);
}
if (startCircuitVo.getStartTime()==null){
fb.setCode(0);
fb.setMessage("线路开始时间不能为空");
return gson.toJson(fb);
}
//判断该线路是否绑定
ResultGatewayVo gatewayVo = tdlLogService.getByNo(startCircuitVo.getTransportationNo());
if(gatewayVo == null){
fb.setCode(0);
fb.setMessage("该线路未绑定tdl和gateway");
return gson.toJson(fb);
}
int a = circuitService.updateStartTime(startCircuitVo);
if (a>0){
fb.setCode(1);
fb.setMessage("线路开启成功");
}else{
fb.setCode(0);
fb.setMessage("线路开启失败");
}
return gson.toJson(fb);
}
//生成运输编号 //生成运输编号
public String getTransportNo(String transportation,String transportationType){ public String getTransportNo(String transportation,String transportationType){
String transportationNo=""; String transportationNo="";
......
...@@ -103,11 +103,11 @@ public class DataController { ...@@ -103,11 +103,11 @@ public class DataController {
return ret; return ret;
} }
//获取gateway的信息 //获取gateway的信息
ResultGatewayVo gatewayVo = tdlLogService.getByNo(transportationNo); TDLLogVo tdlLogVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo==null){ if(tdlLogVo==null){
return gson.toJson(locationDataVoList); return gson.toJson(locationDataVoList);
} }
String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = tdlLogVo.getgType() +"_" +tdlLogVo.getgSN();
String sql =""; String sql ="";
if(resultCircuitVo.getEndTime() != null && resultCircuitVo.getEndTime() != 0){ if(resultCircuitVo.getEndTime() != null && resultCircuitVo.getEndTime() != 0){
Long time = resultCircuitVo.getEndTime()*1000000l; Long time = resultCircuitVo.getEndTime()*1000000l;
...@@ -116,7 +116,6 @@ public class DataController { ...@@ -116,7 +116,6 @@ public class DataController {
sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time "; sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time ";
} }
//获取tdl信息 //获取tdl信息
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
//解析经纬度数据 //解析经纬度数据
List<LocationDataVo> locationDataVos = new ArrayList<>(); List<LocationDataVo> locationDataVos = new ArrayList<>();
...@@ -214,15 +213,15 @@ public class DataController { ...@@ -214,15 +213,15 @@ public class DataController {
if(resultCircuitVo.getEndTime() !=null && resultCircuitVo.getEndTime() !=0 && infoRedisService.hasHashKey("HistoryData",transportationNo)){ if(resultCircuitVo.getEndTime() !=null && resultCircuitVo.getEndTime() !=0 && infoRedisService.hasHashKey("HistoryData",transportationNo)){
return infoRedisService.getHash("HistoryData",transportationNo); return infoRedisService.getHash("HistoryData",transportationNo);
}else{ }else{
ResultGatewayVo gatewayVo = tdlLogService.getByNo(transportationNo); TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo == null){ if(gatewayVo == null){
fb.setCode(0); fb.setCode(0);
fb.setMessage("该运输编号不存在"); fb.setMessage("该运输编号不存在");
return gson.toJson(fb); return gson.toJson(fb);
} }
String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
//获取tdl信息 //获取tdl信息
List<String> devList= tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); List<String> devList= tdlLogService.getTdlSN(transportationNo);
if(devList.size() == 0){ if(devList.size() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有数据"); fb.setMessage("没有数据");
...@@ -245,7 +244,7 @@ public class DataController { ...@@ -245,7 +244,7 @@ public class DataController {
//String sql = "SELECT \"T\" FROM \"tdl_policy\".\"WTD93LG_17110198\" where \"tdl\"=\'TDL-1707010057708\' and time >=1522220659993000000 ORDER BY time "; //String sql = "SELECT \"T\" FROM \"tdl_policy\".\"WTD93LG_17110198\" where \"tdl\"=\'TDL-1707010057708\' and time >=1522220659993000000 ORDER BY time ";
String sql=""; String sql="";
if(resultCircuitVo.getEndTime() !=null && resultCircuitVo.getEndTime() !=0){ if(resultCircuitVo.getEndTime() !=null && resultCircuitVo.getEndTime() !=0){
sql = "SELECT "+list.get(j)+" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"='"+devList.get(i)+"' and time >="+startTime + "and time<="+resultCircuitVo.getEndTime() *1000000l+" ORDER BY time "; sql = "SELECT "+list.get(j)+" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"='"+devList.get(i)+"' and time >="+startTime + " and time<="+resultCircuitVo.getEndTime() *1000000l+" ORDER BY time ";
}else{ }else{
sql = "SELECT "+list.get(j)+" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"='"+devList.get(i)+"' and time >="+startTime + " ORDER BY time "; sql = "SELECT "+list.get(j)+" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"='"+devList.get(i)+"' and time >="+startTime + " ORDER BY time ";
} }
...@@ -287,28 +286,27 @@ public class DataController { ...@@ -287,28 +286,27 @@ public class DataController {
JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
ResultGatewayVo gatewayVo = new ResultGatewayVo(); TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(resultCircuitVo.getEndTime() == 0){ if(gatewayVo == null){
gatewayVo = circuitService.getByNo(transportationNo); fb.setCode(0);
}else{ fb.setMessage("该线路未绑定gateway和tdl");
gatewayVo = tdlLogService.getByNo(transportationNo); return gson.toJson(fb);
} }
String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
//获取tdl信息 //获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); List<String> devList = tdlLogService.getTdlSN(transportationNo);
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
Long startTime = resultCircuitVo.getStartTime() *1000000l; Long startTime = resultCircuitVo.getStartTime() *1000000l;
//SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC //SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
if(devList.size() == 0){ if(devList.size() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有数据"); fb.setMessage("该线路未绑定gateway和tdl");
return gson.toJson(fb); return gson.toJson(fb);
} }
List<Temperature> temperatures = new ArrayList<>(); List<Temperature> temperatures = new ArrayList<>();
for( int i =0;i<devList.size();i++){ for( int i =0;i<devList.size();i++){
Temperature temperature = new Temperature(); Temperature temperature = new Temperature();
temperature.setTDLSN(devList.get(i)); temperature.setTDLSN(devList.get(i));
String sql = "SELECT \"T\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time "; String sql = "SELECT \"T\" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<TemperatureDataVo> temperatureDataVos = new ArrayList<>(); List<TemperatureDataVo> temperatureDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
...@@ -334,27 +332,27 @@ public class DataController { ...@@ -334,27 +332,27 @@ public class DataController {
JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
ResultGatewayVo gatewayVo = new ResultGatewayVo(); TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(resultCircuitVo.getEndTime() == 0){ if(gatewayVo == null){
gatewayVo = circuitService.getByNo(transportationNo); fb.setCode(0);
}else{ fb.setMessage("该线路未绑定gateway和tdl");
gatewayVo = tdlLogService.getByNo(transportationNo); return gson.toJson(fb);
} }
String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l; //获取tdl信息
List<String> devList = tdlLogService.getTdlSN(transportationNo);
//获取tdl信息 //获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
if(devList.size() == 0){ if(devList.size() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有数据"); fb.setMessage("没有数据");
return gson.toJson(fb); return gson.toJson(fb);
} }
Long startTime = resultCircuitVo.getStartTime() *1000000l;
List<Humidity> humidities = new ArrayList<>(); List<Humidity> humidities = new ArrayList<>();
for( int i =0;i<devList.size();i++){ for( int i =0;i<devList.size();i++){
Humidity humidity = new Humidity(); Humidity humidity = new Humidity();
humidity.setTDLSN(devList.get(i)); humidity.setTDLSN(devList.get(i));
String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time "; String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<HumidityDataVo> humidityDataVos = new ArrayList<>(); List<HumidityDataVo> humidityDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
...@@ -380,17 +378,16 @@ public class DataController { ...@@ -380,17 +378,16 @@ public class DataController {
JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l; Long startTime = resultCircuitVo.getStartTime() *1000000l;
TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo == null){
fb.setCode(0);
fb.setMessage("该线路未绑定gateway和tdl");
return gson.toJson(fb);
}
String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
//获取tdl信息 //获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); List<String> devList = tdlLogService.getTdlSN(transportationNo);
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
if(devList.size() == 0){ if(devList.size() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有数据"); fb.setMessage("没有数据");
...@@ -400,7 +397,7 @@ public class DataController { ...@@ -400,7 +397,7 @@ public class DataController {
for( int i =0;i<devList.size();i++){ for( int i =0;i<devList.size();i++){
TiltAngle tiltAngle = new TiltAngle(); TiltAngle tiltAngle = new TiltAngle();
tiltAngle.setTDLSN(devList.get(i)); tiltAngle.setTDLSN(devList.get(i));
String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time "; String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<TiltAngleVo> tiltAngleVos = new ArrayList<>(); List<TiltAngleVo> tiltAngleVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
...@@ -426,17 +423,17 @@ public class DataController { ...@@ -426,17 +423,17 @@ public class DataController {
JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName()); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
ResultGatewayVo gatewayVo = new ResultGatewayVo(); TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(resultCircuitVo.getEndTime() == 0){ if(gatewayVo == null){
gatewayVo = circuitService.getByNo(transportationNo); fb.setCode(0);
}else{ fb.setMessage("该线路未绑定gateway和tdl");
gatewayVo = tdlLogService.getByNo(transportationNo); return gson.toJson(fb);
} }
String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
//获取tdl信息
List<String> devList = tdlLogService.getTdlSN(transportationNo);
Long startTime = resultCircuitVo.getStartTime() *1000000l; Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息 //获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
if(devList.size() == 0){ if(devList.size() == 0){
fb.setCode(0); fb.setCode(0);
fb.setMessage("没有数据"); fb.setMessage("没有数据");
...@@ -446,7 +443,7 @@ public class DataController { ...@@ -446,7 +443,7 @@ public class DataController {
for( int i =0;i<devList.size();i++){ for( int i =0;i<devList.size();i++){
ShockEnergy shockEnergy = new ShockEnergy(); ShockEnergy shockEnergy = new ShockEnergy();
shockEnergy.setTDLSN(devList.get(i)); shockEnergy.setTDLSN(devList.get(i));
String sql = "SELECT \"a0\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time "; String sql = "SELECT \"a0\" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<ShockEnergyVo> shockEnergyVos = new ArrayList<>(); List<ShockEnergyVo> shockEnergyVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
......
...@@ -153,7 +153,7 @@ public class EquipmentBindingController { ...@@ -153,7 +153,7 @@ public class EquipmentBindingController {
return gson.toJson(fb); return gson.toJson(fb);
} }
@ApiOperation(value = "重置tdl",notes = "重置tdl") @ApiOperation(value = "重置tdl",notes = "重置tdl")
@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"),
...@@ -168,7 +168,6 @@ public class EquipmentBindingController { ...@@ -168,7 +168,6 @@ public class EquipmentBindingController {
ConfigVo configVo =configService.getConfig(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType()); ConfigVo configVo =configService.getConfig(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class); ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class);
ConfigCMDVo configCMDVo ; ConfigCMDVo configCMDVo ;
Boolean untie = false;
if(devList.size()>1){ if(devList.size()>1){
devList.remove(TDLSN); devList.remove(TDLSN);
configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l); configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l);
...@@ -179,6 +178,7 @@ public class EquipmentBindingController { ...@@ -179,6 +178,7 @@ public class EquipmentBindingController {
map.put("gSN",resultTDLDeviceVo.getGatewaySN()); map.put("gSN",resultTDLDeviceVo.getGatewaySN());
map.put("gType",resultTDLDeviceVo.getGatewayType()); map.put("gType",resultTDLDeviceVo.getGatewayType());
map.put("message",gson.toJson(configCMDVo)); map.put("message",gson.toJson(configCMDVo));
map.put("untie",true);
map.put("TDLSN",TDLSN); map.put("TDLSN",TDLSN);
map.put("endTime",System.currentTimeMillis()); map.put("endTime",System.currentTimeMillis());
configService.updateConfig(map); configService.updateConfig(map);
......
...@@ -62,7 +62,7 @@ public class GatewayController { ...@@ -62,7 +62,7 @@ public class GatewayController {
" type:网关类型," + " type:网关类型," +
" state:网关状态," + " state:网关状态," +
" bConfig:是否配置通道," + " bConfig:是否配置通道," +
" useScene:使用场景") " useScene:使用场景(0为空闲,1为运输,2为仓库)")
@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"),
}) })
......
...@@ -77,7 +77,10 @@ public class HomePageController { ...@@ -77,7 +77,10 @@ public class HomePageController {
"endTime:到达时间;" + "endTime:到达时间;" +
"lng:当前经度;" + "lng:当前经度;" +
"lat:当前纬度;" + "lat:当前纬度;" +
"time:当前时间;}") "time:当前时间;}" +
"histogramDataList{" +
" classify: 种类(1-温度,2-湿度,3-震动,4-倾角,5-延误,6-离线)" +
" count:数量}")
@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"),
...@@ -92,12 +95,15 @@ public class HomePageController { ...@@ -92,12 +95,15 @@ public class HomePageController {
HomePageDataVo dataVo = new HomePageDataVo(); HomePageDataVo dataVo = new HomePageDataVo();
//获取所有的线路数量 //获取所有的线路数量
dataVo.setSum(circuitService.getCount(time,user.getCompanyName()));//总数量 dataVo.setSum(circuitService.getCount(time,user.getCompanyName()));//总数量
//获取近几天的线路信息
dataVo.setOnRoute(circuitService.getOnRoute(time,user.getCompanyName()));//在途数量 dataVo.setOnRoute(circuitService.getOnRoute(time,user.getCompanyName()));//在途数量
dataVo.setDelay(circuitService.getDelayCount(System.currentTimeMillis(),time,user.getCompanyName()));//延误数量 dataVo.setDelay(circuitService.getDelayCount(System.currentTimeMillis(),time,user.getCompanyName()));//延误数量
dataVo.setAlarmed( alarmLogServcie.getCount(time));//报警数量 dataVo.setAlarmed( alarmLogServcie.getCount(time));//报警数量
dataVo.setBump(alarmLogServcie.getBumpCount(time)); //获取颠簸数量 dataVo.setBump(alarmLogServcie.getBumpCount(time)); //获取颠簸数量
dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time));//报警列表 dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time));//报警列表
List<HistogramData> list = alarmLogServcie.getByCount(time);//获取报警柱状图 List<HistogramData> list = alarmLogServcie.getByCount(time);//获取报警柱状图
dataVo.setHistogramDataList(list);
//获取设备的当前位置 //获取设备的当前位置
List<ResultCircuitVo> circuitVos = circuitService.getByTime(time,user.getCompanyName()); List<ResultCircuitVo> circuitVos = circuitService.getByTime(time,user.getCompanyName());
List<CircuitVo> circuitList = new ArrayList<>(); List<CircuitVo> circuitList = new ArrayList<>();
......
...@@ -43,7 +43,7 @@ public class TDLDeviceController { ...@@ -43,7 +43,7 @@ public class TDLDeviceController {
" TDLSN:TDL序列号," + " TDLSN:TDL序列号," +
" counts:使用次数," + " counts:使用次数," +
" lastTime:最后使用时间," + " lastTime:最后使用时间," +
" useScene:使用场景(0为空闲,1为仓库,2为运输)," + " useScene:使用场景(0为空闲,1为运输,2为仓库)," +
" warehouseName:仓库名," + " warehouseName:仓库名," +
" transportationNo:运输编号," + " transportationNo:运输编号," +
" gatewaySN:网关序列号," + " gatewaySN:网关序列号," +
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ 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.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.service.CompanyService;
import com.example.tdl.service.RoleHasPermissionService; import com.example.tdl.service.RoleHasPermissionService;
import com.example.tdl.service.RoleService; import com.example.tdl.service.RoleService;
...@@ -44,7 +45,8 @@ public class UserController { ...@@ -44,7 +45,8 @@ public class UserController {
@Autowired @Autowired
private RoleService roleService; private RoleService roleService;
@Autowired
private CompanyService companyService;
//获取所有用户信息 //获取所有用户信息
...@@ -176,6 +178,16 @@ public class UserController { ...@@ -176,6 +178,16 @@ public class UserController {
fb.setMessage("没有该角色"); fb.setMessage("没有该角色");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(userVo.getCompanyName())){
fb.setCode(0);
fb.setMessage("公司名不能为空");
return gson.toJson(fb);
}
if (companyService.getByCompanyName(userVo.getCompanyName())==null){
fb.setCode(0);
fb.setMessage("没有该公司");
return gson.toJson(fb);
}
String userNumber="U"+System.currentTimeMillis(); String userNumber="U"+System.currentTimeMillis();
userVo.setUserNumber(userNumber); userVo.setUserNumber(userNumber);
userVo.setCreateTime(System.currentTimeMillis()); userVo.setCreateTime(System.currentTimeMillis());
...@@ -207,7 +219,12 @@ public class UserController { ...@@ -207,7 +219,12 @@ public class UserController {
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);
ResultUserVo userInfo=userService.getByUserNumber(userVo.getUserNumber(),user.getCompanyName()); if (StringUtils.isEmpty(userVo.getUserNumber())){
fb.setCode(0);
fb.setMessage("用户编号不能为空");
return gson.toJson(fb);
}
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("昵称不能为空");
...@@ -223,7 +240,7 @@ public class UserController { ...@@ -223,7 +240,7 @@ public class UserController {
fb.setMessage("手机号不规范"); fb.setMessage("手机号不规范");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (userInfo!=null&&userInfo.getPhone().equals(userVo.getPhone())){ 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("该手机号已被注册");
return gson.toJson(fb); return gson.toJson(fb);
...@@ -238,7 +255,7 @@ public class UserController { ...@@ -238,7 +255,7 @@ public class UserController {
fb.setMessage("邮箱格式不规范"); fb.setMessage("邮箱格式不规范");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (userInfo!=null&&userInfo.getEmail().equals(userVo.getEmail())){ 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("该邮箱已被注册");
return gson.toJson(fb); return gson.toJson(fb);
...@@ -248,11 +265,7 @@ public class UserController { ...@@ -248,11 +265,7 @@ public class UserController {
fb.setMessage("角色名不能为空"); fb.setMessage("角色名不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(userVo.getUserNumber())){
fb.setCode(0);
fb.setMessage("需要修改的用户编号不能为空");
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("修改的角色名不存在");
...@@ -359,7 +372,7 @@ public class UserController { ...@@ -359,7 +372,7 @@ public class UserController {
public Object getUserName(HttpServletRequest request){ public Object getUserName(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);
return new UserNameVo(gson.fromJson(datum,UserRedisVo.class).getUserName()); return new UserNameVo(gson.fromJson(datum,UserRedisVo.class).getUserName(),System.currentTimeMillis()+"");
} }
} }
...@@ -49,7 +49,6 @@ tdl.mqtt.cacrt = ca.crt ...@@ -49,7 +49,6 @@ 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
......
...@@ -44,25 +44,22 @@ ...@@ -44,25 +44,22 @@
</select> </select>
<select id = "getByCount" parameterType="String" resultType="com.example.tdl.domain.vo.HistogramData" > <select id = "getByCount" parameterType="String" resultType="com.example.tdl.domain.vo.HistogramData" >
SELECT classify,count(description) FROM alarm_log WHERE classify = "1" SELECT ifnull(classify,"1") classify,count(description) count FROM alarm_log WHERE classify = "1"
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 UNION ALL
SELECT classify,count(description) FROM alarm_log WHERE classify = "3" SELECT ifnull(classify,"2") classify,count(description) count FROM alarm_log WHERE classify = "2"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT classify,count(description) FROM alarm_log WHERE classify = "2"
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 UNION ALL
SELECT classify,count(description) FROM alarm_log WHERE classify = "5" SELECT ifnull(classify,"3") classify,count(description) count FROM alarm_log WHERE classify = "3"
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 UNION ALL
SELECT classify,count(description) FROM alarm_log WHERE classify = "4" SELECT ifnull(classify,"4") classify,count(description) count FROM alarm_log WHERE classify = "4"
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 UNION ALL
SELECT classify,count(description) FROM alarm_log WHERE classify = "6" SELECT ifnull(classify,"5") classify,count(description) count FROM alarm_log WHERE classify = "5"
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 UNION ALL
SELECT classify,count(description) FROM alarm_log WHERE classify = "倾角" SELECT ifnull(classify,"6") classify,count(description) count FROM alarm_log WHERE classify = "6"
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'))
</select> </select>
......
...@@ -152,6 +152,12 @@ ...@@ -152,6 +152,12 @@
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR} WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</update> </update>
<update id="updateStartTime" parameterType="com.example.tdl.domain.vo.StartCircuitVo">
UPDATE circuit set
startTime=#{startTime,jdbcType=BIGINT},circuitState=1
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</update>
<!--删除线路--> <!--删除线路-->
<delete id="delCircuit" parameterType="String"> <delete id="delCircuit" parameterType="String">
UPDATE circuit set state=0 UPDATE circuit set state=0
...@@ -163,8 +169,10 @@ ...@@ -163,8 +169,10 @@
SELECT c.transportationNo,cargoNo,(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,(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,ifnull(evaluate,"") evaluate,transportation (select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate,transportation,
from circuit c where c.state=1 (select gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN
from circuit c
where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR} AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
...@@ -172,16 +180,16 @@ ...@@ -172,16 +180,16 @@
<!--根据线路编号获取线路信息 app--> <!--根据线路编号获取线路信息 app-->
<select id="getByTransportationNoForApp" resultType="com.example.tdl.domain.vo.ResultCircuitForAppVo" parameterType="String"> <select id="getByTransportationNoForApp" resultType="com.example.tdl.domain.vo.ResultCircuitForAppVo" parameterType="String">
SELECT c.transportationNo,CONCAT_WS("-",(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence =LEFT(s.sequence,1))),(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence=RIGHT(s.sequence,1)))) city, SELECT c.transportationNo,CONCAT_WS("-",(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence =LEFT(s.sequence,1))),(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence=RIGHT(s.sequence,1)))) city,
cargoNo,plateNo,deliveryAddress,transportation,transportationType,remark cargoNo,plateNo,deliveryAddress,transportation,transportationType,(select gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN,remark
from circuit c,(SELECT GROUP_CONCAT(sequence) sequence from circuit_transfer where circuit_id=(SELECT id from circuit where transportationNo=#{transportationNo,jdbcType=VARCHAR})) s from circuit c,(SELECT GROUP_CONCAT(sequence) sequence from circuit_transfer where circuit_id=(SELECT id from circuit where transportationNo=#{transportationNo,jdbcType=VARCHAR})) s
where c.state=1 where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR} AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
<!-- 运输中数量--> <!-- 运输中数量-->
<select id="getOnRoute" resultType="java.lang.Integer" parameterType="String"> <select id="getOnRoute" resultType="java.lang.Integer" parameterType="String">
select count(startTime) from circuit where circuitState=1 select count(startTime) from circuit where circuitState=1 AND state = 1
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s')) and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
...@@ -189,7 +197,8 @@ ...@@ -189,7 +197,8 @@
<!--延误数量--> <!--延误数量-->
<select id="getDelayCount" resultType="java.lang.Integer" > <select id="getDelayCount" resultType="java.lang.Integer" >
select count(id) from circuit where state =1 select count(id) from circuit where state =1
and endtime &lt;=compTime or compTime >= #{compTime,jdbcType=BIGINT} and endtime &lt; compTime or compTime &lt; #{compTime,jdbcType=BIGINT}
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
...@@ -198,6 +207,7 @@ ...@@ -198,6 +207,7 @@
select count(id) from circuit select count(id) from circuit
where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s')) where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
AND state =1
</select> </select>
<!--根据车牌号查线路--> <!--根据车牌号查线路-->
...@@ -210,7 +220,6 @@ ...@@ -210,7 +220,6 @@
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
<!--根据运输状态查询线路信息--> <!--根据运输状态查询线路信息-->
<select id="getByCircuitState" resultType="com.example.tdl.domain.vo.ResultCircuitVo"> <select id="getByCircuitState" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT c.transportationNo,cargoNo,(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,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
...@@ -245,6 +254,7 @@ ...@@ -245,6 +254,7 @@
(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
from circuit c where c.state=1 from circuit c where c.state=1
and c.circuitState = 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})
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s')) AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
</select> </select>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#{gSN,mode=IN,jdbcType=VARCHAR}, #{gSN,mode=IN,jdbcType=VARCHAR},
#{gType,mode=IN,jdbcType=VARCHAR}, #{gType,mode=IN,jdbcType=VARCHAR},
#{message,mode=IN,jdbcType=VARCHAR}, #{message,mode=IN,jdbcType=VARCHAR},
#{untie,mode=IN,jdbcType=INTEGER},
#{TDLSN,mode=IN,jdbcType=VARCHAR}, #{TDLSN,mode=IN,jdbcType=VARCHAR},
#{endTime,mode=IN,jdbcType=BIGINT}, #{endTime,mode=IN,jdbcType=BIGINT},
#{msg,mode=OUT,jdbcType=VARCHAR} #{msg,mode=OUT,jdbcType=VARCHAR}
......
...@@ -69,4 +69,11 @@ ...@@ -69,4 +69,11 @@
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="getTdl" parameterType="String" resultType="String">
select GROUP_CONCAT(TDLSN) from tdldevice t,gateway g
where t.gateway_id = g.id
and g.SN =#{SN,jdbcType=VARCHAR}
and g.type=#{type,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,4 +6,16 @@ ...@@ -6,4 +6,16 @@
where transportationNo = #{transportationNo,jdbcType=VARCHAR} where transportationNo = #{transportationNo,jdbcType=VARCHAR}
GROUP BY gatewaySN GROUP BY gatewaySN
</select> </select>
<select id="getByTransportationNo" parameterType="String" resultType="com.example.tdl.domain.vo.TDLLogVo">
select gatewaySN gSN,gatewayType gType, GROUP_CONCAT(TDLSN) TDLSN
from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR}
</select>
<select id="getTdlSN" parameterType="String" resultType="String">
select CONCAT("TDL-",TDLSN) TDLSN
from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.example.tdl.mapper.UserMapper"> <mapper namespace="com.example.tdl.mapper.UserMapper">
<!--登录--> <!--登录-->
<select id="login" parameterType="com.example.tdl.domain.vo.LoginUserVo" resultType="java.lang.Integer"> <select id="login" parameterType="com.example.tdl.domain.vo.LoginUserVo" resultType="java.lang.Integer">
SELECT COUNT(*) from USER SELECT COUNT(userName) from USER
WHERE userName=#{userName,jdbcType=VARCHAR} WHERE userName=#{userName,jdbcType=VARCHAR}
AND password=#{password,jdbcType=VARCHAR} AND password=#{password,jdbcType=VARCHAR}
AND state=1 AND state=1
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
select userNumber, userName,password,nickName,phone,email,roleName,c.companyName 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 from company c,`user` u INNER JOIN role r ON u.role_id=r.id
WHERE u.company_id=c.id WHERE u.company_id=c.id
AND c.companyName=#{companyName,jdbcType=VARCHAR}
AND userNumber=#{userNumber,jdbcType=VARCHAR} AND userNumber=#{userNumber,jdbcType=VARCHAR}
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