Browse Source

👍 修改为本地数据库。

sj
占永辉 2 years ago
parent
commit
eb76349932
  1. 2
      bin/sync.sh
  2. 18
      yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
  3. 71
      yudao-server/src/main/resources/application-local.yaml
  4. 35
      yudao-server/src/main/resources/application-prod.yaml
  5. 14
      zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java

2
bin/sync.sh

@ -1 +1 @@
rsync yudao-server/target/yudao-server.jar root@39.105.46.0:/root/project/zen/yudao.jar
rsync -v ../yudao-server/target/yudao-server.jar root@47.108.56.75:/www/wwwroot/yudao/yudao-server.jar

18
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java

@ -41,7 +41,6 @@ import java.util.Map;
@MapperScans({
@MapperScan(basePackages ={"co.yixiang.**.service.mapper", "co.yixiang.config"},sqlSessionFactoryRef = "shangcheng"),
@MapperScan(basePackages = {"com.zsw.erp.datasource.mappers"},sqlSessionFactoryRef = "erp"),
@MapperScan(basePackages = {"${yudao.info.base-package}", "cn.iocoder.yudao"}, annotationClass = Mapper.class,
lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试
})
@ -89,23 +88,6 @@ public class YudaoMybatisAutoConfiguration {
return getSqlSessionFactory(factory);
}
@Bean("erpDataSource")
@ConfigurationProperties("spring.datasource.dynamic.datasource.erp")
public DataSource erpDataSource(){
return new DruidDataSource();
}
@Bean("erp")
public SqlSessionFactory erpSqlSessionFactory(@Qualifier("erpDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean();
Resource[] resources = new PathMatchingResourcePatternResolver().getResources("classpath*:/erp_mapper/*.xml");
Arrays.stream(resources).forEach(resource -> {
log.info("erp mapper:{}",resource.getFilename());
});
factory.setMapperLocations(resources);
factory.setDataSource(dataSource);
return getSqlSessionFactory(factory);
}
private SqlSessionFactory getSqlSessionFactory(MybatisSqlSessionFactoryBean factory) throws Exception {
GlobalConfig globalConfig = new GlobalConfig();

71
yudao-server/src/main/resources/application-local.yaml

@ -1,3 +1,11 @@
# 自定义数据库
mysql:
url: 47.108.56.75
port: 3306
vue-username: vue_pro
vue-password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
bxg_username: vue_pro_bxg
bxg_password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
server:
port: 48080
@ -42,56 +50,23 @@ spring:
test-on-return: false
datasource:
master:
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
name: vue_pro
url: jdbc:mysql://${mysql.url}:${mysql.port}/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${mysql.vue-username}
password: ${mysql.vue-password}
slave: # 模拟从库,可根据自己需要修改
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
name: vue_pro
url: jdbc:mysql://${mysql.url}:${mysql.port}/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${mysql.vue-username}
password: ${mysql.vue-password}
bxg: # 农场数据源
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
erp: # 进销存
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
farm: # 农场数据源
url: jdbc:p6spy:mysql://192.168.10.250:3306/zsw-farm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
# datasource:
# master:
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# slave: # 模拟从库,可根据自己需要修改
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# bxg: # 农场数据源
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# erp: # 进销存
# url: jdbc:p6spy:mysql://localhost/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# farm: # 农场数据源
# url: jdbc:p6spy:mysql://localhost/zsw-farm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
name: vue_pro_bxg
url: jdbc:mysql://${mysql.url}:${mysql.port}/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${mysql.bxg-username}
password: ${mysql.bxg-password}
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis:

35
yudao-server/src/main/resources/application-prod.yaml

@ -1,3 +1,11 @@
# 自定义数据库
mysql:
url: 127.0.0.1
port: 3306
vue-username: vue_pro
vue-password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
bxg_username: vue_pro_bxg
bxg_password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
server:
port: 48080
@ -47,28 +55,22 @@ spring:
# ip: rm-2zey92ofhilzm3p4j0o.mysql.rds.aliyuncs.com:3306
master:
name: vue_pro
url: jdbc:mysql://rm-2zey92ofhilzm3p4j0o.mysql.rds.aliyuncs.com:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
url: jdbc:mysql://${mysql.url}:${mysql.port}/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: vue_pro
password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
username: ${mysql.vue-username}
password: ${mysql.vue-password}
slave: # 模拟从库,可根据自己需要修改
name: vue_pro
url: jdbc:mysql://rm-2zey92ofhilzm3p4j0o.mysql.rds.aliyuncs.com:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
url: jdbc:mysql://${mysql.url}:${mysql.port}/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: vue_pro
password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
username: ${mysql.vue-username}
password: ${mysql.vue-password}
bxg: # 农场数据源
name: vue_pro_bxg
url: jdbc:mysql://rm-2zey92ofhilzm3p4j0o.mysql.rds.aliyuncs.com:3306/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
url: jdbc:mysql://${mysql.url}:${mysql.port}/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: vue_pro
password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
erp: # 农场数据源
name: vue_pro_erp
url: jdbc:mysql://rm-2zey92ofhilzm3p4j0o.mysql.rds.aliyuncs.com:3306/${spring.datasource.dynamic.datasource.erp.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: vue_pro
password: CrnPu&g8HqbBikrA&DH-llRgtvpIrG#-
username: ${mysql.bxg-username}
password: ${mysql.bxg-password}
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis:
@ -76,6 +78,9 @@ spring:
port: 6379 # 端口
database: 15 # 数据库索引
flowable:
database-schema-update: false
--- #################### 定时任务相关配置 ####################
# Quartz 配置项,对应 QuartzProperties 配置类

14
zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java

@ -83,6 +83,7 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
@Autowired
private ApplicationEventPublisher publisher;
@SneakyThrows
@Override
//@Cacheable
@ -204,7 +205,10 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
//当前月份所有的商品分类
});
return map;
};
}
;
/***
*根据榜单,分类,时间等获取商品信息
* ***/
@ -249,7 +253,9 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
});
return list;
}
;
@Override
public List<HotListDTO> getList() {
LambdaQueryWrapper<YxStoreHotListRecord> wrapper = new LambdaQueryWrapper<>();
@ -266,6 +272,7 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
String mouth = Collections.max(mouthList);//设定月份为最近的月份
//获取当前月份的榜单记录
List<YxStoreHotListRecord> recordList = yxStoreHotListRecordMapper.selectList(wrapper.eq(YxStoreHotListRecord::getMouth, mouth));
// ???
LinkedHashSet<Integer> hotIdList = new LinkedHashSet<>();
//获得不重复的榜单id
recordList.forEach(cate -> {
@ -276,8 +283,11 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
//批量查询榜单信息,并进行排序
LambdaQueryWrapper<YxStoreHotList> wrapperList = new LambdaQueryWrapper<>();
wrapperList.in(YxStoreHotList::getId, hotIdList).orderByAsc(YxStoreHotList::getSort);
// 榜单ID
ArrayList<Integer> list1 = new ArrayList<>();
yxStoreHotListMapper.selectList(wrapperList).forEach(yxHotList->list1.add(yxHotList.getId()));
yxStoreHotListMapper.selectList(wrapperList).forEach(
yxHotList -> list1.add(yxHotList.getId())
);
ArrayList<HotListDTO> hotListDTOS = new ArrayList<>();
//已经排序过的榜单
list1.forEach(hotId -> {

Loading…
Cancel
Save