lngStation转换

This commit is contained in:
2025-12-03 16:23:50 +08:00
parent c3fcb176e1
commit 7f906bdbb2
6 changed files with 101 additions and 9 deletions

View File

@ -0,0 +1,24 @@
package com.xjrsoft.module.mdm.client;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant;
/**
* @author: ksy
* @since: 2025/11/5
*/
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/tran/lngStation")
public interface ILngStationClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id);
}

View File

@ -44,6 +44,7 @@ public class LngBPngLinePageVo {
* 自有接收站(惠州/阳江) * 自有接收站(惠州/阳江)
*/ */
@ApiModelProperty("自有接收站(惠州/阳江)") @ApiModelProperty("自有接收站(惠州/阳江)")
@Trans(type = TransType.LNG_STATION)
private String staCodeLng; private String staCodeLng;
/** /**
* 显示顺序 * 显示顺序

View File

@ -0,0 +1,50 @@
package com.xjrsoft.module.mdm.client;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.ILNGStationService;
import lombok.AllArgsConstructor;
/**
* @author: yjw
* @since: 2025/3/5
*/
//@Api(hidden = true)
@RestController
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/tran/lngStation")
@AllArgsConstructor
public class LngStationClientImpl implements ILngStationClient {
private final ILNGStationService lngStationService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngBStationLng> list = lngStationService.list();
return list.stream().collect(Collectors.toMap(LngBStationLng::getCode,LngBStationLng::getFullName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById")
@Override
public String getTranById(@RequestParam("id")String code) {
LngBStationLng region = lngStationService.getByCode(code);
return region!=null?region.getFullName():null;
}
}

View File

@ -23,4 +23,6 @@ public interface ILNGStationService extends IService<LngBStationLng> {
boolean enable(@Valid List<Long> ids); boolean enable(@Valid List<Long> ids);
boolean disable(@Valid List<Long> ids); boolean disable(@Valid List<Long> ids);
LngBStationLng getByCode(String code);
} }

View File

@ -17,7 +17,6 @@ import com.pictc.utils.CollectionUtils;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TreeUtil; import com.xjrsoft.common.utils.TreeUtil;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.enums.CountryRegionEnum;
import com.xjrsoft.module.mdm.mapper.LngBRegionMapper; import com.xjrsoft.module.mdm.mapper.LngBRegionMapper;
import com.xjrsoft.module.mdm.service.ICountryRegionService; import com.xjrsoft.module.mdm.service.ICountryRegionService;
import com.xjrsoft.module.mdm.vo.LngBRegionTreeVo; import com.xjrsoft.module.mdm.vo.LngBRegionTreeVo;
@ -60,7 +59,8 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
} }
LambdaQueryWrapper<LngBRegion> tempQw = Wrappers.<LngBRegion>query().lambda() LambdaQueryWrapper<LngBRegion> tempQw = Wrappers.<LngBRegion>query().lambda()
.notIn(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeTypeList); .notIn(StringUtils.isNotBlank(excludeType),LngBRegion::getRegionTypeCode, excludeTypeList)
.orderByAsc(LngBRegion::getCode);
//.eq(StringUtils.isNotBlank(startPCode),LngBRegion::getCode, startPCode); //.eq(StringUtils.isNotBlank(startPCode),LngBRegion::getCode, startPCode);
List<LngBRegion> allList = this.list(tempQw); List<LngBRegion> allList = this.list(tempQw);
Map<Long,LngBRegion> map = allList.stream().collect(Collectors.toMap(LngBRegion::getId, Map<Long,LngBRegion> map = allList.stream().collect(Collectors.toMap(LngBRegion::getId,
@ -145,7 +145,7 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
.in(pid == null, LngBRegion::getPid, pidList) .in(pid == null, LngBRegion::getPid, pidList)
.and(StrUtil.isNotBlank(keyword), x -> { .and(StrUtil.isNotBlank(keyword), x -> {
x.like(StrUtil.isNotBlank(keyword), LngBRegion::getFullName, keyword); x.like(StrUtil.isNotBlank(keyword), LngBRegion::getFullName, keyword);
})); }).orderByAsc(LngBRegion::getCode));
List<LngBRegionVo> voList = CollectionUtils.newArrayList(); List<LngBRegionVo> voList = CollectionUtils.newArrayList();
if(regionList != null && regionList.size() > 0) { if(regionList != null && regionList.size() > 0) {

View File

@ -1,5 +1,12 @@
package com.xjrsoft.module.mdm.service.impl; package com.xjrsoft.module.mdm.service.impl;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pictc.constant.FieldNameConstants; import com.pictc.constant.FieldNameConstants;
@ -7,6 +14,8 @@ import com.pictc.constant.TableNameConstants;
import com.pictc.enums.BusinessCode; import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode; import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.DataLogTools; import com.pictc.utils.DataLogTools;
import com.xjrsoft.common.advice.tran.LngStationDataProvider;
import com.xjrsoft.common.advice.tran.RegionDataProvider;
import com.xjrsoft.common.exception.BusinessException; import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.module.common.db.service.CommonCallService; import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.mdm.dto.UpdateLngBStationLngDto; import com.xjrsoft.module.mdm.dto.UpdateLngBStationLngDto;
@ -14,13 +23,8 @@ import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.mapper.LngBStationLngMapper; import com.xjrsoft.module.mdm.mapper.LngBStationLngMapper;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.service.ILNGStationService;
import com.xjrsoft.module.system.client.ICodeRuleClient; import com.xjrsoft.module.system.client.ICodeRuleClient;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import lombok.AllArgsConstructor;
import java.util.Objects;
/** /**
* @title: service * @title: service
@ -38,6 +42,8 @@ public class LNGStationServiceImpl extends ServiceImpl<LngBStationLngMapper, Lng
private final String STATIONCODE = "stationCode"; private final String STATIONCODE = "stationCode";
private final LngStationDataProvider tranProvider;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBStationLngDto dto) { public Long add(UpdateLngBStationLngDto dto) {
@ -46,6 +52,7 @@ public class LNGStationServiceImpl extends ServiceImpl<LngBStationLngMapper, Lng
UpdateLngBStationLngDto res = DataLogTools.insert(dto); UpdateLngBStationLngDto res = DataLogTools.insert(dto);
codeRuleClient.useEncode(STATIONCODE); codeRuleClient.useEncode(STATIONCODE);
this.addOrUpdateAfter(res.getId()); this.addOrUpdateAfter(res.getId());
tranProvider.saveData(dto.getCode(), dto.getFullName());
return res.getId(); return res.getId();
} }
@ -79,6 +86,7 @@ public class LNGStationServiceImpl extends ServiceImpl<LngBStationLngMapper, Lng
this.checkParams(dto); this.checkParams(dto);
DataLogTools.update(dto); DataLogTools.update(dto);
this.addOrUpdateAfter(dto.getId()); this.addOrUpdateAfter(dto.getId());
tranProvider.saveData(dto.getCode(), dto.getFullName());
return true; return true;
} }
@ -107,4 +115,11 @@ public class LNGStationServiceImpl extends ServiceImpl<LngBStationLngMapper, Lng
} }
return true; return true;
} }
@Override
public LngBStationLng getByCode(String code) {
LambdaQueryWrapper<LngBStationLng> queryWrapper = new LambdaQueryWrapper<LngBStationLng>();
queryWrapper.eq(LngBStationLng::getCode,code);
return baseMapper.selectOne(queryWrapper);
}
} }