Commit 047fe00c by yanHeng

Merge branch 'develop' into feature/vehicle-amount-party

parents 525305c5 b81f98f8
......@@ -67,6 +67,8 @@ ext {
micrometerRegistryVersion = "1.0.4"
poiTlVersion = "1.5.0"
cxfVersion = "3.1.6"
websocketVersion = "1.5.2"
lib = [
/* jiuqi next platform */
np_authz: "com.jiuqi:np.authz:${npAuthzVersion}",
......@@ -251,7 +253,9 @@ ext {
hibernate_common_annotations: "org.hibernate.common:hibernate-commons-annotations:5.0.4.Final",
net_byte_buddy: "net.bytebuddy:byte-buddy:1.8.15",
thumbnailator: "net.coobird:thumbnailator:0.4.8"
thumbnailator: "net.coobird:thumbnailator:0.4.8",
websocket: "org.java-websocket:Java-WebSocket:${websocketVersion}"
]
}
......@@ -413,6 +417,10 @@ configurations.all {
force lib.net_byte_buddy
force lib.thumbnailator
/* websocket */
force lib.websocket
exclude group: "c3p0", module: "c3p0"
exclude group: "dom4j", module: "dom4j"
exclude group: "com.vaadin.external.google", module: "android-json"
......
package com.beecode.inz.authentication.web;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -10,13 +15,17 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
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 org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.beecode.bcp.authc.passwd.service.PassWordService;
import com.beecode.inz.authentication.TenantUser;
import com.beecode.inz.authentication.constants.AuthcConstants;
import com.beecode.inz.authentication.constants.TenantUserConstants;
import com.beecode.inz.authentication.service.SMSsendingService;
import com.beecode.inz.authentication.service.TenantUserService;
......@@ -38,6 +47,8 @@ public class TenantUserController {
@Qualifier("com.beecode.inz.authentication.config.RedisConfiguration.redisTemplate")
RedisTemplate<String, String> redisTemplate;
private final static String REQUEST_CURRENTREGIONALCOMPANY_KEY = "currentRegionalCompany";
@RequestMapping(value = "/user/modifyPassword", method = RequestMethod.POST)
public ResponseEntity<String> modifyPassword(@RequestParam String tenant,@RequestParam String username,@RequestParam String password) throws Exception {
HttpHeaders headers = new HttpHeaders();
......@@ -233,6 +244,22 @@ public class TenantUserController {
return new ResponseEntity<String>(result.toString(), headers, HttpStatus.OK);
}
}
@RequestMapping(value = "/changeOrg", method = RequestMethod.POST)
public void changeOrg(@RequestBody String param) {
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest request = attr.getRequest();
HttpSession session = request.getSession();
//获取当前用户区域公司参数,存入当前用户数据集(session)
JSONObject obj = new JSONObject(param);
String currentRegionalCompany = obj.getString("regionalCompany");
Map<String, String > datas = new ConcurrentHashMap<>();
datas.put(REQUEST_CURRENTREGIONALCOMPANY_KEY, currentRegionalCompany);
//目前数据集只存了用户区域公司
session.setAttribute(AuthcConstants.CURRENTUSERDATAS, datas);
}
private String checkUserState(TenantUser tenantUser) {
if(tenantUser.isLocked()) {
return "该用户被禁止登录,无法找回密码,请联系系统管理员。";
......
package com.beecode.inz.common.util;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.lang.StringUtils;
import java.nio.charset.StandardCharsets;
/**
* WuLing平台对接
*/
public class GpsWuLingUtil {
private static Logger logger = LoggerFactory.getLogger(GpsWuLingUtil.class);
public static String getGpsWuLingTokenRedisKey(String clietId, String clientSecret) {
return "gps_wu_link_token_key" + clietId + "_" + clientSecret;
}
//获取token必填参数 如下三个
private static final String GRANT_TYPE = "client_credentials";
private static final String CLIET_ID = "jt808";
private static final String CLIENT_SECRET = "f04dd1e4";
private static final String GPS_WU_LING_DOMAIN = "http://dev.kunlun.cloud/iot/";
/**
* 获取tokenUrl
*/
private static final String TOKEN_URL = GPS_WU_LING_DOMAIN +"oauth/token";
/**
* 根据设备序列号获取id
*/
private static final String FIND_GATEWAY_ID_URL = GPS_WU_LING_DOMAIN +"gateway/api/findGatewayId";
/**
* 根据设备id查询⽹关指标信息
*/
private static final String GATEWAYINDICATORS_URL = GPS_WU_LING_DOMAIN +"gateway/api/gatewayIndicators";
/**
* 历史轨迹URL
*/
private static final String HISTORY_URL = GPS_WU_LING_DOMAIN +"devices/history";
public static void main(String[] args) throws Exception{
String tokenByAccount = getTokenByAccount();
System.out.println(tokenByAccount);
}
/**
* 获取TOKEN
* @return
* @throws Exception
*/
public static String getTokenByAccount() throws Exception {
String token = RedisUtils.getInstance().get(getGpsWuLingTokenRedisKey(CLIET_ID, CLIENT_SECRET));
if(StringUtils.isNotEmpty(token)){
return token;
}else {
String sendParam = "grant_type="+GRANT_TYPE + "&client_id=" + CLIET_ID + "&client_secret=" + CLIENT_SECRET;
String sendPost = HttpSendUtil.sendPost(TOKEN_URL, sendParam, StandardCharsets.UTF_8.name());
JSONObject postStr = new JSONObject(sendPost);
String accessToken = postStr.getString("access_token");
if (accessToken != null) {
RedisUtils.getInstance().set(getGpsWuLingTokenRedisKey(CLIET_ID, CLIENT_SECRET),accessToken,postStr.getInt("expires_in")-3);
return accessToken;
}else {
logger.error("请求GPSWuLink获取token出错,错误信息"+postStr.get("msg"));
}
}
return null;
}
/**
* 跟踪
* @param account 账号
* @param password 密码
* @param imeis 设备号,可以逗号分隔
* @param mapType 地图类型 如果要显示在百度地图上,map_type=BAIDU此时返回的经纬度将经过baidu校准方式校准
* 如果要显示在google地图上,map_type=GOOGLE,此时返回的经纬度将经过google校准方式校准
* map_type如果不填,则返回原始经纬度
*
* @return
* <table>
* ret uint 返回码 0:正确返回 其它: 失败。错误码 @see {@link com.beecode.inz.common.enumeration.GpsooErrorCodeEnum} <br/>
* msg string 如果ret不为0,会有相应的错误信息提示<br/>
* imei string 设备imei<br/>
* device_info uint 0:正常数据 1:设备未上线 2:设备已过期 3:设备离线<br/>
* gps_time number 设备定位时间,由设备在定位数据中上报。UTC秒数(如果设备过期,值为0)<br/>
* sys_time number 平台收到设备上报位置数据时的系统时间。 UTC秒数(如果设备过期,值为0)<br/>
* heart_time number 设备与平台的最后通信时间。UTC秒数(如果设备过期,值为0)<br/>
* server_time number 当前服务器时间。UTC秒数(如果设备过期,值为0)<br/>
* lng number 经度 (如果设备过期,值为0)<br/>
* lat number 纬度 (如果设备过期,值为0)<br/>
* course number 航向(正北方向为0度,顺时针方向增大。最大值360度) (如果设备过期,值为0)<br/>
* speed number 速度 (单位:km/h) <br/>
* status string ACC等信息 (如果设备过期,值为空字符串) <br/>
* acc unit -1,表示这个设备不支持ACC功能;否则为ACC的状态值(0=关闭,1=开启) <br/>
* acc_seconds string 该设备切换为当前状态已经过的时长(单位:秒) <br/>
* </table>
* @throws Exception
*/
// public static List<Map<String,Object>> tracking(String account, String password, String imeis, String mapType) throws Exception {
// if(StringUtils.isEmpty(imeis)){
// return null;
// }
// String commonParam = getCommonParam(account, password);
//
// if(commonParam==null){
// return null;
// }
// List<Map<String,Object>> imeisInfos = new ArrayList<>();
// List<String> imeisInfoKey = new ArrayList<>();
// String[] split = imeis.split(",");
// for (String s : split) {
// String s1 = RedisUtils.getInstance().get(getGpsooImeisTrackingRedisKey(account, password, s, mapType));
// if(StringUtils.isNotEmpty(s1)){
// imeisInfos.add(new JSONObject(s1).toMap());
// }else {
// imeisInfoKey.add(s);
// }
// }
//
// String sendParam=commonParam +"&imeis="+String.join(",",imeisInfoKey);
// if(StringUtils.isNotEmpty(mapType)){
// sendParam +="&map_type="+mapType;
// }
// String sendPost = HttpSendUtil.sendPost(TRACKING_URL, sendParam, StandardCharsets.UTF_8.name());
// JSONObject postStr = new JSONObject(sendPost);
// int ret = postStr.getInt("ret");
// if (0==(ret)) {
// JSONArray data = postStr.getJSONArray("data");
// for (int i = 0; i < data.length(); i++) {
// String imei = data.getJSONObject(i).getString("imei");
// //每分钟限制了600次请求 8秒缓存,可能不大够..
// JSONObject jsonObject = data.getJSONObject(i);
// Map<String,Object> imeisInfo = jsonObject.toMap();
// RedisUtils.getInstance().set(getGpsooImeisTrackingRedisKey(account, password, imei, mapType), jsonObject.toString(),8);
// imeisInfos.add(imeisInfo);
// }
// }else {
// logger.error("请求GPSOO监控获取tracking出错,错误信息"+postStr.get("msg")+",设备号列表"+imeis);
// }
// return imeisInfos;
// }
//
//
// /**
// * 历史轨迹
// * @param account 账号
// * @param password 密码
// * @param imei 设备号
// * @param mapType 地图类型 如果要显示在百度地图上,map_type=BAIDU此时返回的经纬度将经过baidu校准方式校准
// * 如果要显示在google地图上,map_type=GOOGLE,此时返回的经纬度将经过google校准方式校准
// * map_type如果不填,则返回原始经纬度
// * @param beginTime 开始时间(UTC) 秒数
// * @param endTime 结束时间(UTC) 秒数。end_time不应大于当前时间。
// * gps_time number gps定位时间 UTC秒数<br/>
// * lng number 经度<br/>
// * lat number 纬度<br/>
// * course number 航向(正北方向为0度,顺时针方向增大。最大值360度)<br/>
// * speed number 速度 (单位: km/h)<br/>
// */
// public static List<Object> history(String account, String password, String imei, String mapType,Long beginTime ,Long endTime,List<Object> datas) throws Exception {
//
// if(StringUtils.isEmpty(imei)){
// return null;
// }
// String commonParam = getCommonParam(account, password);
//
// if(commonParam==null){
// return null;
// }
// if(null==datas){
// datas=new ArrayList<>();
// }
//
// String sendParam=commonParam +"&imei="+imei+"&begin_time="+beginTime+"&end_time="+endTime;
// if(StringUtils.isNotEmpty(mapType)){
// sendParam +="&map_type="+mapType;
// }
// String sendPost = HttpSendUtil.sendPost(HISTORY_URL, sendParam, StandardCharsets.UTF_8.name());
// JSONObject postStr = new JSONObject(sendPost);
// int ret = postStr.getInt("ret");
// if (0==ret) {
// JSONArray data = postStr.getJSONArray("data");
// datas.addAll(data.toList());
// if(data.length()>=1000){
// JSONObject jsonObject = data.getJSONObject(999);
// history(account, password, imei, mapType, jsonObject.getLong("gps_time"), endTime, datas);
//
// }
// }else {
// logger.error("请求GPSOO历史获取出错,错误信息"+postStr.get("msg")+",设备号"+imei);
// }
// return datas;
//
// }
//
//
// private static String getCommonParam(String account,String password) throws Exception {
// if(StringUtils.isEmpty(account)|| StringUtils.isEmpty(password)){
// return null;
// }
// String tokenByAccount = getTokenByAccount(account, password);
// String time = Long.toString(System.currentTimeMillis()/1000L);
// return "account="+URLEncoder.encode(account, StandardCharsets.UTF_8.name())+"&access_token="+tokenByAccount+"&time="+time;
// }
}
......@@ -4,6 +4,8 @@ import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
public class HttpSendUtil {
......@@ -54,6 +56,56 @@ public class HttpSendUtil {
}
/**
* 向指定URL发送GET方法的请求
*
* @param url 发送请求的URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return URL 所代表远程资源的响应结果
*/
public static String sendGet(String url, String param,String token) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String urlNameString = url + "?" + param;
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
URLConnection connection = realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("Authorization","Bearer " +token);
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 建立实际的连接
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
// result=new String(result.getBytes(),"utf-8");
} catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e);
e.printStackTrace();
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result.toString();
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
......@@ -161,5 +213,4 @@ public class HttpSendUtil {
}
return result.toString();
}
}
......@@ -3,12 +3,11 @@ package com.xyst.dinas.biz.internal.service;
import com.beecode.bap.attachment.common.Page;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.common.BaseConstants;
import com.beecode.inz.common.util.GpsOOUtil;
import com.beecode.inz.common.util.IotPlatformUtils;
import com.xyst.dinas.biz.dao.ShipInfoDao;
import com.xyst.dinas.biz.service.ShipInfoService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
......@@ -73,24 +72,51 @@ public class ShipInfoServiceImpl implements ShipInfoService {
return shipInfoDao.getAllShipByRegionalCompanyIds(uuidList);
}
//旧版 对接代码 谷米平台
// @Override
// public List<Map<String, Object>> getShipsTracking(List<KObject> allShipByRegionalCompanyIds) throws Exception {
// List<Map<String, Object>> list = new ArrayList<>();
// Map<String, Object> stringObjectHashMap;
// for (KObject allShipByRegionalCompanyId : allShipByRegionalCompanyIds) {
// String account = allShipByRegionalCompanyId.getString("account");
// String accountPassword = allShipByRegionalCompanyId.getString("accountPassword");
// String imei = allShipByRegionalCompanyId.getString("deviceNumber");
//
// stringObjectHashMap = new HashMap<>();
// stringObjectHashMap.put("shipInfo",allShipByRegionalCompanyId);
// stringObjectHashMap.put("shipInfoId",allShipByRegionalCompanyId.getUuid(BaseConstants.ID));
//
// if(StringUtils.isEmpty(account)||StringUtils.isEmpty(accountPassword)||StringUtils.isEmpty(imei)){
// stringObjectHashMap.put("trackingInfo",new ArrayList<>());
// continue;
// }
// List<Map<String,Object>> tracking = GpsOOUtil.tracking(account, accountPassword, imei, null);
// stringObjectHashMap.put("trackingInfo",tracking);
//
// list.add(stringObjectHashMap);
// }
// return list;
// }
@Override
public List<Map<String, Object>> getShipsTracking(List<KObject> allShipByRegionalCompanyIds) throws Exception {
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> stringObjectHashMap;
for (KObject allShipByRegionalCompanyId : allShipByRegionalCompanyIds) {
String account = allShipByRegionalCompanyId.getString("account");
String accountPassword = allShipByRegionalCompanyId.getString("accountPassword");
String imei = allShipByRegionalCompanyId.getString("deviceNumber");
stringObjectHashMap = new HashMap<>();
stringObjectHashMap.put("shipInfo",allShipByRegionalCompanyId);
stringObjectHashMap.put("shipInfoId",allShipByRegionalCompanyId.getUuid(BaseConstants.ID));
if(StringUtils.isEmpty(account)||StringUtils.isEmpty(accountPassword)||StringUtils.isEmpty(imei)){
if(StringUtils.isEmpty(imei)){
stringObjectHashMap.put("trackingInfo",new ArrayList<>());
continue;
}
List<Map<String,Object>> tracking = GpsOOUtil.tracking(account, accountPassword, imei, null);
List<Map<String,Object>> tracking = IotPlatformUtils.tracking(imei);
stringObjectHashMap.put("trackingInfo",tracking);
list.add(stringObjectHashMap);
......@@ -98,17 +124,36 @@ public class ShipInfoServiceImpl implements ShipInfoService {
return list;
}
/**
* @Author yanHeng
* @Date 2022/4/25 18:07
* @Param [uuid, startTime, endTime]
* @return java.util.List<java.lang.Object>
* 旧版本 获取谷米历史数据轨迹
**/
// @Override
// public List<Object> getShipHistoryById(UUID uuid, Long startTime, Long endTime) throws Exception {
// KObject load = shipInfoDao.load(uuid);
// String account = load.getString("account");
// String accountPassword = load.getString("accountPassword");
// String imei = load.getString("deviceNumber");
//
// if(StringUtils.isEmpty(account)||StringUtils.isEmpty(accountPassword)||StringUtils.isEmpty(imei)){
// return null;
// }
// return GpsOOUtil.history(account, accountPassword, imei, null, startTime, endTime, null);
// }
@Override
public List<Object> getShipHistoryById(UUID uuid, Long startTime, Long endTime) throws Exception {
KObject load = shipInfoDao.load(uuid);
String account = load.getString("account");
String accountPassword = load.getString("accountPassword");
String imei = load.getString("deviceNumber");
if(StringUtils.isEmpty(account)||StringUtils.isEmpty(accountPassword)||StringUtils.isEmpty(imei)){
if(StringUtils.isEmpty(imei)){
return null;
}
return GpsOOUtil.history(account, accountPassword, imei, null, startTime, endTime, null);
return IotPlatformUtils.history( imei,startTime, endTime);
}
@Override
......
......@@ -87,12 +87,20 @@ public class WarnSettingDao {
return template.execute(session -> {
StringBuilder hql = new StringBuilder(QUERY_HQL);
if (billId != null) hql.append(" and billId =:billId");
if (billId != null && (target.equals("保证金余额") || target.equals("预付款余额"))) {
hql.append(" and JSON_EXTRACT(memo,'$.contractId')=:billId ");
} else {
hql.append(" and billId =:billId");
}
if (target != null) hql.append(" and target =:target");
Query<KObject> query = session.createQuery(hql.toString(), KObject.class);
query.setParameter("billType", billType);
if (billId != null) query.setParameter("billId", billId);
if (billId != null && (target.equals("保证金余额") || target.equals("预付款余额"))) {
query.setParameter("billId", billId.toString());
} else {
query.setParameter("billId", billId);
}
if (target != null) query.setParameter("target", target);
Optional<KObject> kObject = query.uniqueResultOptional();
return warnSettingToEntity(kObject.orElse(null));
......
......@@ -8,6 +8,7 @@ dependencies {
compile lib.jackson_datatype_jdk8
compile lib.jackson_datatype_jsr310
compile lib.json
compile lib.websocket
compile "com.beecode:bap2.participant:${aminoVersion}"
compile "com.beecode:bcp.org:${aminoVersion}"
compile "com.beecode:bap2.department:${aminoVersion}"
......
......@@ -3,16 +3,23 @@ package com.xyst.dinas.camera.web;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.inz.common.util.IotPlatformUtils;
import com.beecode.util.StringUtils;
import com.xyst.dinas.biz.service.SandMiningAreaService;
import com.xyst.dinas.biz.service.ShipInfoService;
import com.xyst.dinas.camera.entity.RegionalCompanyWatershedCameraTree;
import com.xyst.dinas.camera.service.CameraInfoService;
import com.xyst.dinas.production.service.SandMiningService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* @author scol
......@@ -32,6 +39,12 @@ public class WatershedCameraPlayController {
@Autowired
private SandMiningService sandMiningService;
//获取token必填参数 如下三个
private static final String GRANT_TYPE = "client_credentials";
private static final String CLIET_ID = "jt808";
private static final String CLIENT_SECRET = "f04dd1e4";
/**
* 获取摄像头树列表
* @param uuidList
......@@ -77,5 +90,33 @@ public class WatershedCameraPlayController {
}
/**Description:从IOT平台获取access_token
* @Author yanHeng
* @Date 2022/4/24 18:25
* @Param []
* @return com.beecode.inz.basis.team.pojo.ResponseObj
**/
@GetMapping("/getAccessToken")
public ResponseObj getAccessToken() throws Exception{
HashMap<String, Object> tokenMap = IotPlatformUtils.getAuthToken(CLIET_ID, CLIENT_SECRET);
if ((int) tokenMap.get("status") == -1 || (int) tokenMap.get("status") == -2) {
return ResponseObj.success("获取失败",tokenMap.get("message").toString());
} else {
String token = tokenMap.get("data").toString();
return ResponseObj.success("获取成功",token);
}
}
@GetMapping("/findGatewayId")
public ResponseObj findGatewayId(@RequestParam(name = "deviceNumber") String deviceNumber, @RequestParam(name = "token") String token) throws Exception{
String gatewayId = IotPlatformUtils.findGatewayId(deviceNumber,token);
boolean numeric = StringUtils.isNumeric(gatewayId);
if("".equals(gatewayId) || !numeric){
return ResponseObj.error(500,"查询失败",gatewayId);
}
return ResponseObj.response(200,"查询成功", gatewayId );
}
}
package com.xyst.dinas.camera.websocket;
import com.beecode.amino.core.Amino;
import com.xyst.dinas.camera.web.WatershedCameraPlayController;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
import java.net.URISyntaxException;
/**
* @author 孟庆鑫
* @title: WsClient
* @projectName demo
* @description: webSocket
* @date 2021/8/3017:12
*/
public class WsClient extends WebSocketClient {
private static final Logger logger = LoggerFactory.getLogger(WsClient.class);
//根据这个状态去查询预警设置表
private static final Integer status = 1;
//创建 SingleObject 的一个对象
private static WsClient instance;
private static String serverUri = "";
private static String url = "ws://172.17.74.106:9001/ws?";
//private static String url = "ws://192.168.1.3:9001/ws?";
static {
try {
WatershedCameraPlayController iotPlatformController = Amino.getApplicationContext().getBean(WatershedCameraPlayController.class);
String accessToken = (String) iotPlatformController.getAccessToken().getData();
// EquipmentController equipmentController = Amino.getApplicationContext().getBean(EquipmentController.class);
// ResultMoudel resultMoudel = equipmentController.queryEquipmentAll(new Equipment());
// List<Equipment> equipments = (List<Equipment>) resultMoudel.getBody();
String equipmentId = "";
// for (Equipment equipment : equipments) {
// if (!ObjectUtils.isEmpty(equipment.getEquipmentId())) {
// if (!equipmentId.contains(equipment.getEquipmentId() + ",")) {
// equipmentId = equipmentId + equipment.getEquipmentId() + ",";
// }
// }
// }
url = url + "token=" + accessToken + "&gateway=" + equipmentId.substring(0, equipmentId.length() - 1);
serverUri = url;
instance = new WsClient(serverUri);
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void setUrl(String url) throws URISyntaxException {
WsClient.serverUri = url;
instance = new WsClient(url);
}
//获取唯一可用的对象
public static WsClient getInstance() throws URISyntaxException {
return instance;
}
private WsClient(String serverUri) throws URISyntaxException {
super(new URI(serverUri));
}
@Override
public void onOpen(ServerHandshake arg0) {
System.out.println("握手成功");
}
@Override
public void onMessage(String message) {
}
@Override
public void onClose(int arg0, String arg1, boolean arg2) {
System.out.println("连接关闭");
}
@Override
public void onError(Exception arg0) {
System.out.println("发生错误" + arg0);
}
// @Override
// public void onMessage(String arg0) {
// //收到信息,转换成map
// System.out.println("收到消息" + arg0);
// JSONObject jsonMap = JSONObject.parseObject(arg0);
// Map<String, Object> map = jsonMap;
// //查询出所有的设备信息,需要所有的设备id去做预警监控
// EquipmentController equipmentController = SpringContext.getBean(EquipmentController.class);
// ResultMoudel resultMoudel = equipmentController.queryEquipmentAll(new Equipment());
// List<Equipment> equipments = (List<Equipment>) resultMoudel.getBody();
// WarningSettingsMapper warningSettingsMapper = SpringContext.getBean(WarningSettingsMapper.class);
// EquipmentDictionaryMapper equipmentDictionaryMapper = SpringContext.getBean(EquipmentDictionaryMapper.class);
//
// //遍历所有的设备id如果gatway里有跟我一样的设备id,就监控
// for (Equipment equipment : equipments) {
// //拿到设备信息里的data
// Object data = map.get("data");
// JSONObject datajson = JSONObject.parseObject(String.valueOf(data));
// Map<String, Object> dataMap = datajson;
// //如果设备里有虫情和孢子就需要保存照片
// if (Objects.equals(dataMap.get("gateway"), equipment.getEquipmentId()) && ("3".equals(equipment.getTypeId()) || "4".equals(equipment.getTypeId()))) {
// //拿到设备信息data里的params
// Object params = dataMap.get("params");
// JSONObject objectjson = JSONObject.parseObject(String.valueOf(params));
// Map<String, Object> objectMap = objectjson;
//
// if (!ObjectUtils.isEmpty(objectMap.get("image"))) {
// // 添加UUID编码,防止文件名重复
// UUID uuid = UUID.randomUUID();
// UUID uuid1 = UUID.randomUUID();
// uploadController uploadController = new uploadController();
// //孢子
// if ("3".equals(equipment.getTypeId())) {
// String image = (String) objectMap.get("image");
// uploadController.download(image, uuid.toString(), 4);
// } else {//虫情
// String image = (String) objectMap.get("image");
// String resultImage = (String) objectMap.get("result_image");
// uploadController.download(image, uuid.toString(), 3);
// uploadController.download(resultImage, uuid1.toString(), 3);
// }
// }
//
//
// }
//
// //对比id和getway是否一致,这里要保证设备id要唯一
// if (Objects.equals(dataMap.get("gateway"), equipment.getEquipmentId())) {
// //拿到设备信息data里的params
// Object params = dataMap.get("params");
// JSONObject objectjson = JSONObject.parseObject(String.valueOf(params));
// Map<String, Object> objectMap = objectjson;
// //根据设备id去查询预警设置表
// Map<String, Object> queryMap = new HashMap<>();
// queryMap.put("equipment_type_id", equipment.getTypeId());
// queryMap.put("status", status);
// List<WarningSettings> warningSettings = warningSettingsMapper.selectByMap(queryMap);
// //遍历这个结合校验所有校验
// for (WarningSettings WarningSettings : warningSettings) {
// BigDecimal dparm = (BigDecimal) objectMap.get(WarningSettings.getAlias());
// if (null != dparm && (dparm.compareTo(new BigDecimal(WarningSettings.getMaxValue())) == 1 || dparm.compareTo(new BigDecimal(WarningSettings.getMinValue())) == -1)) {
//
// //推送预警信息
// JPushUtil jPushUtil = new JPushUtil();
// String title = "预警推送";
// String content = equipment.getName() + "设备的" + WarningSettings.getDeviceParameters() + "指标出现异常!,数值:" + String.valueOf(dparm) + "请注意!";
// Map<String, String> extras = new HashMap<>();
// extras.put("areaId", String.valueOf(equipment.getAreaId()));
// extras.put("name", equipment.getName());
// extras.put(WarningSettings.getDeviceParameters(), String.valueOf(dparm));
//
// //保存预警信息
// BreakdownRecord breakdownRecord = new BreakdownRecord();
// breakdownRecord.setEquipmentInfoId(Integer.valueOf(equipment.getEquipmentId()));
// breakdownRecord.setAreaId(equipment.getAreaId());
// breakdownRecord.setFaultParameter(WarningSettings.getDeviceParameters());
// breakdownRecord.setContent(content);
// breakdownRecord.setRemindWays(WarningSettings.getRemindWays());
// breakdownRecord.setHandleWay(0);//TODO 设备故障的还没有写呢
// breakdownRecord.setStatus(status);
// BreakdownRecordMapper breakdownRecordMapper = SpringContext.getBean(BreakdownRecordMapper.class);
// breakdownRecordMapper.insert(breakdownRecord);
//
// extras.put("id", String.valueOf(breakdownRecord.getId()));
// //我们是多个人员所以要拼接一下
// String[] split = WarningSettings.getUserId().split(",");
// String alias;
// for (int i = 0; i < split.length; i++) {
// alias = "dev_" + split[i]; //上线的时候换成prod
//
// try {
// jPushUtil.sendPushObjectPlatformAllBigText(alias, title, content, extras);
// } catch (APIConnectionException e) {
// e.printStackTrace();
// } catch (APIRequestException e) {
// logger.info("调用极光推送失败!");
// }
//
// }
// logger.info("调用极光推送!");
// }
// }
// }
// }
// }
}
package com.xyst.dinas.contract.dao;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
import java.util.List;
import java.util.UUID;
public interface SelfPickupCarDao {
void update(KObject kobject);
......@@ -13,4 +14,7 @@ public interface SelfPickupCarDao {
KObject load(UUID id);
KObject getCarInfoByContractId(UUID contractId);
List<KObject> queryListByCar(String carNum);
}
package com.xyst.dinas.contract.internal.dao;
import java.util.UUID;
import com.beecode.amino.core.Amino;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.contract.constant.SelfPickupCarConstant;
import com.xyst.dinas.contract.dao.SelfPickupCarDao;
import com.xyst.dinas.contract.enumeration.ContractStateEnum;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateOperations;
import org.springframework.stereotype.Repository;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.contract.constant.SelfPickupCarConstant;
import com.xyst.dinas.contract.dao.SelfPickupCarDao;
import java.util.List;
import java.util.UUID;
@Repository
public class SelfPickupCarDaoImpl implements SelfPickupCarDao {
......@@ -43,4 +48,15 @@ public class SelfPickupCarDaoImpl implements SelfPickupCarDao {
}
});
}
@Override
public List<KObject> queryListByCar(String carNum) {
KClass bean = Amino.getStaticMetadataContext().getBean(SelfPickupCarConstant.ENTITY, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
detachedCriteria.createAlias("contract", "contract");
detachedCriteria.add(Restrictions.like("carInfo", "%"+carNum+"%"));
detachedCriteria.add(Restrictions.eq("contract.contractState", ContractStateEnum.EXECUTING.name()));
detachedCriteria.add(Restrictions.eq("discard", false));
return (List<KObject>)template.findByCriteria(detachedCriteria);
}
}
package com.xyst.dinas.contract.internal.service;
import java.util.Date;
import java.util.UUID;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.beecode.bcp.core.context.AminoContextHolder;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.common.BaseConstants;
......@@ -18,6 +10,14 @@ import com.xyst.dinas.contract.internal.dao.ContractDao;
import com.xyst.dinas.contract.service.SelfPickupCarService;
import com.xyst.dinas.project.dao.ProjectFiledDao;
import com.xyst.dinas.project.dao.PurchaseSandCompanyDao;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service
public class SelfPickupCarServiceImpl implements SelfPickupCarService {
......@@ -86,4 +86,9 @@ public class SelfPickupCarServiceImpl implements SelfPickupCarService {
return carInfo;
}
@Override
public List<KObject> queryListByCar(String carNum) {
return selfPickupCarDao.queryListByCar(carNum);
}
}
package com.xyst.dinas.contract.service;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
import java.util.List;
import java.util.UUID;
public interface SelfPickupCarService {
UUID create(KObject kobject);
......@@ -11,4 +12,6 @@ public interface SelfPickupCarService {
void update(String param);
String getCarInfoByContractId(String contractId);
List<KObject> queryListByCar(String carNum);
}
......@@ -52,11 +52,12 @@ public class ArtificialRechargeServiceImpl implements ArtificialRechargeService
contract.set("depositBalance", contract.getBigDecimal("depositBalance") == null ? new BigDecimal("0").add(jsonObject.getBigDecimal("rechargeAmount")) : contract.getBigDecimal("depositBalance").add(jsonObject.getBigDecimal("rechargeAmount")));
}
contractDao.update(contract);
BaseBusinessWarn warn = warningService.createWarn("合同", contract.getUuid("contractId"), "预付款余额");
BaseBusinessWarn warn = warningService.createWarn("合同", contract.getUuid("id"), "预付款余额");
warn.setWarningCalculate(new StockAmountWarnCalculate(contract.getDouble("advanceBalance")));
warn.warn();
return ResponseObj.success();
} catch (Exception e) {
e.printStackTrace();
return ResponseObj.error();
}
......
package com.xyst.dinas.sales.dao;
import com.beecode.bcp.type.KObject;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface NeedPlanDao {
KObject queryNeedPlanByContractIdAndCycleId(UUID planningCycleId, UUID contractId);
......@@ -28,7 +28,7 @@ public interface NeedPlanDao {
KObject queryNeedPlanAmountByCycleId(UUID planningCycleId, UUID projectId);
List<KObject> getByCarAndPlanningCycle(String carNum, KObject planningCycleObj);
List<KObject> getByCarAndPlanningCycle(String carNum, KObject planningCycleObj,UUID contractId);
KObject queryDetailById(UUID fromString);
}
......@@ -351,7 +351,7 @@ public class SalesPlanDao {
* @param station
* @return
*/
public List<KObject> getSaleTempByCarNum(String carNum, KObject station) {
public List<KObject> getSaleTempByCarNum(String carNum, KObject station,UUID contractId) {
KClass bean = Amino.getStaticMetadataContext().getBean(SalesPlanConstant.ENTITY_TEMP, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
dinasTypeDao.addRegionalCompanyFilter(detachedCriteria);
......@@ -361,7 +361,9 @@ public class SalesPlanDao {
detachedCriteria.add(Restrictions.le("planningCycle.startTime", new Date()));
detachedCriteria.add(Restrictions.ge("planningCycle.endTime", new Date()));
detachedCriteria.add(Restrictions.eq("station.id", station.getUuid("id")));
detachedCriteria.add(Restrictions.like("carNumber", "%"+carNum+"%"));
// modify by 销售计划车辆撤销不维护 from yanH start
// detachedCriteria.add(Restrictions.like("carNumber", "%"+carNum+"%"));
detachedCriteria.add(Restrictions.eq("contract.id", contractId));
return (List<KObject>) template.findByCriteria(detachedCriteria);
}
......@@ -398,7 +400,7 @@ public class SalesPlanDao {
* @param station
* @return
*/
public List<KObject> getSaleByCarNum(String carNum, KObject station) {
public List<KObject> getSaleByCarNum(String carNum, KObject station,UUID contractId) {
KClass bean = Amino.getStaticMetadataContext().getBean(SalesPlanConstant.ENTITY_DETAIL, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
......@@ -411,7 +413,9 @@ public class SalesPlanDao {
detachedCriteria.add(Restrictions.ge("planningCycle.endTime", new Date()));
detachedCriteria.add(Restrictions.eq("station.id", station.getUuid("id")));
detachedCriteria.add(Restrictions.eq(BaseConstants.MASTER+"."+SalesPlanConstant.APPROVE_STATE, BizProcessState.DONE_WITH_AGREE.getValue()));
detachedCriteria.add(Restrictions.like("contract.carInfo", "%"+carNum+"%"));
// modify by 销售计划车辆撤销不维护 from yanH start
// detachedCriteria.add(Restrictions.like("contract.carInfo", "%"+carNum+"%"));
detachedCriteria.add(Restrictions.eq("contract.id", contractId));
return (List<KObject>) template.findByCriteria(detachedCriteria);
}
}
......
......@@ -161,13 +161,15 @@ public class NeedPlanDaoImpl implements NeedPlanDao, NeedPlanConstant {
}
@Override
public List<KObject> getByCarAndPlanningCycle(String carNum, KObject planningCycleObj) {
public List<KObject> getByCarAndPlanningCycle(String carNum, KObject planningCycleObj,UUID contractId) {
KClass bean = Amino.getStaticMetadataContext().getBean(NEED_PLAN_ENTITY, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
dinasTypeDao.addRegionalCompanyFilter(detachedCriteria);
detachedCriteria.add(Restrictions.eq("submitState", SubmitStateEnum.SUBMITTED.name()));
detachedCriteria.add(Restrictions.eq("planningCycle.id", planningCycleObj.getUuid("id")));
detachedCriteria.add(Restrictions.like("transportLicensePlateNumber", "%"+carNum+"%"));
// modify by 销售计划车辆撤销不维护 from yanH start
// detachedCriteria.add(Restrictions.like("transportLicensePlateNumber", "%"+carNum+"%"));
detachedCriteria.add(Restrictions.eq("contract.id", contractId));
return (List<KObject>)template.findByCriteria(detachedCriteria);
}
......
package com.xyst.dinas.sales.internal.service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
import com.xyst.dinas.biz.enumeration.PlanningCycleEnum;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.biz.constant.PlanningCycleConstant;
import com.xyst.dinas.biz.enumeration.PlanningCycleEnum;
import com.xyst.dinas.biz.service.PlanningCycleService;
import com.xyst.dinas.contract.service.ContractService;
import com.xyst.dinas.sales.dao.NeedPlanDao;
import com.xyst.dinas.sales.dao.SalesPlanDao;
import com.xyst.dinas.sales.entity.ContractExecuteDetail;
import com.xyst.dinas.sales.service.NeedPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
public class NeedPlanServiceImpl implements NeedPlanService {
......@@ -183,11 +177,11 @@ public class NeedPlanServiceImpl implements NeedPlanService {
}
@Override
public List<KObject> queryNeedPlanByCarNumAndPlanningCycle(KObject station, String carNum, Date date) {
public List<KObject> queryNeedPlanByCarNumAndPlanningCycle(KObject station, String carNum, Date date,UUID contractId) {
//
String planningCycle = station.get("regionalCompany").getString("planningCycle");
PlanningCycleEnum planningCycleEnum = PlanningCycleEnum.valueOf(planningCycle);
KObject planningCycleObj = planningCycleService.getPlanningCycleObj(planningCycleEnum, date);
return needPlanDao.getByCarAndPlanningCycle(carNum,planningCycleObj);
return needPlanDao.getByCarAndPlanningCycle(carNum,planningCycleObj, contractId);
}
}
......@@ -258,10 +258,10 @@ public class SalesPlanServiceImpl implements SalesPlanService {
JSONArray jsonArray = jsonObject.getJSONArray("salesPlanDetails");
//校验逻辑
if (!jsonObject.isNull("isCommit") && jsonObject.getInt("isCommit") == 1) {
List<Map<String, Object>> submitSalesPlanVerifyList = submitSalesPlanVerify(salesPlanId, jsonArray);
if (submitSalesPlanVerifyList.size() > 0) {
return submitSalesPlanVerifyList;
}
// List<Map<String, Object>> submitSalesPlanVerifyList = submitSalesPlanVerify(salesPlanId, jsonArray);
// if (submitSalesPlanVerifyList.size() > 0) {
// return submitSalesPlanVerifyList;
// }
//改状态
kObject.set("approveState", 1);
}
......@@ -540,15 +540,15 @@ public class SalesPlanServiceImpl implements SalesPlanService {
}
@Override
public List<Map<String, Object>> querySalesPlanByCarNum(KObject station, String carNum) {
public List<Map<String, Object>> querySalesPlanByCarNum(KObject station, String carNum ,UUID contractId) {
//根据车牌号获取需用计划,每个车牌可能有多个需用计划
List<KObject> plans = needPlanService.queryNeedPlanByCarNumAndPlanningCycle(station, carNum, new Date());
List<KObject> plans = needPlanService.queryNeedPlanByCarNumAndPlanningCycle(station, carNum, new Date(),contractId);
//根据计划周期和合同编号获取本次购砂单位实际可以分配的砂石类型
//根据需用计划中计划周期和合同获取销售计划
ArrayList<Map<String, Object>> maps = new ArrayList<>();
List<KObject> saleTempByCarNum = salesPlanDao.getSaleTempByCarNum(carNum, station);
List<KObject> saleTempByCarNum = salesPlanDao.getSaleTempByCarNum(carNum, station,contractId);
//没有需用计划却提了销售计划的可能,线下提销售计划
List<KObject> saleDetails = salesPlanDao.getSaleByCarNum(carNum, station);
List<KObject> saleDetails = salesPlanDao.getSaleByCarNum(carNum, station,contractId);
for (KObject saleDetail : saleDetails) {
KObject sale = saleDetail.get("master");
......
package com.xyst.dinas.sales.service;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.entity.ContractExecuteDetail;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.entity.ContractExecuteDetail;
public interface NeedPlanService {
......@@ -31,5 +31,5 @@ public interface NeedPlanService {
KObject querySalePlanByCycleId(UUID fromString);
List<KObject> queryNeedPlanByCarNumAndPlanningCycle(KObject station, String carNum, Date date);
List<KObject> queryNeedPlanByCarNumAndPlanningCycle(KObject station, String carNum, Date date,UUID contractId);
}
package com.xyst.dinas.sales.service;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.web.request.SaleaPlanDetailQuery;
import org.json.JSONObject;
import org.springframework.lang.Nullable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.json.JSONObject;
import org.springframework.lang.Nullable;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.web.request.SaleaPlanDetailQuery;
public interface SalesPlanService {
/**
......@@ -88,6 +87,6 @@ public interface SalesPlanService {
List<KObject> getSealTempDinasTypeListByNeedPlanInfo(UUID purchaseSandUnitId, UUID planningCycleId, UUID projectId);
List<Map<String, Object>> querySalesPlanByCarNum(KObject station, String carNum);
List<Map<String, Object>> querySalesPlanByCarNum(KObject station, String carNum,UUID contractId);
}
......@@ -137,9 +137,9 @@ public class SalesPlanController {
JSONObject jsonObject = new JSONObject(body);
try {
List<Map<String, Object>> list = salesPlanService.modify(jsonObject);
if(list != null && list.size() > 0) {
return ResponseObj.error("操作失败", list);
}
// if(list != null && list.size() > 0) {
// return ResponseObj.error("操作失败", list);
// }
return ResponseObj.success("操作成功", null);
} catch(Exception e) {
e.printStackTrace();
......
......@@ -9,6 +9,7 @@ import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.util.Base64;
import com.xyst.dinas.biz.service.StationService;
import com.xyst.dinas.contract.service.SelfPickupCarService;
import com.xyst.dinas.sales.service.InventoryService;
import com.xyst.dinas.sales.service.SalesPlanService;
import com.xyst.dinas.sales.service.SalesRecordService;
......@@ -45,6 +46,8 @@ public class WeighbridgeSyncController {
private InventoryService inventoryService;
@Autowired
private AttachmentService attachmentService;
@Autowired
private SelfPickupCarService selfPickupCarService;
/**
......@@ -88,23 +91,30 @@ public class WeighbridgeSyncController {
if (station == null) {
return ResponseObj.error(500, "没有查询到地磅匹配的场站");
}
HashMap<String, Object> returnMap = new HashMap<>(4);
returnMap.put("code",200);
returnMap.put("message","查询成功");
if(StringUtils.isNotBlank(carNum)){
//根据车牌查询所属合同和销售计划
List<Map<String, Object>> salesPlan = salesPlanService.querySalesPlanByCarNum(station, carNum);
Collection<? extends Map<String, Object>> maps = vehicleDispatchService.vehicleDispatchService(station, carNum);
if (maps != null) {
salesPlan.addAll(maps);
}
if(salesPlan == null || salesPlan.isEmpty()){
//查询合同内自提车辆信息是否为自提
List<KObject> carInfoKObject = selfPickupCarService.queryListByCar(carNum);
if(carInfoKObject.size() > 0){ //如果有数据则为自提数据
//根据车牌查询所属合同和销售计划
//获取自提车辆对应的合同id
UUID contractId = carInfoKObject.get(0).get("contract").getUuid("id");
List<Map<String, Object>> salesPlan = salesPlanService.querySalesPlanByCarNum(station, carNum,contractId);
Collection<? extends Map<String, Object>> maps = vehicleDispatchService.vehicleDispatchService(station, carNum);
if (maps != null) {
salesPlan.addAll(maps);
}
if(salesPlan.size() > 0 ){
returnMap.put("saleType",1);
returnMap.put("data",salesPlan);
return returnMap;
}else {//否则认为是散户
return getDinasReturn(station, returnMap);
}
}else {//否则认为是散户
return getDinasReturn(station, returnMap);
}else{
returnMap.put("saleType",1);
returnMap.put("data",salesPlan);
return returnMap;
}
}else{
return getDinasReturn(station, returnMap);
......
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