|
@@ -6,8 +6,12 @@ import com.xy.Enum.ctwing.BindTypeEnum;
|
|
|
import com.xy.annotate.Factory;
|
|
|
import com.xy.dto.CtWingDto;
|
|
|
import com.xy.dto.CtWingVo;
|
|
|
+import com.xy.dto.DeviceSimPickRecordsDto;
|
|
|
import com.xy.dto.SimInfoDto;
|
|
|
+import com.xy.entity.DeviceInfo;
|
|
|
import com.xy.entity.SysDictRedis;
|
|
|
+import com.xy.service.DeviceInfoServiceImpl;
|
|
|
+import com.xy.service.DeviceSimPickRecordsServiceImpl;
|
|
|
import com.xy.service.factory.sim.SimInfoFactory;
|
|
|
import com.xy.utils.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -30,6 +34,10 @@ import java.util.Map;
|
|
|
@Factory(type = "电信")
|
|
|
@AllArgsConstructor
|
|
|
public class CtWingFactoryImpl implements SimInfoFactory {
|
|
|
+ private final DeviceSimPickRecordsServiceImpl simPickRecordsService;
|
|
|
+
|
|
|
+ private final DeviceInfoServiceImpl deviceInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 三码查询
|
|
|
*
|
|
@@ -118,10 +126,29 @@ public class CtWingFactoryImpl implements SimInfoFactory {
|
|
|
@Override
|
|
|
@SneakyThrows
|
|
|
public R<String> buyPack(SimInfoDto.BuyPackDto dto) {
|
|
|
+ //查询设备
|
|
|
+ DeviceInfo deviceInfo = deviceInfoService.getById(dto.getDeviceId());
|
|
|
+ //查询字典
|
|
|
+ SysDictRedis sysDictRedis = SysDictUtils.get("sim-packs-ctwing", dto.getPackCode());
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(sysDictRedis.getValue());
|
|
|
+ String name = jsonObject.getStr("name");
|
|
|
+ String icp = jsonObject.getStr("icp");
|
|
|
+ Integer money = jsonObject.getInt("money");
|
|
|
+
|
|
|
CtWingDto.OrderRFPFlowDto orderRFPFlowDto = new CtWingDto.OrderRFPFlowDto();
|
|
|
orderRFPFlowDto.setFlowValue(dto.getPackCode()).setIccid(dto.getIccid());
|
|
|
CtWingVo.BaseVo baseVo = CtWingUtils.orderRFPFlow(orderRFPFlowDto);
|
|
|
if ("0".equals(baseVo.getResultCode())) {
|
|
|
+ //保存记录
|
|
|
+ DeviceSimPickRecordsDto.Save recordsDto = new DeviceSimPickRecordsDto.Save()
|
|
|
+ .setPackCode(dto.getPackCode())
|
|
|
+ .setIcp(dto.getIsp())
|
|
|
+ .setIccid(dto.getIccid())
|
|
|
+ .setName(name)
|
|
|
+ .setAmount(money)
|
|
|
+ .setDeviceId(dto.getDeviceId())
|
|
|
+ .setMercId(deviceInfo.getMercId());
|
|
|
+ simPickRecordsService.save(recordsDto);
|
|
|
log.info("");
|
|
|
return R.ok("订购成功!");
|
|
|
} else {
|