use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class OrderServiceImpl method getOrderList.
@Override
public DataTablesResult getOrderList() {
DataTablesResult result = new DataTablesResult();
TbOrderExample example = new TbOrderExample();
List<TbOrder> list = tbOrderMapper.selectByExample(example);
if (list == null) {
throw new XmallException("获取订单列表失败");
}
result.setSuccess(true);
result.setData(list);
return result;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class SystemServiceImpl method getLogList.
@Override
public DataTablesResult getLogList() {
DataTablesResult result = new DataTablesResult();
TbLogExample example = new TbLogExample();
List<TbLog> list = tbLogMapper.selectByExample(example);
if (list == null) {
throw new XmallException("获取日志列表失败");
}
result.setSuccess(true);
result.setData(list);
return result;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class ContentCatServiceImpl method addContentCat.
@Override
public int addContentCat(ContentCatDto contentCatDto) {
TbContentCategory tbContentCategory = DtoUtil.ContentCatDto2TbContentCategory(contentCatDto);
tbContentCategory.setParentId((long) 0);
tbContentCategory.setCreated(new Date());
tbContentCategory.setUpdated(new Date());
if (tbContentCategoryMapper.insert(tbContentCategory) != 1) {
throw new XmallException("添加内容分类失败");
}
// 同步缓存
deleteHomeRedis();
return 1;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class ContentServiceImpl method addContent.
@Override
public int addContent(TbContent tbContent) {
tbContent.setCreated(new Date());
tbContent.setUpdated(new Date());
if (tbContentMapper.insert(tbContent) != 1) {
throw new XmallException("添加内容失败");
}
// 同步缓存
deleteHomeRedis();
return 1;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class OrderServiceImpl method judgeOrder.
/**
* 判断订单是否超时未支付
*/
public String judgeOrder(TbOrder tbOrder) {
String result = null;
if (tbOrder.getStatus() == 0) {
// 判断是否已超1天
long diff = System.currentTimeMillis() - tbOrder.getCreateTime().getTime();
long days = diff / (1000 * 60 * 60 * 24);
if (days >= 1) {
// 设置失效
tbOrder.setStatus(5);
tbOrder.setCloseTime(new Date());
if (tbOrderMapper.updateByPrimaryKey(tbOrder) != 1) {
throw new XmallException("设置订单关闭失败");
}
} else {
// 返回到期时间
long time = tbOrder.getCreateTime().getTime() + 1000 * 60 * 60 * 24;
result = String.valueOf(time);
}
}
return result;
}
Aggregations