Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sample-form-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
sample-form-platform
Commits
7620efa2
Commit
7620efa2
authored
Nov 10, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加公共庫
parent
772a9699
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
23 deletions
+17
-23
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/service/MatterService.java
.../com/mortals/xhx/module/matter/service/MatterService.java
+1
-1
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterServiceImpl.java
...als/xhx/module/matter/service/impl/MatterServiceImpl.java
+15
-20
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/web/MatterController.java
...a/com/mortals/xhx/module/matter/web/MatterController.java
+1
-2
No files found.
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/service/MatterService.java
View file @
7620efa2
...
@@ -23,5 +23,5 @@ public interface MatterService extends ICRUDService<MatterEntity,Long>{
...
@@ -23,5 +23,5 @@ public interface MatterService extends ICRUDService<MatterEntity,Long>{
* 推荐or取消推荐
* 推荐or取消推荐
* @param id
* @param id
*/
*/
void
recommend
(
Long
id
);
void
recommend
(
Long
id
,
Context
context
);
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterServiceImpl.java
View file @
7620efa2
...
@@ -4,6 +4,7 @@ import com.mortals.framework.common.Rest;
...
@@ -4,6 +4,7 @@ import com.mortals.framework.common.Rest;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.code.MatterSourceEnum
;
import
com.mortals.xhx.common.code.MatterSourceEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.key.ParamKey
;
import
com.mortals.xhx.common.key.ParamKey
;
import
com.mortals.xhx.common.utils.StringUtils
;
import
com.mortals.xhx.common.utils.StringUtils
;
import
com.mortals.xhx.module.matter.model.MatterDatumEntity
;
import
com.mortals.xhx.module.matter.model.MatterDatumEntity
;
...
@@ -52,11 +53,11 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
...
@@ -52,11 +53,11 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
return
params
;
return
params
;
}
}
@Override
//
@Override
protected
void
updateBefore
(
MatterEntity
entity
,
Context
context
)
throws
AppException
{
//
protected void updateBefore(MatterEntity entity, Context context) throws AppException {
entity
.
setIsRecommend
(
null
);
//
entity.setIsRecommend(null);
this
.
validData
(
entity
,
context
);
//
this.validData(entity, context);
}
//
}
// @Override
// @Override
// protected void removeBefore(Long[] ids, Context context) throws AppException {
// protected void removeBefore(Long[] ids, Context context) throws AppException {
...
@@ -86,7 +87,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
...
@@ -86,7 +87,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
@Override
@Override
public
Rest
<
String
>
createMatterbBySheetMatter
(
Long
[]
sheetMatterIds
,
Long
siteId
,
Context
context
)
{
public
Rest
<
String
>
createMatterbBySheetMatter
(
Long
[]
sheetMatterIds
,
Long
siteId
,
Context
context
)
{
if
(
ObjectUtils
.
isEmpty
(
sheetMatterIds
))
{
if
(
ObjectUtils
.
isEmpty
(
sheetMatterIds
))
{
throw
new
AppException
(
"事项ids is null"
);
throw
new
AppException
(
"事项ids is null"
);
}
}
int
success
=
0
;
int
success
=
0
;
...
@@ -141,26 +142,20 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
...
@@ -141,26 +142,20 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
}
}
@Override
@Override
public
void
recommend
(
Long
id
)
{
public
void
recommend
(
Long
id
,
Context
context
)
{
MatterEntity
matterEntity
=
this
.
get
(
id
);
MatterEntity
matterEntity
=
this
.
get
(
id
,
context
);
if
(
matterEntity
==
null
)
{
if
(
matterEntity
==
null
)
{
throw
new
AppException
(
"数据已更改,请重试"
);
throw
new
AppException
(
"数据已更改,请重试"
);
}
}
int
recommendCount
=
paramService
.
getParamIntValue
(
ParamKey
.
MATTER_RECOMMEND_COUNT
);
int
recommendCount
=
this
.
count
(
new
MatterQuery
().
siteId
(
matterEntity
.
getSiteId
()).
isRecommend
(
YesNoEnum
.
YES
.
getValue
()),
null
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
if
(
matterEntity
.
getIsRecommend
()
==
YesNoEnum
.
NO
.
getValue
())
{
Map
<
String
,
Object
>
condition
=
new
HashMap
<>();
condition
.
put
(
"id"
,
id
);
if
(
matterEntity
.
getIsRecommend
()
==
0
)
{
if
(
recommendCount
>=
RECOMMEND_COUNT
)
{
if
(
recommendCount
>=
RECOMMEND_COUNT
)
{
throw
new
AppException
(
"超过推荐个数"
);
throw
new
AppException
(
"超过推荐个数
!
"
);
}
}
recommendCount
++;
matterEntity
.
setIsRecommend
(
YesNoEnum
.
YES
.
getValue
());
data
.
put
(
"isRecommend"
,
1
);
}
else
{
}
else
{
recommendCount
--;
matterEntity
.
setIsRecommend
(
YesNoEnum
.
NO
.
getValue
());
data
.
put
(
"isRecommend"
,
0
);
}
}
this
.
dao
.
update
(
data
,
condition
);
this
.
update
(
matterEntity
,
context
);
paramService
.
setValueByKey
(
ParamKey
.
MATTER_RECOMMEND_COUNT
,
String
.
valueOf
(
recommendCount
));
}
}
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/web/MatterController.java
View file @
7620efa2
...
@@ -96,12 +96,11 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
...
@@ -96,12 +96,11 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@RequestMapping
(
value
=
{
"recommend"
},
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@RequestMapping
(
value
=
{
"recommend"
},
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
String
recommend
(
Long
id
)
{
public
String
recommend
(
Long
id
)
{
Context
context
=
this
.
getContext
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
int
code
=
1
;
int
code
=
1
;
String
busiDesc
=
"推荐or取消推荐"
+
this
.
getModuleDesc
();
String
busiDesc
=
"推荐or取消推荐"
+
this
.
getModuleDesc
();
try
{
try
{
this
.
service
.
recommend
(
id
);
this
.
service
.
recommend
(
id
,
getContext
()
);
model
.
put
(
"message_info"
,
this
.
getModuleDesc
()
+
"推荐or取消推荐成功!"
);
model
.
put
(
"message_info"
,
this
.
getModuleDesc
()
+
"推荐or取消推荐成功!"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】 [id:"
+
id
+
"]"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】 [id:"
+
id
+
"]"
);
}
catch
(
Exception
var7
)
{
}
catch
(
Exception
var7
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment