|
@@ -13,16 +13,12 @@ import com.xy.collections.list.JArrayList;
|
|
|
import com.xy.collections.list.JList;
|
|
|
import com.xy.collections.map.JMap;
|
|
|
import com.xy.config.DeviceThreadPoolConfig;
|
|
|
-import com.xy.dto.DeviceCreateIdsDto;
|
|
|
-import com.xy.dto.DeviceQualityDto;
|
|
|
-import com.xy.dto.DeviceRegisterDto;
|
|
|
-import com.xy.dto.MqttUserDto;
|
|
|
+import com.xy.dto.*;
|
|
|
import com.xy.entity.*;
|
|
|
import com.xy.mapper.*;
|
|
|
import com.xy.utils.*;
|
|
|
import com.xy.utils.consts.CommConsts;
|
|
|
import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiModelProperty;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
@@ -36,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import javax.validation.constraints.NotBlank;
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
@@ -73,6 +68,8 @@ public class DeviceRegisterServiceImpl extends ServiceImpl<DeviceRegisterMapper,
|
|
|
|
|
|
private DeviceCreateIdsServiceImpl deviceCreateIdsService;
|
|
|
|
|
|
+ private AlipayDeviceService alipayDeviceService;
|
|
|
+
|
|
|
@PostMapping("save")
|
|
|
@ApiOperation("添加")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -266,7 +263,7 @@ public class DeviceRegisterServiceImpl extends ServiceImpl<DeviceRegisterMapper,
|
|
|
ThreadPoolUtils.excPoll(DeviceThreadPoolConfig.DEVICE_COMMON_POLL, 1)
|
|
|
.execute(() -> {
|
|
|
try {
|
|
|
- EasyExcel.read(file.getInputStream(), UploadSaveBySn.class, new UploadSaveBySnListener(deviceCreateIdsService, this, deviceType, devicePc, assetNo)).sheet().doRead();
|
|
|
+ EasyExcel.read(file.getInputStream(), UploadSaveBySn.class, new UploadSaveBySnListener(deviceCreateIdsService, this, alipayDeviceService, deviceType, devicePc, assetNo)).sheet().doRead();
|
|
|
} catch (IOException e) {
|
|
|
log.error("", e);
|
|
|
}
|
|
@@ -282,6 +279,8 @@ public class DeviceRegisterServiceImpl extends ServiceImpl<DeviceRegisterMapper,
|
|
|
|
|
|
private final DeviceRegisterServiceImpl deviceRegisterService;
|
|
|
|
|
|
+ private final AlipayDeviceService alipayDeviceService;
|
|
|
+
|
|
|
private final Integer deviceType;
|
|
|
|
|
|
private final String devicePc;
|
|
@@ -331,6 +330,16 @@ public class DeviceRegisterServiceImpl extends ServiceImpl<DeviceRegisterMapper,
|
|
|
R r = deviceRegisterService.save(save);
|
|
|
if (r.getCode() == R.Enum.FAIL.getCode()) {
|
|
|
log.error("{},{}", sn.getSn(), r.getMsg());
|
|
|
+ } else {
|
|
|
+ //初始化支付宝设备
|
|
|
+ if (deviceType == 5) {
|
|
|
+ alipayDeviceService.deviceAssign(new DeviceAssignDTO()
|
|
|
+ .setTerminalId(String.valueOf(deviceId))
|
|
|
+ .setDeviceIdentifyType("DYNAMIC")
|
|
|
+ .setDeviceSn(sn.getSn())
|
|
|
+ .setDeviceName(String.valueOf(deviceId))
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|