From c80fa36ef5e9cfc48a368939e61c9e89a6b5ecc8 Mon Sep 17 00:00:00 2001 From: 姜友瑶 <935090232@qq.com> Date: Mon, 13 Jun 2022 16:29:24 +0800 Subject: [PATCH] fix:排除删除会员方法 --- zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml | 7 -- zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java | 15 ---- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 11 --- zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java | 38 ++++++------ zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java | 52 +++++++++------- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxBindingPhoneNumber.java | 2 6 files changed, 52 insertions(+), 73 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java index 1bc056e..c3daa86 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java @@ -7,7 +7,6 @@ import com.matrix.core.pojo.PaginationVO; import com.matrix.core.tools.DateUtil; import com.matrix.core.tools.LogUtil; -import com.matrix.core.tools.StringUtils; import com.matrix.core.tools.WebUtil; import com.matrix.core.tools.excl.ExcelSheetPO; import com.matrix.core.tools.excl.ExcelUtil; @@ -243,8 +242,9 @@ QueryUtil.setQueryLimit(vipInfo); - - return showList(vipInfoService, vipInfo, pageVo); + List<SysVipInfo> dataList = vipInfoService.findInPage(vipInfo, pageVo); + AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, vipInfoService.findTotal(vipInfo)); + return result; } /** @@ -294,14 +294,25 @@ public @ResponseBody AjaxResult addOrModify(SysVipInfo vipInfo) { if (vipInfo.getId() != null) { - return modify(vipInfoService, vipInfo, "会员信息"); + int i = vipInfoService.modify(vipInfo); + if (i > 0) { + return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员信息修改成功"); + } else { + return new AjaxResult(AjaxResult.STATUS_FAIL, "会员信息修改失败"); + } } else { vipInfo.setVipState(Dictionary.VIP_STATE_HY); SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); if(vipInfo.getShopId()==null){ vipInfo.setShopId(users.getShopId()); } - return add(vipInfoService, vipInfo, "会员信息"); + int i = vipInfoService.add(vipInfo); + if (i > 0) { + return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员信息添加成功"); + } else { + return new AjaxResult(AjaxResult.STATUS_FAIL, "会员信息添加失败"); + } + } } @@ -328,21 +339,7 @@ } - /** - * 删除会员信息 - */ - @RequestMapping(value = "/del") - public @ResponseBody - AjaxResult del(String keys) { - List<Long> ids = StringUtils.strToCollToLong(keys, ","); - int i = vipInfoService.removeLogic(ids); - if (i > 0) { - return new AjaxResult(AjaxResult.STATUS_SUCCESS, "成功删除" + i + "条数据"); - } else { - return new AjaxResult(AjaxResult.STATUS_FAIL, "删除失败"); - } -// return remove(vipInfoService, keys); - } + /** * 弹出框,会员信息 @@ -479,7 +476,12 @@ @RequestMapping(value = "/modifyVip") public @ResponseBody AjaxResult modifyVip(SysVipInfo vipInfo) { - return modify(vipInfoService, vipInfo, "会员"); + int i = vipInfoService.modify(vipInfo); + if (i > 0) { + return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员修改成功"); + } else { + return new AjaxResult(AjaxResult.STATUS_FAIL, "会员修改失败"); + } } @@ -605,7 +607,9 @@ @RequestMapping(value = "/findAllVipInfo") @ResponseBody public AjaxResult findAllVipInfo() { - return showList(vipInfoService, null, null); + List<SysVipInfo> dataList = vipInfoService.findInPage(null, null); + AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, vipInfoService.findTotal(null)); + return result; } @RequestMapping(value = "/findAllVipInfoWithShop") @@ -613,7 +617,9 @@ public AjaxResult findAllVipInfoWithShop() { SysVipInfo info = new SysVipInfo(); info.setShopId(getMe().getShopId()); - return showList(vipInfoService, info, null); + List<SysVipInfo> dataList = vipInfoService.findInPage(info, null); + AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, vipInfoService.findTotal(info)); + return result; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java index 98eb791..ad713ca 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java @@ -8,7 +8,6 @@ import com.matrix.system.app.vo.VipInfoListVo; import com.matrix.system.hive.bean.MoneyCardUse; import com.matrix.system.hive.bean.SysVipInfo; -import com.matrix.system.hive.plugin.util.BaseServices; import com.matrix.system.hive.pojo.VipInfoVo; import java.io.File; @@ -20,7 +19,7 @@ * * @date 2016-07-03 20:53 */ -public interface SysVipInfoService extends BaseServices<SysVipInfo>{ +public interface SysVipInfoService { public MoneyCardUse addVipDefaultCard(Long vipId); /** @@ -35,12 +34,7 @@ */ public int modify(SysVipInfo sysVipInfo); - - /** - * 批量删除SysVipInfo - * - */ - public int remove(List<Long> list); + /** @@ -49,11 +43,6 @@ */ public int removeLogic(List<Long> list); - /** - * 根据id删除SysVipInfo - * - */ - public int removeById(Long id); /** * 分页查询SysVipInfo diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java index 45aa569..c92d1b7 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java @@ -174,12 +174,7 @@ return sysVipInfoDao.update(sysVipInfo); } - @Override - public int remove(List<Long> list) { - return sysVipInfoDao.deleteLogicByIds(list); - - } @Override public int removeLogic(List<Long> list) { @@ -188,12 +183,6 @@ } - @Override - public int removeById(Long id) { - - return sysVipInfoDao.deleteLogicByIds(Arrays.asList(id)); - - } @Override public List<SysVipInfo> findInPage(SysVipInfo sysVipInfo, PaginationVO pageVo) { diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java index b2b2653..b0d5330 100644 --- a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java +++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java @@ -141,7 +141,12 @@ } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { e.printStackTrace(); } - return modify(vipInfoService, vipInfo, "会员信息"); + int i = vipInfoService.modify(vipInfo); + if (i > 0) { + return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员信息修改成功"); + } else { + return new AjaxResult(AjaxResult.STATUS_FAIL, "会员信息修改失败"); + } } else { try { @@ -152,7 +157,12 @@ } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { e.printStackTrace(); } - return add(vipInfoService, vipInfo, "会员信息"); + int i = vipInfoService.add(vipInfo); + if (i > 0) { + return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员信息添加成功"); + } else { + return new AjaxResult(AjaxResult.STATUS_FAIL, "会员信息添加失败"); + } } } @@ -179,22 +189,6 @@ } - /** - * 删除会员信息 - */ - @RequestMapping(value = "/del") - public @ResponseBody - AjaxResult del(String keys) { - List<Long> ids = StringUtils.strToCollToLong(keys, ","); - int i = vipInfoService.removeLogic(ids); - if (i > 0) { - return new AjaxResult(AjaxResult.STATUS_SUCCESS, "成功删除" + i + "条数据"); - } else { - return new AjaxResult(AjaxResult.STATUS_FAIL, "删除失败"); - } - -// return remove(vipInfoService, keys); - } /** * 弹出框,会员信息 @@ -331,7 +325,13 @@ @RequestMapping(value = "/modifyVip") public @ResponseBody AjaxResult modifyVip(SysVipInfo vipInfo) { - return modify(vipInfoService, vipInfo, "会员"); + + int i = vipInfoService.modify(vipInfo); + if (i > 0) { + return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员修改成功"); + } else { + return new AjaxResult(AjaxResult.STATUS_FAIL, "会员修改失败"); + } } diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxBindingPhoneNumber.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxBindingPhoneNumber.java index f69b22f..08bcc6e 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxBindingPhoneNumber.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxBindingPhoneNumber.java @@ -1,5 +1,6 @@ package com.matrix.system.shopXcx.api.action; +import com.alibaba.fastjson.JSON; import com.matrix.component.tools.AES; import com.matrix.core.pojo.AjaxResult; import com.matrix.core.tools.LogUtil; @@ -106,6 +107,7 @@ oldeUser.setPhoto(loginUser.getAvatarUrl()); oldeUser.setAvatarUrl(loginUser.getAvatarUrl()); sysVipInfoDao.update(oldeUser); + LogUtil.info("绑定手机号码删除会员。。"+ JSON.toJSONString(loginUser)); sysVipInfoDao.deleteLogicByIds(Arrays.asList(loginUser.getId())); String token = userCacheManager.saveUserInfo(oldeUser); AjaxResult result = AjaxResult.buildSuccessInstance("绑定成功"); diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml index 7ab788a..e31f02b 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml @@ -576,13 +576,6 @@ </foreach> </update> - <!-- 根据id删除 --> - <delete id="deleteById"> - DELETE FROM sys_vip_info - where ID=#{id} - </delete> - - <!-- 分页查询 --> <select id="selectInPage" resultMap="SysVipInfoMapSimple"> -- Gitblit v1.9.1