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