Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
easy-affair-show
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
赵啸非
easy-affair-show
Commits
48ec80ff
Commit
48ec80ff
authored
Jul 08, 2022
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户作品发布接口
parent
19e0fa32
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
4 deletions
+161
-4
eas-manager/doc/api.md
eas-manager/doc/api.md
+61
-0
eas-manager/src/main/java/com/mortals/xhx/module/customer/model/vo/CustomerWorkDesignVo.java
...ls/xhx/module/customer/model/vo/CustomerWorkDesignVo.java
+4
-0
eas-manager/src/main/java/com/mortals/xhx/module/customer/service/CustomerWorkDesignService.java
...hx/module/customer/service/CustomerWorkDesignService.java
+10
-0
eas-manager/src/main/java/com/mortals/xhx/module/customer/service/impl/CustomerWorkDesignServiceImpl.java
.../customer/service/impl/CustomerWorkDesignServiceImpl.java
+51
-0
eas-manager/src/main/java/com/mortals/xhx/module/customer/web/CustomerWorkDesignController.java
...xhx/module/customer/web/CustomerWorkDesignController.java
+35
-4
No files found.
eas-manager/doc/api.md
View file @
48ec80ff
...
...
@@ -4573,6 +4573,67 @@ data|object|数据对象
```
### 客户发布作品
**请求URL:**
customer/work/design/release
**请求方式:**
POST
**内容类型:**
application/json;charset=utf-8
**简要描述:**
保存或更新客户作品信息:id为空时为新增保存,否则为更新提交
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
id|Long|是|作品id
masterplateName|String|是|模板名称
frontCover|String|是|封面图片地址(相对地址)
**请求样例:**
```
{
"id":6797,
"masterplateName":"c42lp8",
"frontCover":"g3odxd"
}
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 
id|Long|保存后主键id
 
entity|object|保存更新实体
  
id|Long|主键ID,主键,自增长
  
customerId|Long|客户ID
  
createTime|Date|创建时间
  
workDesignName|String|作品名称
  
workDesignStatus|Integer|作品状态:0:草稿,1:发布
  
workDesignDesc|String|作品描述
  
updateTime|Date|更新时间
  
pictureIds|String|模版引用的图片
  
pictureSrcIds|String|模版引用的素材
  
pictureBackgroundIds|String|模版引用的背景
  
fontIds|String|作品引用的字体
  
previewUrl|String|图片预览地址(相对地址)
  
