Search in sources :

Example 36 with XmallException

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

the class MemberServiceImpl method changePassMember.

@Override
public TbMember changePassMember(Long id, MemberDto memberDto) {
    TbMember tbMember = tbMemberMapper.selectByPrimaryKey(id);
    String md5Pass = DigestUtils.md5DigestAsHex(memberDto.getPassword().getBytes());
    tbMember.setPassword(md5Pass);
    tbMember.setUpdated(new Date());
    if (tbMemberMapper.updateByPrimaryKey(tbMember) != 1) {
        throw new XmallException("修改会员密码失败");
    }
    return getMemberById(id);
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember) XmallException(cn.exrick.common.exception.XmallException) Date(java.util.Date)

Example 37 with XmallException

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

the class MemberServiceImpl method getMemberByEmail.

@Override
public TbMember getMemberByEmail(String email) {
    List<TbMember> list;
    TbMemberExample example = new TbMemberExample();
    TbMemberExample.Criteria criteria = example.createCriteria();
    criteria.andEmailEqualTo(email);
    try {
        list = tbMemberMapper.selectByExample(example);
    } catch (Exception e) {
        throw new XmallException("Email获取会员信息失败");
    }
    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)

Example 38 with XmallException

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

the class MemberServiceImpl method getRemoveMemberList.

@Override
public DataTablesResult getRemoveMemberList(int draw, int start, int length, String search, String minDate, String maxDate, String orderCol, String orderDir) {
    DataTablesResult result = new DataTablesResult();
    try {
        // 分页执行查询返回结果
        PageHelper.startPage(start / length + 1, length);
        List<TbMember> list = tbMemberMapper.selectByRemoveMemberInfo("%" + search + "%", minDate, maxDate, orderCol, orderDir);
        PageInfo<TbMember> pageInfo = new PageInfo<>(list);
        for (TbMember tbMember : list) {
            tbMember.setPassword("");
        }
        result.setRecordsFiltered((int) pageInfo.getTotal());
        result.setRecordsTotal(getRemoveMemberCount().getRecordsTotal());
        result.setDraw(draw);
        result.setData(list);
    } catch (Exception e) {
        throw new XmallException("加载删除用户列表失败");
    }
    return result;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TbMember(cn.exrick.manager.pojo.TbMember) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 39 with XmallException

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

the class ContentCatServiceImpl method updateContentCat.

@Override
public int updateContentCat(ContentCatDto contentCatDto) {
    TbContentCategory tbContentCategory = DtoUtil.ContentCatDto2TbContentCategory(contentCatDto);
    TbContentCategory old = getContentCatById(tbContentCategory.getId());
    tbContentCategory.setParentId(old.getParentId());
    tbContentCategory.setIcon(old.getIcon());
    tbContentCategory.setCreated(old.getCreated());
    tbContentCategory.setUpdated(new Date());
    if (tbContentCategoryMapper.updateByPrimaryKey(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 40 with XmallException

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

the class ContentImageServiceImpl method updateContentImage.

@Override
public int updateContentImage(TbImage tbImage) {
    TbImage old = getContentImageById(Long.valueOf(tbImage.getId()));
    if (tbImage.getImage().isEmpty()) {
        tbImage.setImage(old.getImage());
    }
    tbImage.setUpdated(new Date());
    tbImage.setImageMobile(old.getImageMobile());
    tbImage.setCreated(old.getCreated());
    if (tbImageMapper.updateByPrimaryKey(tbImage) != 1) {
        throw new XmallException("更新图片失败");
    }
    // 同步缓存
    deleteHomeRedis();
    return 1;
}
Also used : TbImage(cn.exrick.manager.pojo.TbImage) XmallException(cn.exrick.common.exception.XmallException) Date(java.util.Date)

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