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 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);
}
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);
}
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;
}
Aggregations