Search in sources :

Example 1 with XmallException

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;
}
Also used : DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException)

Example 2 with XmallException

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;
}
Also used : DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException)

Example 3 with XmallException

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;
}
Also used : TbContentCategory(cn.exrick.manager.pojo.TbContentCategory) XmallException(cn.exrick.common.exception.XmallException) Date(java.util.Date)

Example 4 with XmallException

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;
}
Also used : XmallException(cn.exrick.common.exception.XmallException) Date(java.util.Date)

Example 5 with XmallException

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;
}
Also used : XmallException(cn.exrick.common.exception.XmallException) Date(java.util.Date)

Aggregations

XmallException (cn.exrick.common.exception.XmallException)52 Date (java.util.Date)26 TbMember (cn.exrick.manager.pojo.TbMember)12 DataTablesResult (cn.exrick.common.pojo.DataTablesResult)11 TbMemberExample (cn.exrick.manager.pojo.TbMemberExample)5 SimpleDateFormat (java.text.SimpleDateFormat)5 Gson (com.google.gson.Gson)4 TbItem (cn.exrick.manager.pojo.TbItem)3 TbThanksExample (cn.exrick.manager.pojo.TbThanksExample)3 PageInfo (com.github.pagehelper.PageInfo)3 ParseException (java.text.ParseException)3 ArrayList (java.util.ArrayList)3 CartProduct (cn.exrick.manager.dto.front.CartProduct)2 SearchItem (cn.exrick.manager.dto.front.SearchItem)2 TbContentCategory (cn.exrick.manager.pojo.TbContentCategory)2 TbItemCat (cn.exrick.manager.pojo.TbItemCat)2 TbItemDesc (cn.exrick.manager.pojo.TbItemDesc)2 TbPanel (cn.exrick.manager.pojo.TbPanel)2 TbThanks (cn.exrick.manager.pojo.TbThanks)2 TransportClient (org.elasticsearch.client.transport.TransportClient)2