mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-07 23:48:05 +08:00
新增 更新sim卡信息V2
This commit is contained in:
@@ -94,4 +94,6 @@ public interface PileSimInfoMapper {
|
|||||||
PileSimInfo getBasicInfoByIccId(@Param("iccId") String iccId);
|
PileSimInfo getBasicInfoByIccId(@Param("iccId") String iccId);
|
||||||
|
|
||||||
void updateSimCardInfoBatch(@Param("list") List<SimCardVO> list);
|
void updateSimCardInfoBatch(@Param("list") List<SimCardVO> list);
|
||||||
|
|
||||||
|
String selectIdByIccId(String iccId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3354,7 +3354,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
String merchantIdByAppId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(dto.getAppId());
|
String merchantIdByAppId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(dto.getAppId());
|
||||||
String merchantIdByMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(stationInfo.getMerchantId());
|
String merchantIdByMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(stationInfo.getMerchantId());
|
||||||
if (!StringUtils.equals(merchantIdByAppId, merchantIdByMerchantId)) {
|
if (!StringUtils.equals(merchantIdByAppId, merchantIdByMerchantId)) {
|
||||||
throw new BusinessException("", "当前桩运营商与小程序所属运营商不一致");
|
throw new BusinessException("", "当前桩运营商与小程序所属运营商不一致");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.jsowell.pile.dto.QueryPileDTO;
|
|||||||
import com.jsowell.pile.dto.ReplaceMerchantStationDTO;
|
import com.jsowell.pile.dto.ReplaceMerchantStationDTO;
|
||||||
import com.jsowell.pile.mapper.PileBasicInfoMapper;
|
import com.jsowell.pile.mapper.PileBasicInfoMapper;
|
||||||
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
||||||
|
import com.jsowell.pile.mapper.PileSimInfoMapper;
|
||||||
import com.jsowell.pile.service.*;
|
import com.jsowell.pile.service.*;
|
||||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||||
@@ -74,6 +75,9 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SimCardService simCardService;
|
private SimCardService simCardService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileSimInfoMapper pileSimInfoMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PileMerchantInfoMapper pileMerchantInfoMapper;
|
private PileMerchantInfoMapper pileMerchantInfoMapper;
|
||||||
|
|
||||||
@@ -550,6 +554,57 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
|
|||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatePileSimInfoV2(String pileSn, String iccid) {
|
||||||
|
// 清缓存
|
||||||
|
cleanRedisCache(pileSn);
|
||||||
|
PileBasicInfo basicInfo = selectPileBasicInfoBySN(pileSn);
|
||||||
|
if (basicInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 去卡运营商查询流量等信息
|
||||||
|
List<SimCardVO> simCardVOS = simCardService.searchByLoop(Lists.newArrayList(iccid));
|
||||||
|
// 查询数据库中是否有此卡
|
||||||
|
PileSimInfo simInfo = pileSimInfoService.getBasicInfoByIccId(iccid);
|
||||||
|
|
||||||
|
SimCardVO simCardVO = null;
|
||||||
|
if (CollectionUtils.isEmpty(simCardVOS)) {
|
||||||
|
// 已对接的卡商没有信息
|
||||||
|
if (simInfo == null) {
|
||||||
|
// 数据库中也没有此卡信息,说明为新卡,新增一条卡数据
|
||||||
|
simInfo = PileSimInfo.builder()
|
||||||
|
.iccid(iccid)
|
||||||
|
.build();
|
||||||
|
pileSimInfoService.insertPileSimInfo(simInfo);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// 卡商有信息,先获取最新信息
|
||||||
|
simCardVO = simCardVOS.get(0);
|
||||||
|
PileSimInfo simBasicInfo = PileSimInfo.builder()
|
||||||
|
.iccid(iccid)
|
||||||
|
.name(simCardVO.getName())
|
||||||
|
.simSupplier(simCardVO.getSimCardFactory())
|
||||||
|
.expireTime(DateUtils.parseDate(simCardVO.getExpiredTime()))
|
||||||
|
.operator(simCardVO.getSimCardOperator())
|
||||||
|
.status(simCardVO.getSimCardStatus())
|
||||||
|
.surplusData(String.valueOf(simCardVO.getResidualFlowRate()))
|
||||||
|
.totalData(String.valueOf(simCardVO.getPackageCapacity()))
|
||||||
|
.build();
|
||||||
|
if (simInfo == null) {
|
||||||
|
// 数据库中没有此卡,新增
|
||||||
|
pileSimInfoService.insertPileSimInfo(simBasicInfo);
|
||||||
|
}else {
|
||||||
|
// 更新
|
||||||
|
pileSimInfoService.updatePileSimInfo(simBasicInfo);
|
||||||
|
}
|
||||||
|
// 再根据iccid查询当前卡id
|
||||||
|
String simId = pileSimInfoMapper.selectIdByIccId(iccid);
|
||||||
|
basicInfo.setSimId(Long.parseLong(simId));
|
||||||
|
}
|
||||||
|
// 统一更新桩基本信息表
|
||||||
|
updateSimInfo(basicInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePileSimInfo(String pileSn, String iccid) {
|
public void updatePileSimInfo(String pileSn, String iccid) {
|
||||||
// 清缓存
|
// 清缓存
|
||||||
|
|||||||
@@ -203,4 +203,8 @@
|
|||||||
where iccid = #{simCardVO.iccId}
|
where iccid = #{simCardVO.iccId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectIdByIccId" resultType="java.lang.String">
|
||||||
|
select id from pile_sim_info where iccid = #{iccId,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user