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
84f40054
Commit
84f40054
authored
Oct 30, 2023
by
周亚武
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序接口更新
parent
3318e751
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
202 additions
and
5 deletions
+202
-5
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/LoginReq.java
...main/java/com/mortals/xhx/busiz/applets/req/LoginReq.java
+22
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/CompanyApiController.java
...m/mortals/xhx/busiz/applets/web/CompanyApiController.java
+53
-5
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/LoginApiController.java
...com/mortals/xhx/busiz/applets/web/LoginApiController.java
+105
-0
No files found.
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/req/CompanyReq.java
0 → 100644
View file @
84f40054
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/LoginReq.java
0 → 100644
View file @
84f40054
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/web/CompanyApiController.java
View file @
84f40054
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.xhx.busiz.applets.req.CompanyReq
;
import
com.mortals.xhx.module.company.model.CompanyPatentEntity
;
import
com.mortals.xhx.module.company.model.CompanyPatentQuery
;
import
com.mortals.xhx.module.company.model.CompanyQuery
;
import
com.mortals.xhx.module.company.service.Company
Labels
Service
;
import
com.mortals.xhx.module.company.service.Company
Patent
Service
;
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.ProductQuery
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
lombok.extern.slf4j.Slf4j
;
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.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -25,11 +35,15 @@ 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
;
/**
* 公司标注列表
...
...
@@ -63,4 +77,38 @@ 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
+
" 【成功】"
);
Context
context
=
this
.
getContext
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
try
{
if
(
ObjectUtils
.
isEmpty
(
companyReq
.
getCompanyId
()))
{
throw
new
AppException
(
"详细查询id不能为空!"
);
}
CompanyPatentQuery
companyPatentQuery
=
new
CompanyPatentQuery
();
companyPatentQuery
.
setCompanyId
(
companyReq
.
getCompanyId
());
ProductQuery
productQuery
=
new
ProductQuery
();
productQuery
.
setCompanyId
(
String
.
valueOf
(
companyReq
.
getCompanyId
()));
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"patentList"
,
companyPatentService
.
find
(
companyPatentQuery
));
data
.
put
(
"productList"
,
productService
.
find
(
productQuery
));
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/LoginApiController.java
0 → 100644
View file @
84f40054
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.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.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.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
();
String
token
=
authTokenService
.
getToken
(
request
);
data
.
put
(
"token"
,
token
);
UserQuery
userQuery
=
new
UserQuery
();
userQuery
.
setOpenId
(
loginReq
.
getOpenId
());
UserEntity
userEntity
=
userService
.
selectOne
(
userQuery
);
//如果没查到用户,则第一次登录,根据openid创建用户
if
(
ObjectUtils
.
isEmpty
(
userEntity
)){
UserEntity
entity
=
new
UserEntity
();
entity
.
setUserType
(
1
);
//普通用户
entity
.
setLastLoginTime
(
new
Date
());
entity
.
setOpenId
(
loginReq
.
getOpenId
());
entity
.
setRealName
(
"游客"
);
userService
.
save
(
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
(
"未查询到员工信息"
);
}
}
}
rest
.
setData
(
data
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
}
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