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
be35ac55
Commit
be35ac55
authored
May 13, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
c828969f
0f3e964c
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
640 additions
and
16 deletions
+640
-16
enterprise-manager-ui/admin/src/views/product/drawershow.vue
enterprise-manager-ui/admin/src/views/product/drawershow.vue
+1
-1
enterprise-manager-ui/admin/src/views/product/list.vue
enterprise-manager-ui/admin/src/views/product/list.vue
+2
-2
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/CompanyReq.java
...in/java/com/mortals/xhx/busiz/applets/req/CompanyReq.java
+22
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/FavoriteReq.java
...n/java/com/mortals/xhx/busiz/applets/req/FavoriteReq.java
+34
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/LoginReq.java
...main/java/com/mortals/xhx/busiz/applets/req/LoginReq.java
+22
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/UserInfoReq.java
...n/java/com/mortals/xhx/busiz/applets/req/UserInfoReq.java
+42
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/rsp/FavoriteTypeListInfo.java
...m/mortals/xhx/busiz/applets/rsp/FavoriteTypeListInfo.java
+25
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/CompanyApiController.java
...m/mortals/xhx/busiz/applets/web/CompanyApiController.java
+67
-5
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/FavoriteApiController.java
.../mortals/xhx/busiz/applets/web/FavoriteApiController.java
+238
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/LoginApiController.java
...com/mortals/xhx/busiz/applets/web/LoginApiController.java
+172
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/NewsApiController.java
.../com/mortals/xhx/busiz/applets/web/NewsApiController.java
+1
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/StaffApiController.java
...com/mortals/xhx/busiz/applets/web/StaffApiController.java
+6
-4
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
...om/mortals/xhx/module/product/service/ProductService.java
+6
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+2
-4
No files found.
enterprise-manager-ui/admin/src/views/product/drawershow.vue
View file @
be35ac55
...
...
@@ -17,7 +17,7 @@
</el-row>
<el-row>
<Field
label=
"产品分类"
prop=
"categoryId"
v-model=
"form.categoryId"
:multiple=
"true"
type=
"select"
:enumData=
"dict.categoryId"
placeholder=
"请选择产品分类"
/>
<
!--
<Field
label=
"所属企业"
prop=
"companyId"
v-model=
"form.companyId"
:multiple=
"true"
type=
"select"
:enumData=
"dict.companyId"
placeholder=
"请选择所属企业"
/>
--
>
<
Field
label=
"所属企业"
prop=
"companyId"
v-model=
"form.companyId"
:multiple=
"true"
type=
"select"
:enumData=
"dict.companyId"
placeholder=
"请选择所属企业"
/
>
<!--
<Field
label=
"产品图标"
><imageUpload
v-model=
"form.productLogoPath"
prePath=
"/file/preview"
/></Field>
-->
...
...
enterprise-manager-ui/admin/src/views/product/list.vue
View file @
be35ac55
<
template
>
<div
class=
"page"
>
<LayoutTable
ref=
"layouttable"
:data=
"tableData"
:config=
"tableConfig"
notDel
>
<LayoutTable
ref=
"layouttable"
:data=
"tableData"
:config=
"tableConfig"
notDel
>
<!-- 热门0为非热门1为热门 -->
<div
slot=
"table-search-left"
class=
"onlyhot"
>
<el-checkbox
...
...
@@ -139,7 +139,7 @@
width
:
240
,
formatter
:
row
=>
{
return
(
<
table
-
buttons
noAdd
row
=
{
row
}
onEdit
=
{
this
.
toEdit
}
onView
=
{
this
.
toView
}
onDel
=
{
this
.
toDel
}
/
>
<
table
-
buttons
noAdd
noView
row
=
{
row
}
onEdit
=
{
this
.
toEdit
}
onView
=
{
this
.
toView
}
onDel
=
{
this
.
toDel
}
/
>
);
}
}
...
...
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/CompanyReq.java
0 → 100644
View file @
be35ac55
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
CompanyReq
extends
BaseReq
{
/**
* 企业id
*/
private
long
companyId
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/FavoriteReq.java
0 → 100644
View file @
be35ac55
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
FavoriteReq
extends
BaseReq
{
/**
* 产品id
*/
private
long
productId
;
/**
* 新闻id
*/
private
long
newsId
;
/**
* 名片id
*/
private
long
staffId
;
/**
* 分类Id
*/
private
int
typeId
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/LoginReq.java
0 → 100644
View file @
be35ac55
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
LoginReq
extends
BaseReq
{
/**
* 微信openId
*/
private
String
openId
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/UserInfoReq.java
0 → 100644
View file @
be35ac55
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
UserInfoReq
extends
BaseReq
{
/**
* 员工电话
*/
private
String
phone
;
/**
* 员工邮箱
*/
private
String
email
;
/**
* 员工姓名
*/
private
String
name
;
/**
* 员工单位名称
*/
private
String
deptName
;
/**
* 员工昵称
*/
private
String
realName
;
/**
* 员工照片
*/
private
String
photoPath
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/rsp/FavoriteTypeListInfo.java
0 → 100644
View file @
be35ac55
package
com.mortals.xhx.busiz.applets.rsp
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
FavoriteTypeListInfo
{
public
FavoriteTypeListInfo
(
int
id
,
String
title
)
{
this
.
id
=
id
;
this
.
title
=
title
;
}
/**
* id
*/
private
int
id
;
/**
* 标题
*/
private
String
title
;
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/CompanyApiController.java
View file @
be35ac55
package
com.mortals.xhx.busiz.applets.web
;
import
com.alibaba.fastjson.JSONObject
;
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.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.model.Result
;
import
com.mortals.xhx.busiz.applets.req.CompanyReq
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.module.company.model.CompanyPatentEntity
;
import
com.mortals.xhx.module.company.model.CompanyPatentQuery
;
import
com.mortals.xhx.module.company.model.CompanyProductQuery
;
import
com.mortals.xhx.module.company.model.CompanyQuery
;
import
com.mortals.xhx.module.company.service.CompanyLabelsService
;
import
com.mortals.xhx.module.company.service.CompanyPatentService
;
import
com.mortals.xhx.module.company.service.CompanyProductService
;
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
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.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
;
/**
...
...
@@ -25,11 +45,18 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/company"
)
public
class
CompanyApiController
extends
AbstractBaseController
<
News
Req
>{
public
class
CompanyApiController
extends
AbstractBaseController
<
Company
Req
>{
@Autowired
private
CompanyService
companyService
;
@Autowired
private
LabelsService
labelsService
;
@Autowired
private
CompanyPatentService
companyPatentService
;
@Autowired
private
ProductService
productService
;
@Autowired
private
CompanyProductService
companyProductService
;
/**
* 公司标注列表
...
...
@@ -63,4 +90,39 @@ public class CompanyApiController extends AbstractBaseController<NewsReq>{
return
rest
;
}
/**
* 公司知识产权数量列表及推荐产品列表
*/
@PostMapping
(
value
=
"companyInfo"
)
public
Rest
<
Object
>
companyInfo
(
@RequestBody
CompanyReq
companyReq
){
String
busiDesc
=
"公司详情"
;
log
.
info
(
"【{}】【请求体】--> {}"
,
busiDesc
,
JSONObject
.
toJSONString
(
companyReq
));
Rest
<
Object
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
try
{
if
(
ObjectUtils
.
isEmpty
(
companyReq
.
getCompanyId
()))
{
throw
new
AppException
(
"详细查询id不能为空!"
);
}
CompanyPatentQuery
companyPatentQuery
=
new
CompanyPatentQuery
();
companyPatentQuery
.
setCompanyId
(
companyReq
.
getCompanyId
());
CompanyProductQuery
companyProductQuery
=
new
CompanyProductQuery
();
companyProductQuery
.
setCompanyId
(
companyReq
.
getCompanyId
());
ProductEntity
productEntity
=
new
ProductEntity
();
productEntity
.
setCompanyId
(
String
.
valueOf
(
companyReq
.
getCompanyId
()));
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"patentList"
,
companyPatentService
.
find
(
companyPatentQuery
));
data
.
put
(
"productList"
,
productService
.
getProductEntitiesByCompanyId
(
productEntity
,
companyProductService
.
find
(
companyProductQuery
)));
rest
.
setData
(
data
);
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/FavoriteApiController.java
0 → 100644
View file @
be35ac55
package
com.mortals.xhx.busiz.applets.web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.service.IAuthTokenService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.busiz.applets.req.FavoriteReq
;
import
com.mortals.xhx.busiz.applets.req.LoginReq
;
import
com.mortals.xhx.busiz.applets.req.UserInfoReq
;
import
com.mortals.xhx.busiz.applets.rsp.FavoriteTypeListInfo
;
import
com.mortals.xhx.module.bussinesscard.model.BussinesscardEntity
;
import
com.mortals.xhx.module.bussinesscard.model.BussinesscardQuery
;
import
com.mortals.xhx.module.bussinesscard.service.BussinesscardService
;
import
com.mortals.xhx.module.favorites.model.*
;
import
com.mortals.xhx.module.favorites.service.FavoritesBusinesscardService
;
import
com.mortals.xhx.module.favorites.service.FavoritesNewsService
;
import
com.mortals.xhx.module.favorites.service.FavoritesProductService
;
import
com.mortals.xhx.module.favorites.web.FavoritesBusinesscardController
;
import
com.mortals.xhx.module.news.model.NewsEntity
;
import
com.mortals.xhx.module.news.model.NewsQuery
;
import
com.mortals.xhx.module.news.service.NewsService
;
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.service.StaffService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author ZYW
* @date 2023-10-30 9:39
*/
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/favorite"
)
public
class
FavoriteApiController
extends
AbstractBaseController
<
FavoriteReq
>{
@Autowired
private
FavoritesProductService
favoritesProductService
;
@Autowired
private
FavoritesNewsService
favoritesNewsService
;
@Autowired
private
FavoritesBusinesscardService
favoritesBusinesscardService
;
@Autowired
private
IAuthTokenService
authTokenService
;
@Autowired
private
UserService
userService
;
@Autowired
private
ProductService
productService
;
@Autowired
private
NewsService
newsService
;
@Autowired
private
BussinesscardService
bussinesscardService
;
@RequestMapping
(
"favorite"
)
public
Rest
<
Object
>
favorites
(
@RequestBody
FavoriteReq
favoriteReq
)
throws
Exception
{
String
busiDesc
=
"收藏产品/新闻/名片"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
IUser
iUser
=
authTokenService
.
getLoginUser
(
request
);
if
(
ObjectUtils
.
isEmpty
(
iUser
)){
rest
=
Rest
.
fail
(
"获取个人信息失败"
);
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
favoriteReq
.
getProductId
())
&&
favoriteReq
.
getProductId
()
!=
0
){
FavoritesProductEntity
favoritesProductEntity
=
new
FavoritesProductEntity
();
favoritesProductEntity
.
setUserId
(
iUser
.
getId
());
favoritesProductEntity
.
setProductId
(
favoriteReq
.
getProductId
());
favoritesProductEntity
.
setCreateTime
(
new
Date
());
favoritesProductEntity
.
setCreateUserId
(
iUser
.
getId
());
favoritesProductEntity
.
setFavoriteTime
(
new
Date
());
favoritesProductService
.
save
(
favoritesProductEntity
);
rest
.
setMsg
(
"收藏产品成功"
);
}
if
(!
ObjectUtils
.
isEmpty
(
favoriteReq
.
getNewsId
())
&&
favoriteReq
.
getNewsId
()
!=
0
){
FavoritesNewsEntity
favoritesNewsEntity
=
new
FavoritesNewsEntity
();
favoritesNewsEntity
.
setUserId
(
iUser
.
getId
());
favoritesNewsEntity
.
setNewsId
(
favoriteReq
.
getNewsId
());
favoritesNewsEntity
.
setCreateTime
(
new
Date
());
favoritesNewsEntity
.
setCreateUserId
(
iUser
.
getId
());
favoritesNewsEntity
.
setFavoriteTime
(
new
Date
());
favoritesNewsService
.
save
(
favoritesNewsEntity
);
rest
.
setMsg
(
"收藏新闻成功"
);
}
if
(!
ObjectUtils
.
isEmpty
(
favoriteReq
.
getStaffId
())
&&
favoriteReq
.
getStaffId
()
!=
0
){
FavoritesBusinesscardEntity
favoritesBusinesscardEntity
=
new
FavoritesBusinesscardEntity
();
favoritesBusinesscardEntity
.
setUserId
(
iUser
.
getId
());
favoritesBusinesscardEntity
.
setStaffId
(
favoriteReq
.
getStaffId
());
favoritesBusinesscardEntity
.
setCreateTime
(
new
Date
());
favoritesBusinesscardEntity
.
setCreateUserId
(
iUser
.
getId
());
favoritesBusinesscardEntity
.
setFavoriteTime
(
new
Date
());
favoritesBusinesscardService
.
save
(
favoritesBusinesscardEntity
);
rest
.
setMsg
(
"收藏名片成功"
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 查询收藏分类
* @return
* @throws Exception
*/
@RequestMapping
(
"myFavoriteType"
)
public
Rest
<
Object
>
myFavoriteType
()
{
String
busiDesc
=
"我的收藏"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
List
<
FavoriteTypeListInfo
>
list
=
new
ArrayList
<>();
list
.
add
(
new
FavoriteTypeListInfo
(
1
,
"产品收藏"
));
list
.
add
(
new
FavoriteTypeListInfo
(
2
,
"新闻收藏"
));
list
.
add
(
new
FavoriteTypeListInfo
(
3
,
"名片收藏"
));
rest
.
setData
(
list
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 查询我的收藏
* @return
* @throws Exception
*/
@RequestMapping
(
"myFavorite"
)
public
Rest
<
Object
>
myFavorites
(
@RequestBody
FavoriteReq
favoriteReq
)
{
String
busiDesc
=
"我的收藏"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
IUser
iUser
=
authTokenService
.
getLoginUser
(
request
);
long
userId
=
iUser
.
getId
();
if
(
ObjectUtils
.
isEmpty
(
iUser
)){
rest
=
Rest
.
fail
(
"获取个人信息失败"
);
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
favoriteReq
)
&&
favoriteReq
.
getTypeId
()
!=
0
){
switch
(
favoriteReq
.
getTypeId
()){
case
1
:
//产品收藏
List
<
FavoritesProductEntity
>
productList
=
favoritesProductService
.
find
(
new
FavoritesProductQuery
().
id
(
userId
));
if
(!
ObjectUtils
.
isEmpty
(
productList
)){
List
<
ProductEntity
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
productList
.
size
();
i
++)
{
long
id
=
productList
.
get
(
i
).
getProductId
();
ProductEntity
productEntity
=
productService
.
selectOne
(
new
ProductQuery
().
id
(
id
));
if
(!
ObjectUtils
.
isEmpty
(
productEntity
)){
list
.
add
(
productEntity
);
}
}
rest
.
setData
(
list
);
}
else
{
rest
.
setMsg
(
"未收藏产品"
);
}
break
;
case
2
:
//新闻收藏
List
<
FavoritesNewsEntity
>
newsList
=
favoritesNewsService
.
find
(
new
FavoritesNewsQuery
().
id
(
userId
));
if
(!
ObjectUtils
.
isEmpty
(
newsList
)){
List
<
NewsEntity
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
newsList
.
size
();
i
++)
{
long
id
=
newsList
.
get
(
i
).
getNewsId
();
NewsEntity
newsEntity
=
newsService
.
selectOne
(
new
NewsQuery
().
id
(
id
));
if
(!
ObjectUtils
.
isEmpty
(
newsEntity
)){
list
.
add
(
newsEntity
);
}
}
rest
.
setData
(
list
);
}
else
{
rest
.
setMsg
(
"未收藏新闻"
);
}
break
;
case
3
:
//名片收藏
List
<
FavoritesBusinesscardEntity
>
cardList
=
favoritesBusinesscardService
.
find
(
new
FavoritesBusinesscardQuery
().
id
(
userId
));
if
(!
ObjectUtils
.
isEmpty
(
cardList
)){
List
<
BussinesscardEntity
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
cardList
.
size
();
i
++)
{
long
id
=
cardList
.
get
(
i
).
getStaffId
();
BussinesscardEntity
bussinesscardEntity
=
bussinesscardService
.
selectOne
(
new
BussinesscardQuery
().
id
(
id
));
if
(!
ObjectUtils
.
isEmpty
(
bussinesscardEntity
)){
list
.
add
(
bussinesscardEntity
);
}
}
rest
.
setData
(
list
);
}
else
{
rest
.
setMsg
(
"未收藏名片"
);
}
break
;
default
:
rest
=
Rest
.
fail
(
"传入类型id错误"
);
break
;
}
}
else
{
rest
=
Rest
.
fail
(
"必须传入类型id"
);
}
}
}
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/LoginApiController.java
0 → 100644
View file @
be35ac55
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.service.IAuthTokenService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.xhx.base.login.web.LoginForm
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.busiz.applets.req.LoginReq
;
import
com.mortals.xhx.busiz.applets.req.StaffReq
;
import
com.mortals.xhx.busiz.applets.req.UserInfoReq
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.module.company.model.CompanyQuery
;
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.apache.catalina.User
;
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.Date
;
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-30 9:39
*/
@RestController
@Slf4j
@RequestMapping
(
"/api/v1/login"
)
public
class
LoginApiController
extends
AbstractBaseController
<
LoginReq
>{
@Autowired
private
UserService
userService
;
@Autowired
private
StaffService
staffService
;
@Autowired
private
IAuthTokenService
authTokenService
;
@RequestMapping
(
"login"
)
public
Rest
<
Object
>
login
(
@RequestBody
LoginReq
loginReq
)
throws
Exception
{
String
busiDesc
=
"小程序登录"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
JSONObject
data
=
new
JSONObject
();
UserQuery
userQuery
=
new
UserQuery
();
userQuery
.
setOpenId
(
loginReq
.
getOpenId
());
UserEntity
userEntity
=
userService
.
selectOne
(
userQuery
);
String
token
=
""
;
//如果没查到用户,则第一次登录,根据openid创建用户
if
(
ObjectUtils
.
isEmpty
(
userEntity
)){
UserEntity
entity
=
new
UserEntity
();
entity
.
setUserType
(
1
);
//普通用户
entity
.
setLastLoginTime
(
new
Date
());
entity
.
setOpenId
(
loginReq
.
getOpenId
());
entity
.
setStatus
(
1
);
entity
.
setRealName
(
"游客"
);
entity
.
setLoginName
(
loginReq
.
getOpenId
());
entity
.
setLoginPwd
(
"123"
);
//默认密码123
entity
.
setCreateUserName
(
"小程序"
);
userService
.
save
(
entity
);
token
=
authTokenService
.
createToken
(
entity
);
log
.
info
(
busiDesc
,
"第一次登陆,保存用户信息成功"
);
rest
.
setMsg
(
"未查询到用户信息"
);
}
else
{
StaffQuery
staffQuery
=
new
StaffQuery
();
if
(
ObjectUtils
.
isEmpty
(
userEntity
.
getStaffId
())){
rest
.
setMsg
(
"后台未绑定员工信息"
);
}
else
{
staffQuery
.
setId
(
userEntity
.
getStaffId
());
StaffEntity
staffEntity
=
staffService
.
selectOne
(
staffQuery
);
data
.
put
(
"userInfo"
,
staffEntity
);
if
(
ObjectUtils
.
isEmpty
(
userEntity
)){
rest
.
setMsg
(
"未查询到员工信息"
);
}
}
token
=
authTokenService
.
createToken
(
userEntity
);
}
data
.
put
(
"token"
,
token
);
rest
.
setData
(
data
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
@RequestMapping
(
"updateUserInfo"
)
public
Rest
<
Object
>
updateUserInfo
(
@RequestBody
UserInfoReq
userInfoReq
)
throws
Exception
{
String
busiDesc
=
"小程序修改人员信息"
;
Rest
<
Object
>
rest
=
Rest
.
ok
();
try
{
IUser
iUser
=
authTokenService
.
getLoginUser
(
request
);
UserEntity
user
=
userService
.
selectOne
(
new
UserQuery
().
id
(
iUser
.
getId
()));
if
(
ObjectUtils
.
isEmpty
(
user
)){
rest
=
Rest
.
fail
(
"获取个人信息失败"
);
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
userInfoReq
.
getPhone
())){
user
.
setPhone
(
userInfoReq
.
getPhone
());
}
if
(!
ObjectUtils
.
isEmpty
(
userInfoReq
.
getEmail
())){
user
.
setEmail
(
userInfoReq
.
getEmail
());
}
if
(!
ObjectUtils
.
isEmpty
(
userInfoReq
.
getName
())){
user
.
setLoginName
(
userInfoReq
.
getName
());
}
if
(!
ObjectUtils
.
isEmpty
(
userInfoReq
.
getDeptName
())){
user
.
setDeptName
(
userInfoReq
.
getDeptName
());
}
if
(!
ObjectUtils
.
isEmpty
(
userInfoReq
.
getRealName
())){
user
.
setRealName
(
userInfoReq
.
getRealName
());
}
if
(!
ObjectUtils
.
isEmpty
(
userInfoReq
.
getPhotoPath
())){
if
(!
ObjectUtils
.
isEmpty
(
user
.
getPhone
())){
StaffEntity
staffEntity
=
staffService
.
selectOne
(
new
StaffQuery
().
phoneNumber
(
user
.
getPhone
()));
if
(!
ObjectUtils
.
isEmpty
(
staffEntity
)){
staffEntity
.
setPhotoPath
(
userInfoReq
.
getPhotoPath
());
staffService
.
update
(
staffEntity
);
}
else
{
rest
=
Rest
.
fail
(
"请先在后台创建工作人员"
);
}
}
else
{
rest
=
Rest
.
fail
(
"请先绑定电话"
);
}
}
userService
.
update
(
user
);
}
}
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/NewsApiController.java
View file @
be35ac55
package
com.mortals.xhx.busiz.applets.web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/StaffApiController.java
View file @
be35ac55
...
...
@@ -71,9 +71,10 @@ public class StaffApiController extends AbstractBaseController<StaffReq>{
StaffEntity
staffEntity
=
staffService
.
get
(
staffReq
.
getId
());
if
(
staffEntity
!=
null
){
rest
.
setData
(
staffEntity
);
}
else
{
rest
=
Rest
.
fail
(
"未查到该员工"
);
}
// else {
// rest = Rest.fail("未查到该员工");
// }
}
else
{
rest
=
Rest
.
fail
(
"缺少id"
);
...
...
@@ -103,9 +104,10 @@ public class StaffApiController extends AbstractBaseController<StaffReq>{
StaffRecordEntity
staffRecordEntity
=
staffRecordService
.
get
(
staffReq
.
getId
());
if
(
staffRecordEntity
!=
null
){
rest
.
setData
(
staffRecordEntity
);
}
else
{
rest
=
Rest
.
fail
(
"未查到记录"
);
}
// else {
// rest = Rest.fail("未查到记录");
// }
}
else
{
rest
=
Rest
.
fail
(
"缺少id"
);
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
View file @
be35ac55
package
com.mortals.xhx.module.product.service
;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.company.model.CompanyProductEntity
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.dao.ProductDao
;
import
java.util.List
;
/**
* ProductService
*
...
...
@@ -14,4 +18,6 @@ import com.mortals.xhx.module.product.dao.ProductDao;
public
interface
ProductService
extends
ICRUDCacheService
<
ProductEntity
,
Long
>
{
ProductDao
getDao
();
List
<
ProductEntity
>
getProductEntitiesByCompanyId
(
ProductEntity
entity
,
List
<
CompanyProductEntity
>
companyProducList
);
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
be35ac55
package
com.mortals.xhx.module.product.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.xhx.module.category.model.CategoryEntity
;
import
com.mortals.xhx.module.category.model.CategoryQuery
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.company.model.CompanyEntity
;
import
com.mortals.xhx.module.company.model.CompanyProductEntity
;
...
...
@@ -16,7 +14,6 @@ import com.mortals.xhx.module.company.service.CompanyService;
import
com.mortals.xhx.module.product.model.*
;
import
com.mortals.xhx.module.product.service.ProductCategoryService
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.module.product.dao.ProductDao
;
...
...
@@ -111,7 +108,8 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
return
productEntityResult
;
}
private
List
<
ProductEntity
>
getProductEntitiesByCompanyId
(
ProductEntity
entity
,
List
<
CompanyProductEntity
>
companyProducList
)
{
@Override
public
List
<
ProductEntity
>
getProductEntitiesByCompanyId
(
ProductEntity
entity
,
List
<
CompanyProductEntity
>
companyProducList
)
{
List
<
ProductEntity
>
productList
=
companyProducList
.
stream
().
map
(
item
->
{
ProductEntity
productEntity
=
this
.
getCache
(
item
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
...
...
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