diff --git a/pom.xml b/pom.xml index 1e7546c..deaf84f 100644 --- a/pom.xml +++ b/pom.xml @@ -205,6 +205,21 @@ + + com.google.guava + guava + 33.2.1-jre + + + + + com.baomidou + mybatis-plus-core + 3.4.1 + compile + + + diff --git a/sync-common/pom.xml b/sync-common/pom.xml index 4fc76fc..2e95df9 100644 --- a/sync-common/pom.xml +++ b/sync-common/pom.xml @@ -54,6 +54,12 @@ jackson-databind + + com.fasterxml.jackson.core + jackson-annotations + + + com.alibaba.fastjson2 @@ -128,9 +134,12 @@ com.google.guava guava - 33.2.1-jre + + com.baomidou + mybatis-plus-boot-starter + diff --git a/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java b/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java index 3decce2..73b23ea 100644 --- a/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java +++ b/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java @@ -1,5 +1,6 @@ package com.lyr.common.core.controller; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.lyr.common.constant.HttpStatus; import com.lyr.common.core.domain.AjaxResult; import com.lyr.common.core.domain.model.LoginUser; @@ -51,6 +52,16 @@ public class BaseController { 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; + } + /** * 返回成功 */ diff --git a/sync-common/src/main/java/com/lyr/common/core/page/PageDomain.java b/sync-common/src/main/java/com/lyr/common/core/page/PageDomain.java index d0bdbe9..ff7482f 100644 --- a/sync-common/src/main/java/com/lyr/common/core/page/PageDomain.java +++ b/sync-common/src/main/java/com/lyr/common/core/page/PageDomain.java @@ -1,13 +1,16 @@ package com.lyr.common.core.page; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.lyr.common.utils.StringUtils; +import java.io.Serializable; + /** * 分页数据 * * @author ruoyi */ -public class PageDomain { +public class PageDomain implements Serializable { /** * 当前记录起始索引 */ @@ -90,4 +93,11 @@ public class PageDomain { public void setReasonable(Boolean reasonable) { this.reasonable = reasonable; } + + + public Page toPage() { + return new Page(getPageNum(), this.getPageSize()); + } + + } diff --git a/sync-framework/src/main/java/com/lyr/framework/aspectj/DataSourceAspect.java b/sync-framework/src/main/java/com/lyr/framework/aspectj/DataSourceAspect.java index 85c9c35..7cb8045 100644 --- a/sync-framework/src/main/java/com/lyr/framework/aspectj/DataSourceAspect.java +++ b/sync-framework/src/main/java/com/lyr/framework/aspectj/DataSourceAspect.java @@ -57,6 +57,7 @@ public class DataSourceAspect { value = spElUtil.parseExpression(method, args, dataSource.name()); } DynamicDataSourceContextHolder.setDataSourceType(value); + dataSourceManager.print(); } try { return point.proceed(); diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/controller/TSupplierServiceController.java b/sync-gather/src/main/java/com/lyr/gather/kis/controller/TSupplierServiceController.java new file mode 100644 index 0000000..6454444 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/kis/controller/TSupplierServiceController.java @@ -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 all = tSupplierService.page(pageNum, pageSize, datasourceName); + return getDataTable(all); + } +} diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/convert/TSupplierConvert.java b/sync-gather/src/main/java/com/lyr/gather/kis/convert/TSupplierConvert.java new file mode 100644 index 0000000..b9b78bb --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/kis/convert/TSupplierConvert.java @@ -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 converts(List beans); +} diff --git a/sync-gather/src/main/java/com/lyr/gather/domain/model/TSupplier.java b/sync-gather/src/main/java/com/lyr/gather/kis/domain/model/TSupplier.java similarity index 96% rename from sync-gather/src/main/java/com/lyr/gather/domain/model/TSupplier.java rename to sync-gather/src/main/java/com/lyr/gather/kis/domain/model/TSupplier.java index fe80543..c35eaf6 100644 --- a/sync-gather/src/main/java/com/lyr/gather/domain/model/TSupplier.java +++ b/sync-gather/src/main/java/com/lyr/gather/kis/domain/model/TSupplier.java @@ -1,16 +1,17 @@ -package com.lyr.gather.domain.model; +package com.lyr.gather.kis.domain.model; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Date; @Data @Accessors(chain = true) -public class TSupplier { +public class TSupplier implements Serializable { private Integer fItemId; private String fAddress; diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/domain/vo/TSupplierVO.java b/sync-gather/src/main/java/com/lyr/gather/kis/domain/vo/TSupplierVO.java new file mode 100644 index 0000000..0a5a421 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/kis/domain/vo/TSupplierVO.java @@ -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; +} diff --git a/sync-gather/src/main/java/com/lyr/gather/mapper/TSupplierMapper.java b/sync-gather/src/main/java/com/lyr/gather/kis/mapper/TSupplierMapper.java similarity index 51% rename from sync-gather/src/main/java/com/lyr/gather/mapper/TSupplierMapper.java rename to sync-gather/src/main/java/com/lyr/gather/kis/mapper/TSupplierMapper.java index 500d42b..c623377 100644 --- a/sync-gather/src/main/java/com/lyr/gather/mapper/TSupplierMapper.java +++ b/sync-gather/src/main/java/com/lyr/gather/kis/mapper/TSupplierMapper.java @@ -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.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.Select; -import java.util.List; +@Mapper +public interface TSupplierMapper extends BaseMapper { -public interface TSupplierMapper { @DataSource(name = "#dataSource") @Select("SELECT " + // @@ -20,6 +25,5 @@ public interface TSupplierMapper { "s.FHelpCode, " + // "s.FFullName " + // "FROM t_Supplier s") - List list(@Param("dataSource") String dataSource); - + IPage page(@Param("page") Page page, @Param("dataSource") String dataSource); } diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/service/TSupplierService.java b/sync-gather/src/main/java/com/lyr/gather/kis/service/TSupplierService.java new file mode 100644 index 0000000..dc64dd8 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/kis/service/TSupplierService.java @@ -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 page(Integer pageNum, Integer pageSize, String dataSource); +} diff --git a/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java b/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java new file mode 100644 index 0000000..36b1b89 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/kis/service/impl/TSupplierServiceImpl.java @@ -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 page(Integer pageNum, Integer pageSize, String dataSource) { + IPage page = tSupplierMapper.page(new Page(pageNum, pageSize), dataSource) + .convert(TSupplierConvert.INSTANCE::convert); + return page; + } +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/controller/ConfigTaskController.java b/sync-gather/src/main/java/com/lyr/gather/local/controller/ConfigTaskController.java new file mode 100644 index 0000000..f3ecebf --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/controller/ConfigTaskController.java @@ -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 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)); + } + + +} diff --git a/sync-gather/src/main/java/com/lyr/gather/controller/DataSourceConfigController.java b/sync-gather/src/main/java/com/lyr/gather/local/controller/DataSourceConfigController.java similarity index 71% rename from sync-gather/src/main/java/com/lyr/gather/controller/DataSourceConfigController.java rename to sync-gather/src/main/java/com/lyr/gather/local/controller/DataSourceConfigController.java index 0993251..6039c98 100644 --- a/sync-gather/src/main/java/com/lyr/gather/controller/DataSourceConfigController.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/controller/DataSourceConfigController.java @@ -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.ServiceResult; -import com.lyr.gather.domain.DataSourceConfigDTO; -import com.lyr.gather.service.DataSourceConfigService; +import com.lyr.gather.local.domain.DataSourceConfigDTO; +import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO; +import com.lyr.gather.local.service.DataSourceConfigService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.constraints.NotNull; +import java.util.List; /** * @author liyc @@ -25,6 +27,13 @@ public class DataSourceConfigController { private DataSourceConfigService dataSourceConfigService; + @GetMapping("/nav") + public AjaxResult nav() { + List list = dataSourceConfigService.nav(); + return AjaxResult.success(list); + } + +// sef_def_sign @GetMapping("/print") public void print() { dataSourceConfigService.print(); diff --git a/sync-gather/src/main/java/com/lyr/gather/local/convert/ConfigTaskConvert.java b/sync-gather/src/main/java/com/lyr/gather/local/convert/ConfigTaskConvert.java new file mode 100644 index 0000000..6c8cc47 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/convert/ConfigTaskConvert.java @@ -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); +} diff --git a/sync-gather/src/main/java/com/lyr/gather/convert/DataSourceConfigConvert.java b/sync-gather/src/main/java/com/lyr/gather/local/convert/DataSourceConfigConvert.java similarity index 53% rename from sync-gather/src/main/java/com/lyr/gather/convert/DataSourceConfigConvert.java rename to sync-gather/src/main/java/com/lyr/gather/local/convert/DataSourceConfigConvert.java index 06ad9fd..6cd7a09 100644 --- a/sync-gather/src/main/java/com/lyr/gather/convert/DataSourceConfigConvert.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/convert/DataSourceConfigConvert.java @@ -1,8 +1,10 @@ -package com.lyr.gather.convert; +package com.lyr.gather.local.convert; 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.factory.Mappers; @@ -12,4 +14,6 @@ public interface DataSourceConfigConvert { DataSourceConfigConvert INSTANCE = Mappers.getMapper(DataSourceConfigConvert.class); DruidDataSource convert(DataSourceConfigDTO bean); + + DataSourceConfigNavVO convertVO(DataSourceConfig bean); } diff --git a/sync-gather/src/main/java/com/lyr/gather/domain/DataSourceConfigDTO.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/DataSourceConfigDTO.java similarity index 95% rename from sync-gather/src/main/java/com/lyr/gather/domain/DataSourceConfigDTO.java rename to sync-gather/src/main/java/com/lyr/gather/local/domain/DataSourceConfigDTO.java index 3ad3267..f8bafdc 100644 --- a/sync-gather/src/main/java/com/lyr/gather/domain/DataSourceConfigDTO.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/DataSourceConfigDTO.java @@ -1,4 +1,4 @@ -package com.lyr.gather.domain; +package com.lyr.gather.local.domain; import lombok.Data; import org.apache.ibatis.annotations.Insert; diff --git a/sync-gather/src/main/java/com/lyr/gather/local/domain/model/ConfigTask.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/model/ConfigTask.java new file mode 100644 index 0000000..5d1ab73 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/model/ConfigTask.java @@ -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; +} diff --git a/sync-gather/src/main/java/com/lyr/gather/domain/model/DataSourceConfig.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/model/DataSourceConfig.java similarity index 96% rename from sync-gather/src/main/java/com/lyr/gather/domain/model/DataSourceConfig.java rename to sync-gather/src/main/java/com/lyr/gather/local/domain/model/DataSourceConfig.java index 8c2934f..f8d6e2c 100644 --- a/sync-gather/src/main/java/com/lyr/gather/domain/model/DataSourceConfig.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/model/DataSourceConfig.java @@ -1,4 +1,4 @@ -package com.lyr.gather.domain.model; +package com.lyr.gather.local.domain.model; import com.lyr.common.annotation.Excel; import lombok.Data; diff --git a/sync-gather/src/main/java/com/lyr/gather/local/domain/req/ConfigTaskEditReq.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/req/ConfigTaskEditReq.java new file mode 100644 index 0000000..acdac0a --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/req/ConfigTaskEditReq.java @@ -0,0 +1,9 @@ +package com.lyr.gather.local.domain.req; + +/** + * @author liyc + * @date 2024/11/5 + * @description TODO + **/ +public class ConfigTaskEditReq { +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/domain/req/ConfigTaskReq.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/req/ConfigTaskReq.java new file mode 100644 index 0000000..c13ec16 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/req/ConfigTaskReq.java @@ -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; + + +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/ConfigTaskInfoVO.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/ConfigTaskInfoVO.java new file mode 100644 index 0000000..9e021bf --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/ConfigTaskInfoVO.java @@ -0,0 +1,10 @@ +package com.lyr.gather.local.domain.vo; + +/** + * @author liyc + * @date 2024/11/5 + * @description TODO + **/ +public class ConfigTaskInfoVO +{ +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/ConfigTaskPageVO.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/ConfigTaskPageVO.java new file mode 100644 index 0000000..7826c58 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/ConfigTaskPageVO.java @@ -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; + +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/DataSourceConfigNavVO.java b/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/DataSourceConfigNavVO.java new file mode 100644 index 0000000..db564bb --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/domain/vo/DataSourceConfigNavVO.java @@ -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; +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/mapper/ConfigTaskMapper.java b/sync-gather/src/main/java/com/lyr/gather/local/mapper/ConfigTaskMapper.java new file mode 100644 index 0000000..d121a6f --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/mapper/ConfigTaskMapper.java @@ -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 { +} diff --git a/sync-gather/src/main/java/com/lyr/gather/mapper/DataSourceConfigMapper.java b/sync-gather/src/main/java/com/lyr/gather/local/mapper/DataSourceConfigMapper.java similarity index 59% rename from sync-gather/src/main/java/com/lyr/gather/mapper/DataSourceConfigMapper.java rename to sync-gather/src/main/java/com/lyr/gather/local/mapper/DataSourceConfigMapper.java index 4e60007..55b1950 100644 --- a/sync-gather/src/main/java/com/lyr/gather/mapper/DataSourceConfigMapper.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/mapper/DataSourceConfigMapper.java @@ -1,7 +1,7 @@ -package com.lyr.gather.mapper; +package com.lyr.gather.local.mapper; 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 { diff --git a/sync-gather/src/main/java/com/lyr/gather/service/DataSourceConfigService.java b/sync-gather/src/main/java/com/lyr/gather/local/service/DataSourceConfigService.java similarity index 53% rename from sync-gather/src/main/java/com/lyr/gather/service/DataSourceConfigService.java rename to sync-gather/src/main/java/com/lyr/gather/local/service/DataSourceConfigService.java index f2cb494..d25dcff 100644 --- a/sync-gather/src/main/java/com/lyr/gather/service/DataSourceConfigService.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/service/DataSourceConfigService.java @@ -1,12 +1,19 @@ -package com.lyr.gather.service; +package com.lyr.gather.local.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lyr.common.core.domain.ServiceResult; -import com.lyr.gather.domain.DataSourceConfigDTO; -import com.lyr.gather.domain.model.DataSourceConfig; +import com.lyr.gather.local.domain.DataSourceConfigDTO; +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 { + + List nav(); + + void print(); ServiceResult add(DataSourceConfigDTO dto); @@ -14,4 +21,5 @@ public interface DataSourceConfigService extends IService { void remove(String[] ids); void list(String s, Object o); + } diff --git a/sync-gather/src/main/java/com/lyr/gather/local/service/IConfigTaskService.java b/sync-gather/src/main/java/com/lyr/gather/local/service/IConfigTaskService.java new file mode 100644 index 0000000..8575c37 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/service/IConfigTaskService.java @@ -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 { + + + IPage page(ConfigTaskReq req); + + ConfigTaskInfoVO getInfo(Long id); + + int add(ConfigTaskEditReq req); + + int edit(ConfigTaskEditReq req); + + int remove(Long[] ids); + +} diff --git a/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java b/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java new file mode 100644 index 0000000..7463cbe --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/local/service/impl/ConfigTaskServiceImpl.java @@ -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 implements IConfigTaskService { + + @Resource + private ConfigTaskMapper configTaskMapper; + + @Override + public IPage page(ConfigTaskReq req) { + IPage 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; + } +} diff --git a/sync-gather/src/main/java/com/lyr/gather/service/impl/DataSourceConfigServiceImpl.java b/sync-gather/src/main/java/com/lyr/gather/local/service/impl/DataSourceConfigServiceImpl.java similarity index 75% rename from sync-gather/src/main/java/com/lyr/gather/service/impl/DataSourceConfigServiceImpl.java rename to sync-gather/src/main/java/com/lyr/gather/local/service/impl/DataSourceConfigServiceImpl.java index a8b6424..2e35b4e 100644 --- a/sync-gather/src/main/java/com/lyr/gather/service/impl/DataSourceConfigServiceImpl.java +++ b/sync-gather/src/main/java/com/lyr/gather/local/service/impl/DataSourceConfigServiceImpl.java @@ -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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lyr.common.core.domain.ServiceResult; import com.lyr.common.utils.bean.BeanValidators; import com.lyr.framework.manager.DataSourceManager; -import com.lyr.gather.convert.DataSourceConfigConvert; -import com.lyr.gather.domain.DataSourceConfigDTO; -import com.lyr.gather.domain.model.DataSourceConfig; -import com.lyr.gather.mapper.DataSourceConfigMapper; -import com.lyr.gather.mapper.TSupplierMapper; -import com.lyr.gather.service.DataSourceConfigService; +import com.lyr.gather.kis.mapper.TSupplierMapper; +import com.lyr.gather.local.convert.DataSourceConfigConvert; +import com.lyr.gather.local.domain.DataSourceConfigDTO; +import com.lyr.gather.local.domain.model.DataSourceConfig; +import com.lyr.gather.local.domain.vo.DataSourceConfigNavVO; +import com.lyr.gather.local.mapper.DataSourceConfigMapper; +import com.lyr.gather.local.service.DataSourceConfigService; import org.apache.ibatis.annotations.Insert; import org.springframework.stereotype.Service; @@ -18,6 +19,7 @@ import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.validation.Validator; import java.util.List; +import java.util.stream.Collectors; @Service public class DataSourceConfigServiceImpl extends ServiceImpl implements DataSourceConfigService { @@ -44,6 +46,11 @@ public class DataSourceConfigServiceImpl extends ServiceImpl nav() { + return this.lambdaQuery().list().stream().map(e -> DataSourceConfigConvert.INSTANCE.convertVO(e)).collect(Collectors.toList()); + } + @Override public void print() { dataSourceManager.print(); @@ -66,7 +73,7 @@ public class DataSourceConfigServiceImpl extends ServiceImpl converts(List beans) { + if ( beans == null ) { + return null; + } + + List list = new ArrayList( beans.size() ); + for ( TSupplier tSupplier : beans ) { + list.add( convert( tSupplier ) ); + } + + return list; + } +} diff --git a/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java new file mode 100644 index 0000000..664f038 --- /dev/null +++ b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/ConfigTaskConvertImpl.java @@ -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; + } +} diff --git a/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java new file mode 100644 index 0000000..763a89c --- /dev/null +++ b/sync-gather/target/generated-sources/annotations/com/lyr/gather/local/convert/DataSourceConfigConvertImpl.java @@ -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; + } +}