提交 5db01ee2 authored 作者: jiangwenye's avatar jiangwenye

平台账户配置

上级 b6f799fc
package com.clx.performance.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
public enum PlatformAccountConfigEnum {
;
@Getter
@AllArgsConstructor
public enum InvoiceType {
ONLINE(1, "网运单"),
ORDINARY(2, "普通单");
private final Integer code;
private final String msg;
public static Optional<InvoiceType> getByCode(int code) {
return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findFirst();
}
public static String getMsgByCode(int code) {
return getByCode(code).map(InvoiceType::getMsg).orElse(null);
}
}
@Getter
@AllArgsConstructor
public enum BusinessType {
SETTLE(1, "结算单"),
BREAK(2, "违约结算单"),
RECHARGE(3, "充值"),
WITHDRAWAL(4, "提现");
private final Integer code;
private final String msg;
public static Optional<BusinessType> getByCode(int code) {
return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findFirst();
}
public static String getMsgByCode(int code) {
return getByCode(code).map(BusinessType::getMsg).orElse(null);
}
}
@Getter
@AllArgsConstructor
public enum OwnerType {
COMPANY(1, "企业"),
PERSON(2, "个人");
private final Integer code;
private final String msg;
public static Optional<OwnerType> getByCode(int code) {
return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findFirst();
}
public static String getMsgByCode(int code) {
return getByCode(code).map(OwnerType::getMsg).orElse(null);
}
}
@Getter
@AllArgsConstructor
public enum ConfigRange {
COLLECTION(1, "收款账户"),
PAY(2, "付款账户");
private final Integer code;
private final String msg;
public static Optional<ConfigRange> getByCode(int code) {
return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findFirst();
}
public static String getMsgByCode(int code) {
return getByCode(code).map(ConfigRange::getMsg).orElse(null);
}
}
}
package com.clx.performance.param.pc.carrier;
import com.msl.common.base.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* @ClassName PageCarrierSettlementOwnerParam
* @Description
* @Author jiangwenye
* @Date 2024/01/25 13:25
* @Version 1.0
*/
@Getter
@Setter
public class PagePlatformAccountConfigParam extends PageParam {
@ApiModelProperty(value = "应用场景 1-结算单,2-违约结算单,3-充值,4-提现", example = "1")
private Integer businessType;
@ApiModelProperty(value = "货主类型 1-企业,2-个人", example = "2")
private Integer ownerType;
}
package com.clx.performance.param.pc.carrier;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SavePlatformAccountConfigParam {
@ApiModelProperty(value = "id")
private Integer Id;
@ApiModelProperty(value = "应用场景 1-结算单,2-违约结算单,3-充值,4-提现")
private Integer businessType;
@ApiModelProperty(value = "货主类型 1-企业,2-个人")
private Integer ownerType;
@ApiModelProperty(value = "开票标识:1网运单 2普通单")
private Integer invoiceType;
@ApiModelProperty(value = "开票公司id")
private Integer invoiceCompanyId;
@ApiModelProperty(value = "开票公司名称")
private String invoiceCompanyName;
@ApiModelProperty(value = "配置范围:1收款账户 2付款账户")
private Integer configRange;
@ApiModelProperty(value = "公司名称")
private String companyName;
@ApiModelProperty(value = "银行名称")
private String bankName;
@ApiModelProperty(value = "开户行")
private String openBank;
@ApiModelProperty(value = "银行编码")
private String bankCode;
@ApiModelProperty(value = "银行账号")
private String bankCardNo;
}
package com.clx.performance.vo.pc.carrier.settle;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* @Description
* @Author jiangwenye
* @Date 2024/01/25 15:01
* @Version 1.0
*/
@Getter
@Setter
public class CarrierPagePlatformAccountConfigVO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "应用场景 1-结算单,2-违约结算单,3-充值,4-提现")
private Integer businessType;
@ApiModelProperty(value = "应用场景")
private String businessTypeMsg;
@ApiModelProperty(value = "货主类型 1-企业,2-个人")
private Integer ownerType;
@ApiModelProperty(value = "货主类型")
private String ownerTypeMsg;
@ApiModelProperty(value = "开票标识:1网运单 2普通单")
private Integer invoiceType;
@ApiModelProperty(value = "开票标识")
private String invoiceTypeMsg;
@ApiModelProperty(value = "开票公司id")
private Integer invoiceCompanyId;
@ApiModelProperty(value = "开票公司名称")
private String invoiceCompanyName;
@ApiModelProperty(value = "配置范围:1收款账户 2付款账户")
private Integer configRange;
@ApiModelProperty(value = "配置范围")
private String configRangeMsg;
@ApiModelProperty(value = "公司名称")
private String companyName;
@ApiModelProperty(value = "银行名称")
private String bankName;
@ApiModelProperty(value = "开户行")
private String openBank;
@ApiModelProperty(value = "银行编码")
private String bankCode;
@ApiModelProperty(value = "银行账号")
private String bankCardNo;
@ApiModelProperty(value = "删除状态: 0-否;1-是")
private Integer deleteStatus;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "修改时间")
private String modifiedTime;
}
package com.clx.performance.controller.pc.carrier;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.clx.performance.param.pc.carrier.SavePlatformAccountConfigParam;
import com.clx.performance.service.PlatformAccountConfigService;
import com.clx.performance.vo.pc.carrier.settle.*;
import com.msl.common.base.PageData;
import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
@Slf4j
@RestController
@RequestMapping(value="/pc/carrier/platformAccountConfig")
@Validated
@Api(tags = "承运端-平台账户配置")
@AllArgsConstructor
public class PlatformAccountConfigController {
private final PlatformAccountConfigService platformAccountConfigService;
@ApiOperation(value = "平台账户配置列表",notes = "<br>By:姜文业")
@PostMapping("/pagePlatformAccountConfig")
@UnitCovert(param = false)
public Result<PageData<CarrierPagePlatformAccountConfigVO>> pagePlatformAccountConfig(@RequestBody @Validated PagePlatformAccountConfigParam param) {
IPage<CarrierPagePlatformAccountConfigVO> page = platformAccountConfigService.pagePlatformAccountConfig(param);
return Result.page(page.getRecords(),page.getTotal(),page.getPages());
}
@ApiOperation(value = "平台账户配置详情",notes = "<br>By:姜文业")
@GetMapping("/getPlatformAccountConfigDetail")
@UnitCovert(param = false)
public Result<CarrierPagePlatformAccountConfigVO> getPlatformAccountConfigDetail(@NotNull(message = "id不能为空") Integer id) {
return Result.ok(platformAccountConfigService.getPlatformAccountConfigDetail(id));
}
@ApiOperation(value = "删除平台账户配置",notes = "<br>By:姜文业")
@GetMapping("/deletePlatformAccountConfig")
@UnitCovert(param = false)
public Result<CarrierPagePlatformAccountConfigVO> deletePlatformAccountConfig(@NotNull(message = "id不能为空") Integer id) {
platformAccountConfigService.deletePlatformAccountConfig(id);
return Result.ok();
}
@ApiOperation(value = "新增平台账户配置",notes = "<br>By:姜文业")
@PostMapping("/savePlatformAccountConfig")
public Result savePlatformAccountConfig(@RequestBody @Validated SavePlatformAccountConfigParam param) {
platformAccountConfigService.savePlatformAccountConfig(param);
return Result.ok();
}
@ApiOperation(value = "编辑平台账户配置",notes = "<br>By:姜文业")
@PostMapping("/updatePlatformAccountConfig")
public Result updatePlatformAccountConfig(@RequestBody @Validated SavePlatformAccountConfigParam param) {
platformAccountConfigService.updatePlatformAccountConfig(param);
return Result.ok();
}
}
package com.clx.performance.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.mapper.PlatformAccountConfigMapper;
import com.clx.performance.model.PlatformAccountConfig;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.msl.common.dao.BaseDao;
public interface PlatformAccountConfigDao extends BaseDao<PlatformAccountConfigMapper, PlatformAccountConfig, Integer> {
IPage<PlatformAccountConfig> pagePlatformAccountConfig(PagePlatformAccountConfigParam param);
boolean deletePlatformAccountConfig(Integer id);
boolean updatePlatformAccountConfig(PlatformAccountConfig platformAccountConfig);
}
package com.clx.performance.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.enums.DeleteStatusEnum;
import com.clx.performance.dao.PlatformAccountConfigDao;
import com.clx.performance.mapper.PlatformAccountConfigMapper;
import com.clx.performance.model.PlatformAccountConfig;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.Objects;
/**
* @Author: 姜文业
* @Description: 平台账户配置
* @Date: 2024-01-25 18:04:09
* @Version: 1.0
*/
@Repository
public class PlatformAccountConfigImpl extends BaseDaoImpl<PlatformAccountConfigMapper, PlatformAccountConfig, Integer> implements PlatformAccountConfigDao {
@Override
public IPage<PlatformAccountConfig> pagePlatformAccountConfig(PagePlatformAccountConfigParam param) {
LambdaQueryWrapper<PlatformAccountConfig> query = new LambdaQueryWrapper<>();
query.eq(PlatformAccountConfig :: getDeleteStatus, DeleteStatusEnum.YES.getCode());
if(Objects.nonNull(param.getBusinessType())){
query.eq(PlatformAccountConfig :: getBusinessType,param.getBusinessType());
}
if(Objects.nonNull(param.getOwnerType())){
query.eq(PlatformAccountConfig :: getOwnerType,param.getOwnerType());
}
query.orderByDesc(PlatformAccountConfig :: getModifiedTime);
return baseMapper.selectPage(Page.of(param.getPage(),param.getPageSize()),query);
}
@Override
public boolean deletePlatformAccountConfig(Integer id) {
return update(lUdWrapper()
.eq(PlatformAccountConfig::getId, id)
.set(PlatformAccountConfig::getDeleteStatus, DeleteStatusEnum.NO.getCode())
);
}
@Override
public boolean updatePlatformAccountConfig(PlatformAccountConfig config) {
return update(lUdWrapper()
.eq(PlatformAccountConfig::getId, config.getId())
.set(PlatformAccountConfig::getBusinessType, config.getBusinessType())
.set(PlatformAccountConfig::getOwnerType, config.getOwnerType())
.set(PlatformAccountConfig::getInvoiceType, config.getInvoiceType())
.set(PlatformAccountConfig::getInvoiceCompanyId, config.getInvoiceCompanyId())
.set(PlatformAccountConfig::getInvoiceCompanyName, config.getInvoiceCompanyName())
.set(PlatformAccountConfig::getConfigRange, config.getConfigRange())
.set(PlatformAccountConfig::getCompanyName, config.getCompanyName())
.set(PlatformAccountConfig::getBankName, config.getBankName())
.set(PlatformAccountConfig::getOpenBank, config.getOpenBank())
.set(PlatformAccountConfig::getBankCode, config.getBankCode())
.set(PlatformAccountConfig::getBankCardNo, config.getBankCardNo())
);
}
}
package com.clx.performance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.clx.performance.model.PlatformAccountConfig;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PlatformAccountConfigMapper extends BaseMapper<PlatformAccountConfig> {
}
package com.clx.performance.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
import com.msl.common.model.HasKey;
import lombok.*;
import java.time.LocalDateTime;
/**
* @Author: jiangwenye
* @Description: 平台账户配置
* @Date: 2024/01/25 17:46:48
* @Version: 1.0
*/
@Getter
@Setter
@NoArgsConstructor
@TableName(autoResultMap = true)
@Builder
@AllArgsConstructor
public class PlatformAccountConfig implements HasKey<Integer> {
@TableId(value = "id", type = IdType.AUTO)
private Integer id; //id
private Integer businessType; //应用场景 1-结算单,2-违约结算单,3-充值,4-提现
private Integer ownerType; //货主类型 1-企业,2-个人
private Integer invoiceType; //开票标识:1网运单 2普通单
private Integer invoiceCompanyId; //开票公司id
private String invoiceCompanyName; //开票公司名称
private Integer configRange; //配置范围:1收款账户 2付款账户
private String companyName; //公司名称
private String bankName; //银行名称
private String openBank; //开户行
private String bankCode; //银行编码
private String bankCardNo; //银行账号
private Integer deleteStatus; //删除状态: 0-否;1-是
private LocalDateTime createTime; //创建时间
private LocalDateTime modifiedTime; //修改时间
@KeyColumn("id")
@Override
public Integer gainKey() {
return id;
}
}
package com.clx.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.clx.performance.param.pc.carrier.SavePlatformAccountConfigParam;
import com.clx.performance.vo.pc.carrier.settle.*;
/**
* @author jiangwenye
* Date 2024-01-25
* Time 09:43
*/
public interface PlatformAccountConfigService {
IPage<CarrierPagePlatformAccountConfigVO> pagePlatformAccountConfig(PagePlatformAccountConfigParam param);
CarrierPagePlatformAccountConfigVO getPlatformAccountConfigDetail(Integer id);
void deletePlatformAccountConfig(Integer id);
void savePlatformAccountConfig(SavePlatformAccountConfigParam param);
void updatePlatformAccountConfig(SavePlatformAccountConfigParam config);
}
package com.clx.performance.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.enums.DeleteStatusEnum;
import com.clx.performance.dao.PlatformAccountConfigDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.PlatformAccountConfig;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.clx.performance.param.pc.carrier.SavePlatformAccountConfigParam;
import com.clx.performance.service.PlatformAccountConfigService;
import com.clx.performance.struct.PlatformAccountConfigStruct;
import com.clx.performance.vo.pc.carrier.settle.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author jiangwenye
* Date 2024-01-25
* Time 09:43
*/
@Slf4j
@Service
@AllArgsConstructor
public class PlatformAccountConfigServiceImpl implements PlatformAccountConfigService {
private final PlatformAccountConfigDao platformAccountConfigDao;
private final PlatformAccountConfigStruct platformAccountConfigStruct;
@Override
public IPage<CarrierPagePlatformAccountConfigVO> pagePlatformAccountConfig(PagePlatformAccountConfigParam param) {
IPage<PlatformAccountConfig> page = platformAccountConfigDao.pagePlatformAccountConfig(param);
List<CarrierPagePlatformAccountConfigVO> list = platformAccountConfigStruct.convertToVOList(page.getRecords());
return new Page<CarrierPagePlatformAccountConfigVO>().setRecords(list).setTotal(page.getTotal()).setPages(page.getPages());
}
@Override
public CarrierPagePlatformAccountConfigVO getPlatformAccountConfigDetail(Integer id) {
//结算单详情
PlatformAccountConfig platformAccountConfig =platformAccountConfigDao.getEntityByKey(id).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
CarrierPagePlatformAccountConfigVO detail = platformAccountConfigStruct.convertToDetail(platformAccountConfig);
return detail;
}
@Override
public void deletePlatformAccountConfig(Integer id) {
platformAccountConfigDao.deletePlatformAccountConfig(id);
}
@Override
public void updatePlatformAccountConfig(SavePlatformAccountConfigParam param) {
PlatformAccountConfig config = new PlatformAccountConfig();
config.setId(param.getId());
config.setBusinessType(param.getBusinessType());
config.setOwnerType(param.getOwnerType());
config.setInvoiceType(param.getInvoiceType());
config.setInvoiceCompanyId(param.getInvoiceCompanyId());
config.setInvoiceCompanyName(param.getInvoiceCompanyName());
config.setConfigRange(param.getConfigRange());
config.setCompanyName(param.getCompanyName());
config.setBankName(param.getBankName());
config.setOpenBank(param.getOpenBank());
config.setBankCode(param.getBankCode());
config.setBankCardNo(param.getBankCardNo());
platformAccountConfigDao.updatePlatformAccountConfig(config);
}
@Override
public void savePlatformAccountConfig(SavePlatformAccountConfigParam param){
PlatformAccountConfig config = new PlatformAccountConfig();
config.setBusinessType(param.getBusinessType());
config.setOwnerType(param.getOwnerType());
config.setInvoiceType(param.getInvoiceType());
config.setInvoiceCompanyId(param.getInvoiceCompanyId());
config.setInvoiceCompanyName(param.getInvoiceCompanyName());
config.setConfigRange(param.getConfigRange());
config.setCompanyName(param.getCompanyName());
config.setBankName(param.getBankName());
config.setOpenBank(param.getOpenBank());
config.setBankCode(param.getBankCode());
config.setBankCardNo(param.getBankCardNo());
config.setDeleteStatus(DeleteStatusEnum.YES.getCode());
platformAccountConfigDao.saveEntity(config);
}
}
package com.clx.performance.struct;
import com.clx.performance.enums.PlatformAccountConfigEnum;
import com.clx.performance.model.PlatformAccountConfig;
import com.clx.performance.vo.pc.carrier.settle.*;
import com.msl.common.utils.DateStructUtil;
import com.msl.common.utils.DateUtils;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import java.util.List;
@Mapper(componentModel = "spring", uses = DateStructUtil.class, imports = {PlatformAccountConfigEnum.class, DateUtils.class})
public interface PlatformAccountConfigStruct {
@Mapping(target = "businessTypeMsg", expression = "java(PlatformAccountConfigEnum.BusinessType.getMsgByCode(config.getBusinessType()))")
@Mapping(target = "ownerTypeMsg", expression = "java(PlatformAccountConfigEnum.OwnerType.getMsgByCode(config.getOwnerType()))")
@Mapping(target = "invoiceTypeMsg", expression = "java(PlatformAccountConfigEnum.InvoiceType.getMsgByCode(config.getInvoiceType()))")
@Mapping(target = "configRangeMsg", expression = "java(PlatformAccountConfigEnum.ConfigRange.getMsgByCode(config.getConfigRange()))")
CarrierPagePlatformAccountConfigVO convertToDetail(PlatformAccountConfig config);
List<CarrierPagePlatformAccountConfigVO> convertToVOList(List<PlatformAccountConfig> settlementOwners);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论