parent
685a373360
commit
4f50605455
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.mall.order.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.constant.MallConstants;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.order.api.OrderCommentReplyService;
|
||||
import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO;
|
||||
import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO;
|
||||
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 评论回复模块 Api(user)
|
||||
*
|
||||
* @author wtz
|
||||
* @time 2019-05-31 18:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(MallConstants.ROOT_PATH_USER + "/order_comment_reply")
|
||||
@Api("用户评论回复模块 ")
|
||||
public class OrderCommentReplyController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.OrderCommentService.version}")
|
||||
private OrderCommentReplyService orderCommentReplyService;
|
||||
|
||||
@PostMapping("create_order_comment")
|
||||
//@RequiresLogin
|
||||
@ApiOperation(value = "创建订单")
|
||||
public CommonResult<OrderCommentReplyCreateBO> createOrderCommentReply(@RequestBody @Validated OrderCommentReplyCreateDTO orderCommentReplyCreateDTO){
|
||||
return success(orderCommentReplyService.createOrderCommentReply(orderCommentReplyCreateDTO));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.order.api.constant;
|
||||
|
||||
/**
|
||||
*
|
||||
* 评论回复类型
|
||||
*
|
||||
* @author wtz
|
||||
* @time 2019-06-01 10:30:00
|
||||
*/
|
||||
public enum OrderCommentRelpyTypeEnum {
|
||||
|
||||
REPLY_REPLY(0, "回复的回复"),
|
||||
COMMENT_REPLY(1, "评论的回复");
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private Integer value;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
OrderCommentRelpyTypeEnum(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.mall.order.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO;
|
||||
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
|
||||
import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* 评论回复 convert
|
||||
*
|
||||
* @author wtz
|
||||
* @time 2019-05-31 18:30
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderCommentReplyConvert {
|
||||
|
||||
OrderCommentReplyConvert INSTANCE = Mappers.getMapper(OrderCommentReplyConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
OrderCommentReplyDO convert(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO);
|
||||
|
||||
@Mappings({})
|
||||
OrderCommentReplyCreateBO convert(OrderCommentReplyDO orderCommentReplyDO);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.mall.order.biz.service;
|
||||
|
||||
import cn.iocoder.mall.order.api.OrderCommentReplyService;
|
||||
import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO;
|
||||
import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO;
|
||||
import cn.iocoder.mall.order.api.constant.OrderCommentRelpyTypeEnum;
|
||||
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
|
||||
import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO;
|
||||
import cn.iocoder.mall.order.biz.convert.OrderCommentReplyConvert;
|
||||
import cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper;
|
||||
import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 订单评论回复 service impl
|
||||
*
|
||||
* @author wtz
|
||||
* @time 2019-05-31 18:30
|
||||
*/
|
||||
@Service
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true",version = "${dubbo.provider.OrderCommentReplyService.version}")
|
||||
public class OrderCommentReplyServiceImpl implements OrderCommentReplyService {
|
||||
|
||||
@Autowired
|
||||
private OrderCommentReplayMapper orderCommentReplayMapper;
|
||||
|
||||
@Override
|
||||
public List<OrderCommentReplyPageBO> getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建评论回复
|
||||
* @param orderCommentReplyCreateDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OrderCommentReplyCreateBO createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO) {
|
||||
OrderCommentReplyDO orderCommentReplyDO=OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyCreateDTO);
|
||||
orderCommentReplyDO.setCreateTime(new Date());
|
||||
orderCommentReplyDO.setUpdateTime(new Date());
|
||||
|
||||
Integer replyType=orderCommentReplyCreateDTO.getCommentId()==orderCommentReplyCreateDTO.getParentId()?
|
||||
OrderCommentRelpyTypeEnum.COMMENT_REPLY.getValue():OrderCommentRelpyTypeEnum.REPLY_REPLY.getValue();
|
||||
|
||||
orderCommentReplyDO.setReplyType(replyType);
|
||||
|
||||
orderCommentReplayMapper.insert(orderCommentReplyDO);
|
||||
|
||||
return OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyDO);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue