From d938ce1c42af5286a544d4fcdde7d94f858e3487 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期二, 27 六月 2023 14:45:41 +0800
Subject: [PATCH] 查询未挂接权限的三一车辆提交
---
ard-work/src/main/java/com/ruoyi/utils/httpclient/SYCarClient.java | 78 +++++
ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCar.java | 163 +++++++++++
ard-work/src/main/resources/mapper/sy/ArdSyCarMapper.xml | 98 +++++++
ard-work/src/main/java/com/ruoyi/sy/mapper/ArdSyCarMapper.java | 61 ++++
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java | 157 +++++++++++
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 68 ++++
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 162 +++++++++++
7 files changed, 787 insertions(+), 0 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
new file mode 100644
index 0000000..5b76041
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -0,0 +1,157 @@
+package com.ruoyi.sy.controller;
+
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.utils.httpclient.SYCarClient;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.sy.domain.ArdSyCar;
+import com.ruoyi.sy.service.IArdSyCarService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+/**
+ * 涓変竴杞﹁締Controller
+ *
+ * @author ard
+ * @date 2023-06-26
+ */
+@RestController
+@RequestMapping("/sy/syCar")
+@Api(tags = "涓変竴杞﹁締绠$悊鎺ュ彛")
+public class ArdSyCarController extends BaseController
+{
+ @Autowired
+ private IArdSyCarService ardSyCarService;
+
+ @Autowired
+ private ISysConfigService sysConfigService;
+
+ /**
+ * 鏌ヨ涓変竴杞﹁締鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdSyCar ardSyCar)
+ {
+ startPage();
+ List<ArdSyCar> list = ardSyCarService.selectArdSyCarList(ardSyCar);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭涓変竴杞﹁締鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:export')")
+ @Log(title = "涓変竴杞﹁締", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdSyCar ardSyCar)
+ {
+ List<ArdSyCar> list = ardSyCarService.selectArdSyCarList(ardSyCar);
+ ExcelUtil<ArdSyCar> util = new ExcelUtil<ArdSyCar>(ArdSyCar.class);
+ util.exportExcel(response, list, "涓変竴杞﹁締鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇涓変竴杞﹁締璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardSyCarService.selectArdSyCarById(id));
+ }
+
+ /**
+ * 鏂板涓変竴杞﹁締
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:add')")
+ @Log(title = "涓変竴杞﹁締", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdSyCar ardSyCar)
+ {
+ return toAjax(ardSyCarService.insertArdSyCar(ardSyCar));
+ }
+
+ /**
+ * 淇敼涓変竴杞﹁締
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:edit')")
+ @Log(title = "涓変竴杞﹁締", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdSyCar ardSyCar)
+ {
+ return toAjax(ardSyCarService.updateArdSyCar(ardSyCar));
+ }
+
+ /**
+ * 鍒犻櫎涓変竴杞﹁締
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:remove')")
+ @Log(title = "涓変竴杞﹁締", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardSyCarService.deleteArdSyCarByIds(ids));
+ }
+
+ /**
+ * 鑾峰彇涓変竴杞﹁締鐧诲綍淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:loginSY')")
+ @PostMapping("/loginSY")
+ @ApiOperation("鑾峰彇涓変竴杞﹁締鐧诲綍淇℃伅")
+ public Map<String,Object> loginSY(@RequestBody Map<String,String> map){
+ //startPage();
+ String userId = map.get("userId");
+ String password = map.get("password");
+ SysConfig config = new SysConfig();
+ config.setConfigKey("syCarPT");
+ List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
+ String syURL = "";
+ if(sysConfigResult.size() == 0){
+ return error("涓変竴杞﹁締url娌℃湁褰曞叆");
+ }else{
+ syURL = sysConfigResult.get(0).getConfigValue();
+ Map<String,Object> result = SYCarClient.logIn(syURL,userId, password);
+ return success(result);
+ }
+ }
+
+ /**
+ * 鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締
+ */
+ @PreAuthorize("@ss.hasPermi('sy:syCar:getArdSyCarNoRight')")
+ @PostMapping("/getArdSyCarNoRight")
+ @ApiOperation("鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締")
+ public Map<String,Object> getArdSyCarNoRight(){
+ ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ HttpServletRequest request = attributes.getRequest();
+ String userId = request.getHeader("token");
+ System.out.println("//////////");
+ System.out.println(userId);
+ Map<String,Object> result = ardSyCarService.getArdSyCarNoRight(userId);
+ if(((String)result.get("code")).equals("500")){
+ return error((String) result.get("data"));
+ }else if(((String)result.get("code")).equals("200")){
+ return success(result.get("data"));
+ }else{
+ return error("");
+ }
+ }
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCar.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCar.java
new file mode 100644
index 0000000..cbcb004
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCar.java
@@ -0,0 +1,163 @@
+package com.ruoyi.sy.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 涓変竴杞﹁締瀵硅薄 ard_sy_car
+ *
+ * @author ard
+ * @date 2023-06-26
+ */
+public class ArdSyCar extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 涓婚敭 */
+ private String id;
+
+ /** 杞﹁締涓婚敭 */
+ @Excel(name = "杞﹁締涓婚敭")
+ private String carId;
+
+ /** 杞﹁締妯″瀷 */
+ @Excel(name = "杞﹁締妯″瀷")
+ private String carModel;
+
+ /** 杞﹁締绫诲瀷 */
+ @Excel(name = "杞﹁締绫诲瀷")
+ private String carType;
+
+ /** 杞﹁締鍝佺墝 */
+ @Excel(name = "杞﹁締鍝佺墝")
+ private String carBrand;
+
+ /** 鎵�灞為儴闂ㄤ富閿� */
+ @Excel(name = "鎵�灞為儴闂ㄤ富閿�")
+ private String deptId;
+
+ /** 杞﹁締鍥剧墖 */
+ @Excel(name = "杞﹁締鍥剧墖")
+ private String carPicture;
+
+ /** 棰勭暀1 */
+ @Excel(name = "棰勭暀1")
+ private String reserved1;
+
+ /** 棰勭暀2 */
+ @Excel(name = "棰勭暀2")
+ private String reserved2;
+
+ /** 棰勭暀3 */
+ @Excel(name = "棰勭暀3")
+ private String reserved3;
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setCarId(String carId)
+ {
+ this.carId = carId;
+ }
+
+ public String getCarId()
+ {
+ return carId;
+ }
+ public void setCarModel(String carModel)
+ {
+ this.carModel = carModel;
+ }
+
+ public String getCarModel()
+ {
+ return carModel;
+ }
+ public void setCarType(String carType)
+ {
+ this.carType = carType;
+ }
+
+ public String getCarType()
+ {
+ return carType;
+ }
+ public void setCarBrand(String carBrand)
+ {
+ this.carBrand = carBrand;
+ }
+
+ public String getCarBrand()
+ {
+ return carBrand;
+ }
+ public void setDeptId(String deptId)
+ {
+ this.deptId = deptId;
+ }
+
+ public String getDeptId()
+ {
+ return deptId;
+ }
+ public void setCarPicture(String carPicture)
+ {
+ this.carPicture = carPicture;
+ }
+
+ public String getCarPicture()
+ {
+ return carPicture;
+ }
+ public void setReserved1(String reserved1)
+ {
+ this.reserved1 = reserved1;
+ }
+
+ public String getReserved1()
+ {
+ return reserved1;
+ }
+ public void setReserved2(String reserved2)
+ {
+ this.reserved2 = reserved2;
+ }
+
+ public String getReserved2()
+ {
+ return reserved2;
+ }
+ public void setReserved3(String reserved3)
+ {
+ this.reserved3 = reserved3;
+ }
+
+ public String getReserved3()
+ {
+ return reserved3;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("carId", getCarId())
+ .append("carModel", getCarModel())
+ .append("carType", getCarType())
+ .append("carBrand", getCarBrand())
+ .append("deptId", getDeptId())
+ .append("carPicture", getCarPicture())
+ .append("reserved1", getReserved1())
+ .append("reserved2", getReserved2())
+ .append("reserved3", getReserved3())
+ .toString();
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdSyCarMapper.java b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdSyCarMapper.java
new file mode 100644
index 0000000..fabb5ff
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/mapper/ArdSyCarMapper.java
@@ -0,0 +1,61 @@
+package com.ruoyi.sy.mapper;
+
+import java.util.List;
+import com.ruoyi.sy.domain.ArdSyCar;
+
+/**
+ * 涓変竴杞﹁締Mapper鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-06-26
+ */
+public interface ArdSyCarMapper
+{
+ /**
+ * 鏌ヨ涓変竴杞﹁締
+ *
+ * @param id 涓変竴杞﹁締涓婚敭
+ * @return 涓変竴杞﹁締
+ */
+ public ArdSyCar selectArdSyCarById(String id);
+
+ /**
+ * 鏌ヨ涓変竴杞﹁締鍒楄〃
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 涓変竴杞﹁締闆嗗悎
+ */
+ public List<ArdSyCar> selectArdSyCarList(ArdSyCar ardSyCar);
+
+ /**
+ * 鏂板涓変竴杞﹁締
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 缁撴灉
+ */
+ public int insertArdSyCar(ArdSyCar ardSyCar);
+
+ /**
+ * 淇敼涓変竴杞﹁締
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 缁撴灉
+ */
+ public int updateArdSyCar(ArdSyCar ardSyCar);
+
+ /**
+ * 鍒犻櫎涓変竴杞﹁締
+ *
+ * @param id 涓変竴杞﹁締涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdSyCarById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎涓変竴杞﹁締
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdSyCarByIds(String[] ids);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
new file mode 100644
index 0000000..879e547
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -0,0 +1,68 @@
+package com.ruoyi.sy.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.ruoyi.sy.domain.ArdSyCar;
+
+/**
+ * 涓変竴杞﹁締Service鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-06-26
+ */
+public interface IArdSyCarService
+{
+ /**
+ * 鏌ヨ涓変竴杞﹁締
+ *
+ * @param id 涓変竴杞﹁締涓婚敭
+ * @return 涓変竴杞﹁締
+ */
+ public ArdSyCar selectArdSyCarById(String id);
+
+ /**
+ * 鏌ヨ涓変竴杞﹁締鍒楄〃
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 涓変竴杞﹁締闆嗗悎
+ */
+ public List<ArdSyCar> selectArdSyCarList(ArdSyCar ardSyCar);
+
+ /**
+ * 鏂板涓変竴杞﹁締
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 缁撴灉
+ */
+ public int insertArdSyCar(ArdSyCar ardSyCar);
+
+ /**
+ * 淇敼涓変竴杞﹁締
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 缁撴灉
+ */
+ public int updateArdSyCar(ArdSyCar ardSyCar);
+
+ /**
+ * 鎵归噺鍒犻櫎涓変竴杞﹁締
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑涓変竴杞﹁締涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdSyCarByIds(String[] ids);
+
+ /**
+ * 鍒犻櫎涓変竴杞﹁締淇℃伅
+ *
+ * @param id 涓変竴杞﹁締涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdSyCarById(String id);
+
+ /**
+ * 鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締
+ */
+ public Map<String,Object> getArdSyCarNoRight(String userId);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
new file mode 100644
index 0000000..dc8b3e4
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -0,0 +1,162 @@
+package com.ruoyi.sy.service.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+import com.ruoyi.sy.domain.ArdSyUser;
+import com.ruoyi.sy.mapper.ArdSyUserMapper;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.mapper.SysUserMapper;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.utils.httpclient.SYCarClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.sy.mapper.ArdSyCarMapper;
+import com.ruoyi.sy.domain.ArdSyCar;
+import com.ruoyi.sy.service.IArdSyCarService;
+
+import javax.annotation.Resource;
+
+/**
+ * 涓変竴杞﹁締Service涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2023-06-26
+ */
+@Service
+public class ArdSyCarServiceImpl implements IArdSyCarService {
+ @Resource
+ private ArdSyCarMapper ardSyCarMapper;
+
+ @Resource
+ private SysConfigMapper sysConfigMapper;
+
+ @Resource
+ private ArdSyUserMapper ardSyUserMapper;
+
+ /**
+ * 鏌ヨ涓変竴杞﹁締
+ *
+ * @param id 涓変竴杞﹁締涓婚敭
+ * @return 涓変竴杞﹁締
+ */
+ @Override
+ public ArdSyCar selectArdSyCarById(String id) {
+ return ardSyCarMapper.selectArdSyCarById(id);
+ }
+
+ /**
+ * 鏌ヨ涓変竴杞﹁締鍒楄〃
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 涓変竴杞﹁締
+ */
+ @Override
+ public List<ArdSyCar> selectArdSyCarList(ArdSyCar ardSyCar) {
+ return ardSyCarMapper.selectArdSyCarList(ardSyCar);
+ }
+
+ /**
+ * 鏂板涓変竴杞﹁締
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertArdSyCar(ArdSyCar ardSyCar) {
+ return ardSyCarMapper.insertArdSyCar(ardSyCar);
+ }
+
+ /**
+ * 淇敼涓変竴杞﹁締
+ *
+ * @param ardSyCar 涓変竴杞﹁締
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateArdSyCar(ArdSyCar ardSyCar) {
+ return ardSyCarMapper.updateArdSyCar(ardSyCar);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎涓変竴杞﹁締
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑涓変竴杞﹁締涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdSyCarByIds(String[] ids) {
+ return ardSyCarMapper.deleteArdSyCarByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎涓変竴杞﹁締淇℃伅
+ *
+ * @param id 涓変竴杞﹁締涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdSyCarById(String id) {
+ return ardSyCarMapper.deleteArdSyCarById(id);
+ }
+
+ /**
+ * 鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締
+ */
+ @Override
+ public Map<String,Object> getArdSyCarNoRight(String userId) {
+ SysConfig config = new SysConfig();
+ config.setConfigKey("syCarPT");
+ List<SysConfig> sysConfigResult = sysConfigMapper.selectConfigList(config);
+ String syURL = "";
+ Map<String,Object> result = new HashMap();
+ if(sysConfigResult.size() == 0){
+ result.put("data","涓変竴杞﹁締url娌℃湁褰曞叆");
+ result.put("code","500");
+ return result;
+ }else{
+ syURL = sysConfigResult.get(0).getConfigValue();
+ ArdSyUser ardSyUserPara = new ArdSyUser();
+ ardSyUserPara.setSysUserId(userId);
+ List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(ardSyUserPara);
+ if(ardSyUserList.size() == 0){
+ result.put("data","鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
+ result.put("code","500");
+ return result;
+ }else{
+ ArdSyUser ardSyUser = ardSyUserList.get(0);
+ Map<String,Object> LogInResult = SYCarClient.logIn(syURL,ardSyUser.getUserId(), ardSyUser.getPassword());
+ String sessionId = (String) LogInResult.get("sessionId");
+ Map<String,Object> carListMap = SYCarClient.getCarList(syURL,sessionId);
+ if(((String)carListMap.get("rspCode")).equals("1")){
+ List<Map<String,Object>> list = (List<Map<String,Object>>) carListMap.get("list");
+ ArdSyCar ardSyCar = new ArdSyCar();
+ List<ArdSyCar> ardSyCarList = ardSyCarMapper.selectArdSyCarList(ardSyCar);
+ List<String> carIdList = new ArrayList();
+ for(ArdSyCar innerArdSyCar : ardSyCarList){
+ carIdList.add(innerArdSyCar.getCarId());
+ }
+
+ List<Map<String,Object>> carList = list.stream().filter(new Predicate<Map<String,Object>>(){
+ @Override
+ public boolean test(Map<String,Object> map) {
+ return !carIdList.contains((String)map.get("carId"));
+ }
+ }).collect(Collectors.toList());
+ result.put("data",carList);
+ result.put("code","200");
+ return result;
+ }else{
+ result.put("data","涓変竴杞﹁締骞冲彴鍑洪敊");
+ result.put("code","500");
+ return result;
+ }
+ }
+ }
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/httpclient/SYCarClient.java b/ard-work/src/main/java/com/ruoyi/utils/httpclient/SYCarClient.java
new file mode 100644
index 0000000..19d2d80
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/utils/httpclient/SYCarClient.java
@@ -0,0 +1,78 @@
+package com.ruoyi.utils.httpclient;
+
+import com.alibaba.fastjson2.JSON;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class SYCarClient {
+
+ public static Map<String,Object> logIn(String syURL, String userId, String password){
+ OkHttpClient okHttpClient = new OkHttpClient();
+
+ String passwordMd5 = DigestUtils.md5Hex(password);
+
+ Request request = new Request.Builder()
+ .url(syURL + "/gps-web/api/login.jsp?"+"password="+passwordMd5+"&userId="+userId+"&loginType=user&loginWay=interface&loginLang=zh_CN")
+ .build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ response.headers(); //鍝嶅簲澶�
+
+ ResponseBody responseBody = response.body();
+
+ try {
+ String message = responseBody.string();// 鍝嶅簲浣�
+ Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+ map.put("passwordMd5", passwordMd5);
+ //System.out.println(message);
+ return map;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return new HashMap();
+ }
+ }
+
+ public static Map<String,Object> getCarList(String syURL, String sessionId){
+ OkHttpClient okHttpClient = new OkHttpClient();
+
+ Request request = new Request.Builder()
+ .url(syURL + "/gps-web/api/get_car_list.jsp?teamId=&detail=false&sessionId="+sessionId)
+ .build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ response.headers(); //鍝嶅簲澶�
+
+ ResponseBody responseBody = response.body();
+
+ try {
+ String message = responseBody.string();// 鍝嶅簲浣�
+ Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+ //System.out.println(message);
+ return map;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return new HashMap();
+ }
+ }
+}
diff --git a/ard-work/src/main/resources/mapper/sy/ArdSyCarMapper.xml b/ard-work/src/main/resources/mapper/sy/ArdSyCarMapper.xml
new file mode 100644
index 0000000..b70dea5
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/sy/ArdSyCarMapper.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.sy.mapper.ArdSyCarMapper">
+
+ <resultMap type="ArdSyCar" id="ArdSyCarResult">
+ <result property="id" column="id" />
+ <result property="carId" column="car_id" />
+ <result property="carModel" column="car_model" />
+ <result property="carType" column="car_type" />
+ <result property="carBrand" column="car_brand" />
+ <result property="deptId" column="dept_id" />
+ <result property="carPicture" column="car_picture" />
+ <result property="reserved1" column="reserved_1" />
+ <result property="reserved2" column="reserved_2" />
+ <result property="reserved3" column="reserved_3" />
+ </resultMap>
+
+ <sql id="selectArdSyCarVo">
+ select id, car_id, car_model, car_type, car_brand, dept_id, car_picture, reserved_1, reserved_2, reserved_3 from ard_sy_car
+ </sql>
+
+ <select id="selectArdSyCarList" parameterType="ArdSyCar" resultMap="ArdSyCarResult">
+ <include refid="selectArdSyCarVo"/>
+ <where>
+ <if test="carId != null and carId != ''"> and car_id = #{carId}</if>
+ <if test="carModel != null and carModel != ''"> and car_model = #{carModel}</if>
+ <if test="carType != null and carType != ''"> and car_type = #{carType}</if>
+ <if test="carBrand != null and carBrand != ''"> and car_brand = #{carBrand}</if>
+ <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
+ <if test="carPicture != null and carPicture != ''"> and car_picture = #{carPicture}</if>
+ <if test="reserved1 != null and reserved1 != ''"> and reserved_1 = #{reserved1}</if>
+ <if test="reserved2 != null and reserved2 != ''"> and reserved_2 = #{reserved2}</if>
+ <if test="reserved3 != null and reserved3 != ''"> and reserved_3 = #{reserved3}</if>
+ </where>
+ </select>
+
+ <select id="selectArdSyCarById" parameterType="String" resultMap="ArdSyCarResult">
+ <include refid="selectArdSyCarVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertArdSyCar" parameterType="ArdSyCar">
+ insert into ard_sy_car
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="carId != null">car_id,</if>
+ <if test="carModel != null">car_model,</if>
+ <if test="carType != null">car_type,</if>
+ <if test="carBrand != null">car_brand,</if>
+ <if test="deptId != null">dept_id,</if>
+ <if test="carPicture != null">car_picture,</if>
+ <if test="reserved1 != null">reserved_1,</if>
+ <if test="reserved2 != null">reserved_2,</if>
+ <if test="reserved3 != null">reserved_3,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="carId != null">#{carId},</if>
+ <if test="carModel != null">#{carModel},</if>
+ <if test="carType != null">#{carType},</if>
+ <if test="carBrand != null">#{carBrand},</if>
+ <if test="deptId != null">#{deptId},</if>
+ <if test="carPicture != null">#{carPicture},</if>
+ <if test="reserved1 != null">#{reserved1},</if>
+ <if test="reserved2 != null">#{reserved2},</if>
+ <if test="reserved3 != null">#{reserved3},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdSyCar" parameterType="ArdSyCar">
+ update ard_sy_car
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="carId != null">car_id = #{carId},</if>
+ <if test="carModel != null">car_model = #{carModel},</if>
+ <if test="carType != null">car_type = #{carType},</if>
+ <if test="carBrand != null">car_brand = #{carBrand},</if>
+ <if test="deptId != null">dept_id = #{deptId},</if>
+ <if test="carPicture != null">car_picture = #{carPicture},</if>
+ <if test="reserved1 != null">reserved_1 = #{reserved1},</if>
+ <if test="reserved2 != null">reserved_2 = #{reserved2},</if>
+ <if test="reserved3 != null">reserved_3 = #{reserved3},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteArdSyCarById" parameterType="String">
+ delete from ard_sy_car where id = #{id}
+ </delete>
+
+ <delete id="deleteArdSyCarByIds" parameterType="String">
+ delete from ard_sy_car where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3