港口、气源地新增
This commit is contained in:
@ -16,8 +16,22 @@ public interface TableNameConstants {
|
||||
* 币种表
|
||||
*/
|
||||
String LNG_B_CURRENCY = "lng_b_currency";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 币种表
|
||||
*/
|
||||
String LNG_B_CURRENCY = "lng_b_currency";
|
||||
|
||||
/**
|
||||
* 港口表
|
||||
*/
|
||||
String LNG_B_PORT = "lng_b_port";
|
||||
|
||||
/**
|
||||
* LNG气源地表
|
||||
*/
|
||||
String LNG_B_STATION_LNG = "lng_b_station_lng";
|
||||
|
||||
/**
|
||||
* 银行表
|
||||
*/
|
||||
|
||||
@ -51,9 +51,10 @@ public class CurrencyController {
|
||||
r.like(LngBCurrency::getCode, dto.getFullName())
|
||||
.or()
|
||||
.like(LngBCurrency::getFullName, dto.getFullName()))
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()),LngBCurrency::getValid,dto.getValid())
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()), LngBCurrency::getValid, dto.getValid())
|
||||
.orderByAsc(LngBCurrency::getSort, LngBCurrency::getCode)
|
||||
.select(LngBCurrency.class,x -> VoToColumnUtil.fieldsToColumns(LngBCurrencyPageVo.class).contains(x.getProperty()));
|
||||
.select(LngBCurrency.class,x -> VoToColumnUtil.fieldsToColumns(LngBCurrencyPageVo.class)
|
||||
.contains(x.getProperty()));
|
||||
IPage<LngBCurrency> page = currencyService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngBCurrencyPageVo> pageOutput = ConventPage.getPageOutput(page, LngBCurrencyPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
|
||||
@ -1,27 +1,21 @@
|
||||
package com.xjrsoft.module.mdm.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.mdm.dto.AddLngBStationLngDto;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBStationLngDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.mdm.dto.LngBStationLngPageDto;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBStationLngDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBStationLng;
|
||||
import com.xjrsoft.module.mdm.service.ILNGStationService;
|
||||
import com.xjrsoft.module.mdm.vo.LngBStationLngPageVo;
|
||||
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.mdm.vo.LngBStationLngVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -29,7 +23,6 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -52,25 +45,13 @@ public class LNGStationController {
|
||||
@ApiOperation(value="LngBStationLng列表(分页)")
|
||||
@SaCheckPermission("lNGStation:list")
|
||||
public R page(@Valid LngBStationLngPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngBStationLng> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getCode()),LngBStationLng::getCode,dto.getCode())
|
||||
.like(StrUtil.isNotBlank(dto.getFullName()),LngBStationLng::getFullName,dto.getFullName())
|
||||
.like(StrUtil.isNotBlank(dto.getEnterprise()),LngBStationLng::getEnterprise,dto.getEnterprise())
|
||||
.like(StrUtil.isNotBlank(dto.getContact()),LngBStationLng::getContact,dto.getContact())
|
||||
.like(StrUtil.isNotBlank(dto.getTel()),LngBStationLng::getTel,dto.getTel())
|
||||
.like(StrUtil.isNotBlank(dto.getEmail()),LngBStationLng::getEmail,dto.getEmail())
|
||||
.like(StrUtil.isNotBlank(dto.getRegionCode()),LngBStationLng::getRegionCode,dto.getRegionCode())
|
||||
.like(StrUtil.isNotBlank(dto.getAddr()),LngBStationLng::getAddr,dto.getAddr())
|
||||
.like(StrUtil.isNotBlank(dto.getAddrMail()),LngBStationLng::getAddrMail,dto.getAddrMail())
|
||||
.like(StrUtil.isNotBlank(dto.getOwnSign()),LngBStationLng::getOwnSign,dto.getOwnSign())
|
||||
.like(StrUtil.isNotBlank(dto.getOnlineSign()),LngBStationLng::getOnlineSign,dto.getOnlineSign())
|
||||
.like(StrUtil.isNotBlank(dto.getSort()),LngBStationLng::getSort,dto.getSort())
|
||||
.like(StrUtil.isNotBlank(dto.getValid()),LngBStationLng::getValid,dto.getValid())
|
||||
.like(StrUtil.isNotBlank(dto.getNote()),LngBStationLng::getNote,dto.getNote())
|
||||
.orderByAsc(LngBStationLng::getCode)
|
||||
.select(LngBStationLng.class,x -> VoToColumnUtil.fieldsToColumns(LngBStationLngPageVo.class).contains(x.getProperty()));
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()),LngBStationLng::getValid,dto.getValid())
|
||||
.orderByAsc(LngBStationLng::getSort, LngBStationLng::getCode)
|
||||
.select(LngBStationLng.class,x -> VoToColumnUtil.fieldsToColumns(LngBStationLngPageVo.class)
|
||||
.contains(x.getProperty()));
|
||||
IPage<LngBStationLng> page = lNGStationService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngBStationLngPageVo> pageOutput = ConventPage.getPageOutput(page, LngBStationLngPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
@ -86,29 +67,47 @@ public class LNGStationController {
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngBStationLng, LngBStationLngVo.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngBStationLng")
|
||||
@SaCheckPermission("lNGStation:add")
|
||||
public R add(@Valid @RequestBody UpdateLngBStationLngDto dto){
|
||||
UpdateLngBStationLngDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
return R.ok(lNGStationService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngBStationLng")
|
||||
@SaCheckPermission("lNGStation:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngBStationLngDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
return R.ok(lNGStationService.updateByDTO(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("lNGStation:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngBStationLngDto.class, ids));
|
||||
|
||||
return R.ok(dataService.deleteByIds(UpdateLngBStationLngDto.class, ids));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngBStationLng数据详细日志")
|
||||
@SaCheckPermission("lNGStation:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngBStationLngDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
@PostMapping("/enable")
|
||||
@ApiOperation(value = "启用LngBStationLng")
|
||||
@SaCheckPermission("lNGStation:enable")
|
||||
public R enable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(lNGStationService.enable(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/disable")
|
||||
@ApiOperation(value = "禁用LngBStationLng")
|
||||
@SaCheckPermission("lNGStation:disable")
|
||||
public R disable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(lNGStationService.disable(ids));
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,21 @@
|
||||
package com.xjrsoft.module.mdm.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.mdm.dto.AddLngBPortDto;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBPortDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.mdm.dto.LngBPortPageDto;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBPortDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBPort;
|
||||
import com.xjrsoft.module.mdm.service.IPortService;
|
||||
import com.xjrsoft.module.mdm.vo.LngBPortPageVo;
|
||||
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.mdm.vo.LngBPortVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -29,7 +23,6 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -52,25 +45,16 @@ public class PortController {
|
||||
@ApiOperation(value="LngBPort列表(分页)")
|
||||
@SaCheckPermission("port:list")
|
||||
public R page(@Valid LngBPortPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngBPort> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getFullName()),LngBPort::getFullName,dto.getFullName())
|
||||
.like(StrUtil.isNotBlank(dto.getValid()),LngBPort::getValid,dto.getValid())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()),LngBPort::getCode,dto.getCode())
|
||||
.like(StrUtil.isNotBlank(dto.getShortName()),LngBPort::getShortName,dto.getShortName())
|
||||
.like(StrUtil.isNotBlank(dto.getRegionCode()),LngBPort::getRegionCode,dto.getRegionCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getCapacity()),LngBPort::getCapacity,dto.getCapacity())
|
||||
.eq(ObjectUtil.isNotNull(dto.getLongitude()),LngBPort::getLongitude,dto.getLongitude())
|
||||
.eq(ObjectUtil.isNotNull(dto.getLatitude()),LngBPort::getLatitude,dto.getLatitude())
|
||||
.like(StrUtil.isNotBlank(dto.getLimit1()),LngBPort::getLimit1,dto.getLimit1())
|
||||
.like(StrUtil.isNotBlank(dto.getLimit2()),LngBPort::getLimit2,dto.getLimit2())
|
||||
.like(StrUtil.isNotBlank(dto.getLimit3()),LngBPort::getLimit3,dto.getLimit3())
|
||||
.like(StrUtil.isNotBlank(dto.getLimit4()),LngBPort::getLimit4,dto.getLimit4())
|
||||
.like(StrUtil.isNotBlank(dto.getSort()),LngBPort::getSort,dto.getSort())
|
||||
.like(StrUtil.isNotBlank(dto.getNote()),LngBPort::getNote,dto.getNote())
|
||||
.orderByDesc(LngBPort::getId)
|
||||
.select(LngBPort.class,x -> VoToColumnUtil.fieldsToColumns(LngBPortPageVo.class).contains(x.getProperty()));
|
||||
.and(StrUtil.isNotBlank(dto.getFullName()), r ->
|
||||
r.like(LngBPort::getShortName, dto.getFullName())
|
||||
.or()
|
||||
.like(LngBPort::getFullName, dto.getFullName()))
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()), LngBPort::getValid, dto.getValid())
|
||||
.orderByAsc(LngBPort::getSort, LngBPort::getCode)
|
||||
.select(LngBPort.class,x -> VoToColumnUtil.fieldsToColumns(LngBPortPageVo.class)
|
||||
.contains(x.getProperty()));
|
||||
IPage<LngBPort> page = portService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngBPortPageVo> pageOutput = ConventPage.getPageOutput(page, LngBPortPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
@ -87,28 +71,46 @@ public class PortController {
|
||||
return R.ok(BeanUtil.toBean(lngBPort, LngBPortVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngBPort")
|
||||
@SaCheckPermission("port:add")
|
||||
public R add(@Valid @RequestBody UpdateLngBPortDto dto){
|
||||
UpdateLngBPortDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
return R.ok(portService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngBPort")
|
||||
@SaCheckPermission("port:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngBPortDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
return R.ok(portService.updateByDTO(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("port:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngBPortDto.class, ids));
|
||||
|
||||
return R.ok(dataService.deleteByIds(UpdateLngBPortDto.class, ids));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngBPort数据详细日志")
|
||||
@SaCheckPermission("port:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngBPortDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
@PostMapping("/enable")
|
||||
@ApiOperation(value = "启用LngBPort")
|
||||
@SaCheckPermission("port:enable")
|
||||
public R enable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(portService.enable(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/disable")
|
||||
@ApiOperation(value = "禁用LngBPort")
|
||||
@SaCheckPermission("port:disable")
|
||||
public R disable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(portService.disable(ids));
|
||||
}
|
||||
}
|
||||
@ -51,9 +51,10 @@ public class PriceTermsController {
|
||||
r.like(LngBPriceTerm::getCode, dto.getFullName())
|
||||
.or()
|
||||
.like(LngBPriceTerm::getFullName, dto.getFullName()))
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()),LngBPriceTerm::getValid,dto.getValid())
|
||||
.orderByAsc(LngBPriceTerm::getSort, LngBPriceTerm::getCode)
|
||||
.select(LngBPriceTerm.class,x -> VoToColumnUtil.fieldsToColumns(LngBPriceTermPageVo.class).contains(x.getProperty()));
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()), LngBPriceTerm::getValid, dto.getValid())
|
||||
.orderByAsc(LngBPriceTerm::getSort, LngBPriceTerm::getCode)
|
||||
.select(LngBPriceTerm.class,x -> VoToColumnUtil.fieldsToColumns(LngBPriceTermPageVo.class)
|
||||
.contains(x.getProperty()));
|
||||
IPage<LngBPriceTerm> page = priceTermsService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngBPriceTermPageVo> pageOutput = ConventPage.getPageOutput(page, LngBPriceTermPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
package com.xjrsoft.module.mdm.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBStationLngDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBStationLng;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -16,4 +15,12 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public interface ILNGStationService extends IService<LngBStationLng> {
|
||||
|
||||
Long add(@Valid UpdateLngBStationLngDto dto);
|
||||
|
||||
boolean updateByDTO(@Valid UpdateLngBStationLngDto dto);
|
||||
|
||||
boolean enable(@Valid List<Long> ids);
|
||||
|
||||
boolean disable(@Valid List<Long> ids);
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
package com.xjrsoft.module.mdm.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBPortDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBPort;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -16,4 +15,12 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public interface IPortService extends IService<LngBPort> {
|
||||
|
||||
Long add(@Valid UpdateLngBPortDto dto);
|
||||
|
||||
boolean updateByDTO(@Valid UpdateLngBPortDto dto);
|
||||
|
||||
boolean enable(@Valid List<Long> ids);
|
||||
|
||||
boolean disable(@Valid List<Long> ids);
|
||||
}
|
||||
|
||||
@ -1,17 +1,26 @@
|
||||
package com.xjrsoft.module.mdm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.pictc.constant.FieldNameConstants;
|
||||
import com.pictc.constant.TableNameConstants;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.pictc.enums.ExceptionCommonCode;
|
||||
import com.pictc.utils.DataLogTools;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.module.common.db.service.CommonCallService;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBStationLngDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBStationLng;
|
||||
import com.xjrsoft.module.mdm.mapper.LngBStationLngMapper;
|
||||
import com.xjrsoft.module.mdm.service.ILNGStationService;
|
||||
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 java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -22,4 +31,80 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class LNGStationServiceImpl extends ServiceImpl<LngBStationLngMapper, LngBStationLng> implements ILNGStationService {
|
||||
|
||||
private final CommonCallService commonCallService;
|
||||
|
||||
private final ICodeRuleClient codeRuleClient;
|
||||
|
||||
private final String STATIONCODE = "stationCode";
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long add(UpdateLngBStationLngDto dto) {
|
||||
this.checkParams(dto);
|
||||
dto.setCode(codeRuleClient.genEncode(STATIONCODE));
|
||||
UpdateLngBStationLngDto res = DataLogTools.insert(dto);
|
||||
codeRuleClient.useEncode(STATIONCODE);
|
||||
this.addOrUpdateAfter(res.getId());
|
||||
return res.getId();
|
||||
}
|
||||
|
||||
private void checkParams(UpdateLngBStationLngDto dto) {
|
||||
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBStationLng>()
|
||||
.eq(LngBStationLng::getCode, dto.getCode())
|
||||
.ne(!Objects.isNull(dto.getId()), LngBStationLng::getId, dto.getId()));
|
||||
if (codeCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.CODE));
|
||||
}
|
||||
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBStationLng>()
|
||||
.eq(LngBStationLng::getFullName, dto.getFullName())
|
||||
.ne(!Objects.isNull(dto.getId()), LngBStationLng::getId, dto.getId()));
|
||||
if (nameCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.FULL_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
private void addOrUpdateAfter(Long id) {
|
||||
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_STATION_LNG, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateByDTO(UpdateLngBStationLngDto dto) {
|
||||
this.checkParams(dto);
|
||||
DataLogTools.update(dto);
|
||||
this.addOrUpdateAfter(dto.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean enable(List<Long> ids) {
|
||||
DataLogTools.enable(UpdateLngBStationLngDto.class, ids);
|
||||
for (Long id : ids) {
|
||||
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_STATION_LNG, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean disable(List<Long> ids) {
|
||||
DataLogTools.disable(UpdateLngBStationLngDto.class, ids);
|
||||
for (Long id : ids) {
|
||||
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_STATION_LNG, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,26 @@
|
||||
package com.xjrsoft.module.mdm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.pictc.constant.FieldNameConstants;
|
||||
import com.pictc.constant.TableNameConstants;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.pictc.enums.ExceptionCommonCode;
|
||||
import com.pictc.utils.DataLogTools;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.module.common.db.service.CommonCallService;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBPortDto;
|
||||
import com.xjrsoft.module.mdm.entity.LngBPort;
|
||||
import com.xjrsoft.module.mdm.mapper.LngBPortMapper;
|
||||
import com.xjrsoft.module.mdm.service.IPortService;
|
||||
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 java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -22,4 +31,87 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PortServiceImpl extends ServiceImpl<LngBPortMapper, LngBPort> implements IPortService {
|
||||
|
||||
private final CommonCallService commonCallService;
|
||||
|
||||
private final ICodeRuleClient codeRuleClient;
|
||||
|
||||
private final String PORTCODE = "portCode";
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long add(UpdateLngBPortDto dto) {
|
||||
this.checkParams(dto);
|
||||
dto.setCode(codeRuleClient.genEncode(PORTCODE));
|
||||
UpdateLngBPortDto res = DataLogTools.insert(dto);
|
||||
codeRuleClient.useEncode(PORTCODE);
|
||||
this.addOrUpdateAfter(res.getId());
|
||||
return res.getId();
|
||||
}
|
||||
|
||||
private void checkParams(UpdateLngBPortDto dto) {
|
||||
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPort>()
|
||||
.eq(LngBPort::getCode, dto.getCode())
|
||||
.ne(!Objects.isNull(dto.getId()), LngBPort::getId, dto.getId()));
|
||||
if (codeCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.CODE));
|
||||
}
|
||||
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPort>()
|
||||
.eq(LngBPort::getFullName, dto.getFullName())
|
||||
.ne(!Objects.isNull(dto.getId()), LngBPort::getId, dto.getId()));
|
||||
if (nameCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.FULL_NAME));
|
||||
}
|
||||
Long shotNameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBPort>()
|
||||
.eq(LngBPort::getShortName, dto.getShortName())
|
||||
.ne(!Objects.isNull(dto.getId()), LngBPort::getId, dto.getId()));
|
||||
if (shotNameCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.SHORT_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
private void addOrUpdateAfter(Long id) {
|
||||
String msg = commonCallService.saveAfter(TableNameConstants.LNG_B_PORT, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateByDTO(UpdateLngBPortDto dto) {
|
||||
this.checkParams(dto);
|
||||
DataLogTools.update(dto);
|
||||
this.addOrUpdateAfter(dto.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean enable(List<Long> ids) {
|
||||
DataLogTools.enable(UpdateLngBPortDto.class, ids);
|
||||
for (Long id : ids) {
|
||||
String msg = commonCallService.enableBefore(TableNameConstants.LNG_B_PORT, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean disable(List<Long> ids) {
|
||||
DataLogTools.disable(UpdateLngBPortDto.class, ids);
|
||||
for (Long id : ids) {
|
||||
String msg = commonCallService.disableBefore(TableNameConstants.LNG_B_PORT, id);
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user