作者主页:编程指南针
简介:Java领域优质创作者、CSDN博客专家 Java项目、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-XX-011
本系统基于SSM框架开发实现,前端使用easyui开发实现,功能强大,界面美观,数据库使用mysql数据库,开发工具采用idea。
系统部分功能展示如下:
系统管理员登陆: admin /admin
编辑
登陆后主界面:
编辑
用户管理
编辑
角色管理
编辑
资源管理
编辑
地区管理
编辑
奶茶管理==类目管理
编辑
点击购买==输入会员卡进行购买
编辑
消费积分管理
编辑
编辑
日志管理
编辑
以上是奶茶店会员管理系统的部分功能展示,本项目功能完整,运行无误,适合做毕业设计使用。
package SystemManage.ConsumeManage.service; import SystemManage.Common.until.PageInfo; import SystemManage.ConsumeManage.dao.ConsumeMapper; import SystemManage.ConsumeManage.entity.Consume; import SystemManage.ConsumeManage.entity.ConsumeVo; import SystemManage.IntegralDetialManage.service.IntegralDetialService; import SystemManage.IntegralManage.service.IntegralService; import SystemManage.MilkManage.entity.MilkConsumeVo; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.Map; /** * 消费奶茶记录 */ @Service @Transactional public class ConsumeService { @Autowired private ConsumeMapper consumeMapper; @Autowired private IntegralService integralService; @Autowired private IntegralDetialService integralDetialService; /** * 更新消费记录 * * @param vo * @return */ public int add(MilkConsumeVo vo) { Consume record = new Consume(); record.setConsumeDate(new Date()); record.setConsumeMilkId(vo.getMilkId()); record.setConsumeUserId(vo.getUserId()); int insert = consumeMapper.insert(record); // 消费记录成功,进行积分的更细和积分详细表的更新,否则都不更细 if (insert > 0) { //先更新总积分 int add = integralService.add(vo); //再更新积分详情表 if (add > 0) { return integralDetialService.add(vo, record.getId()); } } return 0; } @SuppressWarnings("all") public PageInfo list(String milkName,Long userId, PageInfo info) { PageHelper.startPage(info.getNowpage(), info.getPagesize()); Page<ConsumeVo> milks = consumeMapper.list(userId,milkName); info.setRows(milks.getResult()); info.setTotal((int) milks.getTotal()); return info; } }
package SystemManage.IntegralManage.service; import SystemManage.IntegralManage.dao.IntegralMapper; import SystemManage.IntegralManage.entity.Integral; import SystemManage.IntegralManage.entity.IntegralExample; import SystemManage.MilkManage.entity.MilkConsumeVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; /** * 用户消费总积分 */ @Service @Transactional @SuppressWarnings("all") public class IntegralService { @Autowired private IntegralMapper integralMapper; /** * 根据用户ID查询用户积分 * * @param userId * @return */ public Double findIntegralInfoByUserId(Long userId) { if (userId == null) { throw new RuntimeException("用户ID不能为空"); } IntegralExample example = new IntegralExample(); IntegralExample.Criteria criteria = example.createCriteria(); criteria.andIntegralUserIdEqualTo(Integer.parseInt(String.valueOf(userId))); List<Integral> integrals = integralMapper.selectByExample(example); if (integrals != null && integrals.size() > 0) { Integral integral = integrals.get(0); return integral.getIntegralSum(); } return 0d; } /** * 更新总积分系统 * * @param vo * @return */ public int add(MilkConsumeVo vo) { // 判断是否有总积分,没有就直接添加即可 Integral integral = integralMapper.selectByUserId(vo.getUserId()); // 证明是第一次添加 if (integral == null || integral.getIntegralConsume() == 0.0) { Integral record = new Integral(); record.setIntegralTieme(new Date()); record.setIntegralUserId(vo.getUserId()); // 价格就是积分,1元钱1积分 record.setIntegralConsume(vo.getMilkPrice()); record.setIntegralSum(vo.getMilkPrice()); int insert = integralMapper.insert(record); return insert; } else { // 积分很多,需要加上价格减去抵扣的积分进行累计增加 integral.setIntegralSum(integral.getIntegralSum() + vo.getMilkPrice() - vo.getIntegralCount()); integral.setIntegralConsume((vo.getMilkPrice() - vo.getIntegralCount()) + integral.getIntegralConsume()); int insert = integralMapper.updateByPrimaryKey(integral); return insert; } } }
package SystemManage.LogManage.service; import SystemManage.Common.until.PageInfo; import SystemManage.LogManage.dao.LogDao; import SystemManage.LogManage.entity.Log; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class LogService { @Autowired private LogDao logDao; public void insertLog(Log sysLog) { logDao.insert(sysLog); } public void findDataGrid(PageInfo pageInfo) { pageInfo.setRows(logDao.findDataGrid(pageInfo)); pageInfo.setTotal(logDao.findDataGridCount(pageInfo)); } public void batchDelete(List ids){ logDao.batchDelete(ids) ; } public Log selectById(Long id){ return logDao.selectById(id) ; } public int delByDate(String date){ int count = logDao.delLogCount(date); logDao.delByDate(date); return count ; } }
package SystemManage.MilkManage.service; import SystemManage.Common.until.PageInfo; import SystemManage.MilkManage.dao.MilkMapper; import SystemManage.MilkManage.entity.Milk; import SystemManage.MilkManage.entity.MilkExample; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; /** * 奶茶管理业务层 * */ @Service @Transactional public class MilkService { @Autowired private MilkMapper milkMapper; public PageInfo list(PageInfo info,Milk milk) { MilkExample milkExample = new MilkExample(); MilkExample.Criteria criteria = milkExample.createCriteria(); // 条件查询 if(milk != null && milk.getMilkCode() != null && milk.getMilkCode() != ""){ criteria.andMilkCodeEqualTo(milk.getMilkCode()); } if(milk != null && milk.getMilkName() != null && milk.getMilkName() != ""){ criteria.andMilkNameLike("%" + milk.getMilkName() + "%"); } PageHelper.startPage(info.getNowpage(),info.getPagesize()); Page<Milk> milks = (Page<Milk>) milkMapper.selectByExample(milkExample); info.setRows(milks.getResult()); info.setTotal((int)milks.getTotal()); return info; } public int add(Milk milk) { int insert = milkMapper.insert(milk); return insert; } public int delete(Integer id) { return milkMapper.deleteByPrimaryKey(id); } public Milk findOne(Integer id) { return milkMapper.selectByPrimaryKey(id); } public int update(Milk milk) { milk.setMilkDate(new Date()); return milkMapper.updateByPrimaryKey(milk); } }
package SystemManage.OrganizationManage.service; import SystemManage.Common.entity.Tree; import SystemManage.Common.until.PageInfo; import SystemManage.OrganizationManage.dao.OrganizationDao; import SystemManage.OrganizationManage.entity.Organization; import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class OrganizationService { @Autowired private OrganizationDao organizationDao ; /** * @description * 查找用户管理中组织机构的资源树 * 第一步: 先加载父资源 * 第二步: 通过父资源的 id 查询子资源 * 加入到 实体层中 * @return */ public List<Tree> findTree(){ List<Tree> trees = new ArrayList<Tree>(); // 查找父资源的信息 ; List<Organization> organizationFather = organizationDao.findOrganizationAllByPidNull(); if (organizationFather != null){ for (Organization organizationOne : organizationFather){ Tree treeOne = new Tree(); treeOne.setId(organizationOne.getId()); treeOne.setText(organizationOne.getName()); treeOne.setIconCls(organizationOne.getIcon()); List<Organization> organizationSon = organizationDao.findOrganizationAllByPid(organizationOne.getId()); if (organizationSon != null){ List<Tree> tree = new ArrayList<Tree>(); for (Organization organizationTwo : organizationSon ){ Tree treeTwo = new Tree(); treeTwo.setId(organizationTwo.getId()); treeTwo.setText(organizationTwo.getName()); treeTwo.setIconCls(organizationTwo.getIcon()); tree.add(treeTwo); } treeOne.setChildren(tree); } else { treeOne.setState("closed"); } trees.add(treeOne); } } return trees ; } public List<Organization> findTreeGrid() { return organizationDao.findOrganizationAll(); } public void addOrganization(Organization organization) { organizationDao.insert(organization); } public Organization findOrganizationById(Long id) { return organizationDao.findOrganizationById(id); } public void updateOrganization(Organization organization) { organizationDao.updateOrganization(organization); } public void deleteOrganizationById(Long id) { organizationDao.deleteOrganizationById(id); } }