Search in sources :

Example 26 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 27 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 28 with XmallException

use of cn.exrick.common.exception.XmallException in project xmall by Exrick.

the class ItemServiceImpl method alertItemState.

@Override
public TbItem alertItemState(Long id, Integer state) {
    TbItem tbMember = getNormalItemById(id);
    tbMember.setStatus(state.byteValue());
    tbMember.setUpdated(new Date());
    if (tbItemMapper.updateByPrimaryKey(tbMember) != 1) {
        throw new XmallException("修改商品状态失败");
    }
    return getNormalItemById(id);
}
Also used : XmallException(cn.exrick.common.exception.XmallException) TbItem(cn.exrick.manager.pojo.TbItem) Date(java.util.Date)

Example 29 with XmallException

use of cn.exrick.common.exception.XmallException in project xmall by Exrick.

the class ItemServiceImpl method addItem.

@Override
public TbItem addItem(ItemDto itemDto) {
    long id = IDUtil.getRandomId();
    TbItem tbItem = DtoUtil.ItemDto2TbItem(itemDto);
    tbItem.setId(id);
    tbItem.setStatus((byte) 1);
    tbItem.setCreated(new Date());
    tbItem.setUpdated(new Date());
    if (tbItem.getImage().isEmpty()) {
        tbItem.setImage("http://ow2h3ee9w.bkt.clouddn.com/nopic.jpg");
    }
    if (tbItemMapper.insert(tbItem) != 1) {
        throw new XmallException("添加商品失败");
    }
    TbItemDesc tbItemDesc = new TbItemDesc();
    tbItemDesc.setItemId(id);
    tbItemDesc.setItemDesc(itemDto.getDetail());
    tbItemDesc.setCreated(new Date());
    tbItemDesc.setUpdated(new Date());
    if (tbItemDescMapper.insert(tbItemDesc) != 1) {
        throw new XmallException("添加商品详情失败");
    }
    // 发送消息同步索引库
    sendRefreshESMessage("add", id);
    return getNormalItemById(id);
}
Also used : XmallException(cn.exrick.common.exception.XmallException) TbItemDesc(cn.exrick.manager.pojo.TbItemDesc) TbItem(cn.exrick.manager.pojo.TbItem) Date(java.util.Date)

Example 30 with XmallException

use of cn.exrick.common.exception.XmallException in project xmall by Exrick.

the class MemberServiceImpl method getMemberByPhone.

@Override
public TbMember getMemberByPhone(String phone) {
    List<TbMember> list;
    TbMemberExample example = new TbMemberExample();
    TbMemberExample.Criteria criteria = example.createCriteria();
    criteria.andPhoneEqualTo(phone);
    try {
        list = tbMemberMapper.selectByExample(example);
    } catch (Exception e) {
        throw new XmallException("Phone获取会员信息失败");
    }
    if (!list.isEmpty()) {
        list.get(0).setPassword("");
        return list.get(0);
    }
    return null;
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember) TbMemberExample(cn.exrick.manager.pojo.TbMemberExample) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Aggregations

XmallException (cn.exrick.common.exception.XmallException)47 Date (java.util.Date)22 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 TbThanks (cn.exrick.manager.pojo.TbThanks)2 TransportClient (org.elasticsearch.client.transport.TransportClient)2 Settings (org.elasticsearch.common.settings.Settings)2