From 53ce8de426561e7a43847afda23b5e24e6f76c4e Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 19 一月 2026 17:29:55 +0800
Subject: [PATCH] 2026.1.19 1. 新增可配置的台账提交期限 2. 新增可配置的自巡查承诺
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt
index d3961f6..74e4ddf 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt
@@ -8,11 +8,13 @@
import cn.flightfeather.supervision.domain.entity.UserInfoWx
import cn.flightfeather.supervision.domain.entity.Userinfo
import cn.flightfeather.supervision.domain.mapper.*
+import cn.flightfeather.supervision.domain.repository.UserInfoRep
import cn.flightfeather.supervision.lightshare.service.WxUserService
import cn.flightfeather.supervision.lightshare.vo.AccessToken
import cn.flightfeather.supervision.lightshare.vo.AccessTokenPW
import cn.flightfeather.supervision.lightshare.vo.AccessTokenWX
import cn.flightfeather.supervision.lightshare.vo.BaseResponse
+import cn.flightfeather.supervision.bgtask.sysnotice.SysNoticeManager
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONArray
import com.alibaba.fastjson.JSONObject
@@ -28,7 +30,9 @@
val userMapMapper: UserMapMapper,
val baseInfoMapper: BaseInfoMapper,
private val msgSubscribeWxMapper: MsgSubscribeWxMapper,
- private val logMsgSubscribeWxMapper: LogMsgSubscribeWxMapper
+ private val logMsgSubscribeWxMapper: LogMsgSubscribeWxMapper,
+ private val sysNoticeManager: SysNoticeManager,
+ private val userInfoRep: UserInfoRep
): WxUserService {
private val LOGGER = LoggerFactory.getLogger(WxUserServiceImpl::class.java)
@@ -73,6 +77,7 @@
}
} else {
if (user.uiGuid != null) {
+ userInfoRep.loginLog(user.uiGuid)
val userinfo = userinfoMapper.selectByPrimaryKey(user.uiGuid)
BaseResponse(true, "寰俊鐢ㄦ埛鐧诲綍鎴愬姛", data = userinfo)
} else {
@@ -96,7 +101,7 @@
val result = AccessToken()
//1.1 寰俊id涓虹┖锛岀洿鎺ョ櫥褰�; 寰俊id涓嶄负绌猴紝缁戝畾鑷宠处鍙�
if (!accessTokenPW.code.isNullOrBlank()) {
- val baseInfo = baseInfoMapper.selectByPrimaryKey(user[0].guid)
+ val baseInfo = baseInfoMapper.selectByPrimaryKey(user[0]?.guid)
WXHttpService.code2Session(accessTokenPW.code!!)?.let {
val openid = it.first
val unionid = it.second
@@ -104,7 +109,7 @@
result.openId = openid
return@let if (userWx == null || userWx.uiOpenId == null) {
val newUserWx = UserInfoWx().apply {
- uiGuid = user[0].guid
+ uiGuid = user[0]?.guid
ciGuid = baseInfo?.ciGuid
uiOpenId = openid
uiNickName = accessTokenPW.nickName
@@ -116,8 +121,8 @@
uiUnionid = unionid
}
userInfoWxMapper.insert(newUserWx)
- } else if (userWx.uiGuid != user[0].guid) {
- userWx.uiGuid = user[0].guid
+ } else if (userWx.uiGuid != user[0]?.guid) {
+ userWx.uiGuid = user[0]?.guid
userWx.ciGuid = baseInfo?.ciGuid
userInfoWxMapper.updateByPrimaryKey(userWx)
} else {
@@ -125,8 +130,12 @@
}
}
}
+ val u = user[0]
+ u?.uiLoginTime = Date()
+ userinfoMapper.updateByPrimaryKeySelective(u)
+ userInfoRep.loginLog(u?.guid)
return result.apply {
- userId = user[0].guid
+ userId = user[0]?.guid
val sUser = userMapMapper.selectByPrimaryKey(userId)
sUserId = sUser?.svUserId
success = true
@@ -142,6 +151,9 @@
AccessToken()
} else {
val user = userinfoMapper.selectByPrimaryKey(userWx.uiGuid)
+ user?.uiLoginTime = Date()
+ userinfoMapper.updateByPrimaryKeySelective(user)
+ userInfoRep.loginLog(user?.guid)
AccessToken().apply {
if (user?.guid == null) {
success = false
@@ -183,7 +195,8 @@
//鐢ㄦ埛openid
val openId = (json["FromUserName"] as String?) ?: throw NullPointerException("寰俊鏈嶅姟鍣ㄥ彂閫佺殑璁㈤槄杩斿洖娑堟伅FromUserName瀛楁涓簄ull")
//鏃堕棿鎴�
- val createTime = (json["CreateTime"] as Int?) ?: throw NullPointerException("寰俊鏈嶅姟鍣ㄥ彂閫佺殑璁㈤槄杩斿洖娑堟伅CreateTime瀛楁涓簄ull")
+ var createTime = (json["CreateTime"] as Int?)?.toLong() ?: throw NullPointerException("寰俊鏈嶅姟鍣ㄥ彂閫佺殑璁㈤槄杩斿洖娑堟伅CreateTime瀛楁涓簄ull")
+ createTime = createTime.times(1000)//姝ゅ浼犺繃鏉ョ殑鏃堕棿鎴冲彧绮剧‘鍒扮锛岃浆鎹负姣
//浜嬩欢绫诲瀷锛屾澶勫簲璇ラ兘鏄痚vent
val msgType = json["MsgType"] as String?
@@ -210,7 +223,7 @@
val templateId = it["TemplateId"] as String?
val sStatus = it["SubscribeStatusString"] as String?
//鏍规嵁鏃堕棿鍜岀敤鎴穙penId锛屽垽鏂娆℃搷浣滄槸鍚﹂噸澶�
- val time = Date(createTime.toLong() * 1000)
+ val time = Date(createTime.toLong())
val records = msgSubscribeWxMapper.selectByExample(Example(MsgSubscribeWx::class.java).apply {
createCriteria().andEqualTo("msOpenId", openId)
.andEqualTo("msTemplateId", templateId)
--
Gitblit v1.9.3