package com.stylefeng.guns.modular.system.service.impl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import com.stylefeng.guns.modular.system.dao.OrderCancelMapper;
|
import com.stylefeng.guns.modular.system.model.OrderCancel;
|
import com.stylefeng.guns.modular.system.service.IOrderCancelService;
|
import com.stylefeng.guns.modular.system.util.DateUtil;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Isolation;
|
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Map;
|
|
|
@Service
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
public class OrderCancelServiceImpl extends ServiceImpl<OrderCancelMapper, OrderCancel> implements IOrderCancelService {
|
|
@Resource
|
private OrderCancelMapper orderCancelMapper;
|
|
|
|
/**
|
* 添加数据
|
* @param orderId
|
* @param orderType
|
* @param reason
|
* @param remark
|
* @param payType
|
* @param money
|
* @param state
|
* @throws Exception
|
*/
|
@Override
|
public Integer saveData(Integer orderId, Integer orderType, String reason, String remark, Integer payType,
|
Double money, Integer state, Integer userType, Integer uid) throws Exception {
|
OrderCancel orderCancel = new OrderCancel();
|
orderCancel.setOrderId(orderId);
|
orderCancel.setOrderType(orderType);
|
orderCancel.setReason(reason);
|
orderCancel.setRemark(remark);
|
orderCancel.setPayType(payType);
|
orderCancel.setMoney(money);
|
orderCancel.setState(state);
|
orderCancel.setInsertTime(new Date());
|
orderCancel.setUserType(userType);
|
orderCancel.setUserId(uid);
|
this.insert(orderCancel);
|
return orderCancel.getId();
|
}
|
|
|
/**
|
* 获取取消数据
|
* @param orderId
|
* @param orderType
|
* @param money
|
* @param payType
|
* @param state
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public OrderCancel query(Integer orderId, Integer orderType, Double money, Integer payType, Integer state) throws Exception {
|
return orderCancelMapper.query(orderId, orderType, money, payType, state);
|
}
|
|
|
/**
|
* 获取用户取消记录
|
* @param uid
|
* @param isPay
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<Map<String, Object>> queryCancel(Integer language, Integer uid, Integer isPay) throws Exception {
|
List<Map<String, Object>> list = orderCancelMapper.queryCancel(uid, isPay);
|
for (Map<String, Object> map : list) {
|
if(null != map.get("time")){
|
String time = map.get("time").toString();
|
map.put("time", DateUtil.conversionFormat(language, time));
|
}
|
}
|
return list;
|
}
|
}
|