Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-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
赵啸非
enterprise-platform
Commits
d098f2cb
Commit
d098f2cb
authored
Oct 09, 2023
by
王晓旭
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/enterprise-platform
parents
476adedb
5b881f95
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
393 additions
and
35 deletions
+393
-35
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/ProductReq.java
...in/java/com/mortals/xhx/busiz/applets/req/ProductReq.java
+22
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/StaffReq.java
...main/java/com/mortals/xhx/busiz/applets/req/StaffReq.java
+22
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/CompanyApiController.java
...m/mortals/xhx/busiz/applets/web/CompanyApiController.java
+66
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/ProductApiController.java
...m/mortals/xhx/busiz/applets/web/ProductApiController.java
+117
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/StaffApiController.java
...com/mortals/xhx/busiz/applets/web/StaffApiController.java
+120
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+46
-35
No files found.
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/ProductReq.java
0 → 100644
View file @
d098f2cb
package
com.mortals.xhx.busiz.applets.req
;
import
com.mortals.xhx.busiz.BaseReq
;
import
lombok.Data
;
/**
* 产品请求
*
* @author: zxfei
* @date: 2023/10/7 16:53
*/
@Data
public
class
ProductReq
extends
BaseReq
{
/**
* 分类id
*/
private
Long
categoryId
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/StaffReq.java
0 → 100644
View file @
d098f2cb
package
com.mortals.xhx.busiz.applets.req
;
import
com.mortals.xhx.busiz.BaseReq
;
import
lombok.Data
;
/**
* 产品请求
*
* @author: zxfei
* @date: 2023/10/7 16:53
*/
@Data
public
class
StaffReq
extends
BaseReq
{
/**
* 员工id
*/
private
Long
id
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/CompanyApiController.java
0 → 100644
View file @
d098f2cb
package
com.mortals.xhx.busiz.applets.web
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.busiz.applets.req.NewsReq
;
import
com.mortals.xhx.module.company.model.CompanyLabelsQuery
;
import
com.mortals.xhx.module.company.model.CompanyQuery
;
import
com.mortals.xhx.module.company.service.CompanyLabelsService
;
import
com.mortals.xhx.module.company.service.CompanyService
;
import
com.mortals.xhx.module.labels.model.LabelsQuery
;
import
com.mortals.xhx.module.labels.service.LabelsService
;
import
com.mortals.xhx.module.news.model.NewsCategoryQuery
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author ZYW
* @date 2023-10-09 9:39
*/
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/company"
)
public
class
CompanyApiController
extends
AbstractBaseController
<
NewsReq
>{
@Autowired
private
CompanyService
companyService
;
@Autowired
private
LabelsService
labelsService
;
/**
* 公司标注列表
*/
@PostMapping
(
value
=
"labelsList"
)
public
Rest
<
Object
>
categoryList
(){
String
busiDesc
=
"公司标注"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
rest
.
setData
(
labelsService
.
find
(
new
LabelsQuery
()));
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 公司列表
*/
@PostMapping
(
value
=
"companyList"
)
public
Rest
<
Object
>
companyList
(){
String
busiDesc
=
"公司列表"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
rest
.
setData
(
companyService
.
find
(
new
CompanyQuery
()));
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/ProductApiController.java
0 → 100644
View file @
d098f2cb
package
com.mortals.xhx.busiz.applets.web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.xhx.busiz.applets.req.NewsReq
;
import
com.mortals.xhx.busiz.applets.req.ProductReq
;
import
com.mortals.xhx.busiz.applets.rsp.NewsListInfo
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.module.category.model.CategoryQuery
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.company.model.CompanyQuery
;
import
com.mortals.xhx.module.company.service.CompanyService
;
import
com.mortals.xhx.module.labels.model.LabelsQuery
;
import
com.mortals.xhx.module.labels.service.LabelsService
;
import
com.mortals.xhx.module.news.model.NewsEntity
;
import
com.mortals.xhx.module.news.model.NewsQuery
;
import
com.mortals.xhx.module.product.model.ProductCategoryQuery
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.model.ProductQuery
;
import
com.mortals.xhx.module.product.service.ProductCategoryService
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.
PAGEINFO_KEY
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED_CONTENT
;
/**
* @author ZYW
* @date 2023-10-09 9:39
*/
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/product"
)
public
class
ProductApiController
extends
AbstractBaseController
<
ProductReq
>{
@Autowired
private
ProductService
productService
;
@Autowired
private
CategoryService
categoryService
;
/**
* 产品类型
*/
@PostMapping
(
value
=
"categoryList"
)
public
Rest
<
Object
>
categoryList
(){
String
busiDesc
=
"产品类型"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
rest
.
setData
(
categoryService
.
find
(
new
CategoryQuery
()));
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 产品列表
*/
@PostMapping
(
value
=
"productList"
)
public
Rest
<
Object
>
productList
(
@RequestBody
ProductReq
productReq
){
String
busiDesc
=
"产品列表列表"
;
log
.
info
(
"【{}】【请求体】--> {}"
,
busiDesc
,
JSONObject
.
toJSONString
(
productReq
));
Rest
<
Object
>
rest
=
Rest
.
ok
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
Context
context
=
this
.
getContext
();
if
(
ObjectUtils
.
isEmpty
(
context
)
||
ObjectUtils
.
isEmpty
(
context
.
getUser
()))
{
throw
new
AppException
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
);
}
try
{
PageInfo
pageInfo
=
buildPageInfo
(
productReq
);
ProductQuery
query
=
new
ProductQuery
();
if
(!
ObjectUtils
.
isEmpty
(
productReq
.
getCategoryId
())){
query
.
setCategoryId
(
String
.
valueOf
(
productReq
.
getCategoryId
()));
}
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"createTime"
,
OrderCol
.
DESCENDING
)));
Result
<
ProductEntity
>
result
=
productService
.
find
(
query
,
pageInfo
,
context
);
List
<
ProductEntity
>
collect
=
result
.
getList
().
stream
().
map
(
item
->
{
ProductEntity
productEntity
=
new
ProductEntity
();
BeanUtils
.
copyProperties
(
item
,
productEntity
,
BeanUtil
.
getNullPropertyNames
(
item
));
return
productEntity
;
}).
collect
(
Collectors
.
toList
());
model
.
put
(
KEY_RESULT_DATA
,
collect
);
model
.
put
(
PAGEINFO_KEY
,
result
.
getPageInfo
());
super
.
parsePageInfo
(
model
,
result
.
getPageInfo
());
rest
.
setData
(
model
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/StaffApiController.java
0 → 100644
View file @
d098f2cb
package
com.mortals.xhx.busiz.applets.web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.xhx.busiz.applets.req.ProductReq
;
import
com.mortals.xhx.busiz.applets.req.StaffReq
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.module.category.model.CategoryQuery
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.model.ProductQuery
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.model.StaffRecordEntity
;
import
com.mortals.xhx.module.staff.service.StaffRecordService
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.
PAGEINFO_KEY
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED_CONTENT
;
/**
* @author ZYW
* @date 2023-10-09 9:39
*/
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/staff"
)
public
class
StaffApiController
extends
AbstractBaseController
<
StaffReq
>{
@Autowired
private
StaffService
staffService
;
@Autowired
private
StaffRecordService
staffRecordService
;
/**
* 员工详情
*/
@PostMapping
(
value
=
"staffInfo"
)
public
Rest
<
Object
>
staffInfo
(
@RequestBody
StaffReq
staffReq
){
String
busiDesc
=
"员工详情"
;
log
.
info
(
"【{}】【请求体】--> {}"
,
busiDesc
,
JSONObject
.
toJSONString
(
staffReq
));
Rest
<
Object
>
rest
=
Rest
.
ok
();
Context
context
=
this
.
getContext
();
if
(
ObjectUtils
.
isEmpty
(
context
)
||
ObjectUtils
.
isEmpty
(
context
.
getUser
()))
{
throw
new
AppException
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
);
}
try
{
if
(!
ObjectUtils
.
isEmpty
(
staffReq
.
getId
())){
StaffEntity
staffEntity
=
staffService
.
get
(
staffReq
.
getId
());
if
(
staffEntity
!=
null
){
rest
.
setData
(
staffEntity
);
}
else
{
rest
=
Rest
.
fail
(
"未查到该员工"
);
}
}
else
{
rest
=
Rest
.
fail
(
"缺少id"
);
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 名片被查看记录
*/
@PostMapping
(
value
=
"staffRecord"
)
public
Rest
<
Object
>
staffRecord
(
@RequestBody
StaffReq
staffReq
){
String
busiDesc
=
"名片被查看记录"
;
log
.
info
(
"【{}】【请求体】--> {}"
,
busiDesc
,
JSONObject
.
toJSONString
(
staffReq
));
Rest
<
Object
>
rest
=
Rest
.
ok
();
Context
context
=
this
.
getContext
();
if
(
ObjectUtils
.
isEmpty
(
context
)
||
ObjectUtils
.
isEmpty
(
context
.
getUser
()))
{
throw
new
AppException
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
);
}
try
{
if
(!
ObjectUtils
.
isEmpty
(
staffReq
.
getId
())){
StaffRecordEntity
staffRecordEntity
=
staffRecordService
.
get
(
staffReq
.
getId
());
if
(
staffRecordEntity
!=
null
){
rest
.
setData
(
staffRecordEntity
);
}
else
{
rest
=
Rest
.
fail
(
"未查到记录"
);
}
}
else
{
rest
=
Rest
.
fail
(
"缺少id"
);
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
}
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
d098f2cb
This diff is collapsed.
Click to expand it.
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