Commit d5a5f3a0 authored by chenying's avatar chenying

6.14修改公司接口,修改报警-使用公司编号查询,修改线路接口,通过公司编号操作

parent 1fa8df64
......@@ -2,7 +2,7 @@ package com.example.tdl.domain.vo;
public class AlarmTermVo {
private String companyName;
private String companyNo;
private String transportationNo;
......@@ -16,12 +16,12 @@ public class AlarmTermVo {
private Long endTime;
public String getCompanyName() {
return companyName;
public String getCompanyNo() {
return companyNo;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo;
}
public String getTransportationNo() {
......
......@@ -11,7 +11,9 @@ import java.util.List;
@Mapper
public interface AlarmLogMapper {
//获取所有的数据
List<ResultAlarmLog> getAll();
List<ResultAlarmLog> getAll(String companyNo);
List<ResultAlarmLog> getByTransportationNo(String transportationNo);
//根据条件获取报警数据
List<AlarmLogVo> getAlarmLog(@Param("time") String time, @Param("companyNo") String companyNo);
......@@ -19,8 +21,6 @@ public interface AlarmLogMapper {
//新增报警数据
int addAlarmLog(AlarmLog addAlarmLogVo);
List<ResultAlarmLog> getByTransportationNo(String transportationNo);
Integer getCount(@Param("time") String time, @Param("companyNo") String companyNo);
Integer getBumpCount(@Param("time")String time,@Param("companyNo") String companyNo);
......
......@@ -14,8 +14,8 @@ public class AlarmLogService {
@Autowired
private AlarmLogMapper alarmLogMapper;
public List<ResultAlarmLog> getAll(){
return alarmLogMapper.getAll();
public List<ResultAlarmLog> getAll(String companyNo){
return alarmLogMapper.getAll(companyNo);
}
public List<AlarmLogVo> getAlarmLog(String time,String companyNo){
......
package com.example.tdl.service;
import com.example.tdl.domain.vo.AddCompanyVo;
import com.example.tdl.domain.vo.AlarmContactsVo;
import com.example.tdl.domain.vo.ResultCompanyVo;
import com.example.tdl.domain.vo.UpdateCompanyVo;
import com.example.tdl.mapper.CompanyMapper;
......@@ -12,7 +9,6 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class CompanyService {
@Autowired
......
......@@ -111,7 +111,7 @@ public class AlarmLogController {
if(alarmTermVo.getDescription()==null){
alarmTermVo.setEndTime(null);
}
alarmTermVo.setCompanyName(user.getCompanyName());
alarmTermVo.setCompanyNo(user.getCompanyNo());
return alarmLogServcie.getAlarm(alarmTermVo);
}
......
package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
......@@ -9,7 +8,6 @@ import com.example.tdl.domain.vo.ResultCompanyVo;
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.RoleService;
import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
......@@ -28,7 +26,6 @@ import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
@RequestMapping("/company")
public class CompanyController {
......@@ -90,6 +87,9 @@ public class CompanyController {
})
@RequestMapping(value="/addCompany",method = RequestMethod.POST)
public Object addCompany(@RequestBody AddCompanyVo addCompanyVo,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
if (StringUtils.isEmpty(addCompanyVo.getCompanyName())){
fb.setCode(0);
......@@ -126,7 +126,7 @@ public class CompanyController {
fb.setMessage(i18n.getMessage(request,"manager"));
return gson.toJson(fb);
}
if( !addCompanyVo.getTel().matches("^1[34578]\\d{9}$")){
if (!addCompanyVo.getTel().matches("^1[34578]\\d{9}$")){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongTel"));
return gson.toJson(fb);
......@@ -165,6 +165,7 @@ public class CompanyController {
map.put("tel",addCompanyVo.getTel());
map.put("manager",addCompanyVo.getManager());
map.put("img",addCompanyVo.getImg());
map.put("parentCompanyNo",user.getCompanyNo());
map.put("roleName",addCompanyVo.getRoleName());
map.put("createTime",System.currentTimeMillis());
companyService.addCompany(map);
......@@ -277,6 +278,7 @@ public class CompanyController {
fb.setMessage(i18n.getMessage(request,"companyNo"));
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(companyNo);
companyNo=(String) jsonObject.get("companyNo");
Map<Object,Object> map=new HashMap<>();
......
......@@ -294,10 +294,7 @@ public class RoleController {
//辉度修改其他公司的角色权限
@ApiOperation(value = "辉度修改其他公司的角色权限",notes = "辉度修改其他公司的角色权限,传递参数:" +
" roleName:角色名," +
" permissions: [" +
" 权限名" +
" ]," +
" companyName:角色所属公司")
" companyNameVar:需要修改的公司")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
......
......@@ -2,9 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.AlarmLogMapper">
<!--获取所有的报警数据-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultAlarmLog">
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultAlarmLog" parameterType="String">
select transportationNo,TDLSN,description,ifnull(data,"") data,alarmTime,classify from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo=#{companyNo,jdbcType=VARCHAR}))
order by alarmTime desc;
</select>
......@@ -16,41 +17,42 @@
<!--根据条件获取报警数据-->
<select id="getAlarmLog" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmLogVo">
select transportationNo,description,ifnull(data,"") data,alarmTime
from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
select transportationNo,description,ifnull(data,"") data,alarmTime from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
order by alarmTime desc
</select>
<insert id="addAlarmLog" parameterType="com.example.tdl.entity.AlarmLog">
insert into alarm_log
values(
null,
#{transportationNo,jdbcType=VARCHAR},
#{startCity,jdbcType=VARCHAR},
#{endCity,jdbcType=VARCHAR},
#{TDLSN,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT},
#{alarmTime,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{desp,jdbcType=VARCHAR},
#{alarmNo,jdbcType=VARCHAR}
insert into alarm_log values(
null,
#{transportationNo,jdbcType=VARCHAR},
#{startCity,jdbcType=VARCHAR},
#{endCity,jdbcType=VARCHAR},
#{TDLSN,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT},
#{alarmTime,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{desp,jdbcType=VARCHAR},
#{alarmNo,jdbcType=VARCHAR}
)
</insert>
<select id="getCount" parameterType="String" resultType="java.lang.Integer">
select count(DISTINCT transportationNo) from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,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 id="getBumpCount" resultType="java.lang.Integer" >
select count(DISTINCT transportationNo) from alarm_log
where classify = "3"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
where classify = "3"
and transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,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 id = "getByCount" parameterType="String" resultType="com.example.tdl.domain.vo.HistogramData" >
......@@ -78,15 +80,15 @@
<select id="getByTime" resultType="java.lang.Integer">
select count(id) from alarm_log
where transportationNo= #{transportationNo,jdbcType=VARCHAR}
and alarmTime between #{startTime,jdbcType=BIGINT} and #{endTime,jdbcType=BIGINT}
and alarmTime between #{startTime,jdbcType=BIGINT} and #{endTime,jdbcType=BIGINT}
</select>
<select id="getAlarm" parameterType="com.example.tdl.domain.vo.AlarmTermVo" resultType="com.example.tdl.domain.vo.ResultAlarmLogVo">
select c.transportationNo,al.startCity,al.endCity,c.cargoNo,al.description,al.alarmTime
from alarm_log al,circuit c,company co
where al.transportationNo =c.transportationNo
and c.company_id = co.id
and co.companyName =#{companyName,jdbcType=VARCHAR}
where al.transportationNo =c.transportationNo
and c.company_id = co.id
and co.companyNo =#{companyNo,jdbcType=VARCHAR}
<if test="transportationNo!=null">
AND c.transportationNo = #{transportationNo,jdbcType=VARCHAR}
</if>
......@@ -109,16 +111,17 @@
</select>
<select id="getRealTimeAlarm" parameterType="java.lang.String" resultType="com.example.tdl.domain.vo.AlarmLogVo">
select transportationNo,description,ifnull(FORMAT(data,2),"") data,alarmTime
from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
select transportationNo,description,ifnull(FORMAT(data,2),"") data,alarmTime from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL 1 HOUR ) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
order by alarmTime desc limit 3
order by alarmTime desc limit 3
</select>
<select id="getAlarmCount" resultType="java.lang.Integer">
select count(DISTINCT transportationNo) from alarm_log
where transportationNo in (select transportationNo from circuit where company_id = (SELECT id from company where companyName =#{companyName,jdbcType=VARCHAR}) and circuitState = 1)
select count(DISTINCT transportationNo) from alarm_log
where transportationNo in (select transportationNo from circuit where company_id = (
SELECT id from company where companyNo =#{companyNo,jdbcType=VARCHAR}) and circuitState = 1)
</select>
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
from company
WHERE state=1
<if test="companyNo!='TM201803298320'">
and companyNo=#{companyNo,jdbcType=VARCHAR}
and pid=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
</if>
</select>
......@@ -24,6 +24,7 @@
#{tel,mode=IN,jdbcType=VARCHAR},
#{manager,mode=IN,jdbcType=VARCHAR},
#{img,mode=IN,jdbcType=VARCHAR},
#{parentCompanyNo,mode=IN,jdbcType=VARCHAR},
#{roleName,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
......
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