Commit d2b46c32 by levphon

工单标准接口

1 parent 463602ca
...@@ -21,26 +21,23 @@ ...@@ -21,26 +21,23 @@
<dependency> <dependency>
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>glsx-ne-shield-common</artifactId> <artifactId>rest-admin-swagger2</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>rest-admin-swagger2</artifactId> <artifactId>rest-admin-mybatis</artifactId>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>rest-admin-mybatis</artifactId> <artifactId>rest-admin-office</artifactId>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>rest-admin-office</artifactId> <artifactId>glsx-ne-shield-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
...@@ -48,6 +45,7 @@ ...@@ -48,6 +45,7 @@
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>ne-shield-standard-interfaces-api</artifactId> <artifactId>ne-shield-standard-interfaces-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<!-- 监控中心 devicemonitor-api --> <!-- 监控中心 devicemonitor-api -->
...@@ -55,6 +53,7 @@ ...@@ -55,6 +53,7 @@
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>ne-shield-devicemonitor-api</artifactId> <artifactId>ne-shield-devicemonitor-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<!-- 警情中心 alarmcenter-api --> <!-- 警情中心 alarmcenter-api -->
...@@ -62,6 +61,7 @@ ...@@ -62,6 +61,7 @@
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>ne-shield-alarmcenter-api</artifactId> <artifactId>ne-shield-alarmcenter-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<!-- usercenter-api --> <!-- usercenter-api -->
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>ne-shield-usercenter-api</artifactId> <artifactId>ne-shield-usercenter-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -110,7 +110,7 @@ public class WorkOrderService { ...@@ -110,7 +110,7 @@ public class WorkOrderService {
if (CollectionUtils.isNotEmpty(orderReq.getVehicles())) { if (CollectionUtils.isNotEmpty(orderReq.getVehicles())) {
woVehicle = WorkOrderVehicleConverter.INSTANCE.bo2do(orderReq.getVehicles().get(0)); woVehicle = WorkOrderVehicleConverter.INSTANCE.bo2do(orderReq.getVehicles().get(0));
woVehicle.setWorkOrderId(workOrder.getId()); woVehicle.setWorkOrderId(workOrder.getId());
woVehicle.setDeviceCompose(transBhgServiceCode(orderReq.getOrderSource(), woVehicle)); woVehicle.setDeviceCompose(transBhgServiceCode(orderReq, woVehicle));
woVehicle.setStatus(0); woVehicle.setStatus(0);
woVehicle.setCreatedDate(now); woVehicle.setCreatedDate(now);
log.info("工单车辆信息:{}", JSONUtil.toJsonStr(woVehicle)); log.info("工单车辆信息:{}", JSONUtil.toJsonStr(woVehicle));
...@@ -122,7 +122,7 @@ public class WorkOrderService { ...@@ -122,7 +122,7 @@ public class WorkOrderService {
return workOrderNo; return workOrderNo;
} }
private String transBhgServiceCode(String orderSource, WorkOrderVehicle woVehicle) { private String transBhgServiceCode(InstallWorkOrderBO orderReq, WorkOrderVehicle woVehicle) {
String deviceCompose = woVehicle.getDeviceCompose(); String deviceCompose = woVehicle.getDeviceCompose();
if (StringUtils.isNotBlank(deviceCompose) && deviceCompose.endsWith(";")) { if (StringUtils.isNotBlank(deviceCompose) && deviceCompose.endsWith(";")) {
...@@ -138,27 +138,33 @@ public class WorkOrderService { ...@@ -138,27 +138,33 @@ public class WorkOrderService {
String device = devices[i]; String device = devices[i];
boolean containWired = device.contains("GPSC:700B"); boolean containWired = device.contains("GPSC:700B");
if (containWired) { if (containWired) {
wiredCnt = 1;//默认一个
String[] deviceAndCnt = device.split(":"); String[] deviceAndCnt = device.split(":");
if (deviceAndCnt.length > 1) { if (deviceAndCnt.length > 2) {
wiredCnt += Integer.parseInt(device.split(":")[1]); wiredCnt += Integer.parseInt(device.split(":")[2]);
} }
} }
boolean containWireless = device.contains("GPSW:703B"); boolean containWireless = device.contains("GPSW:703B");
if (containWireless) { if (containWireless) {
wirelessCnt = 1;//默认一个
String[] deviceAndCnt = device.split(":"); String[] deviceAndCnt = device.split(":");
if (deviceAndCnt.length > 1) { if (deviceAndCnt.length > 2) {
wirelessCnt += Integer.parseInt(device.split(":")[1]); wirelessCnt += Integer.parseInt(device.split(":")[2]);
} }
} }
} }
if ("Y".equalsIgnoreCase(orderReq.getNeedInstall())) {
Integer allCnt = wiredCnt + wirelessCnt;
if (allCnt <= 0) {
throw new StdInterfaceException("214541", deviceCompose + "设备组合解析失败");
}
}
String deviceSign = "0" + wiredCnt + wirelessCnt; String deviceSign = "0" + wiredCnt + wirelessCnt;
log.info("工单{}设备组合为{}", woVehicle.getWorkOrderId(), deviceSign);
woVehicle.setDeviceCompose(deviceSign); woVehicle.setDeviceCompose(deviceSign);
String serviceCode = getBhgServiceCode(orderSource, deviceSign); String serviceCode = getBhgServiceCode(orderReq.getOrderSource(), deviceSign);
return serviceCode; return serviceCode;
} }
...@@ -204,20 +210,21 @@ public class WorkOrderService { ...@@ -204,20 +210,21 @@ public class WorkOrderService {
* @return * @return
*/ */
public Long assignAuth(String account) { public Long assignAuth(String account) {
//找不到默认归到运营账号
Long userId = Long.valueOf(PropertiesUtils.getProperty("operators.user.id"));
try {
R<List<User>> userR = apiUserService.findByAccount(account); R<List<User>> userR = apiUserService.findByAccount(account);
log.info("userR===" + JSON.toJSONString(userR)); log.info("userR===" + JSON.toJSONString(userR));
Long userId = 0L;
if (userR.isSuccess()) { if (userR.isSuccess()) {
List<User> userList = userR.getDataList(new TypeToken<List<User>>() { List<User> userList = userR.getDataList(new TypeToken<List<User>>() {
}.getType()); }.getType());
if (CollectionUtils.isNotEmpty(userList)) { if (CollectionUtils.isNotEmpty(userList)) {
userId = userList.get(0).getId(); userId = userList.get(0).getId();
} else {
//找不到默认归到运营账号
userId = Long.valueOf(PropertiesUtils.getProperty("bhg.vehicle.createBy.id"));
log.warn("找不到对应归属账号{},改归到运营账号{},请检查", account, userId);
} }
} }
} catch (Exception e) {
log.error("根据账号名{}获取账号id失败,exception:{}", account, e.getMessage());
}
return userId; return userId;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!