Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanfangljy committed Nov 17, 2018
1 parent be600ef commit 8877c97
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
response.setStatus(200);
return false;
}*/
System.out.println(method);
//System.out.println(method);


// TODO Auto-generated method stub
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ybkj.gun.controller;

import com.ybkj.common.baiduMap.BaiDuUtil;
import com.ybkj.common.entity.GunLocationVO;
import com.ybkj.enums.IStatusMessage;
import com.ybkj.gun.model.GunLocation;
import com.ybkj.gun.service.GunLocationService;
Expand Down Expand Up @@ -46,18 +47,18 @@ public class GunLocationController {
*/
@ApiOperation(value = "查询枪支动态信息", notes = "获取枪支动态信息")
@RequestMapping(value = "/readGunDynamic", method = RequestMethod.GET)
public BaseModel readGunDynamic(@RequestParam(value = "gunId")String gunId
,@RequestParam(value = "appName")String appName){
public BaseModel readGunDynamic(@RequestParam(value = "gunId",defaultValue = "")String gunId
,@RequestParam(value = "appName",defaultValue = "")String appName){
log.debug("--------获取枪支动态信息!-------gunId-------"+gunId+"-----appName-----"+appName);
BaseModel baseModel=new BaseModel();
List<String> locationList=new ArrayList<>();
try {
List<GunLocation> gunLocations = gunLocationService.findGunDynamic(gunId,appName);
for (GunLocation gunLocation : gunLocations) {
List<GunLocationVO> gunLocations = gunLocationService.findGunDynamic(gunId,appName);
/* for (GunLocationVO gunLocation : gunLocations) {
//百度坐标系转换成地理位置信息
String location=BaiDuUtil.getAddress(gunLocation.getLongitude(),gunLocation.getLatitude());
locationList.add(location);
}
}*/
baseModel.add("gunLocations",gunLocations);
baseModel.add("locationList",locationList);
baseModel.setStatus(IStatusMessage.SystemStatus.SUCCESS.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
Expand Down Expand Up @@ -47,19 +49,27 @@ public class WebUserController {
@ApiOperation(value = "用户登录", notes = "用户名和密码")
@RequestMapping(value = "/loginWeb", method = RequestMethod.POST)
public BaseModel loginWeb(WebUserDTO webUserDTO,
@RequestParam(value = "rememberMe", required = false) boolean rememberMe, HttpServletRequest request) throws Exception {
@RequestParam(value = "rememberMe", required = false) boolean rememberMe, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setHeader("Access-Control-Allow-Origin", "*");
BaseModel baseModel = webUserService.shiroLogin(webUserDTO, rememberMe);
//记录日志
LoginLogOutLogPojo loginLog = IpUtil.createLoginLog(request);
WebUserLogin webUserLogin=new WebUserLogin();
webUserLogin.setWebIp(loginLog.getIp());
webUserLogin.setBrowser(loginLog.getBrowser());
webUserLogin.setSystemName(loginLog.getSystemName());
webUserLogin.setState(0);
webUserLogin.setLogintime(new Date());
webUserLogin.setUid(ActiveUser.getActiveUser().getId());
webUserLogin.setUserName(ActiveUser.getActiveUser().getName());
logService.addLogLoginLogOut(webUserLogin);
if(baseModel.getStatus()=="1000"){
//记录日志
LoginLogOutLogPojo loginLog = IpUtil.createLoginLog(request);
WebUserLogin webUserLogin=new WebUserLogin();
webUserLogin.setWebIp(loginLog.getIp());
webUserLogin.setBrowser(loginLog.getBrowser());
webUserLogin.setSystemName(loginLog.getSystemName());
webUserLogin.setState(0);
webUserLogin.setLogintime(new Date());
webUserLogin.setUid(ActiveUser.getActiveUser().getId());
webUserLogin.setUserName(ActiveUser.getActiveUser().getName());
logService.addLogLoginLogOut(webUserLogin);
}
return baseModel;
}

public static void main(String[] args) {
String s = DigestUtils.md5Hex("123456");
System.out.println(s);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ybkj.gun.mapper;

import com.ybkj.common.entity.GunLocationVO;
import com.ybkj.gun.model.GunLocation;
import com.ybkj.gun.model.GunLocationExample;
import java.util.List;
Expand Down Expand Up @@ -33,5 +34,5 @@ public interface GunLocationMapper {
* @Author: 刘家义
* @CreateDate: 2018/11/12 14:23
*/
List<GunLocation> selectGunDynamic(@Param(value = "gunId") String gunId, @Param(value = "appName")String appName);
List<GunLocationVO> selectGunDynamic(@Param(value = "gunId") String gunId, @Param(value = "appName")String appName);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ybkj.gun.service;

import com.ybkj.common.entity.GunLocationVO;
import com.ybkj.gun.model.GunLocation;

import java.util.List;
Expand All @@ -19,5 +20,5 @@ public interface GunLocationService {
* @Author: 刘家义
* @CreateDate: 2018/11/12 14:19
*/
List<GunLocation> findGunDynamic(String gunId, String appName) throws Exception;
List<GunLocationVO> findGunDynamic(String gunId, String appName) throws Exception;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ybkj.gun.service.impl;

import com.ybkj.common.entity.GunLocationVO;
import com.ybkj.gun.mapper.AppMapper;
import com.ybkj.gun.mapper.GunLocationMapper;
import com.ybkj.gun.model.GunLocation;
Expand Down Expand Up @@ -42,7 +43,7 @@ public class GunLocationServiceImpl implements GunLocationService{
* @throws Exception
*/
@Override
public List<GunLocation> findGunDynamic(String gunId, String appName) throws Exception {
public List<GunLocationVO> findGunDynamic(String gunId, String appName) throws Exception {
return gunLocationMapper.selectGunDynamic(gunId,appName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public BaseModel revocationWareHouseRecordsStorage(String gunId, String gunMac,
for (int i = 0; i < gunMacs.length; i++) {
//2、下发07报文给服务器,进行最终出库操作
String mac = gunMacs[i];
String gun = gunMacs[i];
String gun = gunIds[i];
baseModel = producer.sendMessageRevocationStorage(gun, mac, appId, state);
}
baseModel.setStatus(IStatusMessage.SystemStatus.SUCCESS.getCode());
Expand Down
5 changes: 5 additions & 0 deletions gun_yb_web/src/main/resources/mapper/GunLocationMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ FROM (
LEFT JOIN gun_bullet_count AS gbc ON g.gun_id=g.gun_id
LEFT JOIN app AS a ON gl.app_id=a.id
LEFT JOIN app_dynamic_data AS adda ON a.id=adda.app_id
<where>
<if test="gunId != null and gunId !=''">
gl.gun_id = #{gunId}
</if>
</where>
</select>
<!--=End selectGunDynamic 查询枪支实时动态位置信息 -->
</mapper>
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,10 @@
<!--=Start selectWareHouseRecords 查询库存记录表 -->
<select id="selectWareHouseRecords" resultMap="BaseResultMap">
SELECT
g.gun_id,g.gun_model,g.gun_type,g.gun_mac,a.app_name,a.id,a.app_imei
FROM gun AS g
left JOIN warehouse_records AS wr ON g.gun_id=wr.gun_id
<include refid="Base_Column_List_WR"/>,
g.gun_id,g.gun_model,g.gun_type,g.gun_mac,a.app_name,a.app_imei
FROM warehouse_records AS wr
left JOIN gun AS g ON g.gun_id=wr.gun_id
left JOIN app AS a ON wr.app_id=a.id
WHERE wr.state=#{type,jdbcType=INTEGER}
</select>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions gun_yb_web/target/classes/mapper/GunLocationMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ FROM (
LEFT JOIN gun_bullet_count AS gbc ON g.gun_id=g.gun_id
LEFT JOIN app AS a ON gl.app_id=a.id
LEFT JOIN app_dynamic_data AS adda ON a.id=adda.app_id
<where>
<if test="gunId != null and gunId !=''">
gl.gun_id = #{gunId}
</if>
</where>
</select>
<!--=End selectGunDynamic 查询枪支实时动态位置信息 -->
</mapper>
7 changes: 4 additions & 3 deletions gun_yb_web/target/classes/mapper/WarehouseRecordsMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,10 @@
<!--=Start selectWareHouseRecords 查询库存记录表 -->
<select id="selectWareHouseRecords" resultMap="BaseResultMap">
SELECT
g.gun_id,g.gun_model,g.gun_type,g.gun_mac,a.app_name,a.id,a.app_imei
FROM gun AS g
left JOIN warehouse_records AS wr ON g.gun_id=wr.gun_id
<include refid="Base_Column_List_WR"/>,
g.gun_id,g.gun_model,g.gun_type,g.gun_mac,a.app_name,a.app_imei
FROM warehouse_records AS wr
left JOIN gun AS g ON g.gun_id=wr.gun_id
left JOIN app AS a ON wr.app_id=a.id
WHERE wr.state=#{type,jdbcType=INTEGER}
</select>
Expand Down

0 comments on commit 8877c97

Please sign in to comment.