店员管理/店员等级/账户管理
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package com.starry.admin.modules.clear.controller;
|
||||
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelAddVo;
|
||||
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelEditVo;
|
||||
import com.starry.admin.modules.clear.service.IPlayClerkLevelInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import com.starry.common.utils.ConvertUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 店员等级Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/clerk/level")
|
||||
public class PlayClerkLevelInfoController {
|
||||
@Resource
|
||||
private IPlayClerkLevelInfoService playClerkLevelInfoService;
|
||||
|
||||
/**
|
||||
* 查询店员等级列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list() {
|
||||
return R.ok(playClerkLevelInfoService.selectAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店员等级详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playClerkLevelInfoService.selectPlayClerkLevelInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增店员等级
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "店员等级", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayClerkLevelAddVo vo) {
|
||||
PlayClerkLevelInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkLevelInfoEntity.class);
|
||||
int level = playClerkLevelInfoService.selectMaxLevel();
|
||||
entity.setLevel(level + 1);
|
||||
boolean success = playClerkLevelInfoService.create(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员等级
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "店员等级", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update")
|
||||
public R update(@Validated @RequestBody PlayClerkLevelEditVo vo) {
|
||||
PlayClerkLevelInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkLevelInfoEntity.class);
|
||||
boolean success = playClerkLevelInfoService.update(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店员等级
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "店员等级", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("delMaxLevel")
|
||||
public R remove() {
|
||||
int level = playClerkLevelInfoService.selectMaxLevel();
|
||||
playClerkLevelInfoService.delMaxLevelByLevel(level);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.starry.admin.modules.clear.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clear.module.vo.PlayClerkUserAddVo;
|
||||
import com.starry.admin.modules.clear.module.vo.PlayClerkUserEditVo;
|
||||
import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import com.starry.common.utils.ConvertUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 店员Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/clerk/user")
|
||||
public class PlayClerkUserInfoController {
|
||||
@Resource
|
||||
private IPlayClerkUserInfoService playClerkUserInfoService;
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayClerkUserInfoEntity playClerkUserInfo) {
|
||||
IPage<PlayClerkUserInfoEntity> list = playClerkUserInfoService.selectPlayClerkUserInfoByPage(playClerkUserInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店员详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playClerkUserInfoService.selectPlayClerkUserInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增店员
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "店员", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@Validated @RequestBody PlayClerkUserAddVo vo) {
|
||||
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||
boolean success = playClerkUserInfoService.create(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "店员", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update")
|
||||
public R update(@Validated @RequestBody PlayClerkUserEditVo vo) {
|
||||
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||
boolean success = playClerkUserInfoService.update(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店员
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "店员", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playClerkUserInfoService.deletePlayClerkUserInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.starry.admin.modules.clear.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||
|
||||
/**
|
||||
* 店员等级Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
public interface PlayClerkLevelInfoMapper extends BaseMapper<PlayClerkLevelInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.starry.admin.modules.clear.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 店员Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
public interface PlayClerkUserInfoMapper extends BaseMapper<PlayClerkUserInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.starry.admin.modules.clear.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 店员等级对象 play_clerk_level_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_clerk_level_info")
|
||||
public class PlayClerkLevelInfoEntity extends BaseEntity<PlayClerkLevelInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 等级数字(排序字段)
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 首次固定单比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRegularRatio;
|
||||
|
||||
/**
|
||||
* 非首次固定单比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRegularRatio;
|
||||
|
||||
/**
|
||||
* 首次打赏比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRewardRatio;
|
||||
|
||||
/**
|
||||
* 非首次打赏比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRewardRatio;
|
||||
|
||||
/**
|
||||
* 首次随机单比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRandomRadio;
|
||||
|
||||
/**
|
||||
* 非首次随机单比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRandomRadio;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.starry.admin.modules.clear.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 play_clerk_user_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_clerk_user_info")
|
||||
public class PlayClerkUserInfoEntity extends BaseEntity<PlayClerkUserInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 陪玩用户ID
|
||||
*/
|
||||
private String playUserId;
|
||||
|
||||
/**
|
||||
* 用户的标识,对当前公众号唯一
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 店员昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 店员等级
|
||||
*/
|
||||
private String levelId;
|
||||
|
||||
/**
|
||||
* 店员性别(1:男:0:女)
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 头像框
|
||||
*/
|
||||
private String avatarFrameId;
|
||||
|
||||
/**
|
||||
* 音频
|
||||
*/
|
||||
private String audioFrequency;
|
||||
|
||||
/**
|
||||
* 星座
|
||||
*/
|
||||
private String constellation;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 个性签名
|
||||
*/
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Long age;
|
||||
|
||||
/**
|
||||
* 所在国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 所在省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 账户余额(单位分)
|
||||
*/
|
||||
private String accountBalance;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 在职状态(1:在职,1:离职)
|
||||
*/
|
||||
private String onboardingState;
|
||||
|
||||
/**
|
||||
* 是否推荐状态(1:已推荐,0:未推荐)
|
||||
*/
|
||||
private String recommendationState;
|
||||
|
||||
/**
|
||||
* 是否置顶状态(1:已置顶,0:未置顶)
|
||||
*/
|
||||
private String pinToTopState;
|
||||
|
||||
/**
|
||||
* 在线状态【1:在线,0:离线】
|
||||
*/
|
||||
private String onlineState;
|
||||
|
||||
/**
|
||||
* 上架状态【1:上架,0:下架】
|
||||
*/
|
||||
private String listingState;
|
||||
|
||||
/**
|
||||
* 显示状态【1:显示,0:隐藏】
|
||||
*/
|
||||
private String displayState;
|
||||
|
||||
/**
|
||||
* 实名状态【1:已实名,0:未实名】
|
||||
*/
|
||||
private String realState;
|
||||
|
||||
/**
|
||||
* 是否必须实名【1:必须实名,0:非必须实名】
|
||||
*/
|
||||
private String mandatoryRealState;
|
||||
|
||||
/**
|
||||
* 随机接单状态【1:允许,0:禁止】
|
||||
*/
|
||||
private String randomOrder;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.starry.admin.modules.clear.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class PlayClerkLevelAddVo {
|
||||
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
@NotBlank(message = "等级名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 首次固定单比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRegularRatio;
|
||||
|
||||
/**
|
||||
* 非首次固定单比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRegularRatio;
|
||||
|
||||
/**
|
||||
* 首次打赏比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRewardRatio;
|
||||
|
||||
/**
|
||||
* 非首次打赏比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRewardRatio;
|
||||
|
||||
/**
|
||||
* 首次随机单比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRandomRadio;
|
||||
|
||||
/**
|
||||
* 非首次随机单比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRandomRadio;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.starry.admin.modules.clear.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class PlayClerkLevelEditVo {
|
||||
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
@NotBlank(message = "等级名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 首次固定单比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRegularRatio;
|
||||
|
||||
/**
|
||||
* 非首次固定单比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRegularRatio;
|
||||
|
||||
/**
|
||||
* 首次打赏比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRewardRatio;
|
||||
|
||||
/**
|
||||
* 非首次打赏比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRewardRatio;
|
||||
|
||||
/**
|
||||
* 首次随机单比例[0 - 100%]
|
||||
*/
|
||||
private Integer firstRandomRadio;
|
||||
|
||||
/**
|
||||
* 非首次随机单比例[0 - 100%]
|
||||
*/
|
||||
private Integer notFirstRandomRadio;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.starry.admin.modules.clear.module.vo;
|
||||
|
||||
import com.starry.common.annotation.EnumValue;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
@Data
|
||||
public class PlayClerkUserAddVo {
|
||||
|
||||
/**
|
||||
* 账号ID
|
||||
*/
|
||||
@NotBlank(message = "账号不能为空")
|
||||
private String playUserId;
|
||||
|
||||
/**
|
||||
* 用户的标识,对当前公众号唯一
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 店员昵称
|
||||
*/
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 店员等级
|
||||
*/
|
||||
@NotBlank(message = "等级不能为空")
|
||||
private String levelId;
|
||||
|
||||
/**
|
||||
* 店员性别(1:男:0:女)
|
||||
*/
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@NotBlank(message = "头像不能为空")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 音频
|
||||
*/
|
||||
@NotBlank(message = "音频不能为空")
|
||||
private String audioFrequency;
|
||||
|
||||
/**
|
||||
* 星座
|
||||
*/
|
||||
@NotBlank(message = "星座不能为空")
|
||||
private String constellation;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 个性签名
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@NotNull(message = "年龄不能为空")
|
||||
private Long age;
|
||||
|
||||
/**
|
||||
* 所在国家
|
||||
*/
|
||||
@NotBlank(message = "国家不能为空")
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 所在省份
|
||||
*/
|
||||
@NotBlank(message = "省份不能为空")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
@NotBlank(message = "城市不能为空")
|
||||
private String city;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.starry.admin.modules.clear.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
@Data
|
||||
public class PlayClerkUserEditVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotBlank(message = "id不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 账号ID
|
||||
*/
|
||||
@NotBlank(message = "账号不能为空")
|
||||
private String playUserId;
|
||||
|
||||
/**
|
||||
* 用户的标识,对当前公众号唯一
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 店员昵称
|
||||
*/
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 店员等级
|
||||
*/
|
||||
@NotBlank(message = "等级不能为空")
|
||||
private String levelId;
|
||||
|
||||
/**
|
||||
* 店员性别(1:男:0:女)
|
||||
*/
|
||||
@NotNull(message = "性别不能为空")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@NotBlank(message = "头像不能为空")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 音频
|
||||
*/
|
||||
@NotBlank(message = "音频不能为空")
|
||||
private String audioFrequency;
|
||||
|
||||
/**
|
||||
* 星座
|
||||
*/
|
||||
@NotBlank(message = "星座不能为空")
|
||||
private String constellation;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 个性签名
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@NotNull(message = "年龄不能为空")
|
||||
private Long age;
|
||||
|
||||
/**
|
||||
* 所在国家
|
||||
*/
|
||||
@NotBlank(message = "国家不能为空")
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 所在省份
|
||||
*/
|
||||
@NotBlank(message = "省份不能为空")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
@NotBlank(message = "城市不能为空")
|
||||
private String city;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.starry.admin.modules.clear.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店员等级Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
public interface IPlayClerkLevelInfoService extends IService<PlayClerkLevelInfoEntity> {
|
||||
/**
|
||||
* 查询店员等级
|
||||
*
|
||||
* @param id 店员等级主键
|
||||
* @return 店员等级
|
||||
*/
|
||||
PlayClerkLevelInfoEntity selectPlayClerkLevelInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询店员等级列表
|
||||
*
|
||||
* @return 店员等级集合
|
||||
*/
|
||||
List<PlayClerkLevelInfoEntity> selectAll();
|
||||
|
||||
/**
|
||||
* 分页查询店员等级列表
|
||||
*
|
||||
* @param playClerkLevelInfo 店员等级
|
||||
* @return 店员等级集合
|
||||
*/
|
||||
IPage<PlayClerkLevelInfoEntity> selectPlayClerkLevelInfoByPage(PlayClerkLevelInfoEntity playClerkLevelInfo);
|
||||
|
||||
/**
|
||||
* 新增店员等级
|
||||
*
|
||||
* @param playClerkLevelInfo 店员等级
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayClerkLevelInfoEntity playClerkLevelInfo);
|
||||
|
||||
/**
|
||||
* 修改店员等级
|
||||
*
|
||||
* @param playClerkLevelInfo 店员等级
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayClerkLevelInfoEntity playClerkLevelInfo);
|
||||
|
||||
/**
|
||||
* 批量删除店员等级
|
||||
*
|
||||
* @param ids 需要删除的店员等级主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClerkLevelInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除店员等级信息
|
||||
*
|
||||
* @param id 店员等级主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClerkLevelInfoById(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 查询最大等级
|
||||
*
|
||||
* @return 最大等级
|
||||
*/
|
||||
int selectMaxLevel();
|
||||
|
||||
|
||||
/**
|
||||
* 删除最大等级
|
||||
*
|
||||
*/
|
||||
void delMaxLevelByLevel(Integer level);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.starry.admin.modules.clear.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 店员Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEntity> {
|
||||
/**
|
||||
* 查询店员
|
||||
* @param id 店员主键
|
||||
* @return 店员
|
||||
*/
|
||||
PlayClerkUserInfoEntity selectPlayClerkUserInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
* @param playClerkUserInfo 店员
|
||||
* @return 店员集合
|
||||
*/
|
||||
IPage<PlayClerkUserInfoEntity> selectPlayClerkUserInfoByPage(PlayClerkUserInfoEntity playClerkUserInfo);
|
||||
|
||||
/**
|
||||
* 新增店员
|
||||
* @param playClerkUserInfo 店员
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayClerkUserInfoEntity playClerkUserInfo);
|
||||
|
||||
/**
|
||||
* 修改店员
|
||||
* @param playClerkUserInfo 店员
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayClerkUserInfoEntity playClerkUserInfo);
|
||||
|
||||
/**
|
||||
* 批量删除店员
|
||||
*
|
||||
* @param ids 需要删除的店员主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClerkUserInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除店员信息
|
||||
*
|
||||
* @param id 店员主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClerkUserInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.starry.admin.modules.clear.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.modules.clear.mapper.PlayClerkLevelInfoMapper;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||
import com.starry.admin.modules.clear.service.IPlayClerkLevelInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店员等级Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Service
|
||||
public class PlayClerkLevelInfoServiceImpl extends ServiceImpl<PlayClerkLevelInfoMapper, PlayClerkLevelInfoEntity> implements IPlayClerkLevelInfoService {
|
||||
@Resource
|
||||
private PlayClerkLevelInfoMapper playClerkLevelInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询店员等级
|
||||
*
|
||||
* @param id 店员等级主键
|
||||
* @return 店员等级
|
||||
*/
|
||||
@Override
|
||||
public PlayClerkLevelInfoEntity selectPlayClerkLevelInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlayClerkLevelInfoEntity> selectAll() {
|
||||
LambdaQueryWrapper<PlayClerkLevelInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.orderByAsc(PlayClerkLevelInfoEntity::getLevel);
|
||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店员等级列表
|
||||
*
|
||||
* @param playClerkLevelInfo 店员等级
|
||||
* @return 店员等级
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayClerkLevelInfoEntity> selectPlayClerkLevelInfoByPage(PlayClerkLevelInfoEntity playClerkLevelInfo) {
|
||||
Page<PlayClerkLevelInfoEntity> page = new Page<>(1, 9999);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增店员等级
|
||||
*
|
||||
* @param playClerkLevelInfo 店员等级
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayClerkLevelInfoEntity playClerkLevelInfo) {
|
||||
if (StrUtil.isBlankIfStr(playClerkLevelInfo.getId())) {
|
||||
playClerkLevelInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playClerkLevelInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员等级
|
||||
*
|
||||
* @param playClerkLevelInfo 店员等级
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayClerkLevelInfoEntity playClerkLevelInfo) {
|
||||
return updateById(playClerkLevelInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除店员等级
|
||||
*
|
||||
* @param ids 需要删除的店员等级主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClerkLevelInfoByIds(String[] ids) {
|
||||
return playClerkLevelInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店员等级信息
|
||||
*
|
||||
* @param id 店员等级主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClerkLevelInfoById(String id) {
|
||||
return playClerkLevelInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int selectMaxLevel() {
|
||||
QueryWrapper<PlayClerkLevelInfoEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("max(level) as level ");
|
||||
PlayClerkLevelInfoEntity entity = this.baseMapper.selectOne(queryWrapper);
|
||||
return entity == null ? 0 : entity.getLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delMaxLevelByLevel(Integer level) {
|
||||
LambdaQueryWrapper<PlayClerkLevelInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PlayClerkLevelInfoEntity::getLevel, level);
|
||||
playClerkLevelInfoMapper.delete(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.starry.admin.modules.clear.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.modules.clear.mapper.PlayClerkUserInfoMapper;
|
||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
* 店员Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Service
|
||||
public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoMapper, PlayClerkUserInfoEntity> implements IPlayClerkUserInfoService {
|
||||
@Resource
|
||||
private PlayClerkUserInfoMapper playClerkUserInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询店员
|
||||
* @param id 店员主键
|
||||
* @return 店员
|
||||
*/
|
||||
@Override
|
||||
public PlayClerkUserInfoEntity selectPlayClerkUserInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
* @param playClerkUserInfo 店员
|
||||
* @return 店员
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayClerkUserInfoEntity> selectPlayClerkUserInfoByPage(PlayClerkUserInfoEntity playClerkUserInfo) {
|
||||
Page<PlayClerkUserInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayClerkUserInfoEntity>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增店员
|
||||
* @param playClerkUserInfo 店员
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayClerkUserInfoEntity playClerkUserInfo) {
|
||||
if (StrUtil.isBlankIfStr(playClerkUserInfo.getId())){
|
||||
playClerkUserInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playClerkUserInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员
|
||||
* @param playClerkUserInfo 店员
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayClerkUserInfoEntity playClerkUserInfo) {
|
||||
return updateById(playClerkUserInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除店员
|
||||
* @param ids 需要删除的店员主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClerkUserInfoByIds(String[] ids) {
|
||||
return playClerkUserInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店员信息
|
||||
* @param id 店员主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClerkUserInfoById(String id) {
|
||||
return playClerkUserInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.starry.admin.modules.commodity.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayServiceInfoEntity;
|
||||
import com.starry.admin.modules.commodity.service.IPlayServiceInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 服务项目列表Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/commodity/info")
|
||||
public class PlayServiceInfoController {
|
||||
@Resource
|
||||
private IPlayServiceInfoService playServiceInfoService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询服务项目列表列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayServiceInfoEntity playServiceInfo) {
|
||||
IPage<PlayServiceInfoEntity> list = playServiceInfoService.selectPlayServiceInfoByPage(playServiceInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务项目列表详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playServiceInfoService.selectPlayServiceInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增服务项目列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "服务项目列表", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayServiceInfoEntity playServiceInfo) {
|
||||
boolean success = playServiceInfoService.create(playServiceInfo);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务项目列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "服务项目列表", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update/{id}")
|
||||
public R update(@PathVariable String id, @RequestBody PlayServiceInfoEntity playServiceInfo) {
|
||||
playServiceInfo.setId(id);
|
||||
boolean success = playServiceInfoService.update(playServiceInfo);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除服务项目列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "服务项目列表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playServiceInfoService.deletePlayServiceInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.starry.admin.modules.commodity.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayClearServiceEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 陪玩引用服务项目Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
public interface PlayClearServiceMapper extends BaseMapper<PlayClearServiceEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.starry.admin.modules.commodity.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayServiceInfoEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 服务项目列表Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
public interface PlayServiceInfoMapper extends BaseMapper<PlayServiceInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.starry.admin.modules.commodity.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 陪玩引用服务项目对象 play_clear_service
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_clear_service")
|
||||
public class PlayClearServiceEntity extends BaseEntity<PlayClearServiceEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 店员用户ID
|
||||
*/
|
||||
private String playUserId;
|
||||
|
||||
/**
|
||||
* 服务项目ID
|
||||
*/
|
||||
private String serviceId;
|
||||
|
||||
|
||||
/**
|
||||
* 项目启用状态
|
||||
* 1:启用
|
||||
* 0:停用
|
||||
*
|
||||
* @since 2024/3/28 11:20
|
||||
**/
|
||||
private String enablingState;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.starry.admin.modules.commodity.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 服务项目信息对象 play_service_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_service_info")
|
||||
public class PlayServiceInfoEntity extends BaseEntity<PlayServiceInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 服务时长(文字描述信息,不参与订单计算)
|
||||
*/
|
||||
private String serviceDuration;
|
||||
|
||||
/**
|
||||
* 服务单价
|
||||
*/
|
||||
private String price;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.starry.admin.modules.commodity.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayClearServiceEntity;
|
||||
|
||||
/**
|
||||
* 陪玩引用服务项目Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
public interface IPlayClearServiceService extends IService<PlayClearServiceEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 初始化陪玩的服务项目
|
||||
*
|
||||
* @param playUserId 陪玩用户ID
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/3/28 11:13
|
||||
**/
|
||||
void initPlayService(String playUserId);
|
||||
|
||||
/**
|
||||
* 查询陪玩引用服务项目
|
||||
*
|
||||
* @param id 陪玩引用服务项目主键
|
||||
* @return 陪玩引用服务项目
|
||||
*/
|
||||
PlayClearServiceEntity selectPlayClearServiceById(String id);
|
||||
|
||||
/**
|
||||
* 查询陪玩引用服务项目列表
|
||||
*
|
||||
* @param playClearService 陪玩引用服务项目
|
||||
* @return 陪玩引用服务项目集合
|
||||
*/
|
||||
IPage<PlayClearServiceEntity> selectPlayClearServiceByPage(PlayClearServiceEntity playClearService);
|
||||
|
||||
/**
|
||||
* 新增陪玩引用服务项目
|
||||
*
|
||||
* @param playClearService 陪玩引用服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayClearServiceEntity playClearService);
|
||||
|
||||
|
||||
/**
|
||||
* 修改陪玩服务启停状态
|
||||
*
|
||||
* @param playUserId 陪玩用户ID
|
||||
* @param serviceId 服务ID
|
||||
* @param enablingState * 项目启用状态【0:停用,1:启用】
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/3/28 11:35
|
||||
**/
|
||||
void updateServiceEnablingState(String playUserId, String serviceId, String enablingState);
|
||||
|
||||
/**
|
||||
* 修改陪玩引用服务项目
|
||||
*
|
||||
* @param playClearService 陪玩引用服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayClearServiceEntity playClearService);
|
||||
|
||||
/**
|
||||
* 批量删除陪玩引用服务项目
|
||||
*
|
||||
* @param ids 需要删除的陪玩引用服务项目主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClearServiceByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除陪玩引用服务项目信息
|
||||
*
|
||||
* @param id 陪玩引用服务项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClearServiceById(String id);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.starry.admin.modules.commodity.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayServiceInfoEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 服务项目列表Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
public interface IPlayServiceInfoService extends IService<PlayServiceInfoEntity> {
|
||||
|
||||
/**
|
||||
* 查询服务项目列表
|
||||
*
|
||||
* @param id 服务项目列表主键
|
||||
* @return 服务项目列表
|
||||
*/
|
||||
PlayServiceInfoEntity selectPlayServiceInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询所有的服务项目
|
||||
*
|
||||
* @return List<PlayServiceInfoEntity>
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/3/28 11:18
|
||||
**/
|
||||
List<PlayServiceInfoEntity> selectPlayServiceInfoAll();
|
||||
|
||||
/**
|
||||
* 查询服务项目列表列表
|
||||
*
|
||||
* @param playServiceInfo 服务项目列表
|
||||
* @return 服务项目列表集合
|
||||
*/
|
||||
IPage<PlayServiceInfoEntity> selectPlayServiceInfoByPage(PlayServiceInfoEntity playServiceInfo);
|
||||
|
||||
/**
|
||||
* 新增服务项目列表
|
||||
*
|
||||
* @param playServiceInfo 服务项目列表
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayServiceInfoEntity playServiceInfo);
|
||||
|
||||
/**
|
||||
* 修改服务项目列表
|
||||
*
|
||||
* @param playServiceInfo 服务项目列表
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayServiceInfoEntity playServiceInfo);
|
||||
|
||||
/**
|
||||
* 批量删除服务项目列表
|
||||
*
|
||||
* @param ids 需要删除的服务项目列表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayServiceInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除服务项目列表信息
|
||||
*
|
||||
* @param id 服务项目列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayServiceInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.starry.admin.modules.commodity.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.commodity.mapper.PlayClearServiceMapper;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayClearServiceEntity;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayServiceInfoEntity;
|
||||
import com.starry.admin.modules.commodity.service.IPlayClearServiceService;
|
||||
import com.starry.admin.modules.commodity.service.IPlayServiceInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 陪玩引用服务项目Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
@Service
|
||||
public class PlayClearServiceServiceImpl extends ServiceImpl<PlayClearServiceMapper, PlayClearServiceEntity> implements IPlayClearServiceService {
|
||||
@Resource
|
||||
private PlayClearServiceMapper playClearServiceMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private IPlayServiceInfoService playServiceInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public void initPlayService(String playUserId) {
|
||||
for (PlayServiceInfoEntity playServiceInfoEntity : playServiceInfoService.selectPlayServiceInfoAll()) {
|
||||
PlayClearServiceEntity entity = new PlayClearServiceEntity();
|
||||
entity.setServiceId(playServiceInfoEntity.getId());
|
||||
entity.setTenantId(playServiceInfoEntity.getTenantId());
|
||||
entity.setPlayUserId(playUserId);
|
||||
entity.setEnablingState("0");
|
||||
this.create(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询陪玩引用服务项目
|
||||
*
|
||||
* @param id 陪玩引用服务项目主键
|
||||
* @return 陪玩引用服务项目
|
||||
*/
|
||||
@Override
|
||||
public PlayClearServiceEntity selectPlayClearServiceById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询陪玩引用服务项目列表
|
||||
*
|
||||
* @param playClearService 陪玩引用服务项目
|
||||
* @return 陪玩引用服务项目
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayClearServiceEntity> selectPlayClearServiceByPage(PlayClearServiceEntity playClearService) {
|
||||
Page<PlayClearServiceEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayClearServiceEntity>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增陪玩引用服务项目
|
||||
*
|
||||
* @param playClearService 陪玩引用服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayClearServiceEntity playClearService) {
|
||||
if (StrUtil.isBlankIfStr(playClearService.getId())) {
|
||||
playClearService.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playClearService);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateServiceEnablingState(String playUserId, String serviceId, String enablingState) {
|
||||
LambdaQueryWrapper<PlayClearServiceEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PlayClearServiceEntity::getServiceId, serviceId);
|
||||
lambdaQueryWrapper.eq(PlayClearServiceEntity::getPlayUserId, playUserId);
|
||||
List<PlayClearServiceEntity> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if (list.size() != 1) {
|
||||
throw new CustomException("服务不存在,请查证");
|
||||
}
|
||||
// 更新服务状态
|
||||
PlayClearServiceEntity item = list.get(0);
|
||||
item.setEnablingState(enablingState);
|
||||
this.update(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改陪玩引用服务项目
|
||||
*
|
||||
* @param playClearService 陪玩引用服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayClearServiceEntity playClearService) {
|
||||
return updateById(playClearService);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除陪玩引用服务项目
|
||||
*
|
||||
* @param ids 需要删除的陪玩引用服务项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClearServiceByIds(String[] ids) {
|
||||
return playClearServiceMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除陪玩引用服务项目信息
|
||||
*
|
||||
* @param id 陪玩引用服务项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClearServiceById(String id) {
|
||||
return playClearServiceMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.starry.admin.modules.commodity.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.modules.commodity.mapper.PlayServiceInfoMapper;
|
||||
import com.starry.admin.modules.commodity.module.entity.PlayServiceInfoEntity;
|
||||
import com.starry.admin.modules.commodity.service.IPlayServiceInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务项目列表Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-28
|
||||
*/
|
||||
@Service
|
||||
public class PlayServiceInfoServiceImpl extends ServiceImpl<PlayServiceInfoMapper, PlayServiceInfoEntity> implements IPlayServiceInfoService {
|
||||
@Resource
|
||||
private PlayServiceInfoMapper playServiceInfoMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询服务项目列表
|
||||
*
|
||||
* @param id 服务项目列表主键
|
||||
* @return 服务项目列表
|
||||
*/
|
||||
@Override
|
||||
public PlayServiceInfoEntity selectPlayServiceInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlayServiceInfoEntity> selectPlayServiceInfoAll() {
|
||||
return this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务项目列表列表
|
||||
*
|
||||
* @param playServiceInfo 服务项目列表
|
||||
* @return 服务项目列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayServiceInfoEntity> selectPlayServiceInfoByPage(PlayServiceInfoEntity playServiceInfo) {
|
||||
Page<PlayServiceInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayServiceInfoEntity>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增服务项目列表
|
||||
*
|
||||
* @param playServiceInfo 服务项目列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayServiceInfoEntity playServiceInfo) {
|
||||
if (StrUtil.isBlankIfStr(playServiceInfo.getId())) {
|
||||
playServiceInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playServiceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务项目列表
|
||||
*
|
||||
* @param playServiceInfo 服务项目列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayServiceInfoEntity playServiceInfo) {
|
||||
return updateById(playServiceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除服务项目列表
|
||||
*
|
||||
* @param ids 需要删除的服务项目列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayServiceInfoByIds(String[] ids) {
|
||||
return playServiceInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除服务项目列表信息
|
||||
*
|
||||
* @param id 服务项目列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayServiceInfoById(String id) {
|
||||
return playServiceInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,12 @@ import java.util.List;
|
||||
* 商品Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-22
|
||||
* @since 2024-03-22
|
||||
*/
|
||||
public interface CouponInfoMapper extends BaseMapper<CouponInfoEntity> {
|
||||
/**
|
||||
* 查询商品
|
||||
*
|
||||
* @param id 商品主键
|
||||
* @return 商品
|
||||
*/
|
||||
@@ -21,6 +22,7 @@ public interface CouponInfoMapper extends BaseMapper<CouponInfoEntity> {
|
||||
|
||||
/**
|
||||
* 查询商品列表
|
||||
*
|
||||
* @param couponInfo 商品
|
||||
* @return 商品集合
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Arrays;
|
||||
* 商品Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-22
|
||||
* @since 2024-03-22
|
||||
*/
|
||||
@Service
|
||||
public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponInfoEntity> implements ICouponInfoService {
|
||||
@@ -25,6 +25,7 @@ public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponI
|
||||
|
||||
/**
|
||||
* 查询商品
|
||||
*
|
||||
* @param id 商品主键
|
||||
* @return 商品
|
||||
*/
|
||||
@@ -35,6 +36,7 @@ public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponI
|
||||
|
||||
/**
|
||||
* 查询商品列表
|
||||
*
|
||||
* @param couponInfo 商品
|
||||
* @return 商品
|
||||
*/
|
||||
@@ -46,16 +48,18 @@ public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponI
|
||||
|
||||
/**
|
||||
* 新增商品
|
||||
*
|
||||
* @param couponInfo 商品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(CouponInfoEntity couponInfo) {
|
||||
return save(couponInfo);
|
||||
return save(couponInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品
|
||||
*
|
||||
* @param couponInfo 商品
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -66,6 +70,7 @@ public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponI
|
||||
|
||||
/**
|
||||
* 批量删除商品
|
||||
*
|
||||
* @param ids 需要删除的商品主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -76,6 +81,7 @@ public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponI
|
||||
|
||||
/**
|
||||
* 删除商品信息
|
||||
*
|
||||
* @param id 商品主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -53,10 +53,10 @@ public class OrderInfoController {
|
||||
@PreAuthorize("@customSs.hasPermission('order/info/cancellation')")
|
||||
public R cancellationOrder(@RequestBody OrderInfoCancellationVo vo) {
|
||||
|
||||
//判断操作人是否是陪玩本身
|
||||
// 判断操作人是否是陪玩本身
|
||||
OrderInfoEntity entity = orderInfoService.selectOrderInfoById(vo.getId());
|
||||
|
||||
//校验通过
|
||||
// 校验通过
|
||||
orderInfoService.orderRefund(vo.getId(), "2", null, false);
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ public class OrderInfoController {
|
||||
@PostMapping("/reward")
|
||||
public R reward(@RequestBody OrderInfoRewardVo addVo) {
|
||||
|
||||
//校验当前用户余额是否充足
|
||||
// 校验当前用户余额是否充足
|
||||
// if (false) {
|
||||
|
||||
// throw new CustomException("余额不足,无法下单");
|
||||
// }
|
||||
|
||||
// 新增陪玩余额
|
||||
playUserInfoService.editAccountBalance(addVo.getPlayUserId(), addVo.getMoney(), "add");
|
||||
// playUserInfoService.editAccountBalance(addVo.getPlayUserId(), addVo.getMoney(), "add");
|
||||
// 减少用户余额
|
||||
|
||||
// 新增订单记录(订单信息需完善)
|
||||
@@ -96,17 +96,15 @@ public class OrderInfoController {
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody OrderInfoAddVo addVo) {
|
||||
|
||||
//商品总价格
|
||||
// 商品总价格
|
||||
long commodityTotalMoney = 0;
|
||||
//订单总价格
|
||||
// 订单总价格
|
||||
long orderTotalMoney = 0;
|
||||
//校验商品(陪玩)状态
|
||||
// 校验商品(陪玩)状态
|
||||
PlayUserInfoEntity playUserInfo = playUserInfoService.selectPlayUserInfoById(addVo.getPlayUserId());
|
||||
if ("2".equals(playUserInfo.getUserState())) {
|
||||
throw new CustomException("陪玩状态异常,无法下单");
|
||||
}
|
||||
|
||||
//校验优惠券是否存在
|
||||
|
||||
// 校验优惠券是否存在
|
||||
for (String commodityInfoId : addVo.getCouponIds()) {
|
||||
CouponInfoEntity couponInfo = couponInfoService.selectCouponInfoById(commodityInfoId);
|
||||
if (couponInfo == null) {
|
||||
@@ -114,7 +112,7 @@ public class OrderInfoController {
|
||||
}
|
||||
}
|
||||
|
||||
//校验当前用户余额是否充足
|
||||
// 校验当前用户余额是否充足
|
||||
// if (false) {
|
||||
// throw new CustomException("余额不足,无法下单");
|
||||
// }
|
||||
@@ -126,9 +124,9 @@ public class OrderInfoController {
|
||||
|
||||
orderInfoService.create(entity);
|
||||
|
||||
//记录订单日志
|
||||
// 记录订单日志
|
||||
orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "0", new Date()));
|
||||
//记录订单详细信息
|
||||
// 记录订单详细信息
|
||||
orderDetailsInfoService.create(new OrderDetailsInfoEntity(entity.getId(), addVo.getPlayUserId(), "0"));
|
||||
for (String commodityInfoId : addVo.getCouponIds()) {
|
||||
orderDetailsInfoService.create(new OrderDetailsInfoEntity(entity.getId(), commodityInfoId, "1"));
|
||||
|
||||
@@ -9,18 +9,20 @@ import java.util.List;
|
||||
* 订单Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-20
|
||||
* @since 2024-03-20
|
||||
*/
|
||||
public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
|
||||
/**
|
||||
* 查询订单
|
||||
*
|
||||
* @param id 订单主键
|
||||
* @return 订单
|
||||
*/
|
||||
OrderInfoEntity selectOrderInfoById(String id);
|
||||
OrderInfoEntity selectOrderInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
*
|
||||
* @param orderInfoEntity 订单
|
||||
* @return 订单集合
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-22
|
||||
* @since 2024-03-22
|
||||
*/
|
||||
public interface OrderLogInfoMapper extends BaseMapper<OrderLogInfoEntity> {
|
||||
|
||||
|
||||
@@ -34,5 +34,4 @@ public class OrderInfoCancellationVo {
|
||||
private String operatorBy;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,22 +3,25 @@ package com.starry.admin.modules.order.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-22
|
||||
* @since 2024-03-22
|
||||
*/
|
||||
public interface IOrderLogInfoService extends IService<OrderLogInfoEntity> {
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
OrderLogInfoEntity selectOrderLogInfoById(String id);
|
||||
OrderLogInfoEntity selectOrderLogInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param orderLogInfo 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
@@ -26,6 +29,7 @@ public interface IOrderLogInfoService extends IService<OrderLogInfoEntity> {
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param orderLogInfo 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -33,6 +37,7 @@ public interface IOrderLogInfoService extends IService<OrderLogInfoEntity> {
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param orderLogInfo 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,32 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
@Resource
|
||||
private IPlayUserInfoService playUserInfoService;
|
||||
|
||||
/**
|
||||
* 计算退款金额
|
||||
*
|
||||
* @param refundType 退款类型【1:部分退款,2:全部退款】
|
||||
* @param refundMoney 退款金额,单位分(仅部分退款有效)
|
||||
* @param entity 订单信息
|
||||
* @return 最终退款金额
|
||||
*/
|
||||
private static long getFinalAmount(String refundType, String refundMoney, OrderInfoEntity entity) {
|
||||
long finalAmount = 0;
|
||||
// 部分退款,计算退款金额是否小于订单金额
|
||||
if ("1".equals(refundType)) {
|
||||
// 退款金额
|
||||
long refundMoneyLong = Long.getLong(refundMoney);
|
||||
// 订单金额
|
||||
long orderMoney = Long.getLong(entity.getOrderMoney());
|
||||
if (refundMoneyLong <= 0) {
|
||||
throw new CustomException("退款金额必须大于0");
|
||||
}
|
||||
if (orderMoney < refundMoneyLong) {
|
||||
throw new CustomException("退款金额必须小于订单总金额");
|
||||
}
|
||||
finalAmount = orderMoney - refundMoneyLong;
|
||||
}
|
||||
return finalAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
@@ -113,7 +139,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
return orderInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void orderRefund(String id, String refundType, String refundMoney, boolean examine) {
|
||||
OrderInfoEntity entity = this.selectOrderInfoById(id);
|
||||
@@ -123,11 +148,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
if (!"0".equals(entity.getRefundType())) {
|
||||
throw new CustomException("订单已退款,无法二次退款");
|
||||
}
|
||||
//最终退款金额
|
||||
// 最终退款金额
|
||||
long finalAmount = getFinalAmount(refundType, refundMoney, entity);
|
||||
|
||||
// 减少陪玩余额
|
||||
playUserInfoService.editAccountBalance(id, String.valueOf(finalAmount), "reduce");
|
||||
// playUserInfoService.editAccountBalance(id, String.valueOf(finalAmount), "reduce");
|
||||
// 新增用户余额
|
||||
|
||||
// 修改订单信息
|
||||
@@ -138,32 +163,4 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
// 增加订单处理日志
|
||||
orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "4", new Date()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算退款金额
|
||||
*
|
||||
* @param refundType 退款类型【1:部分退款,2:全部退款】
|
||||
* @param refundMoney 退款金额,单位分(仅部分退款有效)
|
||||
* @param entity 订单信息
|
||||
* @return 最终退款金额
|
||||
*/
|
||||
private static long getFinalAmount(String refundType, String refundMoney, OrderInfoEntity entity) {
|
||||
long finalAmount = 0;
|
||||
//部分退款,计算退款金额是否小于订单金额
|
||||
if ("1".equals(refundType)) {
|
||||
// 退款金额
|
||||
long refundMoneyLong = Long.getLong(refundMoney);
|
||||
// 订单金额
|
||||
long orderMoney = Long.getLong(entity.getOrderMoney());
|
||||
if (refundMoneyLong <= 0) {
|
||||
throw new CustomException("退款金额必须大于0");
|
||||
}
|
||||
if (orderMoney < refundMoneyLong) {
|
||||
throw new CustomException("退款金额必须小于订单总金额");
|
||||
}
|
||||
finalAmount = orderMoney - refundMoneyLong;
|
||||
}
|
||||
return finalAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@ public class SysTenantController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询租户表列表
|
||||
*/
|
||||
|
||||
@@ -70,5 +70,4 @@ public interface ISysTenantPackageService extends IService<SysTenantPackageEntit
|
||||
List<SimplePackage> getSimpleList();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ public interface ISysTenantService extends IService<SysTenantEntity> {
|
||||
|
||||
/**
|
||||
* 根据套餐ID查询租户
|
||||
*
|
||||
* @param packageId 套餐ID
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -86,7 +86,7 @@ public class SysTenantPackageServiceImpl extends ServiceImpl<SysTenantPackageMap
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysTenantPackageByPackageIds(String[] packageIds) {
|
||||
//删除前,看套餐是否被租户引用
|
||||
// 删除前,看套餐是否被租户引用
|
||||
for (String packageId : packageIds) {
|
||||
if (!tenantService.queryByPackage(packageId).isEmpty()) {
|
||||
throw new CustomException("套餐背应用,无法删除");
|
||||
|
||||
@@ -60,18 +60,18 @@ public class PlayResourcesInfoController {
|
||||
@Log(title = "陪玩资源", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayResourcesInfoAddVo vo, @RequestParam("file") MultipartFile file) throws IOException {
|
||||
//校验文件类型是否正常
|
||||
// 校验文件类型是否正常
|
||||
|
||||
//上传文件到OSS
|
||||
// 上传文件到OSS
|
||||
String fileAddress = ossFileService.upload(file.getInputStream(), "", file.getOriginalFilename());
|
||||
|
||||
//保持陪玩资源
|
||||
// 保持陪玩资源
|
||||
PlayResourcesInfoEntity entity = ConvertUtil.entityToVo(vo, PlayResourcesInfoEntity.class);
|
||||
entity.setAddress(fileAddress);
|
||||
boolean success = playResourcesInfoService.create(entity);
|
||||
//发送审核通知给对应的管理员
|
||||
// 发送审核通知给对应的管理员
|
||||
|
||||
//返回信息
|
||||
// 返回信息
|
||||
if (success) {
|
||||
return R.ok("成功");
|
||||
}
|
||||
@@ -86,9 +86,9 @@ public class PlayResourcesInfoController {
|
||||
@Log(title = "陪玩资源审核", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/examine")
|
||||
public R examinePlayResourcesInfo(@RequestBody PlayResourcesInfoReviewVo vo) {
|
||||
//验证权限,判断当前接口调用人是否有权限操作该接口
|
||||
// 验证权限,判断当前接口调用人是否有权限操作该接口
|
||||
|
||||
//资料审核
|
||||
// 资料审核
|
||||
playResourcesInfoService.examinePlayResourcesInfo(vo.getId(), vo.isSuccess(), vo.getRemark());
|
||||
return R.ok("成功");
|
||||
}
|
||||
|
||||
@@ -2,40 +2,44 @@ package com.starry.admin.modules.play.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoAddVo;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoUpdateVo;
|
||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import com.starry.common.utils.ConvertUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 陪玩用户Controller
|
||||
* 账号Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/play/user/info")
|
||||
@RequestMapping("/play/user")
|
||||
public class PlayUserInfoController {
|
||||
@Resource
|
||||
private IPlayUserInfoService playUserInfoService;
|
||||
|
||||
/**
|
||||
* 查询陪玩用户列表
|
||||
* 查询账号列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayUserInfoEntity playUserInfo) {
|
||||
IPage<PlayUserInfoEntity> list = playUserInfoService.selectPlayUserInfoByPage(playUserInfo);
|
||||
public R list(PlayUserInfoQueryVo vo) {
|
||||
IPage<PlayUserInfoEntity> list = playUserInfoService.selectPlayUserInfoByPage(vo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取陪玩用户详细信息
|
||||
* 获取账号详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@@ -44,13 +48,14 @@ public class PlayUserInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增陪玩用户
|
||||
* 新增账号
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "陪玩用户", businessType = BusinessType.INSERT)
|
||||
@Log(title = "账号", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayUserInfoEntity playUserInfo) {
|
||||
boolean success = playUserInfoService.create(playUserInfo);
|
||||
public R create(@Validated @RequestBody PlayUserInfoAddVo vo) {
|
||||
PlayUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayUserInfoEntity.class);
|
||||
boolean success = playUserInfoService.create(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
@@ -58,14 +63,14 @@ public class PlayUserInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改陪玩用户
|
||||
* 修改账号
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "陪玩用户", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update/{id}")
|
||||
public R update(@PathVariable String id, @RequestBody PlayUserInfoEntity playUserInfo) {
|
||||
playUserInfo.setId(id);
|
||||
boolean success = playUserInfoService.update(playUserInfo);
|
||||
@Log(title = "账号", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update")
|
||||
public R update(@Validated @RequestBody PlayUserInfoUpdateVo vo) {
|
||||
PlayUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayUserInfoEntity.class);
|
||||
boolean success = playUserInfoService.update(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
@@ -73,10 +78,10 @@ public class PlayUserInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除陪玩用户
|
||||
* 删除账号
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "陪玩用户", businessType = BusinessType.DELETE)
|
||||
@Log(title = "账号", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playUserInfoService.deletePlayUserInfoByIds(ids));
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.starry.admin.modules.play.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 陪玩用户Mapper接口
|
||||
* 账号Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
public interface PlayUserInfoMapper extends BaseMapper<PlayUserInfoEntity> {
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 陪玩用户对象 ply_user_info
|
||||
* 账号对象 play_user_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@@ -28,84 +28,13 @@ public class PlayUserInfoEntity extends BaseEntity<PlayUserInfoEntity> {
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
* 账户名称(手机号码)
|
||||
*/
|
||||
private String name;
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
* 手机号码区号
|
||||
*/
|
||||
private String code;
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 账户余额
|
||||
*/
|
||||
private String accountBalance;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String profilePicture;
|
||||
|
||||
/**
|
||||
* 陪玩状态[0,1,2]
|
||||
* 0:正常,
|
||||
* 1:被标记:
|
||||
* 2:被封禁
|
||||
*/
|
||||
private String userState;
|
||||
|
||||
/**
|
||||
* 陪玩等级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 陪玩在线状态[0:1]
|
||||
* 0:在线
|
||||
* 1:离线
|
||||
*/
|
||||
private String presenceState;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Long age;
|
||||
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 所在国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 所在省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 用户语言
|
||||
*/
|
||||
private String language;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class PlayUserInfoAddVo {
|
||||
|
||||
/**
|
||||
* 账户名称(手机号码)
|
||||
*/
|
||||
@NotBlank(message = "手机号码不能为空")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 手机号码区号
|
||||
*/
|
||||
@NotBlank(message = "手机号码区号不能为空")
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
@NotBlank(message = "手机号码区号不能为空")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 陪玩用户ID
|
||||
*/
|
||||
@NotBlank(message = "绑定用户不能为空")
|
||||
private String playUserId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import com.starry.common.domain.BasePageEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PlayUserInfoQueryVo extends BasePageEntity {
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
|
||||
private String areaCode;
|
||||
|
||||
|
||||
private String ruleId;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class PlayUserInfoUpdateVo {
|
||||
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 陪玩用户ID
|
||||
*/
|
||||
@NotBlank(message = "绑定用户不能为空")
|
||||
private String playUserId;
|
||||
|
||||
|
||||
}
|
||||
@@ -3,97 +3,60 @@ package com.starry.admin.modules.play.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
|
||||
|
||||
/**
|
||||
* 陪玩用户Service接口
|
||||
* 账号Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
public interface IPlayUserInfoService extends IService<PlayUserInfoEntity> {
|
||||
/**
|
||||
* 查询陪玩用户
|
||||
* 查询账号
|
||||
*
|
||||
* @param id 陪玩用户主键
|
||||
* @return 陪玩用户
|
||||
* @param id 账号主键
|
||||
* @return 账号
|
||||
*/
|
||||
PlayUserInfoEntity selectPlayUserInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询陪玩用户列表
|
||||
* 查询账号列表
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @return 陪玩用户集合
|
||||
* @param vo 账号查询实体
|
||||
* @return 账号集合
|
||||
*/
|
||||
IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo);
|
||||
IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoQueryVo vo);
|
||||
|
||||
/**
|
||||
* 新增陪玩用户
|
||||
* 新增账号
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @param playUserInfo 账号
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayUserInfoEntity playUserInfo);
|
||||
|
||||
/**
|
||||
* 修改陪玩用户
|
||||
* 修改账号
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @param playUserInfo 账号
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayUserInfoEntity playUserInfo);
|
||||
|
||||
/**
|
||||
* 批量删除陪玩用户
|
||||
* 批量删除账号
|
||||
*
|
||||
* @param ids 需要删除的陪玩用户主键集合
|
||||
* @param ids 需要删除的账号主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayUserInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除陪玩用户信息
|
||||
* 删除账号信息
|
||||
*
|
||||
* @param id 陪玩用户主键
|
||||
* @param id 账号主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayUserInfoById(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 修改陪玩账户余额
|
||||
*
|
||||
* @param id 陪玩ID
|
||||
* @param accountBalance 账户余额
|
||||
* @param operate 余额操作【add or reduce】
|
||||
*/
|
||||
void editAccountBalance(String id, String accountBalance, String operate);
|
||||
|
||||
/**
|
||||
* 修改陪玩账户等级
|
||||
*
|
||||
* @param id 陪玩ID
|
||||
* @param level 陪玩等级
|
||||
*/
|
||||
void editLevel(String id, int level);
|
||||
|
||||
|
||||
/**
|
||||
* 修改陪玩账户等级
|
||||
*
|
||||
* @param id 陪玩ID
|
||||
* @param state 陪玩状态
|
||||
*/
|
||||
void editState(String id, String state);
|
||||
|
||||
|
||||
/**
|
||||
* 修改陪玩在线状态
|
||||
*
|
||||
* @param id 陪玩ID
|
||||
* @param presenceState 陪玩在线状态
|
||||
*/
|
||||
|
||||
void editPresenceState(String id, String presenceState);
|
||||
|
||||
}
|
||||
|
||||
@@ -77,9 +77,9 @@ public class PlayResourcesInfoServiceImpl extends ServiceImpl<PlayResourcesInfoM
|
||||
entity.setReviewedBy(SecurityUtils.getLoginUser().getUserId());
|
||||
entity.setReviewedTime(new Date());
|
||||
entity.setReviewedRemark(remark);
|
||||
//审核通过后,先删除旧的资源,然后将新的资源标识审核通过状态
|
||||
// 审核通过后,先删除旧的资源,然后将新的资源标识审核通过状态
|
||||
if (success) {
|
||||
//查询当前用户,所有同类型的资源,然后删除之前的资源
|
||||
// 查询当前用户,所有同类型的资源,然后删除之前的资源
|
||||
LambdaQueryWrapper<PlayResourcesInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PlayResourcesInfoEntity::getPlayUserId, entity.getPlayUserId());
|
||||
lambdaQueryWrapper.eq(PlayResourcesInfoEntity::getTenantId, entity.getTenantId());
|
||||
@@ -91,7 +91,7 @@ public class PlayResourcesInfoServiceImpl extends ServiceImpl<PlayResourcesInfoM
|
||||
}
|
||||
}
|
||||
this.update(entity);
|
||||
//查询旧资源
|
||||
// 查询旧资源
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.play.mapper.PlayUserInfoMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
|
||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -16,10 +16,10 @@ import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 陪玩用户Service业务层处理
|
||||
* 账号Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Service
|
||||
public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, PlayUserInfoEntity> implements IPlayUserInfoService {
|
||||
@@ -27,83 +27,42 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
|
||||
private PlayUserInfoMapper playUserInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询陪玩用户
|
||||
* 查询账号
|
||||
*
|
||||
* @param id 陪玩用户主键
|
||||
* @return 陪玩用户
|
||||
* @param id 账号主键
|
||||
* @return 账号
|
||||
*/
|
||||
@Override
|
||||
public PlayUserInfoEntity selectPlayUserInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void editAccountBalance(String id, String accountBalance, String operate) {
|
||||
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
|
||||
if (entity == null) {
|
||||
throw new CustomException("陪玩不存在");
|
||||
}
|
||||
long accountBalanceLong = Long.parseLong(entity.getAccountBalance());
|
||||
if ("add".equals(operate)) {
|
||||
accountBalanceLong += Long.parseLong(accountBalance);
|
||||
} else if ("reduce".equals(operate)) {
|
||||
accountBalanceLong -= Long.parseLong(accountBalance);
|
||||
if (accountBalanceLong < 0) {
|
||||
throw new CustomException("陪玩余额不足,操作失败");
|
||||
}
|
||||
}
|
||||
entity.setAccountBalance(String.valueOf(accountBalanceLong));
|
||||
this.update(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editLevel(String id, int level) {
|
||||
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
|
||||
if (entity == null) {
|
||||
throw new CustomException("陪玩不存在");
|
||||
}
|
||||
entity.setLevel(level);
|
||||
this.update(entity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void editState(String id, String state) {
|
||||
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
|
||||
if (entity == null) {
|
||||
throw new CustomException("陪玩不存在");
|
||||
}
|
||||
entity.setUserState(state);
|
||||
this.update(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editPresenceState(String id, String presenceState) {
|
||||
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
|
||||
if (entity == null) {
|
||||
throw new CustomException("陪玩不存在");
|
||||
}
|
||||
entity.setPresenceState(presenceState);
|
||||
this.update(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询陪玩用户列表
|
||||
* 查询账号列表
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @return 陪玩用户
|
||||
* @param vo 账号查询实体
|
||||
* @return 账号
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo) {
|
||||
Page<PlayUserInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
public IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoQueryVo vo) {
|
||||
LambdaQueryWrapper<PlayUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(vo.getId())) {
|
||||
lambdaQueryWrapper.eq(PlayUserInfoEntity::getId, vo.getId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getUsername())) {
|
||||
lambdaQueryWrapper.eq(PlayUserInfoEntity::getUsername, vo.getUsername());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getAreaCode())) {
|
||||
lambdaQueryWrapper.eq(PlayUserInfoEntity::getAreaCode, vo.getAreaCode());
|
||||
}
|
||||
Page<PlayUserInfoEntity> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
||||
return this.baseMapper.selectPage(page, lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增陪玩用户
|
||||
* 新增账号
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @param playUserInfo 账号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -115,9 +74,9 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改陪玩用户
|
||||
* 修改账号
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @param playUserInfo 账号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -126,9 +85,9 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除陪玩用户
|
||||
* 批量删除账号
|
||||
*
|
||||
* @param ids 需要删除的陪玩用户主键
|
||||
* @param ids 需要删除的账号主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -137,9 +96,9 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除陪玩用户信息
|
||||
* 删除账号信息
|
||||
*
|
||||
* @param id 陪玩用户主键
|
||||
* @param id 账号主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -133,7 +133,7 @@ public class SysMenuController {
|
||||
public R getSimpleMenus() {
|
||||
// 获得菜单列表,只要开启状态的
|
||||
List<SimpleMenu> menus = menuService.selectSimpleMenuList();
|
||||
//TODO 移除公共模块
|
||||
// TODO 移除公共模块
|
||||
List<Long> forbidList = Arrays.asList(26L, 48L, 47L, 19L);
|
||||
List<SimpleMenu> menuList = menus.stream().filter(ca -> !forbidList.contains(ca.getId()) || !forbidList.contains(ca.getParentId())).collect(Collectors.toList());
|
||||
return R.ok(menus);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.builder;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.builder;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.config;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
//package com.starry.admin.modules.weichat.config;
|
||||
// package com.starry.admin.modules.weichat.config;
|
||||
//
|
||||
//
|
||||
//import cn.hutool.core.util.StrUtil;
|
||||
//import com.starry.admin.modules.weichat.entity.CustomWxMpProperties;
|
||||
//import com.starry.admin.modules.weichat.handler.*;
|
||||
//import com.starry.admin.modules.weichat.utils.WxMpPropertiesUtils;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import me.chanjar.weixin.common.api.WxConsts;
|
||||
//import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
//import me.chanjar.weixin.mp.api.WxMpService;
|
||||
//import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
//import me.chanjar.weixin.mp.config.WxMpConfigStorage;
|
||||
//import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
// import cn.hutool.core.util.StrUtil;
|
||||
// import com.starry.admin.modules.weichat.entity.CustomWxMpProperties;
|
||||
// import com.starry.admin.modules.weichat.handler.*;
|
||||
// import com.starry.admin.modules.weichat.utils.WxMpPropertiesUtils;
|
||||
// import lombok.AllArgsConstructor;
|
||||
// import me.chanjar.weixin.common.api.WxConsts;
|
||||
// import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
// import me.chanjar.weixin.mp.api.WxMpService;
|
||||
// import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
// import me.chanjar.weixin.mp.config.WxMpConfigStorage;
|
||||
// import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
||||
// import org.springframework.context.annotation.Bean;
|
||||
// import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
// import java.util.HashMap;
|
||||
// import java.util.Map;
|
||||
//
|
||||
//import static me.chanjar.weixin.common.api.WxConsts.EventType.SUBSCRIBE;
|
||||
//import static me.chanjar.weixin.common.api.WxConsts.EventType.UNSUBSCRIBE;
|
||||
//import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT;
|
||||
//import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*;
|
||||
//import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY;
|
||||
// import static me.chanjar.weixin.common.api.WxConsts.EventType.SUBSCRIBE;
|
||||
// import static me.chanjar.weixin.common.api.WxConsts.EventType.UNSUBSCRIBE;
|
||||
// import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT;
|
||||
// import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*;
|
||||
// import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY;
|
||||
//
|
||||
///**
|
||||
// * wechat mp configuration
|
||||
@@ -31,7 +31,7 @@
|
||||
// */
|
||||
//@AllArgsConstructor
|
||||
//@Configuration
|
||||
//public class WxMpConfiguration {
|
||||
// public class WxMpConfiguration {
|
||||
// private final LogHandler logHandler;
|
||||
// private final NullHandler nullHandler;
|
||||
// private final KfSessionHandler kfSessionHandler;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.constant;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.constant;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.constant;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.constant;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
@@ -25,103 +24,109 @@ import java.util.List;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxautoreply")
|
||||
public class WxAutoReplyController {
|
||||
public class WxAutoReplyController {
|
||||
|
||||
@Resource
|
||||
@Resource
|
||||
WxAutoReplyService wxAutoReplyService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param wxAutoReply 消息自动回复
|
||||
* @return
|
||||
*/
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param wxAutoReply 消息自动回复
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxautoreply:index')")
|
||||
public R getWxAutoReplyPage(Page page, WxAutoReply wxAutoReply) {
|
||||
return R.ok(wxAutoReplyService.page(page,Wrappers.query(wxAutoReply)));
|
||||
return R.ok(wxAutoReplyService.page(page, Wrappers.query(wxAutoReply)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询消息自动回复
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
* 通过id查询消息自动回复
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxautoreply:get')")
|
||||
public R getById(@PathVariable("id") String id){
|
||||
return R.ok(wxAutoReplyService.getById(id));
|
||||
public R getById(@PathVariable("id") String id) {
|
||||
return R.ok(wxAutoReplyService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消息自动回复
|
||||
* @param wxAutoReply 消息自动回复
|
||||
* @return R
|
||||
*/
|
||||
* 新增消息自动回复
|
||||
*
|
||||
* @param wxAutoReply 消息自动回复
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxautoreply:add')")
|
||||
public R save(@RequestBody WxAutoReply wxAutoReply){
|
||||
this.jude(wxAutoReply);
|
||||
return R.ok(wxAutoReplyService.save(wxAutoReply));
|
||||
public R save(@RequestBody WxAutoReply wxAutoReply) {
|
||||
this.jude(wxAutoReply);
|
||||
return R.ok(wxAutoReplyService.save(wxAutoReply));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消息自动回复
|
||||
* @param wxAutoReply 消息自动回复
|
||||
* @return R
|
||||
*/
|
||||
* 修改消息自动回复
|
||||
*
|
||||
* @param wxAutoReply 消息自动回复
|
||||
* @return R
|
||||
*/
|
||||
@PutMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxautoreply:edit')")
|
||||
public R updateById(@RequestBody WxAutoReply wxAutoReply){
|
||||
this.jude(wxAutoReply);
|
||||
return R.ok(wxAutoReplyService.updateById(wxAutoReply));
|
||||
public R updateById(@RequestBody WxAutoReply wxAutoReply) {
|
||||
this.jude(wxAutoReply);
|
||||
return R.ok(wxAutoReplyService.updateById(wxAutoReply));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除消息自动回复
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
* 通过id删除消息自动回复
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxautoreply:del')")
|
||||
public R removeById(@PathVariable String id){
|
||||
return R.ok(wxAutoReplyService.removeById(id));
|
||||
public R removeById(@PathVariable String id) {
|
||||
return R.ok(wxAutoReplyService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* //校验参数
|
||||
* @param wxAutoReply
|
||||
*/
|
||||
public void jude(WxAutoReply wxAutoReply){
|
||||
if(ConfigConstant.WX_AUTO_REPLY_TYPE_2.equals(wxAutoReply.getType())){
|
||||
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery()
|
||||
.eq(WxAutoReply::getReqType,wxAutoReply.getReqType());
|
||||
List<WxAutoReply> list = wxAutoReplyService.list(queryWrapper);
|
||||
if(StringUtils.isNotBlank(wxAutoReply.getId())){
|
||||
if(list != null && list.size() == 1){
|
||||
if(!list.get(0).getId().equals(wxAutoReply.getId())){
|
||||
throw new RuntimeException("请求消息类型重复");
|
||||
}
|
||||
}
|
||||
if(list != null && list.size()>1){
|
||||
throw new RuntimeException("请求消息类型重复");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ConfigConstant.WX_AUTO_REPLY_TYPE_3.equals(wxAutoReply.getType())){
|
||||
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery()
|
||||
.eq(WxAutoReply::getReqKey,wxAutoReply.getReqKey())
|
||||
.eq(WxAutoReply::getRepType,wxAutoReply.getRepMate());
|
||||
List<WxAutoReply> list = wxAutoReplyService.list(queryWrapper);
|
||||
if(list != null && list.size() == 1){
|
||||
if(!list.get(0).getId().equals(wxAutoReply.getId())){
|
||||
throw new RuntimeException("关键词重复");
|
||||
}
|
||||
}
|
||||
if(list != null && list.size()>1){
|
||||
throw new RuntimeException("关键词重复");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* //校验参数
|
||||
*
|
||||
* @param wxAutoReply
|
||||
*/
|
||||
public void jude(WxAutoReply wxAutoReply) {
|
||||
if (ConfigConstant.WX_AUTO_REPLY_TYPE_2.equals(wxAutoReply.getType())) {
|
||||
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery()
|
||||
.eq(WxAutoReply::getReqType, wxAutoReply.getReqType());
|
||||
List<WxAutoReply> list = wxAutoReplyService.list(queryWrapper);
|
||||
if (StringUtils.isNotBlank(wxAutoReply.getId())) {
|
||||
if (list != null && list.size() == 1) {
|
||||
if (!list.get(0).getId().equals(wxAutoReply.getId())) {
|
||||
throw new RuntimeException("请求消息类型重复");
|
||||
}
|
||||
}
|
||||
if (list != null && list.size() > 1) {
|
||||
throw new RuntimeException("请求消息类型重复");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ConfigConstant.WX_AUTO_REPLY_TYPE_3.equals(wxAutoReply.getType())) {
|
||||
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery()
|
||||
.eq(WxAutoReply::getReqKey, wxAutoReply.getReqKey())
|
||||
.eq(WxAutoReply::getRepType, wxAutoReply.getRepMate());
|
||||
List<WxAutoReply> list = wxAutoReplyService.list(queryWrapper);
|
||||
if (list != null && list.size() == 1) {
|
||||
if (!list.get(0).getId().equals(wxAutoReply.getId())) {
|
||||
throw new RuntimeException("关键词重复");
|
||||
}
|
||||
}
|
||||
if (list != null && list.size() > 1) {
|
||||
throw new RuntimeException("关键词重复");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
@@ -32,98 +31,99 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxdraft")
|
||||
@Api(value = "wxdraft", tags = "微信草稿箱")
|
||||
public class WxDraftController {
|
||||
public class WxDraftController {
|
||||
|
||||
@Resource
|
||||
WxMpService wxService;
|
||||
@Resource
|
||||
WxMpService wxService;
|
||||
|
||||
/**
|
||||
* 新增图文消息
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增草稿箱")
|
||||
@PostMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:add')")
|
||||
public R add(@RequestBody JSONObject data) throws Exception {
|
||||
JSONArray jSONArray = data.getJSONArray("articles");
|
||||
List<WxMpDraftArticles> articles = jSONArray.toList(WxMpDraftArticles.class);
|
||||
WxMpAddDraft wxMpAddDraft = new WxMpAddDraft();
|
||||
wxMpAddDraft.setArticles(articles);
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
String rs = wxMpDraftService.addDraft(wxMpAddDraft);
|
||||
return R.ok(rs);
|
||||
}
|
||||
/**
|
||||
* 新增图文消息
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增草稿箱")
|
||||
@PostMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:add')")
|
||||
public R add(@RequestBody JSONObject data) throws Exception {
|
||||
JSONArray jSONArray = data.getJSONArray("articles");
|
||||
List<WxMpDraftArticles> articles = jSONArray.toList(WxMpDraftArticles.class);
|
||||
WxMpAddDraft wxMpAddDraft = new WxMpAddDraft();
|
||||
wxMpAddDraft.setArticles(articles);
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
String rs = wxMpDraftService.addDraft(wxMpAddDraft);
|
||||
return R.ok(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信草稿箱
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改微信草稿箱")
|
||||
@PutMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:edit')")
|
||||
public R edit(@RequestBody JSONObject data) throws Exception {
|
||||
String mediaId = data.getStr("mediaId");
|
||||
JSONArray jSONArray = data.getJSONArray("articles");
|
||||
List<WxMpDraftArticles> articles = jSONArray.toList(WxMpDraftArticles.class);
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
WxMpUpdateDraft wxMpUpdateDraft = new WxMpUpdateDraft();
|
||||
wxMpUpdateDraft.setMediaId(mediaId);
|
||||
int index = 0;
|
||||
for (WxMpDraftArticles article : articles) {
|
||||
wxMpUpdateDraft.setIndex(index);
|
||||
wxMpUpdateDraft.setArticles(article);
|
||||
wxMpDraftService.updateDraft(wxMpUpdateDraft);
|
||||
index++;
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 修改微信草稿箱
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改微信草稿箱")
|
||||
@PutMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:edit')")
|
||||
public R edit(@RequestBody JSONObject data) throws Exception {
|
||||
String mediaId = data.getStr("mediaId");
|
||||
JSONArray jSONArray = data.getJSONArray("articles");
|
||||
List<WxMpDraftArticles> articles = jSONArray.toList(WxMpDraftArticles.class);
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
WxMpUpdateDraft wxMpUpdateDraft = new WxMpUpdateDraft();
|
||||
wxMpUpdateDraft.setMediaId(mediaId);
|
||||
int index = 0;
|
||||
for (WxMpDraftArticles article : articles) {
|
||||
wxMpUpdateDraft.setIndex(index);
|
||||
wxMpUpdateDraft.setArticles(article);
|
||||
wxMpDraftService.updateDraft(wxMpUpdateDraft);
|
||||
index++;
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除微信草稿箱
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除微信草稿箱")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:del')")
|
||||
public R del(String id) throws Exception {
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
return R.ok(wxMpDraftService.delDraft(id));
|
||||
}
|
||||
/**
|
||||
* 通过id删除微信草稿箱
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除微信草稿箱")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:del')")
|
||||
public R del(String id) throws Exception {
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
return R.ok(wxMpDraftService.delDraft(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:index')")
|
||||
public R getPage(Page page) throws Exception {
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
int count = (int) page.getSize();
|
||||
int offset = (int) page.getCurrent() * count - count;
|
||||
return R.ok(wxMpDraftService.listDraft(offset, count));
|
||||
}
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:index')")
|
||||
public R getPage(Page page) throws Exception {
|
||||
WxMpDraftService wxMpDraftService = wxService.getDraftService();
|
||||
int count = (int) page.getSize();
|
||||
int offset = (int) page.getCurrent() * count - count;
|
||||
return R.ok(wxMpDraftService.listDraft(offset, count));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布草稿箱
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "发布草稿箱")
|
||||
@PostMapping("/publish/{id}")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:publish')")
|
||||
public R publish(@PathVariable String id) throws Exception {
|
||||
WxMpFreePublishService wxMpFreePublishService = wxService.getFreePublishService();
|
||||
wxMpFreePublishService.submit(id);
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 发布草稿箱
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "发布草稿箱")
|
||||
@PostMapping("/publish/{id}")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxdraft:publish')")
|
||||
public R publish(@PathVariable String id) throws Exception {
|
||||
WxMpFreePublishService wxMpFreePublishService = wxService.getFreePublishService();
|
||||
wxMpFreePublishService.submit(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@@ -43,197 +42,205 @@ import java.util.Map;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxmaterial")
|
||||
public class WxMaterialController {
|
||||
public class WxMaterialController {
|
||||
|
||||
@Resource
|
||||
WxMpService wxService;
|
||||
@Resource
|
||||
WxMpService wxService;
|
||||
|
||||
/**
|
||||
* 上传非图文微信素材
|
||||
* @param mulFile
|
||||
* @param mediaType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/materialFileUpload")
|
||||
// @PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:add')")
|
||||
public R materialFileUpload(@RequestParam("file") MultipartFile mulFile,
|
||||
@RequestParam("title") String title,
|
||||
@RequestParam("introduction") String introduction,
|
||||
@RequestParam("mediaType") String mediaType) {
|
||||
try {
|
||||
WxMpMaterial material = new WxMpMaterial();
|
||||
material.setName(mulFile.getOriginalFilename());
|
||||
if(WxConsts.MediaFileType.VIDEO.equals(mediaType)){
|
||||
material.setVideoTitle(title);
|
||||
material.setVideoIntroduction(introduction);
|
||||
}
|
||||
File file = FileUtils.multipartFileToFile(mulFile);
|
||||
material.setFile(file);
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
WxMpMaterialUploadResult wxMpMaterialUploadResult = wxMpMaterialService.materialFileUpload(mediaType,material);
|
||||
WxMpMaterialFileBatchGetResult.WxMaterialFileBatchGetNewsItem wxMpMaterialFileBatchGetResult = new WxMpMaterialFileBatchGetResult.WxMaterialFileBatchGetNewsItem();
|
||||
wxMpMaterialFileBatchGetResult.setName(file.getName());
|
||||
wxMpMaterialFileBatchGetResult.setMediaId(wxMpMaterialUploadResult.getMediaId());
|
||||
wxMpMaterialFileBatchGetResult.setUrl(wxMpMaterialUploadResult.getUrl());
|
||||
return R.ok(wxMpMaterialFileBatchGetResult);
|
||||
} catch (WxErrorException e) {
|
||||
log.error("上传非图文微信素材失败" + e);
|
||||
return R.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("上传失败", e);
|
||||
return R.error(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 上传非图文微信素材
|
||||
*
|
||||
* @param mulFile
|
||||
* @param mediaType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/materialFileUpload")
|
||||
// @PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:add')")
|
||||
public R materialFileUpload(@RequestParam("file") MultipartFile mulFile,
|
||||
@RequestParam("title") String title,
|
||||
@RequestParam("introduction") String introduction,
|
||||
@RequestParam("mediaType") String mediaType) {
|
||||
try {
|
||||
WxMpMaterial material = new WxMpMaterial();
|
||||
material.setName(mulFile.getOriginalFilename());
|
||||
if (WxConsts.MediaFileType.VIDEO.equals(mediaType)) {
|
||||
material.setVideoTitle(title);
|
||||
material.setVideoIntroduction(introduction);
|
||||
}
|
||||
File file = FileUtils.multipartFileToFile(mulFile);
|
||||
material.setFile(file);
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
WxMpMaterialUploadResult wxMpMaterialUploadResult = wxMpMaterialService.materialFileUpload(mediaType, material);
|
||||
WxMpMaterialFileBatchGetResult.WxMaterialFileBatchGetNewsItem wxMpMaterialFileBatchGetResult = new WxMpMaterialFileBatchGetResult.WxMaterialFileBatchGetNewsItem();
|
||||
wxMpMaterialFileBatchGetResult.setName(file.getName());
|
||||
wxMpMaterialFileBatchGetResult.setMediaId(wxMpMaterialUploadResult.getMediaId());
|
||||
wxMpMaterialFileBatchGetResult.setUrl(wxMpMaterialUploadResult.getUrl());
|
||||
return R.ok(wxMpMaterialFileBatchGetResult);
|
||||
} catch (WxErrorException e) {
|
||||
log.error("上传非图文微信素材失败" + e);
|
||||
return R.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("上传失败", e);
|
||||
return R.error(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图文消息内的图片获取URL
|
||||
* @param mulFile
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/newsImgUpload")
|
||||
// @PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:add')")
|
||||
public String newsImgUpload(@RequestParam("file") MultipartFile mulFile) throws Exception {
|
||||
File file = FileUtils.multipartFileToFile(mulFile);
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
WxMediaImgUploadResult wxMediaImgUploadResult = wxMpMaterialService.mediaImgUpload(file);
|
||||
Map<Object, Object> responseData = new HashMap<>();
|
||||
responseData.put("link", wxMediaImgUploadResult.getUrl());
|
||||
return JSONUtil.toJsonStr(responseData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除微信素材
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:del')")
|
||||
public R materialDel(String id){
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
try {
|
||||
return R.ok(wxMpMaterialService.materialDelete(id));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("删除微信素材失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:index')")
|
||||
public R getWxMaterialPage(Page page, String type) {
|
||||
try {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
int count = (int)page.getSize();
|
||||
int offset = (int)page.getCurrent()*count-count;
|
||||
if(WxConsts.MaterialType.NEWS.equals(type)){
|
||||
return R.ok(wxMpMaterialService.materialNewsBatchGet(offset,count));
|
||||
}else{
|
||||
return R.ok(wxMpMaterialService.materialFileBatchGet(type,offset,count));
|
||||
}
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("查询素材失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询2
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page-manager")
|
||||
// @PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:index')")
|
||||
public String getWxMaterialPageManager(Integer count, Integer offset, String type) throws WxErrorException {
|
||||
List<ImageManager> listImageManager = new ArrayList<>();
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
List<WxMpMaterialFileBatchGetResult.WxMaterialFileBatchGetNewsItem> list = wxMpMaterialService.materialFileBatchGet(type,offset,count).getItems();
|
||||
list.forEach(wxMaterialFileBatchGetNewsItem -> {
|
||||
ImageManager imageManager = new ImageManager();
|
||||
imageManager.setName(wxMaterialFileBatchGetNewsItem.getMediaId());
|
||||
imageManager.setUrl(wxMaterialFileBatchGetNewsItem.getUrl());
|
||||
imageManager.setThumb(wxMaterialFileBatchGetNewsItem.getUrl());
|
||||
listImageManager.add(imageManager);
|
||||
});
|
||||
return JSONUtil.toJsonStr(listImageManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信视频素材
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/materialVideo")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:get')")
|
||||
public R getMaterialVideo(String mediaId){
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
try {
|
||||
return R.ok(wxMpMaterialService.materialVideoInfo(mediaId));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信视频素材失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信素材直接文件
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/materialOther")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:get')")
|
||||
public ResponseEntity<byte[]> getMaterialOther(String mediaId, String fileName) throws Exception {
|
||||
try {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
//获取文件
|
||||
InputStream is = wxMpMaterialService.materialImageOrVoiceDownload(mediaId);
|
||||
byte[] body = new byte[is.available()];
|
||||
is.read(body);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
//设置文件类型
|
||||
headers.add("Content-Disposition", "attchement;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
headers.add("Content-Type", "application/octet-stream");
|
||||
HttpStatus statusCode = HttpStatus.OK;
|
||||
//返回数据
|
||||
return new ResponseEntity<>(body, headers, statusCode);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信素材直接文件失败", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信临时素材直接文件
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/tempMaterialOther")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmsg:index')")
|
||||
public ResponseEntity<byte[]> getTempMaterialOther(String mediaId, String fileName) throws Exception {
|
||||
/**
|
||||
* 上传图文消息内的图片获取URL
|
||||
*
|
||||
* @param mulFile
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/newsImgUpload")
|
||||
// @PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:add')")
|
||||
public String newsImgUpload(@RequestParam("file") MultipartFile mulFile) throws Exception {
|
||||
File file = FileUtils.multipartFileToFile(mulFile);
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
try (InputStream is = Files.newInputStream(wxMpMaterialService.mediaDownload(mediaId).toPath())){
|
||||
byte[] body = new byte[is.available()];
|
||||
is.read(body);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
//设置文件类型
|
||||
headers.add("Content-Disposition", "attchement;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
headers.add("Content-Type", "application/octet-stream");
|
||||
HttpStatus statusCode = HttpStatus.OK;
|
||||
//返回数据
|
||||
WxMediaImgUploadResult wxMediaImgUploadResult = wxMpMaterialService.mediaImgUpload(file);
|
||||
Map<Object, Object> responseData = new HashMap<>();
|
||||
responseData.put("link", wxMediaImgUploadResult.getUrl());
|
||||
return JSONUtil.toJsonStr(responseData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除微信素材
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:del')")
|
||||
public R materialDel(String id) {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
try {
|
||||
return R.ok(wxMpMaterialService.materialDelete(id));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("删除微信素材失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:index')")
|
||||
public R getWxMaterialPage(Page page, String type) {
|
||||
try {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
int count = (int) page.getSize();
|
||||
int offset = (int) page.getCurrent() * count - count;
|
||||
if (WxConsts.MaterialType.NEWS.equals(type)) {
|
||||
return R.ok(wxMpMaterialService.materialNewsBatchGet(offset, count));
|
||||
} else {
|
||||
return R.ok(wxMpMaterialService.materialFileBatchGet(type, offset, count));
|
||||
}
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("查询素材失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询2
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page-manager")
|
||||
// @PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:index')")
|
||||
public String getWxMaterialPageManager(Integer count, Integer offset, String type) throws WxErrorException {
|
||||
List<ImageManager> listImageManager = new ArrayList<>();
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
List<WxMpMaterialFileBatchGetResult.WxMaterialFileBatchGetNewsItem> list = wxMpMaterialService.materialFileBatchGet(type, offset, count).getItems();
|
||||
list.forEach(wxMaterialFileBatchGetNewsItem -> {
|
||||
ImageManager imageManager = new ImageManager();
|
||||
imageManager.setName(wxMaterialFileBatchGetNewsItem.getMediaId());
|
||||
imageManager.setUrl(wxMaterialFileBatchGetNewsItem.getUrl());
|
||||
imageManager.setThumb(wxMaterialFileBatchGetNewsItem.getUrl());
|
||||
listImageManager.add(imageManager);
|
||||
});
|
||||
return JSONUtil.toJsonStr(listImageManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信视频素材
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/materialVideo")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:get')")
|
||||
public R getMaterialVideo(String mediaId) {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
try {
|
||||
return R.ok(wxMpMaterialService.materialVideoInfo(mediaId));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信视频素材失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信素材直接文件
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/materialOther")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmaterial:get')")
|
||||
public ResponseEntity<byte[]> getMaterialOther(String mediaId, String fileName) throws Exception {
|
||||
try {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
// 获取文件
|
||||
InputStream is = wxMpMaterialService.materialImageOrVoiceDownload(mediaId);
|
||||
byte[] body = new byte[is.available()];
|
||||
is.read(body);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// 设置文件类型
|
||||
headers.add("Content-Disposition", "attchement;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
headers.add("Content-Type", "application/octet-stream");
|
||||
HttpStatus statusCode = HttpStatus.OK;
|
||||
// 返回数据
|
||||
return new ResponseEntity<>(body, headers, statusCode);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信素材直接文件失败", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信素材直接文件失败", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信临时素材直接文件
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/tempMaterialOther")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmsg:index')")
|
||||
public ResponseEntity<byte[]> getTempMaterialOther(String mediaId, String fileName) throws Exception {
|
||||
WxMpMaterialService wxMpMaterialService = wxService.getMaterialService();
|
||||
try (InputStream is = Files.newInputStream(wxMpMaterialService.mediaDownload(mediaId).toPath())) {
|
||||
byte[] body = new byte[is.available()];
|
||||
is.read(body);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// 设置文件类型
|
||||
headers.add("Content-Disposition", "attchement;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
headers.add("Content-Type", "application/octet-stream");
|
||||
HttpStatus statusCode = HttpStatus.OK;
|
||||
// 返回数据
|
||||
return new ResponseEntity<>(body, headers, statusCode);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信素材直接文件失败", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
@@ -25,40 +24,40 @@ import javax.annotation.Resource;
|
||||
@RequestMapping("/wxmenu")
|
||||
public class WxMenuController {
|
||||
|
||||
@Resource
|
||||
@Resource
|
||||
WxMenuService wxMenuService;
|
||||
|
||||
/**
|
||||
* 通过appId查询自定义菜单
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmenu:get')")
|
||||
public R getWxMenuButton() {
|
||||
return R.ok(wxMenuService.getWxMenuButton());
|
||||
}
|
||||
/**
|
||||
* 通过appId查询自定义菜单
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmenu:get')")
|
||||
public R getWxMenuButton() {
|
||||
return R.ok(wxMenuService.getWxMenuButton());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存并发布菜单
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmenu:add')")
|
||||
public R saveAndRelease(@RequestBody String data) {
|
||||
JSONObject jSONObject = JSONUtil.parseObj(data);
|
||||
String strWxMenu = jSONObject.getStr("strWxMenu");
|
||||
String appId = jSONObject.getStr("appId");
|
||||
try {
|
||||
wxMenuService.saveAndRelease(strWxMenu);
|
||||
return R.ok();
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("发布自定义菜单失败appID:" + appId + ":" + e.getMessage());
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 保存并发布菜单
|
||||
*
|
||||
* @param
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxmenu:add')")
|
||||
public R saveAndRelease(@RequestBody String data) {
|
||||
JSONObject jSONObject = JSONUtil.parseObj(data);
|
||||
String strWxMenu = jSONObject.getStr("strWxMenu");
|
||||
String appId = jSONObject.getStr("appId");
|
||||
try {
|
||||
wxMenuService.saveAndRelease(strWxMenu);
|
||||
return R.ok();
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("发布自定义菜单失败appID:" + appId + ":" + e.getMessage());
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
@@ -67,7 +66,7 @@ public class WxMsgController {
|
||||
if (StringUtils.isNotBlank(wxMsgVO.getNotInRepType())) {
|
||||
return R.ok(wxMsgService.listWxMsgMapGroup(page, wxMsgVO));
|
||||
}
|
||||
//标记为已读
|
||||
// 标记为已读
|
||||
if (StringUtils.isNotBlank(wxMsgVO.getWxUserId())) {
|
||||
WxMsg wxMsg = new WxMsg();
|
||||
wxMsg.setReadFlag(CommonConstants.YES);
|
||||
@@ -100,7 +99,7 @@ public class WxMsgController {
|
||||
public R save(@RequestBody WxMsg wxMsg) {
|
||||
try {
|
||||
WxUser wxUser = wxUserService.getById(wxMsg.getWxUserId());
|
||||
//入库
|
||||
// 入库
|
||||
wxMsg.setNickName(wxUser.getNickName());
|
||||
wxMsg.setHeadimgUrl(wxUser.getHeadimgUrl());
|
||||
wxMsg.setCreateTime(LocalDateTime.now());
|
||||
@@ -111,7 +110,7 @@ public class WxMsgController {
|
||||
wxMpKefuMessage = WxMpKefuMessage.TEXT().build();
|
||||
wxMpKefuMessage.setContent(wxMsg.getRepContent());
|
||||
}
|
||||
if (WxConsts.KefuMsgType.IMAGE.equals(wxMsg.getRepType())) {//图片
|
||||
if (WxConsts.KefuMsgType.IMAGE.equals(wxMsg.getRepType())) {// 图片
|
||||
wxMsg.setRepName(wxMsg.getRepName());
|
||||
wxMsg.setRepUrl(wxMsg.getRepUrl());
|
||||
wxMsg.setRepMediaId(wxMsg.getRepMediaId());
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -24,7 +23,7 @@ public class WxPortalController {
|
||||
private final WxMpService wxService;
|
||||
|
||||
//@Resource
|
||||
//private final WxMpMessageRouter messageRouter;
|
||||
// private final WxMpMessageRouter messageRouter;
|
||||
|
||||
@GetMapping(produces = "text/plain;charset=utf-8")
|
||||
public String authGet(@PathVariable String appid,
|
||||
@@ -34,7 +33,7 @@ public class WxPortalController {
|
||||
@RequestParam(name = "echostr", required = false) String echostr) {
|
||||
|
||||
log.info("\n接收到来自微信服务器的认证消息:[{}, {}, {}, {}]", signature,
|
||||
timestamp, nonce, echostr);
|
||||
timestamp, nonce, echostr);
|
||||
if (StringUtils.isAnyBlank(signature, timestamp, nonce, echostr)) {
|
||||
throw new IllegalArgumentException("请求参数非法,请核实!");
|
||||
}
|
||||
@@ -60,8 +59,8 @@ public class WxPortalController {
|
||||
@RequestParam(name = "encrypt_type", required = false) String encType,
|
||||
@RequestParam(name = "msg_signature", required = false) String msgSignature) {
|
||||
log.info("\n接收微信请求:[openid=[{}], [signature=[{}], encType=[{}], msgSignature=[{}],"
|
||||
+ " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
|
||||
openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
|
||||
+ " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
|
||||
openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
|
||||
|
||||
if (!this.wxService.switchover(appid)) {
|
||||
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
|
||||
@@ -84,7 +83,7 @@ public class WxPortalController {
|
||||
} else if ("aes".equalsIgnoreCase(encType)) {
|
||||
// aes加密的消息
|
||||
WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, wxService.getWxMpConfigStorage(),
|
||||
timestamp, nonce, msgSignature);
|
||||
timestamp, nonce, msgSignature);
|
||||
log.debug("\n消息解密后内容为:\n{} ", inMessage.toString());
|
||||
WxMpXmlOutMessage outMessage = this.route(inMessage);
|
||||
if (outMessage == null) {
|
||||
@@ -99,7 +98,7 @@ public class WxPortalController {
|
||||
}
|
||||
|
||||
private WxMpXmlOutMessage route(WxMpXmlMessage message) {
|
||||
//try {
|
||||
// try {
|
||||
// return this.messageRouter.route(message);
|
||||
//} catch (Exception e) {
|
||||
// log.error("路由消息时出现异常!", e);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import com.starry.common.result.R;
|
||||
@@ -45,11 +44,11 @@ public class WxSummaryController {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return R.ok(wxMpDataCubeService.getUserSummary(sdf.parse(startDate), sdf.parse(endDate)));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
|
||||
log.error("获取用户增减数据失败", e);
|
||||
return R.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
log.error("获取用户增减数据失败", e);
|
||||
return R.error("获取用户增减数据失败");
|
||||
}
|
||||
@@ -71,11 +70,11 @@ public class WxSummaryController {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return R.ok(wxMpDataCubeService.getUserCumulate(sdf.parse(startDate), sdf.parse(endDate)));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
|
||||
log.error("获取累计用户数据失败", e);
|
||||
return R.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
log.error("获取用户增减数据失败", e);
|
||||
return R.error("获取用户增减数据失败");
|
||||
}
|
||||
@@ -97,11 +96,11 @@ public class WxSummaryController {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return R.ok(wxMpDataCubeService.getInterfaceSummary(sdf.parse(startDate), sdf.parse(endDate)));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
|
||||
log.error("获取接口分析数据失败", e);
|
||||
return R.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
log.error("获取接口分析数据失败", e);
|
||||
return R.error("获取接口分析数据失败");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -122,7 +121,7 @@ public class WxUserController {
|
||||
wxUserService.synchroWxUser();
|
||||
return R.ok();
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
|
||||
log.error("同步微信用户失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
@@ -140,7 +139,7 @@ public class WxUserController {
|
||||
try {
|
||||
return R.ok(wxUserService.updateRemark(wxUser));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
|
||||
log.error("修改微信用户备注失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
@@ -166,7 +165,7 @@ public class WxUserController {
|
||||
}
|
||||
return R.ok();
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
|
||||
log.error("修改微信用户备注失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
@@ -32,124 +31,129 @@ import java.util.List;
|
||||
@RequestMapping("/wxusertags")
|
||||
public class WxUserTagsController {
|
||||
|
||||
@Resource
|
||||
WxMpService wxService;
|
||||
@Resource
|
||||
WxMpService wxService;
|
||||
|
||||
@Resource
|
||||
@Resource
|
||||
WxUserService wxUserService;
|
||||
|
||||
/**
|
||||
* 获取微信用户标签
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:list')")
|
||||
@GetMapping("/list")
|
||||
public R getWxUserList(String appId) {
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
List<WxUserTag> listWxUserTag = wxMpUserTagService.tagGet();
|
||||
return R.ok(listWxUserTag);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取微信用户标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:list')")
|
||||
@GetMapping("/list")
|
||||
public R getWxUserList(String appId) {
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
List<WxUserTag> listWxUserTag = wxMpUserTagService.tagGet();
|
||||
return R.ok(listWxUserTag);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
/**
|
||||
* 获取微信用户标签字典
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:list')")
|
||||
@GetMapping("/dict")
|
||||
public R getWxUserTagsDict(String appId) {
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
List<WxUserTag> listWxUserTag = wxMpUserTagService.tagGet();
|
||||
List<WxUserTagsDict> listWxUserTagsDict = new ArrayList<>();
|
||||
WxUserTagsDict wxUserTagsDict;
|
||||
for(WxUserTag wxUserTag : listWxUserTag){
|
||||
wxUserTagsDict = new WxUserTagsDict();
|
||||
wxUserTagsDict.setName(wxUserTag.getName());
|
||||
wxUserTagsDict.setValue(wxUserTag.getId());
|
||||
listWxUserTagsDict.add(wxUserTagsDict);
|
||||
}
|
||||
return R.ok(listWxUserTagsDict);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("获取微信用户标签字典失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
log.error("获取微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信用户标签
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:add')")
|
||||
@PostMapping
|
||||
public R save(@RequestBody JSONObject data){
|
||||
String appId = data.getStr("appId");
|
||||
String name = data.getStr("name");
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
return R.ok(wxMpUserTagService.tagCreate(name));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("新增微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取微信用户标签字典
|
||||
*
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:list')")
|
||||
@GetMapping("/dict")
|
||||
public R getWxUserTagsDict(String appId) {
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
List<WxUserTag> listWxUserTag = wxMpUserTagService.tagGet();
|
||||
List<WxUserTagsDict> listWxUserTagsDict = new ArrayList<>();
|
||||
WxUserTagsDict wxUserTagsDict;
|
||||
for (WxUserTag wxUserTag : listWxUserTag) {
|
||||
wxUserTagsDict = new WxUserTagsDict();
|
||||
wxUserTagsDict.setName(wxUserTag.getName());
|
||||
wxUserTagsDict.setValue(wxUserTag.getId());
|
||||
listWxUserTagsDict.add(wxUserTagsDict);
|
||||
}
|
||||
return R.ok(listWxUserTagsDict);
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
/**
|
||||
* 修改微信用户标签
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:edit')")
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody JSONObject data){
|
||||
String appId = data.getStr("appId");
|
||||
Long id = data.getLong("id");
|
||||
String name = data.getStr("name");
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
return R.ok(wxMpUserTagService.tagUpdate(id,name));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("修改微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
log.error("获取微信用户标签字典失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信用户标签
|
||||
* @param id
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:del')")
|
||||
@DeleteMapping
|
||||
public R removeById(Long id,String appId){
|
||||
int count = (int) wxUserService.count(Wrappers.<WxUser>lambdaQuery()
|
||||
.and(wrapper -> wrapper
|
||||
.eq(WxUser::getTagidList,"["+id+"]")
|
||||
.or()
|
||||
.like(WxUser::getTagidList,","+id+",")
|
||||
.or()
|
||||
.likeRight(WxUser::getTagidList,"["+id+",")
|
||||
.or()
|
||||
.likeLeft(WxUser::getTagidList,","+id+"]")));
|
||||
if(count>0){
|
||||
return R.error("该标签下有用户存在,无法删除");
|
||||
}
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
return R.ok(wxMpUserTagService.tagDelete(id));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("删除微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增微信用户标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:add')")
|
||||
@PostMapping
|
||||
public R save(@RequestBody JSONObject data) {
|
||||
String appId = data.getStr("appId");
|
||||
String name = data.getStr("name");
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
return R.ok(wxMpUserTagService.tagCreate(name));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("新增微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信用户标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:edit')")
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody JSONObject data) {
|
||||
String appId = data.getStr("appId");
|
||||
Long id = data.getLong("id");
|
||||
String name = data.getStr("name");
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
return R.ok(wxMpUserTagService.tagUpdate(id, name));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("修改微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信用户标签
|
||||
*
|
||||
* @param id
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('wxmp:wxusertags:del')")
|
||||
@DeleteMapping
|
||||
public R removeById(Long id, String appId) {
|
||||
int count = (int) wxUserService.count(Wrappers.<WxUser>lambdaQuery()
|
||||
.and(wrapper -> wrapper
|
||||
.eq(WxUser::getTagidList, "[" + id + "]")
|
||||
.or()
|
||||
.like(WxUser::getTagidList, "," + id + ",")
|
||||
.or()
|
||||
.likeRight(WxUser::getTagidList, "[" + id + ",")
|
||||
.or()
|
||||
.likeLeft(WxUser::getTagidList, "," + id + "]")));
|
||||
if (count > 0) {
|
||||
return R.error("该标签下有用户存在,无法删除");
|
||||
}
|
||||
WxMpUserTagService wxMpUserTagService = wxService.getUserTagService();
|
||||
try {
|
||||
return R.ok(wxMpUserTagService.tagDelete(id));
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
log.error("删除微信用户标签失败", e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,31 @@ package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class CustomWxMpProperties {
|
||||
|
||||
/**
|
||||
* 微信APPID
|
||||
*/
|
||||
public String appid;
|
||||
public String appid = "wx917f3f747c7dc5dd";
|
||||
|
||||
/**
|
||||
* 微信公众号的app secret
|
||||
*/
|
||||
public String secret;
|
||||
public String secret = "85012dec2ba8bdc9d0174dd800ef1dec";
|
||||
|
||||
/**
|
||||
* 微信公众号的token
|
||||
*/
|
||||
public String token;
|
||||
public String token = "AkzAW8yqUhOWAFN550";
|
||||
|
||||
/**
|
||||
* 微信公众号的EncodingAESKey
|
||||
*/
|
||||
public String aesKey;
|
||||
public String aesKey = "tsoM88UUQ5uEHJ29xgNiaHHaoswZapS5ijWpaN6hUZF";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -4,6 +4,7 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信开发数据
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import com.starry.admin.modules.weichat.builder.TextBuilder;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.mapper;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.mapper;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class WxMpApi {
|
||||
return mpService.getOAuth2Service().buildAuthorizationUrl(url, "snsapi_userinfo", "mystate");
|
||||
}
|
||||
|
||||
//public String oauth2Callback(String code, String appId) {
|
||||
// public String oauth2Callback(String code, String appId) {
|
||||
// if (StringUtils.isEmpty(code)) {
|
||||
// throw new RuntimeException("授权码不能为空");
|
||||
// }
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.starry.admin.modules.weichat.utils;
|
||||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
@@ -12,6 +11,7 @@ import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* file工具
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user