Commit d5a5f3a0 authored by chenying's avatar chenying

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

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