diff --git a/gun_yb_web/src/main/java/com/ybkj/common/interceptor/UserActionInterceptor.java b/gun_yb_web/src/main/java/com/ybkj/common/interceptor/UserActionInterceptor.java index a3b1864..3b82ab6 100644 --- a/gun_yb_web/src/main/java/com/ybkj/common/interceptor/UserActionInterceptor.java +++ b/gun_yb_web/src/main/java/com/ybkj/common/interceptor/UserActionInterceptor.java @@ -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 diff --git a/gun_yb_web/src/main/java/com/ybkj/gun/controller/GunLocationController.java b/gun_yb_web/src/main/java/com/ybkj/gun/controller/GunLocationController.java index 5b555b4..7ba4b33 100644 --- a/gun_yb_web/src/main/java/com/ybkj/gun/controller/GunLocationController.java +++ b/gun_yb_web/src/main/java/com/ybkj/gun/controller/GunLocationController.java @@ -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; @@ -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 locationList=new ArrayList<>(); try { - List gunLocations = gunLocationService.findGunDynamic(gunId,appName); - for (GunLocation gunLocation : gunLocations) { + List 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()); diff --git a/gun_yb_web/src/main/java/com/ybkj/gun/controller/WebUserController.java b/gun_yb_web/src/main/java/com/ybkj/gun/controller/WebUserController.java index 8538e1d..0d01ac7 100644 --- a/gun_yb_web/src/main/java/com/ybkj/gun/controller/WebUserController.java +++ b/gun_yb_web/src/main/java/com/ybkj/gun/controller/WebUserController.java @@ -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; @@ -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); + } } diff --git a/gun_yb_web/src/main/java/com/ybkj/gun/mapper/GunLocationMapper.java b/gun_yb_web/src/main/java/com/ybkj/gun/mapper/GunLocationMapper.java index 659a5b1..c24045d 100644 --- a/gun_yb_web/src/main/java/com/ybkj/gun/mapper/GunLocationMapper.java +++ b/gun_yb_web/src/main/java/com/ybkj/gun/mapper/GunLocationMapper.java @@ -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; @@ -33,5 +34,5 @@ public interface GunLocationMapper { * @Author: 刘家义 * @CreateDate: 2018/11/12 14:23 */ - List selectGunDynamic(@Param(value = "gunId") String gunId, @Param(value = "appName")String appName); + List selectGunDynamic(@Param(value = "gunId") String gunId, @Param(value = "appName")String appName); } \ No newline at end of file diff --git a/gun_yb_web/src/main/java/com/ybkj/gun/service/GunLocationService.java b/gun_yb_web/src/main/java/com/ybkj/gun/service/GunLocationService.java index cd38f5c..92ba18a 100644 --- a/gun_yb_web/src/main/java/com/ybkj/gun/service/GunLocationService.java +++ b/gun_yb_web/src/main/java/com/ybkj/gun/service/GunLocationService.java @@ -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; @@ -19,5 +20,5 @@ public interface GunLocationService { * @Author: 刘家义 * @CreateDate: 2018/11/12 14:19 */ - List findGunDynamic(String gunId, String appName) throws Exception; + List findGunDynamic(String gunId, String appName) throws Exception; } diff --git a/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/GunLocationServiceImpl.java b/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/GunLocationServiceImpl.java index 17fec38..f475d37 100644 --- a/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/GunLocationServiceImpl.java +++ b/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/GunLocationServiceImpl.java @@ -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; @@ -42,7 +43,7 @@ public class GunLocationServiceImpl implements GunLocationService{ * @throws Exception */ @Override - public List findGunDynamic(String gunId, String appName) throws Exception { + public List findGunDynamic(String gunId, String appName) throws Exception { return gunLocationMapper.selectGunDynamic(gunId,appName); } } diff --git a/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.java b/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.java index e0d9aeb..b4c9bfa 100644 --- a/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.java +++ b/gun_yb_web/src/main/java/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.java @@ -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()); diff --git a/gun_yb_web/src/main/resources/mapper/GunLocationMapper.xml b/gun_yb_web/src/main/resources/mapper/GunLocationMapper.xml index a07bddd..46747c3 100644 --- a/gun_yb_web/src/main/resources/mapper/GunLocationMapper.xml +++ b/gun_yb_web/src/main/resources/mapper/GunLocationMapper.xml @@ -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 + + + gl.gun_id = #{gunId} + + \ No newline at end of file diff --git a/gun_yb_web/src/main/resources/mapper/WarehouseRecordsMapper.xml b/gun_yb_web/src/main/resources/mapper/WarehouseRecordsMapper.xml index 515307c..7642c01 100644 --- a/gun_yb_web/src/main/resources/mapper/WarehouseRecordsMapper.xml +++ b/gun_yb_web/src/main/resources/mapper/WarehouseRecordsMapper.xml @@ -325,9 +325,10 @@ diff --git a/gun_yb_web/target/classes/com/ybkj/common/interceptor/UserActionInterceptor.class b/gun_yb_web/target/classes/com/ybkj/common/interceptor/UserActionInterceptor.class index 06da2c9..82e4025 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/common/interceptor/UserActionInterceptor.class and b/gun_yb_web/target/classes/com/ybkj/common/interceptor/UserActionInterceptor.class differ diff --git a/gun_yb_web/target/classes/com/ybkj/gun/controller/GunLocationController.class b/gun_yb_web/target/classes/com/ybkj/gun/controller/GunLocationController.class index 1955af7..4e2b4a2 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/gun/controller/GunLocationController.class and b/gun_yb_web/target/classes/com/ybkj/gun/controller/GunLocationController.class differ diff --git a/gun_yb_web/target/classes/com/ybkj/gun/controller/WebUserController.class b/gun_yb_web/target/classes/com/ybkj/gun/controller/WebUserController.class index e84f0df..c9642e6 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/gun/controller/WebUserController.class and b/gun_yb_web/target/classes/com/ybkj/gun/controller/WebUserController.class differ diff --git a/gun_yb_web/target/classes/com/ybkj/gun/mapper/GunLocationMapper.class b/gun_yb_web/target/classes/com/ybkj/gun/mapper/GunLocationMapper.class index 9664f2f..b35c81d 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/gun/mapper/GunLocationMapper.class and b/gun_yb_web/target/classes/com/ybkj/gun/mapper/GunLocationMapper.class differ diff --git a/gun_yb_web/target/classes/com/ybkj/gun/service/GunLocationService.class b/gun_yb_web/target/classes/com/ybkj/gun/service/GunLocationService.class index 6800101..941053c 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/gun/service/GunLocationService.class and b/gun_yb_web/target/classes/com/ybkj/gun/service/GunLocationService.class differ diff --git a/gun_yb_web/target/classes/com/ybkj/gun/service/impl/GunLocationServiceImpl.class b/gun_yb_web/target/classes/com/ybkj/gun/service/impl/GunLocationServiceImpl.class index 1333e46..adc52c3 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/gun/service/impl/GunLocationServiceImpl.class and b/gun_yb_web/target/classes/com/ybkj/gun/service/impl/GunLocationServiceImpl.class differ diff --git a/gun_yb_web/target/classes/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.class b/gun_yb_web/target/classes/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.class index 65d8e50..14ba124 100644 Binary files a/gun_yb_web/target/classes/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.class and b/gun_yb_web/target/classes/com/ybkj/gun/service/impl/WareHouseRecordsServiceImpl.class differ diff --git a/gun_yb_web/target/classes/mapper/GunLocationMapper.xml b/gun_yb_web/target/classes/mapper/GunLocationMapper.xml index a07bddd..46747c3 100644 --- a/gun_yb_web/target/classes/mapper/GunLocationMapper.xml +++ b/gun_yb_web/target/classes/mapper/GunLocationMapper.xml @@ -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 + + + gl.gun_id = #{gunId} + + \ No newline at end of file diff --git a/gun_yb_web/target/classes/mapper/WarehouseRecordsMapper.xml b/gun_yb_web/target/classes/mapper/WarehouseRecordsMapper.xml index 515307c..7642c01 100644 --- a/gun_yb_web/target/classes/mapper/WarehouseRecordsMapper.xml +++ b/gun_yb_web/target/classes/mapper/WarehouseRecordsMapper.xml @@ -325,9 +325,10 @@