feat(gather): 新增配置任务功能并重构数据源配置

- 新增 ConfigTask 相关实体、控制器、服务和映射器
- 重构 DataSourceConfig 相关代码,改为使用 VO 和 DTO
- 更新 TSupplier 相关代码,使用 MyBatis-Plus
- 优化分页相关代码,使用统一的 PageDomain 类- 添加必要的依赖和注解
dev
1iyc 2 days ago
parent a2d4bf58ca
commit b2035c440e

@ -205,6 +205,21 @@
</dependency> </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.2.1-jre</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.4.1</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

@ -54,6 +54,12 @@
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<!-- 阿里JSON解析器 --> <!-- 阿里JSON解析器 -->
<dependency> <dependency>
<groupId>com.alibaba.fastjson2</groupId> <groupId>com.alibaba.fastjson2</groupId>
@ -128,9 +134,12 @@
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>33.2.1-jre</version>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
</dependencies> </dependencies>

@ -1,5 +1,6 @@
package com.lyr.common.core.controller; package com.lyr.common.core.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lyr.common.constant.HttpStatus; import com.lyr.common.constant.HttpStatus;
import com.lyr.common.core.domain.AjaxResult; import com.lyr.common.core.domain.AjaxResult;
import com.lyr.common.core.domain.model.LoginUser; import com.lyr.common.core.domain.model.LoginUser;
@ -51,6 +52,16 @@ public class BaseController {
return rspData; return rspData;
} }
protected TableDataInfo getDataTable(IPage<?> page) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(page.getRecords());
rspData.setTotal(page.getTotal());
return rspData;
}
/** /**
* *
*/ */

