Commit 7ba5cd5e authored by 廖旭伟's avatar 廖旭伟

客户收藏接口bug修改,新增客户取消发布接口

parent bc070a8e
......@@ -4634,6 +4634,48 @@ data|object|数据对象
```
### 客户取消已发布作品
**请求URL:** customer/work/design/release/cancel
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存或更新客户作品信息:id为空时为新增保存,否则为更新提交
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
id|Long|是|作品id
**请求样例:**
```
{
"id":6797
}
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
**响应消息样例:**
```
{
"msg":"发布成功",
"code":1,
"data":{}
}
}
```
### 删除客户设计作品信息
**请求URL:** customer/work/design/delete
......
......@@ -21,4 +21,12 @@ public interface CustomerWorkDesignService extends ICRUDService<CustomerWorkDesi
* @throws AppException
*/
int release(CustomerWorkDesignEntity entity, Context context,String customerName) throws AppException;
/**
* 客户取消已发布作品
* @param designId
* @return
* @throws AppException
*/
int cancelRelease(Long designId) throws AppException;
}
\ No newline at end of file
......@@ -44,7 +44,7 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust
if(CollectionUtils.isNotEmpty(list)){
list.stream().forEach(item->{
DesignMasterplateEntity designMasterplateEntity = designMasterplateService.get(item.getMasterplateId());
if(StringUtils.isNotEmpty(designMasterplateEntity.getDraft())){
if(designMasterplateEntity!=null && StringUtils.isNotEmpty(designMasterplateEntity.getDraft())){
designMasterplateEntity.setDesignContent(JSONObject.parseArray(designMasterplateEntity.getDraft(),JSONObject.class));
}
item.setDesignMasterplate(designMasterplateEntity!=null?designMasterplateEntity:null);
......
......@@ -87,6 +87,9 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
if(workDesign==null){
throw new AppException("作品不存在或者已被删除");
}
if(workDesign.getWorkDesignStatus()==WorkDesignStatusEnum.RELEASE.getValue()){
throw new AppException("请勿重复发布");
}
DesignMasterplateEntity newMasterplate = new DesignMasterplateEntity();
newMasterplate.setMasterplateName(entity.getMasterplateName());
List<DesignMasterplateEntity> masterplates = designMasterplateService.find(newMasterplate);
......@@ -116,4 +119,13 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
designMasterplateService.save(newMasterplate,context);
return 1;
}
@Override
public int cancelRelease(Long designId) throws AppException {
CustomerWorkDesignEntity updateEntity = new CustomerWorkDesignEntity();
updateEntity.setId(designId);
updateEntity.setWorkDesignStatus(WorkDesignStatusEnum.DRAFT.getValue());
updateEntity.setUpdateTime(new Date());
return dao.update(updateEntity);
}
}
\ No newline at end of file
......@@ -62,7 +62,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
});
}
Map<String, Object> map = new HashMap<>();
map.put("draft",draft);
map.put("draft",resultList);
map.put("release",release);
model.put("data",map);
return 1;
......@@ -153,4 +153,34 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
ret.put("data", model);
return ret.toJSONString();
}
@PostMapping({"release/cancel"})
@RepeatSubmit
public String cancelRelease(@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.cancelRelease(entity.getId());
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment