增加密保及app提示功能
diff --git a/backend/src/main/java/com/supwisdom/dlpay/portal/util/PortalConstant.java b/backend/src/main/java/com/supwisdom/dlpay/portal/util/PortalConstant.java
index f9f21e0..5506ef4 100644
--- a/backend/src/main/java/com/supwisdom/dlpay/portal/util/PortalConstant.java
+++ b/backend/src/main/java/com/supwisdom/dlpay/portal/util/PortalConstant.java
@@ -20,6 +20,11 @@
public static final String SYSPARA_PORTAL_AMAPURL = "portal.amapurl";
public static final String SYSPARA_PORTAL_EMAIL_ADDRESS = "portal.email.address";
public static final String SYSPARA_PORTAL_EMAIL_PWD = "portal.email.pwd";
+ public static final String SYSPARA_PORTAL_APP_PROMPT = "portal.app.prompt";
+ /**
+ * 版本名称和版本号之间用##分隔
+ */
+ public static final String SYSPARA_PORTAL_APP_VERSION = "portal.app.version";
public static final String SYSPARA_MEDICAL_URL = "medical.url";
public static final String SYSPARA_MEDICAL_SHOPACCNO = "medical.shopaccno";
public static final String SYSPARA_MEDICAL_SAVEJSON = "medical.savejson";
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/medical/service/MedicalService.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/medical/service/MedicalService.kt
index 4da3230..464dddd 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/medical/service/MedicalService.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/medical/service/MedicalService.kt
@@ -1,6 +1,5 @@
package com.supwisdom.dlpay.medical.service
-import com.supwisdom.dlpay.api.bean.JsonResult
import com.supwisdom.dlpay.framework.jpa.page.Pagination
import com.supwisdom.dlpay.medical.bean.*
import com.supwisdom.dlpay.medical.domain.TBMedicalCard
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
index 0e3605b..743bb7b 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt
@@ -24,7 +24,6 @@
import com.supwisdom.dlpay.portal.bean.FeedbackSearchBean
import com.supwisdom.dlpay.portal.bean.UserSecurityRequestBean
import com.supwisdom.dlpay.portal.domain.TBFeedback
-import com.supwisdom.dlpay.portal.domain.TBUserSecurity
import com.supwisdom.dlpay.portal.service.*
import com.supwisdom.dlpay.portal.util.PortalConstant
import com.supwisdom.dlpay.system.service.DictionaryProxy
@@ -480,6 +479,9 @@
?: return JsonResult.error("用户不存在")
}
val data = secretSecurityService.getSecretSecurityList(user.uid)
+ if (data.isNullOrEmpty()) {
+ return JsonResult.error("用户未设置密保问题")
+ }
JsonResult.ok().put("data", data)
} catch (e: Exception) {
if (e is PortalBusinessException) {
@@ -493,7 +495,7 @@
/**
* 校验密保答案
*/
- @RequestMapping(value = ["/security/check"], method = [RequestMethod.GET])
+ @RequestMapping(value = ["/security/check"], method = [RequestMethod.POST])
fun checkUserSecurity(@RequestBody bean: UserSecurityRequestBean): JsonResult? {
return try {
val user = mobileApiService.findUserByPhone(bean.phone)
@@ -545,6 +547,30 @@
}
}
+ /**
+ * app打开提示信息
+ */
+ @RequestMapping(value = ["/app/prompt"], method = [RequestMethod.GET])
+ fun appPrompt(vername: String, verno: String): JsonResult? {
+ try {
+ val prompt = systemUtilService.getBusinessValue(PortalConstant.SYSPARA_PORTAL_APP_PROMPT)
+ if (prompt.isNullOrEmpty()) {
+ val version = systemUtilService.getBusinessValue(PortalConstant.SYSPARA_PORTAL_APP_VERSION)
+ if (!version.isNullOrEmpty()) {
+ val split = version.split("##")
+ if (split[1] > verno) {
+ return JsonResult.ok().put("prompt", "您当前使用的应用不是最新版本,如要升级请至应用商店更新")
+ }
+ }
+ return JsonResult.ok().put("prompt", null)
+ }
+ return JsonResult.ok().put("prompt", prompt)
+ } catch (e: Exception) {
+ logger.error("获取app提示信息异常", e)
+ return JsonResult.ok().put("prompt", null)
+ }
+ }
+
}
@@ -1301,7 +1327,7 @@
* 解除绑定
* */
@RequestMapping("/unbindcard")
- fun unbindcard(paypwd: String): JsonResult {
+ fun unBindCard(paypwd: String): JsonResult {
val p = SecurityContextHolder.getContext().authentication
val user = mobileApiService.findUserById(p.name)
?: return JsonResult.error("用户不存在,请注册")
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/dao/UserSecurityDao.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/dao/UserSecurityDao.kt
index a635f5d..02985d4 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/dao/UserSecurityDao.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/dao/UserSecurityDao.kt
@@ -4,7 +4,6 @@
import org.springframework.data.jpa.repository.JpaRepository
interface UserSecurityDao : JpaRepository<TBUserSecurity, String> {
- fun deleteByUid(uid: String)
fun findByUidAndSsid(uid: String, ssid: String): TBUserSecurity?
fun findByUid(uis: String): List<TBUserSecurity>
}
\ No newline at end of file
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/SecretSecurityServiceImpl.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/SecretSecurityServiceImpl.kt
index c03aae0..83940d1 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/SecretSecurityServiceImpl.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/SecretSecurityServiceImpl.kt
@@ -31,7 +31,10 @@
throw PortalBusinessException("密保问题至少设置三个")
}
// 先删除用户之前所有的问题再保存
- userSecurityDao.deleteByUid(bean.uid)
+ val list = userSecurityDao.findByUid(bean.uid)
+ if (!list.isNullOrEmpty()) {
+ userSecurityDao.deleteAll(list)
+ }
answers.forEach {
if (it.answer.isNullOrEmpty()) {
throw PortalBusinessException("密保答案不能为空")
diff --git a/backend/src/main/resources/data-postgresql.sql b/backend/src/main/resources/data-postgresql.sql
index d96584a..11c1ea5 100644
--- a/backend/src/main/resources/data-postgresql.sql
+++ b/backend/src/main/resources/data-postgresql.sql
@@ -19,6 +19,10 @@
INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('portal.secret', '1a8905a272364ef592e61f4a1288f07d', '{tenentid}');
INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('portal.email.address', '18227591821@163.com', '{tenentid}');
INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('portal.email.pwd', 'AVIGHTZYNSINDXZX', '{tenentid}');
+INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('portal.app.version', '2.0.1##7', '{tenentid}');
+INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('portal.app.prompt', '', '{tenentid}');
+
+
INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('aes.cfb.totp.offset', '20', '{tenantid}');
INSERT INTO "tb_businesspara"("parakey", "paraval", "tenantid") VALUES ('aes.cfb.rootkey', 'Vbb1syh8U1+CdLmTVGdtDiVvKBQ81n4GmgBEO/ohSbU=', '{tenantid}');