@ -1,13 +1,16 @@
package com.lyr.common.core.page; package com.lyr.common.core.page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyr.common.utils.StringUtils; import com.lyr.common.utils.StringUtils;
import java.io.Serializable;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class PageDomain { public class PageDomain implements Serializable {
/** /**
* *
*/ */
@ -90,4 +93,11 @@ public class PageDomain {
public void setReasonable(Boolean reasonable) { public void setReasonable(Boolean reasonable) {
this.reasonable = reasonable; this.reasonable = reasonable;
} }
public Page toPage() {
return new Page(getPageNum(), this.getPageSize());
}
} }

@ -57,6 +57,7 @@ public class DataSourceAspect {
value = spElUtil.parseExpression(method, args, dataSource.name()); value = spElUtil.parseExpression(method, args, dataSource.name());
} }
DynamicDataSourceContextHolder.setDataSourceType(value); DynamicDataSourceContextHolder.setDataSourceType(value);
dataSourceManager.print();
} }
try { try {
return point.proceed(); return point.proceed();

@ -0,0 +1,37 @@
package com.lyr.gather.kis.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lyr.common.core.controller.BaseController;
import com.lyr.common.core.page.TableDataInfo;
import com.lyr.gather.kis.domain.vo.TSupplierVO;
import com.lyr.gather.kis.service.TSupplierService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
/**
* @author liyc
* @date 2024/10/30
* @description TODO
**/
@Validated
@RestController
@RequestMapping("/kis/supplier")
public class TSupplierServiceController extends BaseController {
@Resource
private TSupplierService tSupplierService;
@GetMapping("/list/{dataSource}")
public TableDataInfo page(@NotNull(message = "数据源名称不能为空")
@PathVariable("dataSource") String datasourceName,
@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize) {
IPage<TSupplierVO> all = tSupplierService.page(pageNum, pageSize, datasourceName);
return getDataTable(all);
}
}

@ -0,0 +1,19 @@
package com.lyr.gather.kis.convert;
import com.lyr.gather.kis.domain.model.TSupplier;
import com.lyr.gather.kis.domain.vo.TSupplierVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface TSupplierConvert {
TSupplierConvert INSTANCE = Mappers.getMapper(TSupplierConvert.class);
TSupplierVO convert(TSupplier bean);
List<TSupplierVO> converts(List<TSupplier> beans);
}

@ -1,16 +1,17 @@
package com.lyr.gather.domain.model; package com.lyr.gather.kis.domain.model;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class TSupplier { public class TSupplier implements Serializable {
private Integer fItemId; private Integer fItemId;
private String fAddress; private String fAddress;

@ -0,0 +1,112 @@
package com.lyr.gather.kis.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
/**
* @author liyc
* @date 2024/11/1
* @description TODO
**/
@Data
public class TSupplierVO implements Serializable {
private Integer fItemId;
private String fAddress;
private String fCity;
private String fProvince;
private String fCountry;
private String fPostalCode;
private String fPhone;
private String fFax;
private String fEmail;
private String fHomePage;
private String fCreditLimit;
private String fTaxId;
private String fBank;
private String fAccount;
private String fBrNo;
private Integer fBoundAttr;
private Integer fErpClsId;
private String fShortName;
private Integer fPriorityId;
private Integer fPGroupId;
private Integer fStatus;
private Integer fLanguageId;
private Integer fRegionId;
private Integer fTrade;
private Double fMinPoValue;
private Double fMaxDebitDate;
private String fLegalPerson;
private String fContact;
private String fContactAcct;
private String fPhoneAcct;
private String fFaxAcct;
private String fZipAcct;
private String fEmailAcct;
private String fAddrAcct;
private Float fTax;
private Integer fCyId;
private Integer fSetId;
private Integer fSetDLineId;
private String fTaxNum;
private Integer fPriceClsId;
private Integer fOperId;
private String fCiqNumber;
private Short fDeleted;
private Short fSaleMode;
private String fName;
private String fNumber;
private Integer fParentId;
private String fShortNumber;
private Integer fArAccountId;
private Integer fApAccountId;
private Integer fPreAcctId;
private BigDecimal fLastTradeAmount;
private BigDecimal fLastRPAmount;
private String fFavorPolicy;
private Integer fDepartment;
private Integer fEmployee;
private String fCorperate;
private Date fBeginTradeDate;
private Date fEndTradeDate;
private Date fLastTradeDate;
private Date fLastReceiveDate;
private String fCashDiscount;
private Integer fCurrencyId;
private Double fMaxDealAmount;
private Double fMinForeReceiveRate;
private Double fMinReserveRate;
private Double fMaxForePayAmount;
private Double fMaxForePayRate;
private Integer fDebtLevel;
private Integer fCreditDays;
private BigDecimal fValueAddRate;
private Integer fPayTaxAcctId;
private BigDecimal fDiscount;
private Integer fTypeId;
private BigDecimal fCreditAmount;
private String fCreditLevel;
private Integer fStockIdAssignee;
private Integer fBr;
private String fRegmark;
private Boolean fLicAndPermit;
private String fLicence;
private Date fPaperPeriod;
private Integer fAlarmPeriod;
private Integer fOtherArAcctId;
private Integer fOtherApAcctId;
private Integer fPreArAcctId;
private String fHelpCode;
private Timestamp fModifyTime;
private Integer fCreditDegree;
private String fRightUserId;
private Integer fPaymentTime;
private String fSMSPhoneNumber;
private String fFullName;
}

@ -1,13 +1,18 @@
package com.lyr.gather.mapper; package com.lyr.gather.kis.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyr.common.annotation.DataSource; import com.lyr.common.annotation.DataSource;
import com.lyr.gather.domain.model.TSupplier; import com.lyr.gather.kis.domain.model.TSupplier;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List; @Mapper
public interface TSupplierMapper extends BaseMapper<TSupplier> {
public interface TSupplierMapper {
@DataSource(name = "#dataSource") @DataSource(name = "#dataSource")
@Select("SELECT " + // @Select("SELECT " + //
@ -20,6 +25,5 @@ public interface TSupplierMapper {
"s.FHelpCode, " + // "s.FHelpCode, " + //
"s.FFullName " + // "s.FFullName " + //
"FROM t_Supplier s") "FROM t_Supplier s")
List<TSupplier> list(@Param("dataSource") String dataSource); IPage<TSupplier> page(@Param("page") Page page, @Param("dataSource") String dataSource);
} }

@ -0,0 +1,9 @@
package com.lyr.gather.kis.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lyr.gather.kis.domain.vo.TSupplierVO;
public interface TSupplierService {
IPage<TSupplierVO> page(Integer pageNum, Integer pageSize, String dataSource);
}

@ -0,0 +1,31 @@
package com.lyr.gather.kis.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyr.gather.kis.convert.TSupplierConvert;
import com.lyr.gather.kis.domain.vo.TSupplierVO;
import com.lyr.gather.kis.mapper.TSupplierMapper;
import com.lyr.gather.kis.service.TSupplierService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author liyc
* @date 2024/11/1
* @description TODO
**/
@Service
public class TSupplierServiceImpl implements TSupplierService {
@Resource
private TSupplierMapper tSupplierMapper;
@Override
public IPage<TSupplierVO> page(Integer pageNum, Integer pageSize, String dataSource) {
IPage<TSupplierVO> page = tSupplierMapper.page(new Page(pageNum, pageSize), dataSource)
.convert(TSupplierConvert.INSTANCE::convert);
return page;
}
}

@ -0,0 +1,82 @@
package com.lyr.gather.local.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lyr.common.annotation.Log;
import com.lyr.common.core.controller.BaseController;
import com.lyr.common.core.domain.AjaxResult;
import com.lyr.common.core.page.TableDataInfo;
import com.lyr.common.enums.BusinessType;
import com.lyr.gather.local.domain.req.ConfigTaskEditReq;
import com.lyr.gather.local.domain.req.ConfigTaskReq;
import com.lyr.gather.local.domain.vo.ConfigTaskPageVO;
import com.lyr.gather.local.service.IConfigTaskService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
@RestController
@RequestMapping("/gather/task")
public class ConfigTaskController extends BaseController {
@Resource
private IConfigTaskService configTaskService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('gather:task:list')")
@GetMapping("/page")
public TableDataInfo page(ConfigTaskReq req) {
IPage<ConfigTaskPageVO> page = configTaskService.page(req);
return getDataTable(page);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('gather:task:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(configTaskService.getInfo(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('gather:task:add')")
@Log(title = "数据源配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ConfigTaskEditReq req) {
return toAjax(configTaskService.add(req));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('gather:task:edit')")
@Log(title = "数据源配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ConfigTaskEditReq req) {
return toAjax(configTaskService.edit(req));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('gather:task:remove')")
@Log(title = "数据源配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(configTaskService.remove(ids));
}
}

@ -1,14 +1,16 @@
package com.lyr.gather.controller; package com.lyr.gather.local.controller;
import com.lyr.common.core.domain.AjaxResult; import com.lyr.common.core.domain.AjaxResult;
import com.lyr.common.core.domain.ServiceResult; import com.lyr.common.core.domain.ServiceResult;
import com.lyr.gather.domain.DataSourceConfigDTO; import com.lyr.gather.local.domain.DataSourceConfigDTO;
import com.lyr.gather.service.DataSourceConfigService; import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO;
import com.lyr.gather.local.service.DataSourceConfigService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
/** /**
* @author liyc * @author liyc
@ -25,6 +27,13 @@ public class DataSourceConfigController {
private DataSourceConfigService dataSourceConfigService; private DataSourceConfigService dataSourceConfigService;
@GetMapping("/nav")
public AjaxResult nav() {
List<DataSourceConfigNavVO> list = dataSourceConfigService.nav();
return AjaxResult.success(list);
}
// sef_def_sign
@GetMapping("/print") @GetMapping("/print")
public void print() { public void print() {
dataSourceConfigService.print(); dataSourceConfigService.print();

@ -0,0 +1,16 @@
package com.lyr.gather.local.convert;
import com.lyr.gather.local.domain.model.ConfigTask;
import com.lyr.gather.local.domain.vo.ConfigTaskPageVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface ConfigTaskConvert {
ConfigTaskConvert INSTANCE = Mappers.getMapper(ConfigTaskConvert.class);
ConfigTaskPageVO convertVO(ConfigTask configTask);
}

@ -1,8 +1,10 @@
package com.lyr.gather.convert; package com.lyr.gather.local.convert;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import com.lyr.gather.domain.DataSourceConfigDTO; import com.lyr.gather.local.domain.DataSourceConfigDTO;
import com.lyr.gather.local.domain.model.DataSourceConfig;
import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
@ -12,4 +14,6 @@ public interface DataSourceConfigConvert {
DataSourceConfigConvert INSTANCE = Mappers.getMapper(DataSourceConfigConvert.class); DataSourceConfigConvert INSTANCE = Mappers.getMapper(DataSourceConfigConvert.class);
DruidDataSource convert(DataSourceConfigDTO bean); DruidDataSource convert(DataSourceConfigDTO bean);
DataSourceConfigNavVO convertVO(DataSourceConfig bean);
} }

@ -1,4 +1,4 @@
package com.lyr.gather.domain; package com.lyr.gather.local.domain;
import lombok.Data; import lombok.Data;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;

@ -0,0 +1,52 @@
package com.lyr.gather.local.domain.model;
import com.lyr.common.annotation.Excel;
import lombok.Data;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
@Data
public class ConfigTask {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
*
*/
@Excel(name = "表名")
private String tableName;
/**
*
*/
@Excel(name = "明细")
private String tableDescription;
/**
*
*/
@Excel(name = "备注")
private String tableNote;
/**
* 0/ 1
*/
@Excel(name = "0禁用/ 1启用")
private Integer enable;
/**
* cron
*/
@Excel(name = "cron表达式")
private String cron;
private String dataSource;
}

@ -1,4 +1,4 @@
package com.lyr.gather.domain.model; package com.lyr.gather.local.domain.model;
import com.lyr.common.annotation.Excel; import com.lyr.common.annotation.Excel;
import lombok.Data; import lombok.Data;

@ -0,0 +1,9 @@
package com.lyr.gather.local.domain.req;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
public class ConfigTaskEditReq {
}

@ -0,0 +1,51 @@
package com.lyr.gather.local.domain.req;
import com.lyr.common.annotation.Excel;
import com.lyr.common.core.page.PageDomain;
import lombok.Data;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
@Data
public class ConfigTaskReq extends PageDomain {
/**
*
*/
@Excel(name = "表名")
private String tableName;
/**
*
*/
@Excel(name = "明细")
private String tableDescription;
/**
*
*/
@Excel(name = "备注")
private String tableNote;
/**
* 0/ 1
*/
@Excel(name = "0禁用/ 1启用")
private Integer enable;
/**
* cron
*/
@Excel(name = "cron表达式")
private String cron;
private String name;
}

@ -0,0 +1,10 @@
package com.lyr.gather.local.domain.vo;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
public class ConfigTaskInfoVO
{
}

@ -0,0 +1,54 @@
package com.lyr.gather.local.domain.vo;
import com.lyr.common.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
@Data
public class ConfigTaskPageVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
*
*/
@Excel(name = "表名")
private String tableName;
/**
*
*/
@Excel(name = "明细")
private String tableDescription;
/**
*
*/
@Excel(name = "备注")
private String tableNote;
/**
* 0/ 1
*/
@Excel(name = "0禁用/ 1启用")
private Integer enable;
/**
* cron
*/
@Excel(name = "cron表达式")
private String cron;
}

@ -0,0 +1,68 @@
package com.lyr.gather.local.domain.vo;
import com.lyr.common.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
/**
* @author liyc
* @date 2024/10/31
* @description TODO
**/
@Data
public class DataSourceConfigNavVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
@Excel(name = "名称")
private String alias;
/**
*
*/
@Excel(name = "数据源的唯一名称,用于标识不同的数据源")
private String name;
/**
* MySQL, PostgreSQL
*/
@Excel(name = "数据库类型,例如 MySQL, PostgreSQL 等")
private String dbType;
/**
* URL
*/
@Excel(name = "数据库连接URL")
private String url;
/**
*
*/
@Excel(name = "数据库用户名")
private String username;
/**
*
*/
@Excel(name = "数据库密码")
private String password;
/**
*
*/
@Excel(name = "数据库驱动类名")
private String driverClassName;
/**
* 1 0
*/
@Excel(name = "是否启用该数据源1 表示启用0 表示禁用")
private Integer isEnabled;
}

@ -0,0 +1,7 @@
package com.lyr.gather.local.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyr.gather.local.domain.model.ConfigTask;
public interface ConfigTaskMapper extends BaseMapper<ConfigTask> {
}

@ -1,7 +1,7 @@
package com.lyr.gather.mapper; package com.lyr.gather.local.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyr.gather.domain.model.DataSourceConfig; import com.lyr.gather.local.domain.model.DataSourceConfig;
public interface DataSourceConfigMapper extends BaseMapper<DataSourceConfig> { public interface DataSourceConfigMapper extends BaseMapper<DataSourceConfig> {

@ -1,12 +1,19 @@
package com.lyr.gather.service; package com.lyr.gather.local.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lyr.common.core.domain.ServiceResult; import com.lyr.common.core.domain.ServiceResult;
import com.lyr.gather.domain.DataSourceConfigDTO; import com.lyr.gather.local.domain.DataSourceConfigDTO;
import com.lyr.gather.domain.model.DataSourceConfig; import com.lyr.gather.local.domain.model.DataSourceConfig;
import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO;
import java.util.List;
public interface DataSourceConfigService extends IService<DataSourceConfig> { public interface DataSourceConfigService extends IService<DataSourceConfig> {
List<DataSourceConfigNavVO> nav();
void print(); void print();
ServiceResult add(DataSourceConfigDTO dto); ServiceResult add(DataSourceConfigDTO dto);
@ -14,4 +21,5 @@ public interface DataSourceConfigService extends IService<DataSourceConfig> {
void remove(String[] ids); void remove(String[] ids);
void list(String s, Object o); void list(String s, Object o);
} }

@ -0,0 +1,29 @@
package com.lyr.gather.local.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lyr.gather.local.domain.model.ConfigTask;
import com.lyr.gather.local.domain.req.ConfigTaskEditReq;
import com.lyr.gather.local.domain.req.ConfigTaskReq;
import com.lyr.gather.local.domain.vo.ConfigTaskInfoVO;
import com.lyr.gather.local.domain.vo.ConfigTaskPageVO;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
public interface IConfigTaskService extends IService<ConfigTask> {
IPage<ConfigTaskPageVO> page(ConfigTaskReq req);
ConfigTaskInfoVO getInfo(Long id);
int add(ConfigTaskEditReq req);
int edit(ConfigTaskEditReq req);
int remove(Long[] ids);
}

@ -0,0 +1,61 @@
package com.lyr.gather.local.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyr.gather.local.convert.ConfigTaskConvert;
import com.lyr.gather.local.domain.model.ConfigTask;
import com.lyr.gather.local.domain.req.ConfigTaskEditReq;
import com.lyr.gather.local.domain.req.ConfigTaskReq;
import com.lyr.gather.local.domain.vo.ConfigTaskInfoVO;
import com.lyr.gather.local.domain.vo.ConfigTaskPageVO;
import com.lyr.gather.local.mapper.ConfigTaskMapper;
import com.lyr.gather.local.service.IConfigTaskService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author liyc
* @date 2024/11/5
* @description TODO
**/
@Service
public class ConfigTaskServiceImpl extends ServiceImpl<ConfigTaskMapper, ConfigTask> implements IConfigTaskService {
@Resource
private ConfigTaskMapper configTaskMapper;
@Override
public IPage<ConfigTaskPageVO> page(ConfigTaskReq req) {
IPage<ConfigTaskPageVO> page = this.lambdaQuery() //
.eq(ConfigTask::getDataSource, req.getName())//
.eq(ConfigTask::getEnable, req.getEnable()) //
.like(StringUtils.isNoneEmpty(req.getTableName()), ConfigTask::getTableName, req.getTableName())//
.like(StringUtils.isNoneEmpty(req.getTableDescription()), ConfigTask::getTableDescription, req.getTableDescription())//
.like(StringUtils.isNoneEmpty(req.getTableNote()), ConfigTask::getTableNote, req.getTableNote())//
.page(req.toPage()) //
.convert(configTask -> ConfigTaskConvert.INSTANCE.convertVO((ConfigTask) configTask));
return page;
}
@Override
public ConfigTaskInfoVO getInfo(Long id) {
return null;
}
@Override
public int add(ConfigTaskEditReq req) {
return 0;
}
@Override
public int edit(ConfigTaskEditReq req) {
return 0;
}
@Override
public int remove(Long[] ids) {
return 0;
}
}

@ -1,16 +1,17 @@
package com.lyr.gather.service.impl; package com.lyr.gather.local.service.impl;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyr.common.core.domain.ServiceResult; import com.lyr.common.core.domain.ServiceResult;
import com.lyr.common.utils.bean.BeanValidators; import com.lyr.common.utils.bean.BeanValidators;
import com.lyr.framework.manager.DataSourceManager; import com.lyr.framework.manager.DataSourceManager;
import com.lyr.gather.convert.DataSourceConfigConvert; import com.lyr.gather.kis.mapper.TSupplierMapper;
import com.lyr.gather.domain.DataSourceConfigDTO; import com.lyr.gather.local.convert.DataSourceConfigConvert;
import com.lyr.gather.domain.model.DataSourceConfig; import com.lyr.gather.local.domain.DataSourceConfigDTO;
import com.lyr.gather.mapper.DataSourceConfigMapper; import com.lyr.gather.local.domain.model.DataSourceConfig;
import com.lyr.gather.mapper.TSupplierMapper; import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO;
import com.lyr.gather.service.DataSourceConfigService; import com.lyr.gather.local.mapper.DataSourceConfigMapper;
import com.lyr.gather.local.service.DataSourceConfigService;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -18,6 +19,7 @@ import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Validator; import javax.validation.Validator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class DataSourceConfigServiceImpl extends ServiceImpl<DataSourceConfigMapper, DataSourceConfig> implements DataSourceConfigService { public class DataSourceConfigServiceImpl extends ServiceImpl<DataSourceConfigMapper, DataSourceConfig> implements DataSourceConfigService {
@ -44,6 +46,11 @@ public class DataSourceConfigServiceImpl extends ServiceImpl<DataSourceConfigMap
}); });
} }
@Override
public List<DataSourceConfigNavVO> nav() {
return this.lambdaQuery().list().stream().map(e -> DataSourceConfigConvert.INSTANCE.convertVO(e)).collect(Collectors.toList());
}
@Override @Override
public void print() { public void print() {
dataSourceManager.print(); dataSourceManager.print();
@ -66,7 +73,7 @@ public class DataSourceConfigServiceImpl extends ServiceImpl<DataSourceConfigMap
@Override @Override
public void list(String datasourceName, Object o) { public void list(String datasourceName, Object o) {
tSupplierMapper.list(datasourceName);
} }

@ -1,28 +0,0 @@
package com.lyr.gather.convert;
import com.alibaba.druid.pool.DruidDataSource;
import com.lyr.gather.domain.DataSourceConfigDTO;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-10-31T16:39:16+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class DataSourceConfigConvertImpl implements DataSourceConfigConvert {
@Override
public DruidDataSource convert(DataSourceConfigDTO bean) {
if ( bean == null ) {
return null;
}
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setName( bean.getName() );
druidDataSource.setUsername( bean.getUsername() );
druidDataSource.setPassword( bean.getPassword() );
return druidDataSource;
}
}

@ -0,0 +1,134 @@
package com.lyr.gather.kis.convert;
import com.lyr.gather.kis.domain.model.TSupplier;
import com.lyr.gather.kis.domain.vo.TSupplierVO;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-11-06T10:37:36+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class TSupplierConvertImpl implements TSupplierConvert {
@Override
public TSupplierVO convert(TSupplier bean) {
if ( bean == null ) {
return null;
}
TSupplierVO tSupplierVO = new TSupplierVO();
tSupplierVO.setFItemId( bean.getFItemId() );
tSupplierVO.setFAddress( bean.getFAddress() );
tSupplierVO.setFCity( bean.getFCity() );
tSupplierVO.setFProvince( bean.getFProvince() );
tSupplierVO.setFCountry( bean.getFCountry() );
tSupplierVO.setFPostalCode( bean.getFPostalCode() );
tSupplierVO.setFPhone( bean.getFPhone() );
tSupplierVO.setFFax( bean.getFFax() );
tSupplierVO.setFEmail( bean.getFEmail() );
tSupplierVO.setFHomePage( bean.getFHomePage() );
tSupplierVO.setFCreditLimit( bean.getFCreditLimit() );
tSupplierVO.setFTaxId( bean.getFTaxId() );
tSupplierVO.setFBank( bean.getFBank() );
tSupplierVO.setFAccount( bean.getFAccount() );
tSupplierVO.setFBrNo( bean.getFBrNo() );
tSupplierVO.setFBoundAttr( bean.getFBoundAttr() );
tSupplierVO.setFErpClsId( bean.getFErpClsId() );
tSupplierVO.setFShortName( bean.getFShortName() );
tSupplierVO.setFPriorityId( bean.getFPriorityId() );
tSupplierVO.setFPGroupId( bean.getFPGroupId() );
tSupplierVO.setFStatus( bean.getFStatus() );
tSupplierVO.setFLanguageId( bean.getFLanguageId() );
tSupplierVO.setFRegionId( bean.getFRegionId() );
tSupplierVO.setFTrade( bean.getFTrade() );
tSupplierVO.setFMinPoValue( bean.getFMinPoValue() );
tSupplierVO.setFMaxDebitDate( bean.getFMaxDebitDate() );
tSupplierVO.setFLegalPerson( bean.getFLegalPerson() );
tSupplierVO.setFContact( bean.getFContact() );
tSupplierVO.setFContactAcct( bean.getFContactAcct() );
tSupplierVO.setFPhoneAcct( bean.getFPhoneAcct() );
tSupplierVO.setFFaxAcct( bean.getFFaxAcct() );
tSupplierVO.setFZipAcct( bean.getFZipAcct() );
tSupplierVO.setFEmailAcct( bean.getFEmailAcct() );
tSupplierVO.setFAddrAcct( bean.getFAddrAcct() );
tSupplierVO.setFTax( bean.getFTax() );
tSupplierVO.setFCyId( bean.getFCyId() );
tSupplierVO.setFSetId( bean.getFSetId() );
tSupplierVO.setFSetDLineId( bean.getFSetDLineId() );
tSupplierVO.setFTaxNum( bean.getFTaxNum() );
tSupplierVO.setFPriceClsId( bean.getFPriceClsId() );
tSupplierVO.setFOperId( bean.getFOperId() );
tSupplierVO.setFCiqNumber( bean.getFCiqNumber() );
tSupplierVO.setFDeleted( bean.getFDeleted() );
tSupplierVO.setFSaleMode( bean.getFSaleMode() );
tSupplierVO.setFName( bean.getFName() );
tSupplierVO.setFNumber( bean.getFNumber() );
tSupplierVO.setFParentId( bean.getFParentId() );
tSupplierVO.setFShortNumber( bean.getFShortNumber() );
tSupplierVO.setFArAccountId( bean.getFArAccountId() );
tSupplierVO.setFApAccountId( bean.getFApAccountId() );
tSupplierVO.setFPreAcctId( bean.getFPreAcctId() );
tSupplierVO.setFLastTradeAmount( bean.getFLastTradeAmount() );
tSupplierVO.setFLastRPAmount( bean.getFLastRPAmount() );
tSupplierVO.setFFavorPolicy( bean.getFFavorPolicy() );
tSupplierVO.setFDepartment( bean.getFDepartment() );
tSupplierVO.setFEmployee( bean.getFEmployee() );
tSupplierVO.setFCorperate( bean.getFCorperate() );
tSupplierVO.setFBeginTradeDate( bean.getFBeginTradeDate() );
tSupplierVO.setFEndTradeDate( bean.getFEndTradeDate() );
tSupplierVO.setFLastTradeDate( bean.getFLastTradeDate() );
tSupplierVO.setFLastReceiveDate( bean.getFLastReceiveDate() );
tSupplierVO.setFCashDiscount( bean.getFCashDiscount() );
tSupplierVO.setFCurrencyId( bean.getFCurrencyId() );
tSupplierVO.setFMaxDealAmount( bean.getFMaxDealAmount() );
tSupplierVO.setFMinForeReceiveRate( bean.getFMinForeReceiveRate() );
tSupplierVO.setFMinReserveRate( bean.getFMinReserveRate() );
tSupplierVO.setFMaxForePayAmount( bean.getFMaxForePayAmount() );
tSupplierVO.setFMaxForePayRate( bean.getFMaxForePayRate() );
tSupplierVO.setFDebtLevel( bean.getFDebtLevel() );
tSupplierVO.setFCreditDays( bean.getFCreditDays() );
tSupplierVO.setFValueAddRate( bean.getFValueAddRate() );
tSupplierVO.setFPayTaxAcctId( bean.getFPayTaxAcctId() );
tSupplierVO.setFDiscount( bean.getFDiscount() );
tSupplierVO.setFTypeId( bean.getFTypeId() );
tSupplierVO.setFCreditAmount( bean.getFCreditAmount() );
tSupplierVO.setFCreditLevel( bean.getFCreditLevel() );
tSupplierVO.setFStockIdAssignee( bean.getFStockIdAssignee() );
tSupplierVO.setFBr( bean.getFBr() );
tSupplierVO.setFRegmark( bean.getFRegmark() );
tSupplierVO.setFLicAndPermit( bean.getFLicAndPermit() );
tSupplierVO.setFLicence( bean.getFLicence() );
tSupplierVO.setFPaperPeriod( bean.getFPaperPeriod() );
tSupplierVO.setFAlarmPeriod( bean.getFAlarmPeriod() );
tSupplierVO.setFOtherArAcctId( bean.getFOtherArAcctId() );
tSupplierVO.setFOtherApAcctId( bean.getFOtherApAcctId() );
tSupplierVO.setFPreArAcctId( bean.getFPreArAcctId() );
tSupplierVO.setFHelpCode( bean.getFHelpCode() );
tSupplierVO.setFModifyTime( bean.getFModifyTime() );
tSupplierVO.setFCreditDegree( bean.getFCreditDegree() );
tSupplierVO.setFRightUserId( bean.getFRightUserId() );
tSupplierVO.setFPaymentTime( bean.getFPaymentTime() );
tSupplierVO.setFSMSPhoneNumber( bean.getFSMSPhoneNumber() );
tSupplierVO.setFFullName( bean.getFFullName() );
return tSupplierVO;
}
@Override
public List<TSupplierVO> converts(List<TSupplier> beans) {
if ( beans == null ) {
return null;
}
List<TSupplierVO> list = new ArrayList<TSupplierVO>( beans.size() );
for ( TSupplier tSupplier : beans ) {
list.add( convert( tSupplier ) );
}
return list;
}
}

@ -0,0 +1,31 @@
package com.lyr.gather.local.convert;
import com.lyr.gather.local.domain.model.ConfigTask;
import com.lyr.gather.local.domain.vo.ConfigTaskPageVO;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-11-06T10:37:36+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class ConfigTaskConvertImpl implements ConfigTaskConvert {
@Override
public ConfigTaskPageVO convertVO(ConfigTask configTask) {
if ( configTask == null ) {
return null;
}
ConfigTaskPageVO configTaskPageVO = new ConfigTaskPageVO();
configTaskPageVO.setId( configTask.getId() );
configTaskPageVO.setTableName( configTask.getTableName() );
configTaskPageVO.setTableDescription( configTask.getTableDescription() );
configTaskPageVO.setTableNote( configTask.getTableNote() );
configTaskPageVO.setEnable( configTask.getEnable() );
configTaskPageVO.setCron( configTask.getCron() );
return configTaskPageVO;
}
}

@ -0,0 +1,51 @@
package com.lyr.gather.local.convert;
import com.alibaba.druid.pool.DruidDataSource;
import com.lyr.gather.local.domain.DataSourceConfigDTO;
import com.lyr.gather.local.domain.model.DataSourceConfig;
import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-11-06T10:37:36+0800",
comments = "version: 1.6.2, compiler: javac, environment: Java 1.8.0_392 (Amazon.com Inc.)"
)
public class DataSourceConfigConvertImpl implements DataSourceConfigConvert {
@Override
public DruidDataSource convert(DataSourceConfigDTO bean) {
if ( bean == null ) {
return null;
}
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setName( bean.getName() );
druidDataSource.setUsername( bean.getUsername() );
druidDataSource.setPassword( bean.getPassword() );
return druidDataSource;
}
@Override
public DataSourceConfigNavVO convertVO(DataSourceConfig bean) {
if ( bean == null ) {
return null;
}
DataSourceConfigNavVO dataSourceConfigNavVO = new DataSourceConfigNavVO();
dataSourceConfigNavVO.setId( bean.getId() );
dataSourceConfigNavVO.setAlias( bean.getAlias() );
dataSourceConfigNavVO.setName( bean.getName() );
dataSourceConfigNavVO.setDbType( bean.getDbType() );
dataSourceConfigNavVO.setUrl( bean.getUrl() );
dataSourceConfigNavVO.setUsername( bean.getUsername() );
dataSourceConfigNavVO.setPassword( bean.getPassword() );
dataSourceConfigNavVO.setDriverClassName( bean.getDriverClassName() );
dataSourceConfigNavVO.setIsEnabled( bean.getIsEnabled() );
return dataSourceConfigNavVO;
}
}
Loading…
Cancel
Save