喝不起奶茶,咱就為奶茶店開發(fā)個會員積分收銀系統(tǒng)
?作者主頁:
?簡介:Java領(lǐng)域優(yōu)質(zhì)創(chuàng)作者、CSDN博客專家? Java項目、簡歷模板、學(xué)習(xí)資料、面試題庫、技術(shù)互助
文末獲取源碼
?項目編號:BS-XX-011
本系統(tǒng)基于SSM框架開發(fā)實現(xiàn),前端使用easyui開發(fā)實現(xiàn),功能強大,界面美觀,數(shù)據(jù)庫使用mysql數(shù)據(jù)庫,開發(fā)工具采用idea。
系統(tǒng)部分功能展示如下:
系統(tǒng)管理員登陸: admin /admin

登陸后主界面:

用戶管理

角色管理

資源管理

地區(qū)管理

奶茶管理==類目管理

點擊購買==輸入會員卡進行購買

消費積分管理


日志管理

以上是奶茶店會員管理系統(tǒng)的部分功能展示,本項目功能完整,運行無誤,適合做畢業(yè)設(shè)計使用。
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;/**
* 消費奶茶記錄
*/public class ConsumeService { ? ?
? ?private ConsumeMapper consumeMapper; ? ?
? ?private IntegralService integralService; ? ?
? ?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); ? ? ? ?// 消費記錄成功,進行積分的更細(xì)和積分詳細(xì)表的更新,否則都不更細(xì)
? ? ? ?if (insert > 0) { ? ? ? ? ? ?//先更新總積分
? ? ? ? ? ?int add = integralService.add(vo); ? ? ? ? ? ?//再更新積分詳情表
? ? ? ? ? ?if (add > 0) { ? ? ? ? ? ? ? ?return integralDetialService.add(vo, record.getId());
? ? ? ? ? ?}
? ? ? ?} ? ? ? ?return 0;
? ?} ? ?
? ?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;/**
* 用戶消費總積分
*/public class IntegralService { ? ?
? ?private IntegralMapper integralMapper; ? ?/**
? ? * 根據(jù)用戶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;
? ?} ? ?/**
? ? * 更新總積分系統(tǒng)
? ? *
? ? * @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;public class LogService { ? ? ? ?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;/**
* 奶茶管理業(yè)務(wù)層
*
*/public class MilkService { ? ?
? ?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;public class OrganizationService { ? ?
? ?private OrganizationDao organizationDao ; ? ?/**
? ? * @description
? ? * 查找用戶管理中組織機構(gòu)的資源樹
? ? * 第一步: 先加載父資源
? ? * 第二步: 通過父資源的 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);
? ?}
}