From ad31648c6f7a8bff1f7ccdf84b76006b9ffb78f8 Mon Sep 17 00:00:00 2001 From: jyy <jyy> Date: Sat, 17 Jul 2021 15:59:10 +0800 Subject: [PATCH] 1. 新增套餐中有效和无效的操作 2. 会员修改门店功能 3. 套餐新增编辑次数功能 4. 计算是否为赠送的条件为,全部为赠送金额购买且支付金额大于0 5. 打印小票功能调整间距,和收银人 6. PC端服务单新增划扣金额展示 --- zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java | 65 +++++++++++++++++++++++++++++++- 1 files changed, 62 insertions(+), 3 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java index a93ef26..8d149de 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java @@ -1,7 +1,11 @@ package com.matrix.system.hive.action; import com.matrix.core.pojo.AjaxResult; +import com.matrix.core.pojo.PaginationVO; +import com.matrix.core.tools.StringUtils; +import com.matrix.core.tools.WebUtil; import com.matrix.system.common.bean.SysUsers; +import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.SysVipLabel; import com.matrix.system.hive.dao.SysVipLabelDao; import com.matrix.system.hive.plugin.util.CollectionUtils; @@ -12,8 +16,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Random; /** * @author wzy @@ -26,11 +32,22 @@ @Autowired private SysVipLabelDao sysVipLabelDao; + + @RequestMapping(value = "/showList") + @ResponseBody + private AjaxResult showList(SysVipLabel sysVipLabel, PaginationVO pageVo) { + SysUsers user = getMe(); + sysVipLabel.setCompanyId(user.getCompanyId()); + return AjaxResult.buildSuccessInstance(sysVipLabelDao.selectInPage(sysVipLabel, pageVo), sysVipLabelDao.selectTotal(sysVipLabel)); + } + @RequestMapping(value = "/add") @ResponseBody public AjaxResult add(SysVipLabel sysVipLabel) { SysUsers sysUsers = getMe(); + sysVipLabel.setIsAll(1); + sysVipLabel.setCompanyId(sysUsers.getCompanyId()); List<SysVipLabel> sysVipLabels = sysVipLabelDao.selectByModel(sysVipLabel); if (CollectionUtils.isNotEmpty(sysVipLabels)) { return AjaxResult.buildFailInstance("已存在该标签"); @@ -38,6 +55,7 @@ sysVipLabel.setCreateBy(sysUsers.getSuName()); sysVipLabel.setCreateTime(new Date()); + sysVipLabel.setColor(Dictionary.COLORS[new Random().nextInt(6)]); int i = sysVipLabelDao.insert(sysVipLabel); if (i > 0) { @@ -48,13 +66,54 @@ return AjaxResult.buildFailInstance("添加失败"); } + @RequestMapping(value = "/modify") + @ResponseBody + public AjaxResult modify(SysVipLabel sysVipLabel) { + SysUsers sysUsers = getMe(); + + SysVipLabel hasExist = sysVipLabelDao.selectById(sysVipLabel.getId()); + if (!sysVipLabel.getLabel().equals(hasExist.getLabel())) { + SysVipLabel query = new SysVipLabel(); + query.setIsAll(1); + query.setCompanyId(sysUsers.getCompanyId()); + query.setLabel(sysVipLabel.getLabel()); + List<SysVipLabel> sysVipLabels = sysVipLabelDao.selectByModel(sysVipLabel); + if (CollectionUtils.isNotEmpty(sysVipLabels)) { + return AjaxResult.buildFailInstance("已存在该标签"); + } + } + + sysVipLabel.setColor(Dictionary.COLORS[new Random().nextInt(6)]); + + int i = sysVipLabelDao.update(sysVipLabel); + if (i > 0) { + AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("编辑成功"); + ajaxResult.putInMap("label", sysVipLabel); + return ajaxResult; + } + return AjaxResult.buildFailInstance("编辑失败"); + } + @RequestMapping(value = "/del") @ResponseBody - public AjaxResult del(Long id) { - int i = sysVipLabelDao.deleteById(id); + public AjaxResult del(String keys) { + List<Long> ids = StringUtils.strToCollToLong(keys, ","); + int i = sysVipLabelDao.deleteByIds(ids); if (i > 0) { return AjaxResult.buildSuccessInstance("删除成功"); + } else { + return AjaxResult.buildFailInstance("删除失败"); } - return AjaxResult.buildFailInstance("删除失败"); + } + + + + @RequestMapping(value = "/edit") + public String edit(Long id) { + if (id != null) { + SysVipLabel sysVipLabel = sysVipLabelDao.selectById(id); + WebUtil.getRequest().setAttribute("obj", sysVipLabel); + } + return "admin/hive/operate/label-form"; } } -- Gitblit v1.9.1