Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f7354cae
authored
Nov 20, 2023
by
Ren Ping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:容量类消息增加日期、图层判断
1 parent
5d7a522a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
3 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/MsgController.java
project-order/src/main/java/com/dituhui/pea/order/dao/MsgDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/MsgDTO.java
project-order/src/main/java/com/dituhui/pea/order/entity/MsgEntity.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/MsgServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/MsgController.java
View file @
f7354ca
...
...
@@ -91,9 +91,6 @@ public class MsgController {
@PostMapping
(
"/msg/add"
)
public
Result
<
Boolean
>
add
(
@RequestBody
@Valid
MsgDTO
dto
)
{
CommonUtil
.
setNullValue
(
dto
);
AssertUtil
.
checkArgument
(
StrUtil
.
isNotEmpty
(
dto
.
getClusterId
())
||
StrUtil
.
isNotEmpty
(
dto
.
getBranchId
())
||
StrUtil
.
isNotEmpty
(
dto
.
getGroupId
()),
"大区Id、分部Id、分组Id不能同时为空"
);
msgService
.
add
(
dto
);
return
Result
.
success
(
true
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/MsgDao.java
View file @
f7354ca
...
...
@@ -86,4 +86,19 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.is_read=0 and r.user_id=?1"
,
nativeQuery
=
true
)
Integer
getUnReadNum
(
String
userId
);
@Query
(
value
=
"SELECT count(t.id)"
+
" from zzz_msg t"
+
" where IF(:groupId is not null, t.group_id =:groupId, t.group_id is null)"
+
" and IF(:branchId is not null, t.branch_id =:branchId, t.branch_id is null)"
+
" and IF(:clusterId is not null, t.cluster_id =:clusterId, t.cluster_id is null)"
+
" and t.capacity_layer_id = :capacityLayerId"
+
" and t.capacity_date = :capacityDate"
,
nativeQuery
=
true
)
Integer
getCapacityMsgCount
(
@Param
(
"clusterId"
)
String
clusterId
,
@Param
(
"branchId"
)
String
branchId
,
@Param
(
"groupId"
)
String
groupId
,
@Param
(
"capacityLayerId"
)
String
capacityLayerId
,
@Param
(
"capacityDate"
)
String
capacityDate
);
}
project-order/src/main/java/com/dituhui/pea/order/dto/MsgDTO.java
View file @
f7354ca
...
...
@@ -50,6 +50,16 @@ public class MsgDTO {
@Max
(
value
=
1
,
message
=
"标签类型格式不对"
)
private
Integer
tag
;
/**
* 容量所属图层 ID
*/
private
String
capacityLayerId
;
/**
* 容量所属日期
*/
private
String
capacityDate
;
@Data
public
static
class
IdDTO
{
...
...
project-order/src/main/java/com/dituhui/pea/order/entity/MsgEntity.java
View file @
f7354ca
...
...
@@ -73,5 +73,17 @@ public class MsgEntity {
@Column
(
name
=
"update_time"
,
nullable
=
false
,
columnDefinition
=
"datetime default current_timestamp"
)
private
Date
updateTime
;
/**
* 容量类所属图层ID
*/
@Column
(
name
=
"capacity_layer_id"
)
private
String
capacityLayerId
;
/**
* 容量类所属日期:2022-10-20
*/
@Column
(
name
=
"capacity_date"
)
private
String
capacityDate
;
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/MsgServiceImpl.java
View file @
f7354ca
...
...
@@ -2,6 +2,7 @@ package com.dituhui.pea.order.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.order.dao.*
;
...
...
@@ -16,6 +17,7 @@ import com.dituhui.pea.order.entity.OrgGroupEntity;
import
com.dituhui.pea.order.enums.MsgTagEnum
;
import
com.dituhui.pea.order.enums.MsgTypeEnum
;
import
com.dituhui.pea.order.service.MsgService
;
import
com.dituhui.pea.order.utils.AssertUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.*
;
...
...
@@ -121,6 +123,14 @@ public class MsgServiceImpl implements MsgService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
add
(
MsgDTO
dto
)
{
AssertUtil
.
checkArgument
(
StrUtil
.
isNotEmpty
(
dto
.
getClusterId
())
||
StrUtil
.
isNotEmpty
(
dto
.
getBranchId
())
||
StrUtil
.
isNotEmpty
(
dto
.
getGroupId
()),
"大区Id、分部Id、分组Id不能同时为空"
);
AssertUtil
.
checkArgument
(
ObjectUtil
.
equals
(
MsgTypeEnum
.
CAPACITY
.
getCode
(),
dto
.
getType
())
&&
ObjectUtil
.
isNotEmpty
(
dto
.
getCapacityLayerId
())
&&
ObjectUtil
.
isNotEmpty
(
dto
.
getCapacityDate
()),
"容量类消息图层ID、所属日期不能为空"
);
if
(
Objects
.
nonNull
(
dto
.
getGroupId
()))
{
OrgGroupEntity
group
=
groupDao
.
getByGroupId
(
dto
.
getGroupId
());
dto
.
setBranchId
(
group
.
getBranchId
());
...
...
@@ -133,6 +143,19 @@ public class MsgServiceImpl implements MsgService {
dto
.
setClusterId
(
branch
.
getClusterId
());
}
if
(
ObjectUtil
.
equals
(
MsgTypeEnum
.
CAPACITY
.
getCode
(),
dto
.
getType
()))
{
AssertUtil
.
checkArgument
(
ObjectUtil
.
isNotEmpty
(
dto
.
getCapacityLayerId
())
&&
ObjectUtil
.
isNotEmpty
(
dto
.
getCapacityDate
()),
"容量类消息图层ID、所属日期不能为空"
);
int
count
=
msgDao
.
getCapacityMsgCount
(
dto
.
getClusterId
(),
dto
.
getBranchId
(),
dto
.
getGroupId
(),
dto
.
getCapacityLayerId
(),
dto
.
getCapacityDate
());
if
(
count
>
0
)
{
return
;
}
}
List
<
String
>
userList
=
msgDao
.
getDispatchUserList
(
dto
.
getClusterId
(),
dto
.
getBranchId
(),
dto
.
getGroupId
());
MsgEntity
msgEntity
=
new
MsgEntity
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment