This commit is contained in:
parent
0df23d0900
commit
7672ae5a79
|
@ -12,6 +12,7 @@ import me.zhyd.oauth.model.AuthResponse;
|
|||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.model.LoginBody;
|
||||
|
@ -134,7 +135,7 @@ public class AuthController {
|
|||
// 校验租户
|
||||
if (StringUtils.isEmpty(loginBody.getTenantId())) {
|
||||
//没有则默认注册在主租户下;
|
||||
loginBody.setTenantId("000000");
|
||||
loginBody.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
} else {
|
||||
loginService.checkTenant(loginBody.getTenantId());
|
||||
}
|
||||
|
|
|
@ -12,10 +12,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.domain.model.XcxLoginBody;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
import org.dromara.common.core.exception.user.UserException;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.ValidatorUtils;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
|
@ -45,9 +47,24 @@ public class XcxAuthStrategy implements IAuthStrategy {
|
|||
|
||||
@Override
|
||||
public LoginVo login(String body, SysClientVo client) {
|
||||
String clientKey = client.getClientKey();
|
||||
if ("mp-weixin".equals(clientKey)) {
|
||||
if (!wxMaService.switchover("wx2e09db4124332242")) {
|
||||
throw new IllegalArgumentException("未找到对应appid=wx2e09db4124332242的配置,请核实!");
|
||||
}
|
||||
} else {
|
||||
if (!wxMaService.switchover("wx7320557526b9e7ba")) {
|
||||
throw new IllegalArgumentException("未找到对应appid=wx7320557526b9e7ba的配置,请核实!wx7320557526b9e7ba");
|
||||
}
|
||||
}
|
||||
XcxLoginBody loginBody = JsonUtils.parseObject(body, XcxLoginBody.class);
|
||||
ValidatorUtils.validate(loginBody);
|
||||
String tenantId = loginBody.getTenantId();
|
||||
if (StringUtils.isEmpty(tenantId)) {
|
||||
//没有则默认注册在主租户下;
|
||||
loginBody.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
tenantId = TenantConstants.DEFAULT_TENANT_ID;
|
||||
}
|
||||
// code 为 小程序调用 wx.login 授权后获取
|
||||
String code = loginBody.getCode();
|
||||
String encryptedData = loginBody.getEncryptedData();
|
||||
|
|
|
@ -4,7 +4,7 @@ spring.servlet.multipart.location: /ruoyi/server/temp
|
|||
--- # 监控中心配置
|
||||
spring.boot.admin.client:
|
||||
# 增加客户端开关
|
||||
enabled: true
|
||||
enabled: false
|
||||
url: http://localhost:9090/admin
|
||||
instance:
|
||||
service-host-type: IP
|
||||
|
@ -13,7 +13,7 @@ spring.boot.admin.client:
|
|||
|
||||
--- # snail-job 配置
|
||||
snail-job:
|
||||
enabled: true
|
||||
enabled: false
|
||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||
group: "ruoyi_group"
|
||||
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
|
||||
|
@ -45,35 +45,17 @@ spring:
|
|||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://172.25.23.150:16338/mental_tenant?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: root
|
||||
password: Mz!@#123
|
||||
# 从库数据源
|
||||
slave:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://172.25.23.150:16338/mental_tenant?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||
username:
|
||||
password:
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||
# username: ROOT
|
||||
# password: root
|
||||
# postgres:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: root
|
||||
# password: root
|
||||
# sqlserver:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# username: SA
|
||||
# password: root
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
|
@ -94,13 +76,13 @@ spring:
|
|||
spring.data:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: 172.25.23.150
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
port: 16237
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# redis 密码必须配置
|
||||
password: ruoyi123
|
||||
password: Mzkj@1234
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
@ -261,16 +243,19 @@ justauth:
|
|||
|
||||
wx:
|
||||
pay:
|
||||
appId: #微信公众号或者小程序等的appid
|
||||
mchId: #微信支付商户号
|
||||
mchKey: #微信支付商户密钥
|
||||
subAppId: #服务商模式下的子商户公众账号ID
|
||||
subMchId: #服务商模式下的子商户号
|
||||
keyPath: # p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
|
||||
appId: wx2e09db4124332242
|
||||
mchId: 1646701170
|
||||
mchKey: Mozhekejiyouxiangongsi6296296296
|
||||
keyPath: /usr/local/tenant/certs/apiclient_cert.p12
|
||||
miniapp:
|
||||
configs:
|
||||
- appid: #微信小程序的appid
|
||||
secret: #微信小程序的Secret
|
||||
- appid: wx2e09db4124332242
|
||||
secret: ca069319b37b0909e65367c802c53d29
|
||||
token: #微信小程序消息服务器配置的token
|
||||
aesKey: #微信小程序消息服务器配置的EncodingAESKey
|
||||
msgDataFormat: JSON
|
||||
- appid: wx7320557526b9e7ba
|
||||
secret: 2927739a82d43921fe9a33f48e96a437
|
||||
token: #微信小程序消息服务器配置的token
|
||||
aesKey: #微信小程序消息服务器配置的EncodingAESKey
|
||||
msgDataFormat: JSON
|
||||
|
|
|
@ -143,6 +143,7 @@ tenant:
|
|||
- sys_oss_config
|
||||
- sys_oss
|
||||
- sys_evaluation_answer
|
||||
- sys_scale_order
|
||||
- m_counselor
|
||||
- m_counselor_experience
|
||||
- m_counselor_qualification
|
||||
|
@ -201,7 +202,7 @@ api-decrypt:
|
|||
springdoc:
|
||||
api-docs:
|
||||
# 是否开启接口文档
|
||||
enabled: true
|
||||
enabled: false
|
||||
# swagger-ui:
|
||||
# # 持久化认证数据
|
||||
# persistAuthorization: true
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package org.dromara.test;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 断言单元测试案例
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@DisplayName("断言单元测试案例")
|
||||
public class AssertUnitTest {
|
||||
|
||||
@DisplayName("测试 assertEquals 方法")
|
||||
@Test
|
||||
public void testAssertEquals() {
|
||||
Assertions.assertEquals("666", new String("666"));
|
||||
Assertions.assertNotEquals("666", new String("666"));
|
||||
}
|
||||
|
||||
@DisplayName("测试 assertSame 方法")
|
||||
@Test
|
||||
public void testAssertSame() {
|
||||
Object obj = new Object();
|
||||
Object obj1 = obj;
|
||||
Assertions.assertSame(obj, obj1);
|
||||
Assertions.assertNotSame(obj, obj1);
|
||||
}
|
||||
|
||||
@DisplayName("测试 assertTrue 方法")
|
||||
@Test
|
||||
public void testAssertTrue() {
|
||||
Assertions.assertTrue(true);
|
||||
Assertions.assertFalse(true);
|
||||
}
|
||||
|
||||
@DisplayName("测试 assertNull 方法")
|
||||
@Test
|
||||
public void testAssertNull() {
|
||||
Assertions.assertNull(null);
|
||||
Assertions.assertNotNull(null);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package org.dromara.test;
|
||||
|
||||
import org.dromara.common.core.config.RuoYiConfig;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 单元测试案例
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@SpringBootTest // 此注解只能在 springboot 主包下使用 需包含 main 方法与 yml 配置文件
|
||||
@DisplayName("单元测试案例")
|
||||
public class DemoUnitTest {
|
||||
|
||||
@Autowired
|
||||
private RuoYiConfig ruoYiConfig;
|
||||
|
||||
@DisplayName("测试 @SpringBootTest @Test @DisplayName 注解")
|
||||
@Test
|
||||
public void testTest() {
|
||||
System.out.println(ruoYiConfig);
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@DisplayName("测试 @Disabled 注解")
|
||||
@Test
|
||||
public void testDisabled() {
|
||||
System.out.println(ruoYiConfig);
|
||||
}
|
||||
|
||||
@Timeout(value = 2L, unit = TimeUnit.SECONDS)
|
||||
@DisplayName("测试 @Timeout 注解")
|
||||
@Test
|
||||
public void testTimeout() throws InterruptedException {
|
||||
Thread.sleep(3000);
|
||||
System.out.println(ruoYiConfig);
|
||||
}
|
||||
|
||||
|
||||
@DisplayName("测试 @RepeatedTest 注解")
|
||||
@RepeatedTest(3)
|
||||
public void testRepeatedTest() {
|
||||
System.out.println(666);
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
public static void testBeforeAll() {
|
||||
System.out.println("@BeforeAll ==================");
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void testBeforeEach() {
|
||||
System.out.println("@BeforeEach ==================");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void testAfterEach() {
|
||||
System.out.println("@AfterEach ==================");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void testAfterAll() {
|
||||
System.out.println("@AfterAll ==================");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package org.dromara.test;
|
||||
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.junit.jupiter.params.provider.NullSource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 带参数单元测试案例
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@DisplayName("带参数单元测试案例")
|
||||
public class ParamUnitTest {
|
||||
|
||||
@DisplayName("测试 @ValueSource 注解")
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"t1", "t2", "t3"})
|
||||
public void testValueSource(String str) {
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
@DisplayName("测试 @NullSource 注解")
|
||||
@ParameterizedTest
|
||||
@NullSource
|
||||
public void testNullSource(String str) {
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
@DisplayName("测试 @EnumSource 注解")
|
||||
@ParameterizedTest
|
||||
@EnumSource(UserType.class)
|
||||
public void testEnumSource(UserType type) {
|
||||
System.out.println(type.getUserType());
|
||||
}
|
||||
|
||||
@DisplayName("测试 @MethodSource 注解")
|
||||
@ParameterizedTest
|
||||
@MethodSource("getParam")
|
||||
public void testMethodSource(String str) {
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
public static Stream<String> getParam() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("t1");
|
||||
list.add("t2");
|
||||
list.add("t3");
|
||||
return list.stream();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void testBeforeEach() {
|
||||
System.out.println("@BeforeEach ==================");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void testAfterEach() {
|
||||
System.out.println("@AfterEach ==================");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package org.dromara.test;
|
||||
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* 标签单元测试案例
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@SpringBootTest
|
||||
@DisplayName("标签单元测试案例")
|
||||
public class TagUnitTest {
|
||||
|
||||
@Tag("dev")
|
||||
@DisplayName("测试 @Tag dev")
|
||||
@Test
|
||||
public void testTagDev() {
|
||||
System.out.println("dev");
|
||||
}
|
||||
|
||||
@Tag("prod")
|
||||
@DisplayName("测试 @Tag prod")
|
||||
@Test
|
||||
public void testTagProd() {
|
||||
System.out.println("prod");
|
||||
}
|
||||
|
||||
@Tag("local")
|
||||
@DisplayName("测试 @Tag local")
|
||||
@Test
|
||||
public void testTagLocal() {
|
||||
System.out.println("local");
|
||||
}
|
||||
|
||||
@Tag("exclude")
|
||||
@DisplayName("测试 @Tag exclude")
|
||||
@Test
|
||||
public void testTagExclude() {
|
||||
System.out.println("exclude");
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void testBeforeEach() {
|
||||
System.out.println("@BeforeEach ==================");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void testAfterEach() {
|
||||
System.out.println("@AfterEach ==================");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -7,13 +7,10 @@ import org.dromara.common.core.validate.AddGroup;
|
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SubmitAnswerBo;
|
||||
import org.dromara.system.domain.vo.QuestionAnswerVo;
|
||||
import org.dromara.system.domain.vo.SysEvaluationRecordVo;
|
||||
import org.dromara.system.domain.vo.SysScaleVo;
|
||||
import org.dromara.system.service.IEvaluationService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -39,10 +36,10 @@ public class WxEvaluationController extends BaseController {
|
|||
/**
|
||||
* 查询发布量表
|
||||
*/
|
||||
@GetMapping("/publish")
|
||||
public R<List<SysScaleVo>> queryPublish() {
|
||||
return R.ok(evaluationService.queryPublishScale());
|
||||
}
|
||||
// @GetMapping("/publish")
|
||||
// public R<List<SysScaleVo>> queryPublish() {
|
||||
// return R.ok(evaluationService.queryPublishScale());
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -50,16 +47,9 @@ public class WxEvaluationController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/answer/{id}")
|
||||
public R<List<QuestionAnswerVo>> queryAnswer(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||
return R.ok(evaluationService.queryQuestionAnswerListByScaleId(id));
|
||||
return R.ok(TenantHelper.ignore(() -> evaluationService.queryQuestionAnswerListByScaleId(id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询量测记录
|
||||
*/
|
||||
@GetMapping("/record")
|
||||
public TableDataInfo<SysEvaluationRecordVo> queryRecord(Integer status, PageQuery pageQuery) {
|
||||
return evaluationService.queryEvaluationRecord(status, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增量测记录
|
||||
|
@ -68,7 +58,7 @@ public class WxEvaluationController extends BaseController {
|
|||
@RepeatSubmit()
|
||||
@PostMapping("/record/create/{scaleId}")
|
||||
public R<Void> newRecord(@NotNull(message = "主键不能为空") @PathVariable Long scaleId) {
|
||||
return toAjax(evaluationService.newRecord(scaleId));
|
||||
return toAjax(TenantHelper.ignore(() -> evaluationService.newRecord(scaleId)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +68,7 @@ public class WxEvaluationController extends BaseController {
|
|||
@RepeatSubmit()
|
||||
@PostMapping("/record/{id}")
|
||||
public R<Void> checkRecord(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||
return toAjax(evaluationService.checkRecord(id));
|
||||
return toAjax(TenantHelper.ignore(() -> evaluationService.checkRecord(id)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,6 +78,6 @@ public class WxEvaluationController extends BaseController {
|
|||
@RepeatSubmit()
|
||||
@PostMapping("/record/answer")
|
||||
public R<Map<String, Object>> add(@Validated(AddGroup.class) @RequestBody SubmitAnswerBo bo) {
|
||||
return R.ok(evaluationService.submitAnswer(bo));
|
||||
return R.ok(TenantHelper.ignore(() -> evaluationService.submitAnswer(bo)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,14 @@ import cn.hutool.core.io.FileUtil;
|
|||
import cn.hutool.core.io.IoUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.file.FileUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.BaseQueryBo;
|
||||
import org.dromara.system.domain.bo.ReservationOrderBo;
|
||||
|
@ -52,7 +54,7 @@ public class WxMyController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/num")
|
||||
public R<List<StatisticNumVo>> getEvaluationTaskNum() {
|
||||
return R.ok(myService.getMyNum());
|
||||
return R.ok(TenantHelper.ignore(() -> myService.getMyNum()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +62,7 @@ public class WxMyController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/evaluation/task/pageList")
|
||||
public TableDataInfo<SysEvaluationRecordVo> taskList(PageQuery pageQuery) {
|
||||
return myService.queryPersonalTaskPageList(pageQuery);
|
||||
return TenantHelper.ignore(() -> myService.queryPersonalTaskPageList(pageQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +70,8 @@ public class WxMyController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/scale/pageList")
|
||||
public TableDataInfo<SysScaleVo> list(SysScaleBo bo, PageQuery pageQuery) {
|
||||
return myService.queryScalePageList(bo, pageQuery);
|
||||
bo.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
return TenantHelper.ignore(() -> myService.queryScalePageList(bo, pageQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,14 +96,14 @@ public class WxMyController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/evaluation/personal/pageList")
|
||||
public TableDataInfo<SysEvaluationRecordVo> personalList(PageQuery pageQuery) {
|
||||
return myService.queryPersonalEvaluationRecordPageList(pageQuery);
|
||||
return TenantHelper.ignore(() -> myService.queryPersonalEvaluationRecordPageList(pageQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的咨询
|
||||
*/
|
||||
@GetMapping("/reservation/pageList")
|
||||
public TableDataInfo<ReservationOrderVo> reservationList(ReservationOrderBo bo,PageQuery pageQuery) {
|
||||
public TableDataInfo<ReservationOrderVo> reservationList(ReservationOrderBo bo, PageQuery pageQuery) {
|
||||
return myService.queryReservationPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
@ -110,7 +113,7 @@ public class WxMyController extends BaseController {
|
|||
@GetMapping("/archive/pageList")
|
||||
public TableDataInfo<ArchiveStatisticVo> statisticPageList(PageQuery pageQuery) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
return archiveService.queryStatisticPageList(userId, pageQuery);
|
||||
return TenantHelper.ignore(() -> archiveService.queryStatisticPageList(userId, pageQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,7 +123,13 @@ public class WxMyController extends BaseController {
|
|||
public void export(BaseQueryBo bo, HttpServletResponse response) throws Exception {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
bo.setUserId(userId);
|
||||
String filePath = sysEvaluationRecordService.getWordTemplate(bo);
|
||||
String filePath = TenantHelper.ignore(() -> {
|
||||
try {
|
||||
return sysEvaluationRecordService.getWordTemplate(bo);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
File pdf = FileUtil.createTempFile(".pdf", true);
|
||||
String pdfPath = pdf.getPath();
|
||||
File pdfFile = new File(pdfPath);
|
||||
|
|
|
@ -2,11 +2,13 @@ package org.dromara.system.controller.wx;
|
|||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysScaleBo;
|
||||
import org.dromara.system.domain.vo.SysScaleVo;
|
||||
|
@ -41,7 +43,8 @@ public class WxScaleController extends BaseController {
|
|||
@GetMapping("/pageList")
|
||||
public TableDataInfo<SysScaleVo> pageList(SysScaleBo bo, PageQuery pageQuery) {
|
||||
bo.setOrderBy("num");
|
||||
return sysScaleService.queryPageList(bo, pageQuery);
|
||||
bo.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
return TenantHelper.ignore(() -> sysScaleService.queryPageList(bo, pageQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +53,8 @@ public class WxScaleController extends BaseController {
|
|||
@GetMapping("/typeList")
|
||||
public R<List<SysScaleVo>> pageListTest(SysScaleBo bo) {
|
||||
bo.setOrderBy("num");
|
||||
return R.ok(sysScaleService.queryPageListType(bo));
|
||||
bo.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
return R.ok(TenantHelper.ignore(() -> sysScaleService.queryPageListType(bo)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +65,7 @@ public class WxScaleController extends BaseController {
|
|||
if (StringUtils.isEmpty(scaleType)) {
|
||||
throw new ServiceException("类型不能为空");
|
||||
}
|
||||
return R.ok(sysScaleService.queryWxMapList(scaleType));
|
||||
return R.ok(TenantHelper.ignore(() ->sysScaleService.queryWxMapList(scaleType)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,6 +75,6 @@ public class WxScaleController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/{scaleId}")
|
||||
public R<SysScaleVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long scaleId) {
|
||||
return R.ok(sysScaleService.queryById4Wx(scaleId));
|
||||
return R.ok(TenantHelper.ignore(() ->sysScaleService.queryById4Wx(scaleId)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.dromara.system.controller.wx;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
|
@ -10,6 +10,7 @@ import org.dromara.common.log.annotation.Log;
|
|||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.ScoreRecordBo;
|
||||
import org.dromara.system.domain.vo.ScoreRecordVo;
|
||||
|
@ -34,10 +35,10 @@ public class WxScoreRecordController extends BaseController {
|
|||
/**
|
||||
* 查询评分列表
|
||||
*/
|
||||
@SaCheckPermission("scale:scoreRecord:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ScoreRecordVo> list(ScoreRecordBo bo, PageQuery pageQuery) {
|
||||
return scoreRecordService.queryPageList(bo, pageQuery);
|
||||
bo.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
return TenantHelper.ignore(() ->scoreRecordService.queryPageList(bo, pageQuery));
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,21 +47,19 @@ public class WxScoreRecordController extends BaseController {
|
|||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("scale:scoreRecord:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<ScoreRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(scoreRecordService.queryById(id));
|
||||
return R.ok(TenantHelper.ignore(() ->scoreRecordService.queryById(id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评分
|
||||
*/
|
||||
@SaCheckPermission("scale:scoreRecord:add")
|
||||
@Log(title = "评分", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ScoreRecordBo bo) {
|
||||
return toAjax(scoreRecordService.insertByBo(bo));
|
||||
return toAjax(TenantHelper.ignore(() ->scoreRecordService.insertByBo(bo)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -18,7 +18,7 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_scale_order")
|
||||
public class SysScaleOrder extends TenantEntity {
|
||||
public class SysScaleOrder extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -32,7 +33,7 @@ public class SysScalePackage extends BaseEntity {
|
|||
/**
|
||||
* 量表套餐id
|
||||
*/
|
||||
@TableId(value = "package_id")
|
||||
@TableId(value = "package_id", type = IdType.AUTO)
|
||||
private Long packageId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -26,7 +27,7 @@ public class SysTenant extends BaseEntity {
|
|||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 租户套餐对象 sys_tenant_package
|
||||
*
|
||||
|
@ -23,7 +26,7 @@ public class SysTenantPackage extends BaseEntity {
|
|||
/**
|
||||
* 租户套餐id
|
||||
*/
|
||||
@TableId(value = "package_id")
|
||||
@TableId(value = "package_id", type = IdType.AUTO)
|
||||
private Long packageId;
|
||||
/**
|
||||
* 套餐名称
|
||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import org.dromara.system.domain.ScoreRecord;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -20,7 +20,7 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ScoreRecord.class, reverseConvertGenerate = false)
|
||||
public class ScoreRecordBo extends BaseEntity {
|
||||
public class ScoreRecordBo extends TenantEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -10,7 +10,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import org.dromara.system.domain.SysScale;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SysScale.class, reverseConvertGenerate = false)
|
||||
public class SysScaleBo extends BaseEntity {
|
||||
public class SysScaleBo extends TenantEntity {
|
||||
|
||||
/**
|
||||
* 测评id
|
||||
|
@ -85,9 +85,9 @@ public class SysScaleBo extends BaseEntity {
|
|||
/**
|
||||
* 封面
|
||||
*/
|
||||
@NotNull(message = "封面不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
//@NotNull(message = "封面不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long cover;
|
||||
@NotNull(message = "移动端封面不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
//@NotNull(message = "移动端封面不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long appCover;
|
||||
//@NotNull(message = "移动端详情图不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long detailAnnex;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.dromara.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
@ -25,8 +22,6 @@ public interface SysEvaluationRecordMapper extends BaseMapperPlus<SysEvaluationR
|
|||
|
||||
List<SysScaleVo> selectPublishScaleListByUserAndBatch(@Param("userId") Long userId, @Param("batchNos") String batchNos);
|
||||
|
||||
Page<SysEvaluationRecordVo> selectRecordVoPage(@Param("page") Page<SysEvaluationRecord> page, @Param(Constants.WRAPPER) Wrapper<SysEvaluationRecord> queryWrapper);
|
||||
|
||||
List<WordEvaluationFactor> selectEvaluationFactor4Word(Long recordId);
|
||||
|
||||
List<SysEvaluationRecordVo> selectUseByBatchNo(Long batchNo);
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package org.dromara.system.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.bo.SubmitAnswerBo;
|
||||
import org.dromara.system.domain.vo.QuestionAnswerVo;
|
||||
import org.dromara.system.domain.vo.SysEvaluationRecordVo;
|
||||
import org.dromara.system.domain.vo.SysScaleVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IEvaluationService {
|
||||
|
||||
List<SysScaleVo> queryPublishScale();
|
||||
// List<SysScaleVo> queryPublishScale();
|
||||
|
||||
List<QuestionAnswerVo> queryQuestionAnswerListByScaleId(Long scaleId);
|
||||
|
||||
TableDataInfo<SysEvaluationRecordVo> queryEvaluationRecord(Integer status, PageQuery pageQuery);
|
||||
|
||||
Boolean newRecord(Long recordId);
|
||||
|
||||
Boolean checkRecord(Long recordId);
|
||||
|
|
|
@ -78,15 +78,17 @@ public class CounselorServiceImpl implements ICounselorService {
|
|||
counselorVo.setPracticeString(betweenYear);
|
||||
|
||||
ScoreRateVo scoreRateVo = scoreRecordMapper.selectRate(id);
|
||||
Integer count = scoreRateVo.getCount();
|
||||
if (count > 0) {
|
||||
double v = count * 5 * 5 * 5;
|
||||
Double total = scoreRateVo.getTotal();
|
||||
if (total > 0) {
|
||||
BigDecimal rate = BigDecimal.valueOf(total).divide(new BigDecimal(v), 2, RoundingMode.HALF_UP)
|
||||
.multiply(new BigDecimal(100));
|
||||
if (rate.compareTo(new BigDecimal(90)) > 0) {
|
||||
counselorVo.setGoodRate(rate.toString());
|
||||
if (scoreRateVo != null) {
|
||||
Integer count = scoreRateVo.getCount();
|
||||
if (count > 0) {
|
||||
double v = count * 5 * 5 * 5;
|
||||
Double total = scoreRateVo.getTotal();
|
||||
if (total > 0) {
|
||||
BigDecimal rate = BigDecimal.valueOf(total).divide(new BigDecimal(v), 2, RoundingMode.HALF_UP)
|
||||
.multiply(new BigDecimal(100));
|
||||
if (rate.compareTo(new BigDecimal(90)) > 0) {
|
||||
counselorVo.setGoodRate(rate.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,12 @@ package org.dromara.system.service.impl;
|
|||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.constant.*;
|
||||
import org.dromara.system.domain.*;
|
||||
|
@ -65,38 +61,34 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
|||
private final MathContext mathContext = new MathContext(2);
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysScaleVo> queryPublishScale() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
Long deptId = loginUser.getDeptId();
|
||||
|
||||
String deptBatchNo = publishMapper.selectUseBatchNoByDeptId(deptId);
|
||||
String userBatchNo = publishMapper.selectUseBatchNoByUserId(userId);
|
||||
List<String> batchList = new ArrayList<>();
|
||||
List<SysScaleVo> scaleVos = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(deptBatchNo)) {
|
||||
batchList.add(deptBatchNo);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(userBatchNo)) {
|
||||
batchList.add(userBatchNo);
|
||||
}
|
||||
if (batchList.size() == 0) {
|
||||
return scaleVos;
|
||||
}
|
||||
scaleVos = recordMapper.selectPublishScaleListByUserAndBatch(userId, StrUtil.join(StrUtil.COMMA, batchList));
|
||||
return scaleVos;
|
||||
}
|
||||
// @Override
|
||||
// public List<SysScaleVo> queryPublishScale() {
|
||||
// LoginUser loginUser = getLoginUser();
|
||||
// Long userId = loginUser.getUserId();
|
||||
// Long deptId = loginUser.getDeptId();
|
||||
//
|
||||
// String deptBatchNo = publishMapper.selectUseBatchNoByDeptId(deptId);
|
||||
// String userBatchNo = publishMapper.selectUseBatchNoByUserId(userId);
|
||||
// List<String> batchList = new ArrayList<>();
|
||||
// List<SysScaleVo> scaleVos = new ArrayList<>();
|
||||
// if (StringUtils.isNotEmpty(deptBatchNo)) {
|
||||
// batchList.add(deptBatchNo);
|
||||
// }
|
||||
// if (StringUtils.isNotEmpty(userBatchNo)) {
|
||||
// batchList.add(userBatchNo);
|
||||
// }
|
||||
// if (batchList.size() == 0) {
|
||||
// return scaleVos;
|
||||
// }
|
||||
// scaleVos = recordMapper.selectPublishScaleListByUserAndBatch(userId, StrUtil.join(StrUtil.COMMA, batchList));
|
||||
// return scaleVos;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<QuestionAnswerVo> queryQuestionAnswerListByScaleId(Long scaleId) {
|
||||
return scaleAnswerService.queryQuestionAnswerListByScaleId(scaleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysEvaluationRecordVo> queryEvaluationRecord(Integer status, PageQuery pageQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean newRecord(Long scaleId) {
|
||||
|
|
|
@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.service.OssService;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
|
@ -56,7 +58,8 @@ public class MyServiceImpl implements IMyService {
|
|||
Long recordNum = evaluationRecordMapper.selectCount(new LambdaQueryWrapper<SysEvaluationRecord>()
|
||||
.eq(SysEvaluationRecord::getUserId, userId)
|
||||
.eq(SysEvaluationRecord::getPublishFlag, 0)
|
||||
.le(SysEvaluationRecord::getStatus, StatusEnum.DISABLED.getValue()));
|
||||
.eq(SysEvaluationRecord::getTenantId, TenantConstants.DEFAULT_TENANT_ID)
|
||||
.eq(SysEvaluationRecord::getStatus, StatusEnum.DISABLED.getValue()));
|
||||
list.add(new StatisticNumVo("evaluation", recordNum.intValue()));
|
||||
|
||||
List<String> scaleList = evaluationRecordMapper.selectEvaluationScaleList(userId);
|
||||
|
@ -67,10 +70,12 @@ public class MyServiceImpl implements IMyService {
|
|||
.eq(ReservationOrder::getOrderStatus, 2));
|
||||
list.add(new StatisticNumVo("intervene", orderNum.intValue()));
|
||||
|
||||
String tenantId = LoginHelper.getTenantId();
|
||||
Long publishNum = evaluationRecordMapper.selectCount(new LambdaQueryWrapper<SysEvaluationRecord>()
|
||||
.eq(SysEvaluationRecord::getUserId, userId)
|
||||
.eq(SysEvaluationRecord::getPublishFlag, 1)
|
||||
.le(SysEvaluationRecord::getStatus, StatusEnum.DISABLED.getValue()));
|
||||
.eq(SysEvaluationRecord::getTenantId, tenantId)
|
||||
.eq(SysEvaluationRecord::getStatus, StatusEnum.DISABLED.getValue()));
|
||||
list.add(new StatisticNumVo("publish", publishNum.intValue()));
|
||||
return list;
|
||||
}
|
||||
|
@ -83,6 +88,7 @@ public class MyServiceImpl implements IMyService {
|
|||
//根据flag查询个人或发布
|
||||
lqw.eq(SysEvaluationRecord::getPublishFlag, 0);
|
||||
lqw.eq(SysEvaluationRecord::getStatus, 0);
|
||||
lqw.eq(SysEvaluationRecord::getTenantId, TenantConstants.DEFAULT_TENANT_ID);
|
||||
lqw.orderByDesc(SysEvaluationRecord::getCreateTime);
|
||||
return queryEvaluationRecordPageList(lqw, pageQuery);
|
||||
}
|
||||
|
@ -94,7 +100,8 @@ public class MyServiceImpl implements IMyService {
|
|||
lqw.eq(SysEvaluationRecord::getUserId, userId);
|
||||
//根据flag查询个人或发布
|
||||
lqw.eq(SysEvaluationRecord::getPublishFlag, 0);
|
||||
//lqw.gt(SysEvaluationRecord::getStatus, -1);
|
||||
lqw.eq(SysEvaluationRecord::getTenantId, TenantConstants.DEFAULT_TENANT_ID);
|
||||
lqw.ne(SysEvaluationRecord::getStatus, -1);
|
||||
lqw.orderByDesc(SysEvaluationRecord::getCreateTime);
|
||||
return queryEvaluationRecordPageList(lqw, pageQuery);
|
||||
}
|
||||
|
@ -115,7 +122,9 @@ public class MyServiceImpl implements IMyService {
|
|||
Long userId = LoginHelper.getUserId();
|
||||
List<String> list = evaluationRecordMapper.selectEvaluationScaleList(userId);
|
||||
IPage<SysScaleVo> page = scaleMapper.selectVoPage(pageQuery.build(),
|
||||
new LambdaQueryWrapper<SysScale>().in(SysScale::getScaleId, list));
|
||||
new LambdaQueryWrapper<SysScale>()
|
||||
.eq(StringUtils.isNotBlank(bo.getTenantId()), SysScale::getTenantId, bo.getTenantId())
|
||||
.in(SysScale::getScaleId, list));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
|
@ -130,12 +139,13 @@ public class MyServiceImpl implements IMyService {
|
|||
}
|
||||
|
||||
private TableDataInfo<SysEvaluationRecordVo> queryEvaluationRecordPageList(LambdaQueryWrapper<SysEvaluationRecord> lqw, PageQuery pageQuery) {
|
||||
Page<SysEvaluationRecordVo> result = evaluationRecordMapper.selectRecordVoPage(pageQuery.build(), lqw);
|
||||
Page<SysEvaluationRecordVo> result = evaluationRecordMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<SysEvaluationRecordVo> records = result.getRecords();
|
||||
for (SysEvaluationRecordVo record : records) {
|
||||
SysScale scale = scaleMapper.selectById(record.getScaleId());
|
||||
String s = ossService.selectUrlByIds(String.valueOf(scale.getAppCover()));
|
||||
record.setAppCoverUrl(s);
|
||||
record.setScaleName(scale.getScaleName());
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ public class ReservationRefundServiceImpl implements IReservationRefundService {
|
|||
refund.setStatus(1);
|
||||
refund.setWxRefundId(wxRefundId);
|
||||
refund.setUpdateTime(date);
|
||||
boolean refundFlag = baseMapper.insert(refund) > 0;
|
||||
boolean refundFlag = baseMapper.updateById(refund) > 0;
|
||||
return orderFlag && refundFlag;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.ScoreRecord;
|
||||
|
@ -36,7 +38,7 @@ public class ScoreRecordServiceImpl implements IScoreRecordService {
|
|||
* @return 评分
|
||||
*/
|
||||
@Override
|
||||
public ScoreRecordVo queryById(Long id){
|
||||
public ScoreRecordVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
|
@ -71,6 +73,7 @@ public class ScoreRecordServiceImpl implements IScoreRecordService {
|
|||
LambdaQueryWrapper<ScoreRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getBusinessId() != null, ScoreRecord::getBusinessId, bo.getBusinessId());
|
||||
lqw.eq(bo.getRecordStatus() != null, ScoreRecord::getRecordStatus, bo.getRecordStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), ScoreRecord::getTenantId, bo.getTenantId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
@ -82,8 +85,8 @@ public class ScoreRecordServiceImpl implements IScoreRecordService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ScoreRecordBo bo) {
|
||||
bo.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||
ScoreRecord add = MapstructUtils.convert(bo, ScoreRecord.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
|
@ -91,11 +94,5 @@ public class ScoreRecordServiceImpl implements IScoreRecordService {
|
|||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ScoreRecord entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,12 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
@Override
|
||||
public TableDataInfo<SysEvaluationRecordVo> queryPageList(SysEvaluationRecordBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysEvaluationRecord> lqw = buildQueryWrapper(bo);
|
||||
Page<SysEvaluationRecordVo> result = baseMapper.selectRecordVoPage(pageQuery.build(), lqw);
|
||||
Page<SysEvaluationRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<SysEvaluationRecordVo> records = result.getRecords();
|
||||
for (SysEvaluationRecordVo record : records) {
|
||||
SysScale scale = scaleMapper.selectById(record.getScaleId());
|
||||
record.setScaleName(scale.getScaleName());
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.dromara.system.domain.vo.SysOssVo;
|
|||
import org.dromara.system.mapper.SysOssMapper;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -51,6 +52,7 @@ import java.util.Map;
|
|||
public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
|
||||
private final SysOssMapper baseMapper;
|
||||
private final DataSourcePoolMetricsAutoConfiguration dataSourcePoolMetricsAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 查询OSS对象存储列表
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.service.DictService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
|
@ -23,6 +24,7 @@ import org.dromara.system.mapper.SysEvaluationRecordMapper;
|
|||
import org.dromara.system.mapper.SysScaleMapper;
|
||||
import org.dromara.system.service.ISysScaleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
@ -104,6 +106,7 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysScaleVo> queryPageList(SysScaleBo bo, PageQuery pageQuery) {
|
||||
StopWatch watch = new StopWatch();
|
||||
LambdaQueryWrapper<SysScale> lqw = buildQueryWrapper(bo);
|
||||
if ("num".equals(bo.getOrderBy())) {
|
||||
lqw.orderByDesc(SysScale::getPublishNums);
|
||||
|
@ -155,6 +158,7 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
lqw.like(StringUtils.isNotBlank(bo.getScaleName()), SysScale::getScaleName, bo.getScaleName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getScaleCode()), SysScale::getScaleCode, bo.getScaleCode());
|
||||
lqw.eq(bo.getStatus() != null, SysScale::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), SysScale::getTenantId, bo.getTenantId());
|
||||
if (CollUtil.isNotEmpty(bo.getScaleType())) {
|
||||
lqw.like(SysScale::getScaleType, bo.getScaleType().get(0));
|
||||
}
|
||||
|
@ -213,6 +217,7 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
for (String s : split) {
|
||||
LambdaQueryWrapper<SysScale> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.like(SysScale::getScaleType, s);
|
||||
lqw.eq(SysScale::getTenantId, TenantConstants.DEFAULT_TENANT_ID);
|
||||
lqw.orderByDesc(SysScale::getPublishNums);
|
||||
lqw.last("limit 2");
|
||||
List<SysScaleVo> list = baseMapper.selectVoList(lqw);
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.constant.CacheNames;
|
||||
import org.dromara.common.core.constant.Constants;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
|
@ -27,6 +28,7 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -35,6 +37,7 @@ import java.util.*;
|
|||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysTenantServiceImpl implements ISysTenantService {
|
||||
|
@ -137,7 +140,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
|
||||
// 根据套餐创建角色
|
||||
Long roleId = createTenantRole(tenantId, bo.getTenantPackageId());
|
||||
|
||||
createTenantScale(tenantId, bo.getScalePackageId());
|
||||
// 创建部门: 公司名是部门名称
|
||||
SysDept dept = new SysDept();
|
||||
dept.setTenantId(tenantId);
|
||||
|
@ -267,25 +270,25 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
if (ObjectUtil.isNull(scalePackage)) {
|
||||
throw new ServiceException("量表套餐不存在");
|
||||
}
|
||||
// 获取免费量表id
|
||||
// 获取新增量表id
|
||||
List<Long> scaleIds = StringUtils.splitTo(scalePackage.getScaleIds(), Convert::toLong);
|
||||
//新增量表
|
||||
List<SysScale> allScaleList = scaleMapper.selectList(new LambdaQueryWrapper<SysScale>()
|
||||
.eq(SysScale::getTenantId, TenantConstants.DEFAULT_TENANT_ID));
|
||||
.eq(SysScale::getTenantId, TenantConstants.DEFAULT_TENANT_ID)
|
||||
.in(SysScale::getScaleId, scaleIds));
|
||||
//处理问题和因子
|
||||
List<SysScaleQuestion> allQuestionList = new ArrayList<>();
|
||||
List<SysScaleAnswer> allAnswerList = new ArrayList<>();
|
||||
List<SysScaleFactor> allFactorList = new ArrayList<>();
|
||||
List<SysScaleFactorRange> allRangeList = new ArrayList<>();
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
for (SysScale sysScale : allScaleList) {
|
||||
Long oldScaleId = sysScale.getScaleId();
|
||||
Long newScaleId = identifierGenerator.nextId(SysScale.class).longValue();
|
||||
sysScale.setScaleId(newScaleId);
|
||||
sysScale.setTenantId(tenantId);
|
||||
sysScale.setPublishNums(0);
|
||||
if (scaleIds.contains(sysScale.getScaleId())) {
|
||||
sysScale.setFreeFlag(1);
|
||||
}
|
||||
sysScale.setFreeFlag(1);
|
||||
Map<Long, Long> questionIdMap = new HashMap<>();
|
||||
//处理问题列表
|
||||
List<SysScaleQuestion> questionList = questionMapper.selectList(new LambdaQueryWrapper<SysScaleQuestion>()
|
||||
|
@ -345,11 +348,16 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
}
|
||||
allFactorList.addAll(factorList);
|
||||
}
|
||||
scaleMapper.insertBatch(allScaleList, 200);
|
||||
questionMapper.insertBatch(allQuestionList, 200);
|
||||
answerMapper.insertBatch(allAnswerList, 200);
|
||||
factorMapper.insertBatch(allFactorList, 200);
|
||||
rangeMapper.insertBatch(allRangeList, 200);
|
||||
stopWatch.stop();
|
||||
log.info("处理所有量表用时{} 秒", stopWatch.getTotalTimeSeconds());
|
||||
stopWatch.start();
|
||||
scaleMapper.insertBatch(allScaleList, 500);
|
||||
questionMapper.insertBatch(allQuestionList, 500);
|
||||
answerMapper.insertBatch(allAnswerList, 500);
|
||||
factorMapper.insertBatch(allFactorList, 500);
|
||||
rangeMapper.insertBatch(allRangeList, 500);
|
||||
stopWatch.stop();
|
||||
log.info("入库所有量表用时{} 秒", stopWatch.getTotalTimeSeconds());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
and find_in_set(er.batch_no, #{batchNos})
|
||||
</select>
|
||||
|
||||
<select id="selectRecordVoPage" resultType="org.dromara.system.domain.vo.SysEvaluationRecordVo">
|
||||
select er.*, s.scale_name
|
||||
from sys_evaluation_record er
|
||||
left join sys_scale s on s.scale_id = er.scale_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationFactor4Word" resultType="org.dromara.system.domain.word.WordEvaluationFactor">
|
||||
select sf.factor_name as `factorName`,
|
||||
|
@ -106,6 +100,7 @@
|
|||
select scale_id
|
||||
from sys_evaluation_record
|
||||
where user_id = #{userId}
|
||||
and tenant_id = '000000'
|
||||
group by scale_id
|
||||
</select>
|
||||
|
||||
|
|
Loading…
Reference in New Issue