订单评价
This commit is contained in:
parent
6959ea6699
commit
5fb63050a4
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.canteen.core.cook.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -65,5 +67,10 @@ public class CookEvaluaOrder extends BaseEntity {
|
|||
@ApiModelProperty(value = "订单评价类型1食堂2商超")
|
||||
private Long orderEvaluaType;
|
||||
|
||||
@ApiModelProperty("评价图片")
|
||||
private List<String> pictureList;
|
||||
|
||||
@ApiModelProperty("订单详情")
|
||||
List<CookEvaluaDetail> detailList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,4 +57,6 @@ public interface CookEvaluaOrderMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteCookEvaluaOrderByEvaluaIds(Long[] evaluaIds);
|
||||
|
||||
public void updateOrderEvaluaStatus(Long orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
package com.bonus.canteen.core.cook.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.bonus.canteen.core.cook.domain.CookEvaluaDetail;
|
||||
import com.bonus.canteen.core.cook.domain.CookEvaluaPicture;
|
||||
import com.bonus.canteen.core.cook.mapper.CookEvaluaDetailMapper;
|
||||
import com.bonus.canteen.core.cook.mapper.CookEvaluaPictureMapper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.cook.mapper.CookEvaluaOrderMapper;
|
||||
|
|
@ -19,6 +26,10 @@ import com.bonus.canteen.core.cook.service.ICookEvaluaOrderService;
|
|||
public class CookEvaluaOrderServiceImpl implements ICookEvaluaOrderService {
|
||||
@Autowired
|
||||
private CookEvaluaOrderMapper cookEvaluaOrderMapper;
|
||||
@Autowired
|
||||
private CookEvaluaDetailMapper cookEvaluaDetailMapper;
|
||||
@Autowired
|
||||
private CookEvaluaPictureMapper cookEvaluaPictureMapper;
|
||||
|
||||
/**
|
||||
* 查询订单评价
|
||||
|
|
@ -50,11 +61,35 @@ public class CookEvaluaOrderServiceImpl implements ICookEvaluaOrderService {
|
|||
*/
|
||||
@Override
|
||||
public int insertCookEvaluaOrder(CookEvaluaOrder cookEvaluaOrder) {
|
||||
if (Objects.isNull(cookEvaluaOrder.getOrderId())) {
|
||||
throw new ServiceException("订单编号不能为空");
|
||||
}
|
||||
cookEvaluaOrder.setCreateTime(DateUtils.getNowDate());
|
||||
cookEvaluaOrder.setCreateBy(SecurityUtils.getUsername());
|
||||
try {
|
||||
return cookEvaluaOrderMapper.insertCookEvaluaOrder(cookEvaluaOrder);
|
||||
int count = cookEvaluaOrderMapper.insertCookEvaluaOrder(cookEvaluaOrder);
|
||||
long evaluaId = cookEvaluaOrder.getEvaluaId();
|
||||
List<String> pictureList = cookEvaluaOrder.getPictureList();
|
||||
for (int i = 0; i < pictureList.size(); i++) {
|
||||
CookEvaluaPicture menuEvaluaPicture = new CookEvaluaPicture();
|
||||
menuEvaluaPicture.setEvaluaId(evaluaId);
|
||||
menuEvaluaPicture.setImgUrl(pictureList.get(i));
|
||||
menuEvaluaPicture.setCreateTime(DateUtils.getNowDate());
|
||||
menuEvaluaPicture.setCreateBy(SecurityUtils.getUsername());
|
||||
cookEvaluaPictureMapper.insertCookEvaluaPicture(menuEvaluaPicture);
|
||||
}
|
||||
List<CookEvaluaDetail> detailList = cookEvaluaOrder.getDetailList();
|
||||
for (int i = 0; i < detailList.size(); i++) {
|
||||
CookEvaluaDetail menuEvaluaDetail = detailList.get(i);
|
||||
menuEvaluaDetail.setEvaluaId(evaluaId);
|
||||
menuEvaluaDetail.setCreateTime(DateUtils.getNowDate());
|
||||
menuEvaluaDetail.setCreateBy(SecurityUtils.getUsername());
|
||||
cookEvaluaDetailMapper.insertCookEvaluaDetail(menuEvaluaDetail);
|
||||
}
|
||||
cookEvaluaOrderMapper.updateOrderEvaluaStatus(cookEvaluaOrder.getOrderId());
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
throw new ServiceException("新增订单评价异常, " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,4 +103,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{evaluaId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateOrderEvaluaStatus" parameterType="Long">
|
||||
update order_info
|
||||
set comment_state = 1
|
||||
where order_id = #{orderId}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue