Commit d2b46c32 by levphon

工单标准接口

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