| | |
| | | String COUPON_AUDIT_DOUBLE = "优惠券已被其他员工审核"; |
| | | |
| | | String COOPERATION_TIME_ERROR = "未在合作时间内"; |
| | | |
| | | String COUPON_NO_FIND = "未找到优惠券"; |
| | | |
| | | String COUPON_EXPIRED = "优惠券已过期"; |
| | | |
| | | String COUPON_USED = "优惠券已被核销"; |
| | | |
| | | String COUPON_TYPE_ERROR = "只能核销商品优惠券"; |
| | | } |
| | |
| | | package com.ruoyi.system.api.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | public class AppMemberCouponVo { |
| | | |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long memberCouponId; |
| | | private String memberCouponId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品id") |
New file |
| | |
| | | package com.ruoyi.system.api.domain.vo; |
| | | |
| | | import com.ruoyi.system.api.domain.poji.goods.Goods; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName MerVerifyCouponGetVo |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2023/6/26 17:22 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class MerVerifyCouponGetVo { |
| | | |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "商品列表") |
| | | private List<Goods> goodsList; |
| | | |
| | | } |
| | |
| | | * @param mgtBaseBathDto |
| | | * @return R<List<MgtSysSimpleUserVo>> |
| | | */ |
| | | @PostMapping("/listSimpleUserVo") |
| | | @PostMapping("/config/listSimpleUserVo") |
| | | public R<List<MgtSysSimpleUserVo>> listSimpleUserVo(@RequestBody MgtBaseBathDto mgtBaseBathDto); |
| | | } |
| | |
| | | * @param shopIdlist |
| | | * @return R<List<Long>> |
| | | */ |
| | | @PostMapping("/listUserIdByShopId") |
| | | @PostMapping("/member/listUserIdByShopId") |
| | | public R<List<Long>> listUserIdByShopId(@RequestBody List<Long> shopIdlist); |
| | | |
| | | /** |
| | |
| | | * @param shopIdlist |
| | | * @return R<MgtShopTotalMemberVo> |
| | | */ |
| | | @PostMapping("/getUserTotalByShopId") |
| | | @PostMapping("/member/getUserTotalByShopId") |
| | | public R<MgtShopTotalMemberVo> getUserTotalByShopId(@RequestBody List<Long> shopIdlist); |
| | | } |
| | |
| | | * @author jqs34 |
| | | * @date 2023/6/23 14:12 |
| | | */ |
| | | @PostMapping("/listShopIdByPlTotal") |
| | | @PostMapping("/shop/listShopIdByPlTotal") |
| | | public R<List<Long>> listShopIdByPlTotal(@RequestBody MgtBasePlatformDto mgtBasePlatformDto); |
| | | } |
| | |
| | | MgtShopTotalMemberVo shopTotalMemberVo = memberService.getUserTotalByShopId(shopIdlist); |
| | | return R.ok(shopTotalMemberVo); |
| | | } |
| | | |
| | | @PostMapping("/getVerifyCoupon") |
| | | public R getVerifyCoupon(@RequestBody String verifyCoupon) |
| | | { |
| | | memberCouponService.verifyCoupon(verifyCoupon); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | * @Date 2023/6/13 9:15 |
| | | * @Version 1.0 |
| | | */ |
| | | @Api(value = "平台端配置相关接口", tags = "平台端配置相关接口", description = "平台端配置相关接口") |
| | | @Api(value = "平台端优惠券相关接口", tags = "平台端优惠券相关接口", description = "平台端优惠券相关接口") |
| | | @RestController |
| | | @RequestMapping("/mgt/coupon") |
| | | public class MgtCouponController { |
| | |
| | | package com.ruoyi.member.domain.pojo.member; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | @TableId(value = "id") |
| | | private String id; |
| | | /** |
| | | * 删除标记 |
| | | */ |
| | |
| | | List<MemberCoupon> memberCouponList = new ArrayList<>(); |
| | | MemberCoupon memberCoupon; |
| | | Integer sendTotal = 0; |
| | | String memberCouponId; |
| | | for(Long userId : userIdList){ |
| | | memberCouponId = IdUtils.simpleUUID(); |
| | | memberCoupon = new MemberCoupon(); |
| | | memberCoupon.setId(memberCouponId); |
| | | memberCoupon.setDelFlag(0); |
| | | memberCoupon.setCouponId(coupon.getCouponId()); |
| | | memberCoupon.setUserId(userId); |
| | |
| | | package com.ruoyi.member.service.impl.member; |
| | | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.member.domain.pojo.member.MemberCoupon; |
| | | import com.ruoyi.member.mapper.member.MemberCouponMapper; |
| | | import com.ruoyi.member.service.member.MemberCouponService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.vo.AppMemberCouponVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | List<AppMemberCouponVo> appMemberCouponVoList = memberCouponMapper.listVoMemberCouponByUserId(userId); |
| | | return appMemberCouponVoList; |
| | | } |
| | | |
| | | /** |
| | | * @description 核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/6/26 17:02 |
| | | * @param verifyCoupon |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void verifyCoupon(String verifyCoupon){ |
| | | MemberCoupon memberCoupon = this.getById(verifyCoupon); |
| | | if(memberCoupon==null){ |
| | | throw new ServiceException(AppErrorConstant.COUPON_NO_FIND); |
| | | } |
| | | if(memberCoupon.getCouponStatus()==0){ |
| | | throw new ServiceException(AppErrorConstant.COUPON_EXPIRED); |
| | | }else if(memberCoupon.getCouponStatus()==2){ |
| | | throw new ServiceException(AppErrorConstant.COUPON_USED); |
| | | }else if(memberCoupon.getCouponStatus()!=0){ |
| | | throw new ServiceException(AppErrorConstant.COUPON_NO_FIND); |
| | | } |
| | | if(memberCoupon.getCouponType()!=4){ |
| | | throw new ServiceException(AppErrorConstant.COUPON_TYPE_ERROR); |
| | | } |
| | | //更新优惠券为已使用 |
| | | memberCoupon.setCouponStatus(2); |
| | | memberCoupon.setUseTime(new Date()); |
| | | this.saveOrUpdate(memberCoupon); |
| | | } |
| | | } |
| | |
| | | * @version 1.0 |
| | | */ |
| | | List<AppMemberCouponVo> listVoMemberCouponByUserId(Long userId); |
| | | |
| | | /** |
| | | * @description 核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/6/26 17:02 |
| | | * @param verifyCoupon |
| | | * @return void |
| | | */ |
| | | void verifyCoupon(String verifyCoupon); |
| | | } |
| | |
| | | private OrderService orderService; |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/verifyCode", method = RequestMethod.POST) |
| | | @ApiOperation(value = "核销code") |
| | | public R<MerVerifyCodeVo> verifyCode(@RequestBody MerVerifyCodeDto merVerifyCodeDto) { |
| | |
| | | private Integer buyNum; |
| | | |
| | | @ApiModelProperty(value = "用户优惠券id") |
| | | private Long memberCouponId; |
| | | private String memberCouponId; |
| | | |
| | | } |
| | |
| | | private Integer buyNum; |
| | | |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long memberCouponId; |
| | | private String memberCouponId; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | private BigDecimal goodsPrice; |
| | |
| | | String goodsId; |
| | | Integer buyNum; |
| | | BigDecimal buyNumBig; |
| | | Long memberCouponId; |
| | | String memberCouponId; |
| | | Goods goods; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | |
| | | BigDecimal buyNumBig; |
| | | Integer serviceNum; |
| | | Integer goodsNum = 0; |
| | | Long memberCouponId; |
| | | String memberCouponId; |
| | | Goods goods; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | |
| | | BigDecimal buyNumBig; |
| | | Integer serviceNum; |
| | | Integer goodsNum = 0; |
| | | Long memberCouponId; |
| | | String memberCouponId; |
| | | Goods goods; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | |
| | | Long shopId = merNewOrderDto.getShopId(); |
| | | Shop shop = remoteShopService.getShop(shopId).getData(); |
| | | List<AppMemberCouponVo> appMemberCouponVoList = remoteMemberService.listVoMemberCouponByUserId(userId).getData(); |
| | | Map<Long, AppMemberCouponVo> appMemberCouponVoMap = new HashMap<>(); |
| | | Map<String, AppMemberCouponVo> appMemberCouponVoMap = new HashMap<>(); |
| | | if (null != appMemberCouponVoList) { |
| | | appMemberCouponVoMap = appMemberCouponVoList.stream().collect(Collectors.toMap(AppMemberCouponVo::getMemberCouponId, Function.identity())); |
| | | } |
| | |
| | | MgtShopAuthGetVo shopAuthGetVo = shopService.getMgtShopAuth(mgtShopAuthGetDto.getAuthId()); |
| | | return R.ok(shopAuthGetVo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getMgtShopAuthCode", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商户进件信息") |
| | | public R<MgtShopAuthCodeVo> getMgtShopAuthCode(@RequestBody MgtShopAuthGetDto mgtShopAuthGetDto) { |
| | | MgtShopAuthCodeVo mgtShopAuthCodeVo = shopService.getMgtShopAuthCode(mgtShopAuthGetDto.getAuthId()); |
| | | return R.ok(mgtShopAuthCodeVo); |
| | | } |
| | | } |
| | |
| | | * 商户id |
| | | */ |
| | | @TableId("shop_id") |
| | | private Integer shopId; |
| | | private Long shopId; |
| | | /** |
| | | * 删除标记 |
| | | */ |
| | |
| | | * 总活动次数 |
| | | */ |
| | | @TableField("total_activity_count") |
| | | private String totalActivityCount; |
| | | private Integer totalActivityCount; |
| | | /** |
| | | * 总订单数 |
| | | */ |
| | | @TableField("total_order") |
| | | private String totalOrder; |
| | | private Integer totalOrder; |
| | | /** |
| | | * 总周期订单数 |
| | | */ |
New file |
| | |
| | | package com.ruoyi.shop.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName MgtShopAuthCodeVo |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2023/6/26 10:31 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class MgtShopAuthCodeVo { |
| | | |
| | | @ApiModelProperty(value = "签约链接") |
| | | private String signUrl; |
| | | |
| | | @ApiModelProperty(value = "法人验证链接") |
| | | private String legalValidationUrl; |
| | | } |
| | |
| | | import com.ruoyi.shop.domain.pojo.task.MemberTask; |
| | | import com.ruoyi.shop.domain.vo.MerMemberTaskPageVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<MerMemberTaskPageVo> pageMerMemberTask(Page page, @Param("param") MerMemberTaskPageDto merMemberTaskPageDto); |
| | | |
| | | |
| | | /** |
| | | * @description 获取进行中任务数 |
| | | * @author jqs |
| | | * @date 2023/6/26 13:45 |
| | | * @param shopId |
| | | * @return Integer |
| | | */ |
| | | Integer getMemberIngTotal(@Param("shopId")Long shopId); |
| | | } |
| | |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | | import com.ruoyi.shop.domain.dto.*; |
| | | import com.ruoyi.shop.domain.pojo.ShopTotal; |
| | | import com.ruoyi.shop.domain.pojo.shop.*; |
| | | import com.ruoyi.shop.domain.pojo.task.ShopFile; |
| | | import com.ruoyi.shop.domain.vo.*; |
| | | import com.ruoyi.shop.mapper.shop.ShopMapper; |
| | | import com.ruoyi.shop.service.shop.*; |
| | | import com.ruoyi.shop.service.task.MemberTaskService; |
| | | import com.ruoyi.shop.service.task.ShopFileService; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | |
| | | @Resource |
| | | private RemoteConfigService remoteConfigService; |
| | | |
| | | @Resource |
| | | private ShopTotalService shopTotalService; |
| | | |
| | | @Resource |
| | | private MemberTaskService memberTaskService; |
| | | |
| | | /** |
| | | * 获取商户详情 |
| | | * @param shopId |
| | |
| | | public void createShop(MgtEditShopDto mgtEditShopDto){ |
| | | Shop shop = new Shop(); |
| | | Boolean newShop = false; |
| | | BigDecimal zeroBig = BigDecimal.ZERO; |
| | | Shop shopSame = this.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag,0).eq(Shop::getShopName,mgtEditShopDto.getShopName())); |
| | | if(mgtEditShopDto.getShopId()!=null){ |
| | | if(shopSame!=null&&!Objects.equals(shopSame.getShopId(),mgtEditShopDto.getShopId())){ |
| | |
| | | shopProportion.setUpdateTime(new Date()); |
| | | shopProportion.setUpdateUserId(mgtEditShopDto.getUserId()); |
| | | shopProportionService.save(shopProportion); |
| | | //商户统计 |
| | | ShopTotal shopTotal = new ShopTotal(); |
| | | shopTotal.setShopId(shop.getShopId()); |
| | | shopTotal.setDelFlag(0); |
| | | shopTotal.setLastPayMoney(zeroBig); |
| | | shopTotal.setTotalActivityCount(0); |
| | | shopTotal.setTotalOrder(0); |
| | | shopTotal.setTotalCycleOrder(0); |
| | | shopTotal.setToltaExperienceOrder(0); |
| | | shopTotal.setTotalServiceOrder(0); |
| | | shopTotal.setTotalGoodsOrder(0); |
| | | shopTotal.setTotalServiceCount(0); |
| | | shopTotal.setUsedServiceCount(0); |
| | | shopTotal.setUseableServiceCount(0); |
| | | shopTotal.setTotalCycleService(0); |
| | | shopTotal.setUsedCycleService(0); |
| | | shopTotal.setUseableCycleService(0); |
| | | shopTotal.setTotalCyclePerson(0); |
| | | shopTotal.setUseableCyclePerson(0); |
| | | shopTotal.setTotalServiceService(0); |
| | | shopTotal.setUsedServiceService(0); |
| | | shopTotal.setUseableServiceService(0); |
| | | shopTotal.setTotalServicePerson(0); |
| | | shopTotal.setUseableServicePerson(0); |
| | | shopTotal.setTotalExperienceService(0); |
| | | shopTotal.setUsedExperienceService(0); |
| | | shopTotal.setUseableExperienceService(0); |
| | | shopTotal.setTotalExperiencePerson(0); |
| | | shopTotal.setUseableExperiencePerson(0); |
| | | shopTotal.setTotalOrderMoney(zeroBig); |
| | | shopTotal.setTotalCycleMoney(zeroBig); |
| | | shopTotal.setTotalExperienceMoney(zeroBig); |
| | | shopTotal.setTotalServiceMoney(zeroBig); |
| | | shopTotal.setTotalGoodsMoney(zeroBig); |
| | | shopTotalService.save(shopTotal); |
| | | } |
| | | } |
| | | |
| | |
| | | Shop shop = this.getById(shopId); |
| | | merHomeShopTotalVo.setShopType(shop.getShopType()); |
| | | MerHomeShopTotalVo orderVo = remoteOrderService.getMerHomeTotal(merHomeShopTotalVo).getData(); |
| | | |
| | | ShopTotal shopTotal = shopTotalService.getById(shopId); |
| | | merHomeShopTotalVo.setShopId(shopId); |
| | | merHomeShopTotalVo.setShopType(shop.getShopType()); |
| | | merHomeShopTotalVo.setTodayShop(orderVo.getTodayShop()); |
| | | merHomeShopTotalVo.setUnHandleOrder(orderVo.getUnHandleOrder()); |
| | | Integer taskCount = memberTaskService.getMemberIngTotal(shopId); |
| | | merHomeShopTotalVo.setTask(taskCount); |
| | | merHomeShopTotalVo.setShopTurnover(orderVo.getShopTurnover()); |
| | | merHomeShopTotalVo.setCycleSurp(shopTotal.getUseableCyclePerson()); |
| | | merHomeShopTotalVo.setExplorationSurp(shopTotal.getUseableExperiencePerson()); |
| | | return merHomeShopTotalVo; |
| | | } |
| | | |
| | |
| | | BeanUtils.copyProperties(shopAuthentication, shopAuthGetVo); |
| | | return shopAuthGetVo; |
| | | } |
| | | |
| | | /** |
| | | * @description 获取商户验证信息 |
| | | * @author jqs |
| | | * @date 2023/6/26 10:38 |
| | | * @param authId |
| | | * @return MgtShopAuthCodeVo |
| | | */ |
| | | @Override |
| | | public MgtShopAuthCodeVo getMgtShopAuthCode(String authId){ |
| | | MgtShopAuthCodeVo mgtShopAuthCodeVo = new MgtShopAuthCodeVo(); |
| | | ShopAuthentication shopAuthentication = shopAuthenticationService.getById(authId); |
| | | mgtShopAuthCodeVo.setSignUrl(shopAuthentication.getSignUrl()); |
| | | mgtShopAuthCodeVo.setLegalValidationUrl(shopAuthentication.getLegalValidationUrl()); |
| | | return mgtShopAuthCodeVo; |
| | | } |
| | | } |
| | |
| | | this.saveOrUpdate(memberTask); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取进行中任务数 |
| | | * @author jqs |
| | | * @date 2023/6/26 13:45 |
| | | * @param shopId |
| | | * @return Integer |
| | | */ |
| | | @Override |
| | | public Integer getMemberIngTotal(Long shopId) { |
| | | return memberTaskMapper.getMemberIngTotal(shopId); |
| | | } |
| | | |
| | | } |
| | |
| | | * @return MgtShopAuthGetVo |
| | | */ |
| | | MgtShopAuthGetVo getMgtShopAuth(String authId); |
| | | |
| | | /** |
| | | * @description 获取商户验证信息 |
| | | * @author jqs |
| | | * @date 2023/6/26 10:38 |
| | | * @param authId |
| | | * @return MgtShopAuthCodeVo |
| | | */ |
| | | MgtShopAuthCodeVo getMgtShopAuthCode(String authId); |
| | | } |
| | |
| | | */ |
| | | void followMemberTask(MerFollowMemberTaskDto merFollowMemberTaskDto); |
| | | |
| | | /** |
| | | * @description 获取进行中任务数 |
| | | * @author jqs |
| | | * @date 2023/6/26 13:45 |
| | | * @param shopId |
| | | * @return Integer |
| | | */ |
| | | Integer getMemberIngTotal(Long shopId); |
| | | } |
| | |
| | | WHERE tmt.del_flag = 0 AND tmt.shop_id = #{param.shopId} AND tmt.user_id = #{param.memberUserId} |
| | | ORDER BY todayFlag,task_date DESC |
| | | </select> |
| | | |
| | | |
| | | <select id="getMemberIngTotal" resultType="java.lang.Integer"> |
| | | SELECT COUNT(task_id) |
| | | FROM t_member_task |
| | | WHERE del_flag = 0 AND task_status = 1 AND shop_id = #{shopId} AND task_date = DATE(NOW()) |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import static com.ruoyi.common.core.web.domain.AjaxResult.success; |
| | | |
| | | /** |
| | | * @ClassName StaffMenuController |
| | | * @Description TODO |
| | |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectStaffMenuList(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | AjaxResult ajax = success(); |
| | | ajax.put("checkedKeys", menuService.selectStaffMenuListByDeptId(deptId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return ajax; |
| | |
| | | public AjaxResult deptUserStaffMenuTreeselect(@PathVariable("deptUserId") Long deptUserId) |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectStaffMenuList(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | List<SysMenu> menus = menuService.selectStaffDeptMenuList(deptUserId); |
| | | AjaxResult ajax = success(); |
| | | ajax.put("checkedKeys", menuService.selectStaffMenuListByDeptUserId(deptUserId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @GetMapping("/treedeptselect") |
| | | public AjaxResult treedeptselect(SysMenu menu) |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectStaffMenuList(menu, userId); |
| | | return success(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "加载对应部门菜单列表树") |
| | | @GetMapping(value = "/roleMenuTreeselect/{deptId}") |
| | | @GetMapping(value = "/deptMenuTreeselect/{deptId}") |
| | | public AjaxResult deptMenuTreeselect(@PathVariable("deptId") Long deptId) |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | |
| | | public AjaxResult deptUserMenuTreeselect(@PathVariable("deptUserId") Long deptUserId) |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuList(userId); |
| | | List<SysMenu> menus = menuService.selectDeptMenuList(deptUserId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByDeptUserId(deptUserId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.domain.dto.UserMenuEditDto; |
| | | import com.ruoyi.system.service.sys.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改用户权限") |
| | | @PostMapping("/editUserMenu") |
| | | public R editUserMenu(@RequestBody UserMenuEditDto userMenuEditDto){ |
| | | userService.editUserMenu(userMenuEditDto); |
| | |
| | | * 用户id |
| | | */ |
| | | @ApiModelProperty(value = "用户id 新增不传") |
| | | private Long userId; |
| | | private Long sysUserId; |
| | | /** |
| | | * 员工姓名 |
| | | */ |
| | |
| | | private Long[] staffMenuIds; |
| | | |
| | | |
| | | private String dataScope; |
| | | |
| | | } |
| | |
| | | */ |
| | | @ApiModelProperty(value = "负责人标记") |
| | | private String headFlag; |
| | | |
| | | @ApiModelProperty(value = "数据权限范围") |
| | | private Integer dataScope; |
| | | } |
| | |
| | | public List<SysMenu> selectMenuListByUserId(SysMenu menu); |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/6/26 15:16 |
| | | * @param deptId |
| | | * @return List<SysMenu> |
| | | */ |
| | | public List<SysMenu> selectDeptMenuList(@Param("deptId") Long deptId); |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/6/26 15:16 |
| | | * @param deptId |
| | | * @return List<SysMenu> |
| | | */ |
| | | public List<SysMenu> selectStaffDeptMenuList(@Param("deptId")Long deptId); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param menu 菜单信息 |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuListByStaffUserId(SysMenu menu); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param menu 菜单信息 |
| | |
| | | public List<String> selectMenuPermsByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询权限 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | public List<String> selectMenuPermsByStaffUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询菜单 |
| | | * |
| | | * @return 菜单列表 |
| | |
| | | */ |
| | | @Override |
| | | public List<MgtDeptStaffListVo>listMgtDeptStaffByPermission(Long userId){ |
| | | SysUser sysUser = sysUserService.getById(userId); |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | String dataScope = sysUser.getDataScope(); |
| | | List<MgtDeptStaffListVo> deptStaffListVoList; |
| | | if(dataScope.equals("4")){ |
| | |
| | | public void mgtStaffEdit(MgtStaffEditDto mgtStaffEditDto){ |
| | | SysStaff sysStaff; |
| | | SysUser sysUser; |
| | | if(mgtStaffEditDto.getUserId()!=null){ |
| | | sysStaff = this.getByUserId(mgtStaffEditDto.getUserId()); |
| | | sysUser = sysUserService.getById(mgtStaffEditDto.getUserId()); |
| | | if(mgtStaffEditDto.getSysUserId()!=null){ |
| | | sysStaff = this.getByUserId(mgtStaffEditDto.getSysUserId()); |
| | | sysUser = sysUserService.selectUserById(mgtStaffEditDto.getSysUserId()); |
| | | sysUser.setUserName(mgtStaffEditDto.getStaffMobile()); |
| | | sysUser.setPhonenumber(mgtStaffEditDto.getStaffMobile()); |
| | | sysUser.setNickName(mgtStaffEditDto.getStaffName()); |
| | | sysUser.setAvatar(mgtStaffEditDto.getStaffAvatar()); |
| | | sysUser.setEmail(mgtStaffEditDto.getStaffEmail()); |
| | | sysUserService.saveOrUpdate(sysUser); |
| | | sysUserService.updateOnlyUser(sysUser); |
| | | }else{ |
| | | sysStaff = new SysStaff(); |
| | | String staffId = IdUtils.simpleUUID(); |
| | |
| | | import com.ruoyi.system.mapper.sys.SysRoleMapper; |
| | | import com.ruoyi.system.mapper.sys.SysRoleMenuMapper; |
| | | import com.ruoyi.system.service.sys.ISysMenuService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.ruoyi.system.service.sys.ISysUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | { |
| | | public static final String PREMISSION_STRING = "perms[\"{0}\"]"; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysMenuMapper menuMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysRoleMenuMapper roleMenuMapper; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | |
| | | { |
| | | return selectMenuList(new SysMenu(), userId); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | @Override |
| | | public List<SysMenu> selectDeptMenuList(Long userId){ |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | Long deptId = sysUser.getDeptId(); |
| | | List<SysMenu> menuList = menuMapper.selectDeptMenuList(deptId); |
| | | return menuList; |
| | | } |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | |
| | | @Override |
| | | public List<SysMenu> selectStaffMenuList(Long userId){ |
| | | return selectStaffMenuList(new SysMenu(), userId); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | @Override |
| | | public List<SysMenu> selectStaffDeptMenuList(Long userId){ |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | Long deptId = sysUser.getDeptId(); |
| | | return menuMapper.selectStaffDeptMenuList(deptId); |
| | | } |
| | | /** |
| | | * 查询系统菜单列表 |
| | |
| | | else |
| | | { |
| | | menu.getParams().put("userId", userId); |
| | | menuList = menuMapper.selectMenuListByUserId(menu); |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | if(sysUser.getUserName().equals("admin")||sysUser.getUserName().equals("hongruitang")){ |
| | | menuList = menuMapper.selectMenuListByUserId(menu); |
| | | }else{ |
| | | menuList = menuMapper.selectMenuListByStaffUserId(menu); |
| | | } |
| | | |
| | | } |
| | | return menuList; |
| | | } |
| | |
| | | @Override |
| | | public Set<String> selectMenuPermsByUserId(Long userId) |
| | | { |
| | | List<String> perms = menuMapper.selectMenuPermsByUserId(userId); |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | List<String> perms = null; |
| | | if(sysUser.getUserName().equals("admin")||sysUser.getUserName().equals("hongruitang")){ |
| | | perms = menuMapper.selectMenuPermsByUserId(userId); |
| | | }else{ |
| | | perms = menuMapper.selectMenuPermsByStaffUserId(userId); |
| | | } |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (String perm : perms) |
| | | { |
| | |
| | | */ |
| | | @Override |
| | | public void editUserMenu(UserMenuEditDto userMenuEditDto){ |
| | | SysUser sysUser = this.selectUserById(userMenuEditDto.getUserId()); |
| | | sysUser.setDataScope(userMenuEditDto.getDataScope()); |
| | | userMapper.updateUser(sysUser); |
| | | userMenuMapper.deleteUserMenuByUserId(userMenuEditDto.getUserId()); |
| | | int rows = 1; |
| | | // 新增用户与角色管理 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/6/26 10:36 |
| | | * @param sysUser |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void updateOnlyUser(SysUser sysUser){ |
| | | userMapper.updateUser(sysUser); |
| | | } |
| | | } |
| | |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectDeptMenuList(Long deptId); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectStaffMenuList(Long userId); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectStaffDeptMenuList(Long userId); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param menu 菜单信息 |
| | | * @param userId 用户ID |
| | |
| | | * @return void |
| | | */ |
| | | void editUserMenu(UserMenuEditDto userMenuEditDto); |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/6/26 10:36 |
| | | * @param sysUser |
| | | * @return void |
| | | */ |
| | | void updateOnlyUser(SysUser sysUser); |
| | | } |
| | |
| | | tss.staff_email staffEmail, |
| | | tss.staff_post staffPost, |
| | | tss.staff_avatar staffAvatar, |
| | | tss.head_flag headFlag |
| | | tss.head_flag headFlag, |
| | | su.data_scope dataScope |
| | | FROM t_sys_staff tss |
| | | INNER JOIN sys_user su ON tss.user_id = su.user_id |
| | | WHERE su.del_flag = 0 |
| | | INNER JOIN sys_dept sd ON su.dept_id = sd.dept_id |
| | | WHERE su.del_flag = '0' AND tss.del_flag = 0 |
| | | <if test="param.deptId!=null and param.deptId!=''"> |
| | | AND su.dept_id = #{param.deptId} |
| | | AND (FIND_IN_SET(#{param.deptId},sd.ancestors) OR su.dept_id = #{param.deptId}) |
| | | </if> |
| | | <if test="param.staffName!=null and param.staffName!=''"> |
| | | AND tss.staff_name LIKE CONCAT('%',#{param.staffName},'%') |
| | |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="dataScope" column="data_scope" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectDeptVo"> |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time ,d.data_scope |
| | | from sys_dept d |
| | | </sql> |
| | | |
| | |
| | | <if test="email != null and email != ''">email,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="dataScope != null and dataScope != ''">data_scope,</if> |
| | | create_time |
| | | )values( |
| | | <if test="deptId != null and deptId != 0">#{deptId},</if> |
| | |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="email != null">email = #{email},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where dept_id = #{deptId} |
| | | </update> |
| | |
| | | </delete> |
| | | |
| | | <insert id="batchDeptMenu"> |
| | | insert into sys_dept_menu(dept_id, menu_id) values |
| | | insert into sys_dept_menu(dept_id, menu_id, menu_from) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#{item.deptId},#{item.menuId}) |
| | | (#{item.deptId},#{item.menuId},#{item.menuFrom}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | order by m.parent_id, m.order_num |
| | | </select> |
| | | |
| | | <select id="selectDeptMenuList" parameterType="Long" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time |
| | | from sys_menu m |
| | | inner join sys_dept_menu rm on m.menu_id = rm.menu_id |
| | | where rm.dept_id = #{deptId} AND m.menu_from = 1 AND rm.menu_from = 1 |
| | | order by m.parent_id, m.order_num |
| | | </select> |
| | | |
| | | <select id="selectStaffDeptMenuList" parameterType="Long" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time |
| | | from sys_menu m |
| | | inner join sys_dept_menu rm on m.menu_id = rm.menu_id |
| | | where rm.dept_id = #{deptId} AND m.menu_from = 2 AND rm.menu_from = 2 |
| | | order by m.parent_id, m.order_num |
| | | </select> |
| | | |
| | | <select id="selectMenuListByStaffUserId" parameterType="SysMenu" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time |
| | | from sys_menu m |
| | | left join sys_user_menu rm on m.menu_id = rm.menu_id |
| | | where rm.user_id = #{params.userId} AND m.menu_from = 1 AND rm.menu = 1 |
| | | <if test="menuName != null and menuName != ''"> |
| | | AND m.menu_name like concat('%', #{menuName}, '%') |
| | | </if> |
| | | <if test="visible != null and visible != ''"> |
| | | AND m.visible = #{visible} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND m.status = #{status} |
| | | </if> |
| | | order by m.parent_id, m.order_num |
| | | </select> |
| | | |
| | | <select id="selectStaffMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time |
| | | from sys_menu m |
| | |
| | | left join sys_role r on r.role_id = ur.role_id |
| | | where m.status = '0' and r.status = '0' and ur.user_id = #{userId} AND m.menu_from = 1 |
| | | </select> |
| | | |
| | | <select id="selectMenuPermsByStaffUserId" parameterType="Long" resultType="String"> |
| | | select distinct m.perms |
| | | from sys_menu m |
| | | INNER join sys_user_menu rm on m.menu_id = rm.menu_id |
| | | where m.status = '0' and r.status = '0' and rm.user_id = #{userId} AND m.menu_from = 1 AND rm.menu_from = 1 |
| | | </select> |
| | | |
| | | <select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String"> |
| | | select distinct m.perms |
| | |
| | | |
| | | <select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult"> |
| | | <include refid="selectMenuVo"/> |
| | | where menu_id = #{menuId} AND m.menu_from = 1 |
| | | where menu_id = #{menuId} AND menu_from = 1 |
| | | </select> |
| | | |
| | | <select id="hasChildByMenuId" resultType="Integer"> |
| | | select count(1) from sys_menu where parent_id = #{menuId} AND m.menu_from = 1 |
| | | select count(1) from sys_menu where parent_id = #{menuId} AND menu_from = 1 |
| | | </select> |
| | | |
| | | <select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult"> |
| | | <include refid="selectMenuVo"/> |
| | | where menu_name=#{menuName} and parent_id = #{parentId} limit 1 AND m.menu_from = 1 |
| | | where menu_name=#{menuName} AND menu_from = 1 and parent_id = #{parentId} limit 1 |
| | | </select> |
| | | |
| | | <update id="updateMenu" parameterType="SysMenu"> |
| | |
| | | |
| | | <insert id="insertOperlog" parameterType="SysOperLog"> |
| | | insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time, oper_content) |
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate()) |
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate(), #{operContent}) |
| | | </insert> |
| | | |
| | | <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult"> |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | create_time |
| | | <if test="dataScope != null and dataScope != ''">data_scope,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | | <if test="deptId != null and deptId != ''">#{deptId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | sysdate() |
| | | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | update_time = sysdate() |
| | | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where user_id = #{userId} |
| | | </update> |
| | |
| | | </delete> |
| | | |
| | | <insert id="batchUserMenu"> |
| | | insert into sys_user_menu(user_id, menu_id) values |
| | | insert into sys_user_menu(user_id, menu_id, menu_from) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#{item.userId},#{item.menuId}) |
| | | (#{item.userId},#{item.menuId},#{item.menuFrom}) |
| | | </foreach> |
| | | </insert> |
| | | |