draft|String|草稿内容
**响应消息样例:**
```
{
"msg":"发布成功",
"code":1,
"data":{}
}
}
```
### 删除客户设计作品信息
**请求URL:**
customer/work/design/delete
...
...
eas-manager/src/main/java/com/mortals/xhx/module/customer/model/vo/CustomerWorkDesignVo.java
View file @
48ec80ff
...
...
@@ -20,4 +20,8 @@ public class CustomerWorkDesignVo extends BaseEntityLong {
private
String
updateTimeStr
;
/** 设计内容 */
private
List
<
JSONObject
>
designContent
;
/** 发布模板名称 */
private
String
masterplateName
;
/** 发布模板封面 */
private
String
frontCover
;
}
\ No newline at end of file
eas-manager/src/main/java/com/mortals/xhx/module/customer/service/CustomerWorkDesignService.java
View file @
48ec80ff
package
com.mortals.xhx.module.customer.service
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity
;
/**
...
...
@@ -11,4 +13,12 @@ import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
*/
public
interface
CustomerWorkDesignService
extends
ICRUDService
<
CustomerWorkDesignEntity
,
Long
>{
/**
* 客户发布作品
* @param entity
* @param context
* @return
* @throws AppException
*/
int
release
(
CustomerWorkDesignEntity
entity
,
Context
context
,
String
customerName
)
throws
AppException
;
}
\ No newline at end of file
eas-manager/src/main/java/com/mortals/xhx/module/customer/service/impl/CustomerWorkDesignServiceImpl.java
View file @
48ec80ff
...
...
@@ -4,12 +4,16 @@ import com.mortals.framework.exception.AppException;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.common.code.WorkDesignStatusEnum
;
import
com.mortals.xhx.common.utils.StringUtils
;
import
com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao
;
import
com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity
;
import
com.mortals.xhx.module.customer.model.CustomerWorkDesignStatEntity
;
import
com.mortals.xhx.module.customer.model.CustomerWorkDesignStatQuery
;
import
com.mortals.xhx.module.customer.service.CustomerWorkDesignService
;
import
com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService
;
import
com.mortals.xhx.module.design.model.DesignMasterplateEntity
;
import
com.mortals.xhx.module.design.service.DesignMasterplateService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -29,6 +33,8 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
@Autowired
private
CustomerWorkDesignStatService
customerWorkDesignStatService
;
@Autowired
private
DesignMasterplateService
designMasterplateService
;
@Override
protected
CustomerWorkDesignEntity
findBefore
(
CustomerWorkDesignEntity
params
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
...
...
@@ -65,4 +71,49 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
customerWorkDesignStatService
.
update
(
updateEntity
);
}
}
@Override
public
int
release
(
CustomerWorkDesignEntity
entity
,
Context
context
,
String
customerName
)
throws
AppException
{
if
(
entity
.
getId
()==
null
){
throw
new
AppException
(
"作品信息不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getMasterplateName
())){
throw
new
AppException
(
"模板名称不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getFrontCover
())){
throw
new
AppException
(
"模板封面图不能为空"
);
}
CustomerWorkDesignEntity
workDesign
=
this
.
get
(
entity
.
getId
());
if
(
workDesign
==
null
){
throw
new
AppException
(
"作品不存在或者已被删除"
);
}
DesignMasterplateEntity
newMasterplate
=
new
DesignMasterplateEntity
();
newMasterplate
.
setMasterplateName
(
entity
.
getMasterplateName
());
List
<
DesignMasterplateEntity
>
masterplates
=
designMasterplateService
.
find
(
newMasterplate
);
if
(
CollectionUtils
.
isNotEmpty
(
masterplates
)){
throw
new
AppException
(
"模板名称已存在"
);
}
CustomerWorkDesignEntity
updateEntity
=
new
CustomerWorkDesignEntity
();
updateEntity
.
setId
(
workDesign
.
getId
());
updateEntity
.
setWorkDesignStatus
(
WorkDesignStatusEnum
.
RELEASE
.
getValue
());
updateEntity
.
setUpdateTime
(
new
Date
());
this
.
update
(
updateEntity
);
newMasterplate
.
setCustomerId
(
workDesign
.
getCustomerId
());
newMasterplate
.
setMasterplateName
(
entity
.
getMasterplateName
());
newMasterplate
.
setMasterplateCode
(
1
);
newMasterplate
.
setCustomerName
(
customerName
);
newMasterplate
.
setMasterplateDesc
(
entity
.
getMasterplateName
());
newMasterplate
.
setMasterplatePath
(
workDesign
.
getPreviewUrl
());
newMasterplate
.
setFontIds
(
workDesign
.
getFontIds
());
newMasterplate
.
setPictureBackgroundIds
(
workDesign
.
getPictureBackgroundIds
());
newMasterplate
.
setPictureIds
(
workDesign
.
getPictureIds
());
newMasterplate
.
setPictureSrcIds
(
workDesign
.
getPictureSrcIds
());
newMasterplate
.
setMasterplateUseNum
(
0
);
newMasterplate
.
setPreviewUrl
(
entity
.
getFrontCover
());
newMasterplate
.
setDraft
(
workDesign
.
getDraft
());
newMasterplate
.
setCreateTime
(
new
Date
());
designMasterplateService
.
save
(
newMasterplate
,
context
);
return
1
;
}
}
\ No newline at end of file
eas-manager/src/main/java/com/mortals/xhx/module/customer/web/CustomerWorkDesignController.java
View file @
48ec80ff
package
com.mortals.xhx.module.customer.web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.RepeatSubmit
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
...
...
@@ -17,10 +19,8 @@ import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
*
* 客户作品信息
...
...
@@ -122,4 +122,35 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
ret
.
put
(
"data"
,
model
);
return
ret
.
toJSONString
();
}
@PostMapping
({
"release"
})
@RepeatSubmit
public
String
release
(
@RequestBody
CustomerWorkDesignEntity
entity
)
{
if
(
this
.
getCurUser
()==
null
||
this
.
getCurUser
().
getUserType
()!=
Constant
.
CUSTOMER_USER
){
throw
new
AppException
(
"非法用户,不可访问"
);
}
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"客户发布作品"
;
int
code
=
1
;
try
{
this
.
service
.
release
(
entity
,
context
,
this
.
getCurUser
().
getRealName
());
model
.
put
(
"entity"
,
entity
);
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】 [id:"
+
entity
.
getId
()
+
"]"
);
}
catch
(
Exception
var7
)
{
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var7
);
model
.
put
(
"entity"
,
entity
);
this
.
init
(
model
,
context
);
code
=
this
.
saveException
(
entity
,
model
,
context
,
var7
);
}
this
.
init
(
model
,
context
);
JSONObject
ret
=
new
JSONObject
();
ret
.
put
(
"code"
,
code
);
ret
.
put
(
"msg"
,
model
.
remove
(
"message_info"
));
ret
.
put
(
"data"
,
model
);
return
ret
.
toJSONString
();
}
}
\ No newline at end of file
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