Browse Source

微信表单推送、负责人重构

contract
Yen 2 years ago
parent
commit
ab3f4ddba3
  1. 11
      src/main/java/com/qs/serve/modules/bms/controller/BmsChannelController.java
  2. 4
      src/main/java/com/qs/serve/modules/bms/controller/BmsMasterUserController.java
  3. 2
      src/main/java/com/qs/serve/modules/bms/controller/BmsRegion2Controller.java
  4. 2
      src/main/java/com/qs/serve/modules/bms/controller/BmsRegionController.java
  5. 49
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java
  6. 14
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsSupplierMyController.java
  7. 9
      src/main/java/com/qs/serve/modules/bms/entity/BmsChannelPoint.java
  8. 7
      src/main/java/com/qs/serve/modules/bms/mapper/BmsChannelPointMapper.java
  9. 2
      src/main/java/com/qs/serve/modules/bms/service/BmsChannelPointService.java
  10. 5
      src/main/java/com/qs/serve/modules/bms/service/impl/BmsChannelPointServiceImpl.java
  11. 1
      src/main/java/com/qs/serve/modules/goods/controller/GoodsSkuController.java
  12. 6
      src/main/java/com/qs/serve/modules/goods/mapper/GoodsSkuSpecValueMapper.java
  13. 9
      src/main/java/com/qs/serve/modules/his/entity/HisUserChannelPoint.java
  14. 5
      src/main/java/com/qs/serve/modules/his/mapper/HisUserChannelPointMapper.java
  15. 12
      src/main/java/com/qs/serve/modules/his/service/HisUserChannelPointService.java
  16. 35
      src/main/java/com/qs/serve/modules/his/service/impl/HisUserChannelPointServiceImpl.java
  17. 71
      src/main/java/com/qs/serve/modules/sys/service/impl/SysUserServiceImpl.java
  18. 1
      src/main/java/com/qs/serve/modules/third/PortalFormPushController.java
  19. 12
      src/main/java/com/qs/serve/modules/wx/api/WxSvcUserApi.java
  20. 6
      src/main/java/com/qs/serve/modules/wx/controller/WxFormPushController.java
  21. 61
      src/main/java/com/qs/serve/modules/wx/controller/my/WxFormPushMyController.java
  22. 3
      src/main/java/com/qs/serve/modules/wx/entity/WxFormPush.java
  23. 3
      src/main/java/com/qs/serve/modules/wx/entity/WxFormPushUser.java
  24. 3
      src/main/java/com/qs/serve/modules/wx/entity/WxUser.java
  25. 60
      src/main/resources/mapper/bms/BmsChannelPointMapper.xml
  26. 2
      src/main/resources/mapper/goods/GoodsSkuMapper.xml
  27. 75
      src/main/resources/mapper/his/HisUserChannelPointMapper.xml

11
src/main/java/com/qs/serve/modules/bms/controller/BmsChannelController.java

@ -136,16 +136,19 @@ public class BmsChannelController {
return R.error("活动含当前渠道,删除失败"); return R.error("活动含当前渠道,删除失败");
} }
LambdaQueryWrapper<BmsChannelPoint> pointLqw = new LambdaQueryWrapper<>();
pointLqw.eq(BmsChannelPoint::getChannelId,id);
if(bmsChannelPointService.count(pointLqw)>1){
return R.error("含有网点,删除失败");
}
//删除相关的网点授权 //删除相关的网点授权
LambdaQueryWrapper<BmsMasterUser> mgrLqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BmsMasterUser> mgrLqw = new LambdaQueryWrapper<>();
mgrLqw.eq(BmsMasterUser::getType, MasterUserType.Channel); mgrLqw.eq(BmsMasterUser::getType, MasterUserType.Channel);
mgrLqw.eq(BmsMasterUser::getTargetId,id); mgrLqw.eq(BmsMasterUser::getTargetId,id);
bmsMasterUserMapper.delete(mgrLqw); bmsMasterUserMapper.delete(mgrLqw);
LambdaQueryWrapper<HisUserChannelPoint> lqwPoint = new LambdaQueryWrapper<>(); hisUserChannelPointService.removeByChannelId(id);
lqwPoint.eq(HisUserChannelPoint::getSourceType,3);
lqwPoint.eq(HisUserChannelPoint::getSourceIds,id);
hisUserChannelPointService.remove(lqwPoint);
boolean result = bmsChannelService.removeById(id); boolean result = bmsChannelService.removeById(id);
return R.isTrue(result); return R.isTrue(result);

4
src/main/java/com/qs/serve/modules/bms/controller/BmsMasterUserController.java

@ -201,6 +201,10 @@ public class BmsMasterUserController {
for (BmsChannelPoint channelPoint : channelPointList) { for (BmsChannelPoint channelPoint : channelPointList) {
hisUserChannelPointService.flushPoint(channelPoint.getId(),channelPoint.getSaleRegionPathIds(),channelPoint.getBizRegionPathIds()); hisUserChannelPointService.flushPoint(channelPoint.getId(),channelPoint.getSaleRegionPathIds(),channelPoint.getBizRegionPathIds());
} }
}else {
for (String targetId : param.getTargetIds()) {
hisUserChannelPointService.flushByChannelId(Long.parseLong(targetId));
}
} }
return R.ok(); return R.ok();
} }

2
src/main/java/com/qs/serve/modules/bms/controller/BmsRegion2Controller.java

@ -260,7 +260,7 @@ public class BmsRegion2Controller {
public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){
BmsRegion2 param = CopierUtil.copy(regionBo,new BmsRegion2()); BmsRegion2 param = CopierUtil.copy(regionBo,new BmsRegion2());
if(param.getId()==null){ if(param.getId()==null){
param.setId(IdUtil.getSnowFlakeId()+""); param.setId("B"+IdUtil.getSnowFlakeId());
} }
boolean result = bmsRegion2Service.saveBmsRegion2(param); boolean result = bmsRegion2Service.saveBmsRegion2(param);
return R.isTrue(result); return R.isTrue(result);

2
src/main/java/com/qs/serve/modules/bms/controller/BmsRegionController.java

@ -276,7 +276,7 @@ public class BmsRegionController {
public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){
BmsRegion param = CopierUtil.copy(regionBo,new BmsRegion()); BmsRegion param = CopierUtil.copy(regionBo,new BmsRegion());
if(param.getId()==null){ if(param.getId()==null){
param.setId(IdUtil.getSnowFlakeId()+""); param.setId("A"+IdUtil.getSnowFlakeId());
} }
boolean result = bmsRegionService.saveBmsRegion(param); boolean result = bmsRegionService.saveBmsRegion(param);
return R.isTrue(result); return R.isTrue(result);

49
src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java

@ -16,6 +16,7 @@ import com.qs.serve.modules.baz.service.BazVisitInfoService;
import com.qs.serve.modules.bms.entity.BmsChannelPoint; import com.qs.serve.modules.bms.entity.BmsChannelPoint;
import com.qs.serve.modules.bms.entity.BmsRegion; import com.qs.serve.modules.bms.entity.BmsRegion;
import com.qs.serve.modules.bms.entity.BmsRegion2; import com.qs.serve.modules.bms.entity.BmsRegion2;
import com.qs.serve.modules.bms.entity.BmsRegionUser;
import com.qs.serve.modules.bms.entity.bo.BmsChannelPointBo; import com.qs.serve.modules.bms.entity.bo.BmsChannelPointBo;
import com.qs.serve.modules.bms.entity.bo.BmsChannelPointMapInfoBo; import com.qs.serve.modules.bms.entity.bo.BmsChannelPointMapInfoBo;
import com.qs.serve.modules.bms.entity.so.BmsPointVisitSo; import com.qs.serve.modules.bms.entity.so.BmsPointVisitSo;
@ -24,7 +25,11 @@ import com.qs.serve.modules.bms.mapper.BmsChannelPointMapper;
import com.qs.serve.modules.bms.service.BmsChannelPointService; import com.qs.serve.modules.bms.service.BmsChannelPointService;
import com.qs.serve.modules.bms.service.BmsRegion2Service; import com.qs.serve.modules.bms.service.BmsRegion2Service;
import com.qs.serve.modules.bms.service.BmsRegionService; import com.qs.serve.modules.bms.service.BmsRegionService;
import com.qs.serve.modules.bms.service.BmsRegionUserService;
import com.qs.serve.modules.his.service.HisUserChannelPointService; import com.qs.serve.modules.his.service.HisUserChannelPointService;
import com.qs.serve.modules.sys.entity.SysUser;
import com.qs.serve.modules.sys.service.SysUserSalesService;
import com.qs.serve.modules.sys.service.SysUserService;
import com.qs.serve.modules.tbs.entity.TbsActivityChannelPoint; import com.qs.serve.modules.tbs.entity.TbsActivityChannelPoint;
import com.qs.serve.modules.tbs.service.TbsActivityChannelPointService; import com.qs.serve.modules.tbs.service.TbsActivityChannelPointService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -34,6 +39,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 基础档案 渠道站点(我的) * 基础档案 渠道站点(我的)
@ -53,15 +59,17 @@ public class BmsChannelPointMyController {
private TbsActivityChannelPointService activityChannelPointService; private TbsActivityChannelPointService activityChannelPointService;
private BmsChannelPointMapper channelPointMapper; private BmsChannelPointMapper channelPointMapper;
private HisUserChannelPointService hisUserChannelPointService; private HisUserChannelPointService hisUserChannelPointService;
private SysUserService sysUserService;
private BmsRegionUserService bmsRegionUserService;
private SysUserSalesService sysUserSalesService;
/** /**
* 翻页 * 我负责的网店
* @param param * @param param
* @return * @return
*/ */
@GetMapping("/page") @GetMapping("/page")
@PreAuthorize("hasRole('bms:channelPoint:query')")
public R<PageVo<BmsChannelPoint>> getPage(BmsChannelPoint param){ public R<PageVo<BmsChannelPoint>> getPage(BmsChannelPoint param){
PageUtil.startPage(); PageUtil.startPage();
param.setUserId(AuthContextUtils.getSysUserId()); param.setUserId(AuthContextUtils.getSysUserId());
@ -86,5 +94,42 @@ public class BmsChannelPointMyController {
/**
* 下属负责的网店
* @param param
* @return
*/
@GetMapping("/page4Under")
public R<PageVo<BmsChannelPoint>> getPage4Under(BmsChannelPoint param){
String loginUserId = AuthContextUtils.getSysUserId();
List<String> userIds = sysUserSalesService.listByChildIds(loginUserId);
param.setUserIdList(userIds);
LambdaQueryWrapper<BmsRegionUser> rulqw = new LambdaQueryWrapper<>();
rulqw.select(BmsRegionUser::getPathIds);
rulqw.eq(BmsRegionUser::getUserId,loginUserId);
List<BmsRegionUser> regionUserList = bmsRegionUserService.list(rulqw);
List<String> regionPaths = regionUserList.stream().map(BmsRegionUser::getPathIds).collect(Collectors.toList());
param.setSourceIdsList(regionPaths);
PageUtil.startPage();
param.setTenantId(AuthContextUtils.getTenant());
List<BmsChannelPoint> list = bmsChannelPointService.selectChannelPointMyUnderList(param);
for (BmsChannelPoint channelPoint : list) {
if(StringUtils.hasText(channelPoint.getBizRegionPath())){
String[] bizRegions = channelPoint.getBizRegionPath().split("_");
if(bizRegions.length>0){
channelPoint.setBizRegionName(bizRegions[bizRegions.length-1]);
}
}
if(StringUtils.hasText(channelPoint.getSaleRegionPath())){
String[] regions = channelPoint.getSaleRegionPath().split("_");
if(regions.length>0){
channelPoint.setSaleRegionName(regions[regions.length-1]);
}
}
}
return R.byPageHelperList(list);
}
} }

14
src/main/java/com/qs/serve/modules/bms/controller/my/BmsSupplierMyController.java

@ -49,5 +49,19 @@ public class BmsSupplierMyController {
return R.byPageHelperList(list); return R.byPageHelperList(list);
} }
/**
* 下属翻页查询
* @param param
* @return
*/
@GetMapping("/underlingPage")
public R<PageVo<BmsSupplier>> getUnderlingPage(BmsSupplier param){
param.setCurrUserId(AuthContextUtils.getSysUserId());
param.setStopFlag(0);
PageUtil.startPage();
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param);
return R.byPageHelperList(list);
}
} }

9
src/main/java/com/qs/serve/modules/bms/entity/BmsChannelPoint.java

@ -2,6 +2,7 @@ package com.qs.serve.modules.bms.entity;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -171,5 +172,13 @@ public class BmsChannelPoint implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String userId; private String userId;
/** 后端参数 */
@TableField(exist = false)
private List<String> sourceIdsList;
/** 后端参数 */
@TableField(exist = false)
private List<String> userIdList;
} }

7
src/main/java/com/qs/serve/modules/bms/mapper/BmsChannelPointMapper.java

@ -47,5 +47,12 @@ public interface BmsChannelPointMapper extends BaseMapper<BmsChannelPoint> {
@InterceptorIgnore(tenantLine = "1") @InterceptorIgnore(tenantLine = "1")
List<BmsChannelPoint> selectUserPointList4My(@Param("query") BmsChannelPoint param); List<BmsChannelPoint> selectUserPointList4My(@Param("query") BmsChannelPoint param);
/**
* 下属管理人
* @param param
* @return
*/
@InterceptorIgnore(tenantLine = "1")
List<BmsChannelPoint> selectUserPointList4MyUnder(@Param("query") BmsChannelPoint param);
} }

2
src/main/java/com/qs/serve/modules/bms/service/BmsChannelPointService.java

@ -21,6 +21,8 @@ public interface BmsChannelPointService extends IService<BmsChannelPoint> {
List<BmsChannelPoint> selectChannelPointMyList(BmsChannelPoint channelPoint); List<BmsChannelPoint> selectChannelPointMyList(BmsChannelPoint channelPoint);
List<BmsChannelPoint> selectChannelPointMyUnderList(BmsChannelPoint channelPoint);
List<BmsChannelPoint> listByBizRegionId(String id); List<BmsChannelPoint> listByBizRegionId(String id);
List<BmsChannelPoint> listBySaleRegionId(String id); List<BmsChannelPoint> listBySaleRegionId(String id);

5
src/main/java/com/qs/serve/modules/bms/service/impl/BmsChannelPointServiceImpl.java

@ -116,6 +116,11 @@ public class BmsChannelPointServiceImpl extends ServiceImpl<BmsChannelPointMappe
return baseMapper.selectUserPointList4My(channelPoint); return baseMapper.selectUserPointList4My(channelPoint);
} }
@Override
public List<BmsChannelPoint> selectChannelPointMyUnderList(BmsChannelPoint channelPoint) {
return baseMapper.selectUserPointList4MyUnder(channelPoint);
}
@Override @Override
public List<BmsChannelPoint> listByBizRegionId(String id) { public List<BmsChannelPoint> listByBizRegionId(String id) {
LambdaQueryWrapper<BmsChannelPoint> channelPointWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BmsChannelPoint> channelPointWrapper = new LambdaQueryWrapper<>();

1
src/main/java/com/qs/serve/modules/goods/controller/GoodsSkuController.java

@ -171,6 +171,7 @@ public class GoodsSkuController {
lqw2.eq(GoodsSkuSpecValue::getSkuId,id); lqw2.eq(GoodsSkuSpecValue::getSkuId,id);
goodsSkuSpecValueService.remove(lqw2); goodsSkuSpecValueService.remove(lqw2);
} }
return R.isTrue(result); return R.isTrue(result);
} }

6
src/main/java/com/qs/serve/modules/goods/mapper/GoodsSkuSpecValueMapper.java

@ -56,7 +56,11 @@ public interface GoodsSkuSpecValueMapper extends BaseMapper<GoodsSkuSpecValue> {
" ON `goods_sku_spec_value`.spec_value_id = `goods_spec_value`.`id` " + " ON `goods_sku_spec_value`.spec_value_id = `goods_spec_value`.`id` " +
" LEFT JOIN `goods_spec` " + " LEFT JOIN `goods_spec` " +
" ON `goods_spec_value`.`spec_id` = `goods_spec`.`id` " + " ON `goods_spec_value`.`spec_id` = `goods_spec`.`id` " +
" WHERE `goods_sku_spec_value`.`sku_id` = #{skuId}" + " WHERE " +
" `goods_sku_spec_value`.del_flag=0 " +
" and `goods_spec_value`.del_flag=0 " +
" and `goods_spec`.del_flag=0 " +
" and `goods_sku_spec_value`.`sku_id` = #{skuId}" +
" ORDER BY `goods_sku_spec_value`.`sort` DESC") " ORDER BY `goods_sku_spec_value`.`sort` DESC")
List<GoodsSkuSpecValueVo> listSpecValueBySkuId(@Param("skuId") Long skuId); List<GoodsSkuSpecValueVo> listSpecValueBySkuId(@Param("skuId") Long skuId);

9
src/main/java/com/qs/serve/modules/his/entity/HisUserChannelPoint.java

@ -15,7 +15,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.util.List;
/** /**
* 渠道站点 实体类 * 渠道站点 实体类
* @author YenHex * @author YenHex
@ -39,7 +39,7 @@ public class HisUserChannelPoint implements Serializable {
private Long pointId; private Long pointId;
/** 来源类型:0->网点负责人;1->行政区域;2->销售区域;3->渠道负责人 */ /** 来源类型:0->网点负责人;1->行政区域;2->销售区域;3->渠道负责人 */
@NotNull(message = "来源类型:0->我管理的;1->行政区域;2->销售区域不能为空") @NotNull(message = "来源类型不能为空")
private Integer sourceType; private Integer sourceType;
/** 来源id路径 */ /** 来源id路径 */
@ -84,6 +84,11 @@ public class HisUserChannelPoint implements Serializable {
@NotNull(message = "可投放费用不能为空") @NotNull(message = "可投放费用不能为空")
private Integer costFlag; private Integer costFlag;
@TableField(exist = false)
private List<String> sourceIdsList;
@TableField(exist = false)
private List<String> userIdList;
public static HisUserChannelPoint toNewObject(HisUserChannelPoint source){ public static HisUserChannelPoint toNewObject(HisUserChannelPoint source){
HisUserChannelPoint userChannelPoint = new HisUserChannelPoint(); HisUserChannelPoint userChannelPoint = new HisUserChannelPoint();

5
src/main/java/com/qs/serve/modules/his/mapper/HisUserChannelPointMapper.java

@ -2,7 +2,8 @@ package com.qs.serve.modules.his.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qs.serve.modules.his.entity.HisUserChannelPoint; import com.qs.serve.modules.his.entity.HisUserChannelPoint;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 渠道站点 Mapper * 渠道站点 Mapper
* @author YenHex * @author YenHex
@ -10,5 +11,7 @@ import com.qs.serve.modules.his.entity.HisUserChannelPoint;
*/ */
public interface HisUserChannelPointMapper extends BaseMapper<HisUserChannelPoint> { public interface HisUserChannelPointMapper extends BaseMapper<HisUserChannelPoint> {
List<HisUserChannelPoint> selectHisUserChannelPointList(@Param("query")HisUserChannelPoint query);
} }

12
src/main/java/com/qs/serve/modules/his/service/HisUserChannelPointService.java

@ -11,6 +11,18 @@ import java.util.List;
*/ */
public interface HisUserChannelPointService extends IService<HisUserChannelPoint> { public interface HisUserChannelPointService extends IService<HisUserChannelPoint> {
/**
* 渠道id
* @param channelId
*/
void removeByChannelId(Long channelId);
/**
* 渠道id
* @param channelId
*/
void flushByChannelId(Long channelId);
/** /**
* 删除 * 删除
* @param pointId * @param pointId

35
src/main/java/com/qs/serve/modules/his/service/impl/HisUserChannelPointServiceImpl.java

@ -37,6 +37,41 @@ public class HisUserChannelPointServiceImpl extends ServiceImpl<HisUserChannelPo
private final BmsRegionMapper regionMapper; private final BmsRegionMapper regionMapper;
private final BmsRegion2Mapper region2Mapper; private final BmsRegion2Mapper region2Mapper;
@Override
public void removeByChannelId(Long channelId) {
LambdaQueryWrapper<HisUserChannelPoint> lqwPoint = new LambdaQueryWrapper<>();
lqwPoint.eq(HisUserChannelPoint::getSourceType,3);
lqwPoint.eq(HisUserChannelPoint::getSourceIds,channelId);
this.remove(lqwPoint);
}
@Override
public void flushByChannelId(Long channelId) {
this.removeByChannelId(channelId);
LambdaQueryWrapper<BmsMasterUser> mgrLqw = new LambdaQueryWrapper<>();
mgrLqw.eq(BmsMasterUser::getType, MasterUserType.Channel);
mgrLqw.eq(BmsMasterUser::getTargetId,channelId);
List<BmsMasterUser> masterUsers = masterUserMapper.selectList(mgrLqw);
if(masterUsers.size()>0){
LambdaQueryWrapper<BmsChannelPoint> pointLqw = new LambdaQueryWrapper<>();
pointLqw.eq(BmsChannelPoint::getChannelId,channelId);
pointLqw.select(BmsChannelPoint::getId);
List<BmsChannelPoint> channelPointList = channelPointMapper.selectList(pointLqw);
List<HisUserChannelPoint> saveList = new ArrayList<>();
for (BmsChannelPoint channelPoint : channelPointList) {
for (BmsMasterUser masterUser : masterUsers) {
HisUserChannelPoint userChannelPoint = new HisUserChannelPoint();
userChannelPoint.setUserId(masterUser.getUserId());
userChannelPoint.setPointId(channelPoint.getId());
userChannelPoint.setSourceType(3);
saveList.add(userChannelPoint);
}
}
if(CollectionUtil.isNotEmpty(saveList)){
this.saveBatch(saveList);
}
}
}
@Override @Override
public void removeByPointId(Long pointId) { public void removeByPointId(Long pointId) {

71
src/main/java/com/qs/serve/modules/sys/service/impl/SysUserServiceImpl.java

@ -114,31 +114,54 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
} }
List<String> authorCodes = new ArrayList<>(); List<String> authorCodes = new ArrayList<>();
List<String> menuIds = new ArrayList<>(); List<String> menuIds = new ArrayList<>();
if(sysUser.getSuperFlag().equals(1)){ //以下细分到权限和菜单
List<SysPermit> sysRolePermits = sysPermitService.listByCache(); // if(sysUser.getSuperFlag().equals(1)){
authorCodes = sysRolePermits.stream().map(SysPermit::getCode).distinct().collect(Collectors.toList()); // List<SysPermit> sysRolePermits = sysPermitService.listByCache();
menuIds = sysMenuMapper.searchMenuIds(); // authorCodes = sysRolePermits.stream().map(SysPermit::getCode).distinct().collect(Collectors.toList());
}else { // menuIds = sysMenuMapper.searchMenuIds();
List<SysUserRole> userRoles = sysUserRoleService.listByUid(sysUser.getId()); // }else {
List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).distinct().collect(Collectors.toList()); // List<SysUserRole> userRoles = sysUserRoleService.listByUid(sysUser.getId());
//添加默认的角色ID // List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).distinct().collect(Collectors.toList());
List<SysRole> defaultRole = sysRoleService.getDefaultRole(); // //添加默认的角色ID
List<String> defaultRoleIds = defaultRole.stream().map(SysRole::getId).collect(Collectors.toList()); // List<SysRole> defaultRole = sysRoleService.getDefaultRole();
roleIds.addAll(defaultRoleIds); // List<String> defaultRoleIds = defaultRole.stream().map(SysRole::getId).collect(Collectors.toList());
List<SysRole> sysRoles = sysRoleService.getEnableByIds(roleIds); // roleIds.addAll(defaultRoleIds);
List<SysPermit> sysRolePermits = new ArrayList<>(); // List<SysRole> sysRoles = sysRoleService.getEnableByIds(roleIds);
if(CollectionUtil.isNotEmpty(sysRoles)){ // List<SysPermit> sysRolePermits = new ArrayList<>();
//listPermitCode // if(CollectionUtil.isNotEmpty(sysRoles)){
sysRolePermits = sysRoleMenuMapper.listPermitCode(sysRoles.stream().map(SysRole::getId).collect(Collectors.toList())); // //listPermitCode
} // sysRolePermits = sysRoleMenuMapper.listPermitCode(sysRoles.stream().map(SysRole::getId).collect(Collectors.toList()));
for (SysPermit sysRolePermit : sysRolePermits) { // }
if(sysRolePermit==null){continue;} // for (SysPermit sysRolePermit : sysRolePermits) {
authorCodes.add(sysRolePermit.getCode()); // if(sysRolePermit==null){continue;}
} // authorCodes.add(sysRolePermit.getCode());
menuIds = sysMenuMapper.searchUserMenuIds(sysUser.getId()); // }
List<String> defaultRoleMenuIds = sysMenuMapper.searchDefaultMenuIds(defaultRoleIds); // menuIds = sysMenuMapper.searchUserMenuIds(sysUser.getId());
menuIds.addAll(defaultRoleMenuIds); // List<String> defaultRoleMenuIds = sysMenuMapper.searchDefaultMenuIds(defaultRoleIds);
// menuIds.addAll(defaultRoleMenuIds);
// }
List<SysPermit> sysRolePermits = sysPermitService.listByCache();
authorCodes = sysRolePermits.stream().map(SysPermit::getCode).distinct().collect(Collectors.toList());
List<SysUserRole> userRoles = sysUserRoleService.listByUid(sysUser.getId());
List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).distinct().collect(Collectors.toList());
//添加默认的角色ID
List<SysRole> defaultRole = sysRoleService.getDefaultRole();
List<String> defaultRoleIds = defaultRole.stream().map(SysRole::getId).collect(Collectors.toList());
roleIds.addAll(defaultRoleIds);
for (SysPermit sysRolePermit : sysRolePermits) {
if(sysRolePermit==null){continue;}
authorCodes.add(sysRolePermit.getCode());
} }
menuIds = sysMenuMapper.searchUserMenuIds(sysUser.getId());
List<String> defaultRoleMenuIds = sysMenuMapper.searchDefaultMenuIds(defaultRoleIds);
menuIds.addAll(defaultRoleMenuIds);
LoginUserType userType = sysUser.getSuperFlag()==0?LoginUserType.SYS_USER:LoginUserType.SYS_SUP_USER; LoginUserType userType = sysUser.getSuperFlag()==0?LoginUserType.SYS_USER:LoginUserType.SYS_SUP_USER;
return new LoginUser(sysUser.getId(),sysUser.getName(),sysUser.getPassword(), ServletUtils.getIp(null),userType,authorCodes,menuIds,sysUser.getTenantId()); return new LoginUser(sysUser.getId(),sysUser.getName(),sysUser.getPassword(), ServletUtils.getIp(null),userType,authorCodes,menuIds,sysUser.getTenantId());
} }

1
src/main/java/com/qs/serve/modules/third/PortalFormPushController.java

@ -83,6 +83,7 @@ public class PortalFormPushController {
wxPushService.sendWxMsg(wxUser,"表单通知",wxSmsNewForm,true,entity.getId()); wxPushService.sendWxMsg(wxUser,"表单通知",wxSmsNewForm,true,entity.getId());
WxFormPushUser pushUser = new WxFormPushUser(); WxFormPushUser pushUser = new WxFormPushUser();
pushUser.setFormPushId(entity.getId()); pushUser.setFormPushId(entity.getId());
pushUser.setFormTitle(entity.getTitle());
pushUser.setUserId(wxUser.getSysUserId()); pushUser.setUserId(wxUser.getSysUserId());
pushUser.setUserCode(wxUser.getSysUserCode()); pushUser.setUserCode(wxUser.getSysUserCode());
pushUser.setUserName(wxUser.getEmpName()); pushUser.setUserName(wxUser.getEmpName());

12
src/main/java/com/qs/serve/modules/wx/api/WxSvcUserApi.java

@ -2,6 +2,7 @@ package com.qs.serve.modules.wx.api;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qs.serve.common.framework.redis.RedisService; import com.qs.serve.common.framework.redis.RedisService;
import com.qs.serve.common.framework.security.model.LoginUser;
import com.qs.serve.common.model.annotation.LimitSubmit; import com.qs.serve.common.model.annotation.LimitSubmit;
import com.qs.serve.common.model.annotation.SysLog; import com.qs.serve.common.model.annotation.SysLog;
import com.qs.serve.common.model.consts.RedisCacheKeys; import com.qs.serve.common.model.consts.RedisCacheKeys;
@ -11,7 +12,9 @@ import com.qs.serve.common.model.enums.InterType;
import com.qs.serve.common.util.AuthContextUtils; import com.qs.serve.common.util.AuthContextUtils;
import com.qs.serve.common.util.IdUtil; import com.qs.serve.common.util.IdUtil;
import com.qs.serve.modules.base.TencentYunSmsService; import com.qs.serve.modules.base.TencentYunSmsService;
import com.qs.serve.modules.sys.entity.SysDept;
import com.qs.serve.modules.sys.entity.SysUser; import com.qs.serve.modules.sys.entity.SysUser;
import com.qs.serve.modules.sys.entity.dto.SysUserVo;
import com.qs.serve.modules.sys.service.SysUserService; import com.qs.serve.modules.sys.service.SysUserService;
import com.qs.serve.modules.wx.entity.WxUser; import com.qs.serve.modules.wx.entity.WxUser;
import com.qs.serve.modules.wx.entity.dto.WxPhoneBindParam; import com.qs.serve.modules.wx.entity.dto.WxPhoneBindParam;
@ -43,7 +46,13 @@ public class WxSvcUserApi {
*/ */
@GetMapping("/info") @GetMapping("/info")
public R<?> info(){ public R<?> info(){
LoginUser loginUser = AuthContextUtils.getLoginUser();
WxUser wxUser = wxUserService.getCurrentWxUser(true); WxUser wxUser = wxUserService.getCurrentWxUser(true);
SysUser sysUser = sysUserService.getById(loginUser.getUserId());
sysUser.setAuthorIds(loginUser.getAuthorIds());
sysUser.setAuthorList(loginUser.getAuthorList());
SysUserVo sysUserVo = sysUser.toSysUserVo(false);
wxUser.setSysUserInfo(sysUserVo);
return R.ok(wxUser); return R.ok(wxUser);
} }
@ -95,7 +104,8 @@ public class WxSvcUserApi {
wxUser.setSysUserId(sysUser.getId()); wxUser.setSysUserId(sysUser.getId());
wxUser.setSysUserCode(sysUser.getCode()); wxUser.setSysUserCode(sysUser.getCode());
wxUserService.updateById(wxUser); wxUserService.updateById(wxUser);
//便于多设备登陆
redisService.remove(key);
return R.ok(); return R.ok();
} }

6
src/main/java/com/qs/serve/modules/wx/controller/WxFormPushController.java

@ -80,7 +80,7 @@ public class WxFormPushController {
* @param param * @param param
* @return * @return
*/ */
//@PostMapping("/updateById") @PostMapping("/updateById")
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.UPDATE) @SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.UPDATE)
@PreAuthorize("hasRole('wx:formPush:update')") @PreAuthorize("hasRole('wx:formPush:update')")
public R<?> updateById(@RequestBody @Valid WxFormPushBo param){ public R<?> updateById(@RequestBody @Valid WxFormPushBo param){
@ -94,7 +94,7 @@ public class WxFormPushController {
* @param param * @param param
* @return * @return
*/ */
//@PostMapping("/save") @PostMapping("/save")
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.INSERT) @SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.INSERT)
@PreAuthorize("hasRole('wx:formPush:insert')") @PreAuthorize("hasRole('wx:formPush:insert')")
public R<?> save(@RequestBody @Valid WxFormPushBo param){ public R<?> save(@RequestBody @Valid WxFormPushBo param){
@ -108,7 +108,7 @@ public class WxFormPushController {
* @param ids * @param ids
* @return * @return
*/ */
//@DeleteMapping("/deleteById/{ids}") @DeleteMapping("/deleteById/{ids}")
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.DELETE) @SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.DELETE)
public R<?> deleteById(@PathVariable("ids") String ids){ public R<?> deleteById(@PathVariable("ids") String ids){
List<Long> idsLong = StringUtils.splitIdLong(ids); List<Long> idsLong = StringUtils.splitIdLong(ids);

61
src/main/java/com/qs/serve/modules/wx/controller/my/WxFormPushMyController.java

@ -0,0 +1,61 @@
package com.qs.serve.modules.wx.controller.my;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qs.serve.common.model.annotation.SysLog;
import com.qs.serve.common.model.dto.PageVo;
import com.qs.serve.common.model.dto.R;
import com.qs.serve.common.model.enums.BizType;
import com.qs.serve.common.model.enums.SystemModule;
import com.qs.serve.common.util.CopierUtil;
import com.qs.serve.common.util.PageUtil;
import com.qs.serve.common.util.StringUtils;
import com.qs.serve.modules.wx.entity.WxFormPush;
import com.qs.serve.modules.wx.entity.WxFormPushUser;
import com.qs.serve.modules.wx.entity.bo.WxFormPushBo;
import com.qs.serve.modules.wx.service.WxFormPushService;
import com.qs.serve.modules.wx.service.WxFormPushUserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
/**
* 微信 表单推送(我的)
* @author YenHex
* @since 2023-04-19
*/
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("my/formPush")
public class WxFormPushMyController {
private WxFormPushService wxFormPushService;
private WxFormPushUserService wxFormPushUserService;
/**
* 列表
* @param param
* @return
*/
@GetMapping("/page")
public R<List<WxFormPush>> getList(WxFormPushUser param){
LambdaQueryWrapper<WxFormPushUser> lqw = new LambdaQueryWrapper<>(param);
PageUtil.startPage();
List<WxFormPushUser> list = wxFormPushUserService.list(lqw);
List<WxFormPush> result = new ArrayList<>();
for (WxFormPushUser pushUser : list) {
WxFormPush formPush = wxFormPushService.getById(pushUser.getFormPushId());
formPush.setReadFlag(pushUser.getReadFlag());
result.add(formPush);
}
return R.ok(result);
}
}

3
src/main/java/com/qs/serve/modules/wx/entity/WxFormPush.java

@ -90,6 +90,9 @@ public class WxFormPush implements Serializable {
@JsonProperty @JsonProperty
private String delFlag; private String delFlag;
/** 是否已读 */
@TableField(exist = false)
private Integer readFlag;
public static WxFormPush toNewObject(WxFormPush source){ public static WxFormPush toNewObject(WxFormPush source){
WxFormPush formPush = new WxFormPush(); WxFormPush formPush = new WxFormPush();

3
src/main/java/com/qs/serve/modules/wx/entity/WxFormPushUser.java

@ -35,6 +35,9 @@ public class WxFormPushUser implements Serializable {
@Length(max = 36,message = "推送id长度不能超过36字") @Length(max = 36,message = "推送id长度不能超过36字")
private String formPushId; private String formPushId;
@TableField(condition = SqlCondition.LIKE)
private String formTitle;
/** 用户id */ /** 用户id */
@Length(max = 64,message = "用户id长度不能超过64字") @Length(max = 64,message = "用户id长度不能超过64字")
private String userId; private String userId;

3
src/main/java/com/qs/serve/modules/wx/entity/WxUser.java

@ -146,5 +146,8 @@ public class WxUser implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Integer notBindFlag; private Integer notBindFlag;
@TableField(exist = false)
private Object sysUserInfo;
} }

60
src/main/resources/mapper/bms/BmsChannelPointMapper.xml

@ -146,7 +146,65 @@
<select id="selectUserPointList4My" resultType="com.qs.serve.modules.bms.entity.BmsChannelPoint"> <select id="selectUserPointList4My" resultType="com.qs.serve.modules.bms.entity.BmsChannelPoint">
SELECT SELECT
<include refid="bmsChannelPointSql"/> <include refid="bmsChannelPointSql"/>
FROM ( SELECT DISTINCT mu.point_id target_id FROM `his_user_channel_point` mu WHERE del_flag = 0 AND user_id = #{query.userId} AND tenant_id = #{query.tenantId} ) pmu FROM (
SELECT DISTINCT mu.point_id target_id FROM `his_user_channel_point` mu WHERE del_flag = 0 AND user_id = #{query.userId} AND tenant_id = #{query.tenantId}
) pmu
LEFT JOIN `bms_channel_point` `bms_channel_point` ON `bms_channel_point`.id = pmu.target_id
<if test="query.supplierId!=null and query.supplierId!=''">
LEFT JOIN bms_supplier_channel ON bms_supplier_channel.`channel_id` = `bms_channel_point`.`channel_id`
</if>
<where>
and `bms_channel_point`.`del_flag` = 0
<if test="query.supplierId!=null and query.supplierId!=''">
and bms_supplier_channel.`supplier_id` = #{query.supplierId} and bms_supplier_channel.`del_flag` = 0
</if>
<if test="query.id != null"> and `bms_channel_point`.`id` = #{query.id}</if>
<if test="query.channelId != null"> and `bms_channel_point`.`channel_id` = #{query.channelId}</if>
<if test="query.channelName != null and query.channelName != ''"> and `bms_channel_point`.`channel_name` like concat('%',#{query.channelName},'%') </if>
<if test="query.pointCode != null and query.pointCode != ''"> and `bms_channel_point`.`point_code` like concat('%',#{query.pointCode},'%') </if>
<if test="query.pointName != null and query.pointName != ''"> and `bms_channel_point`.`point_name` like concat('%',#{query.pointName},'%') </if>
<if test="query.shopArea != null and query.shopArea != ''"> and `bms_channel_point`.`shop_area` = #{query.shopArea}</if>
<if test="query.countCheckstand != null"> and `bms_channel_point`.`count_checkstand` = #{query.countCheckstand}</if>
<if test="query.pointLevel != null and query.pointLevel != ''"> and `bms_channel_point`.`point_level` = #{query.pointLevel}</if>
<if test="query.pointType != null and query.pointType != ''"> and `bms_channel_point`.`point_type` like concat('%',#{query.pointType},'%') </if>
<if test="query.address != null and query.address != ''"> and `bms_channel_point`.`address` = #{query.address}</if>
<if test="query.saleRegionId != null and query.saleRegionId != ''"> and `bms_channel_point`.`sale_region_id` = #{query.saleRegionId}</if>
<if test="query.saleRegionPath != null and query.saleRegionPath != ''"> and `bms_channel_point`.`sale_region_path` like concat('%',#{query.saleRegionPath},'%') </if>
<if test="query.saleRegionPathIds != null and query.saleRegionPathIds != ''"> and `bms_channel_point`.`sale_region_path_ids` = #{query.saleRegionPathIds}</if>
<if test="query.bizRegionId != null and query.bizRegionId != ''"> and `bms_channel_point`.`biz_region_id` = #{query.bizRegionId}</if>
<if test="query.bizRegionPath != null and query.bizRegionPath != ''"> and `bms_channel_point`.`biz_region_path` like concat('%',#{query.bizRegionPath},'%') </if>
<if test="query.bizRegionPathIds != null and query.bizRegionPathIds != ''"> and `bms_channel_point`.`biz_region_path_ids` = #{query.bizRegionPathIds}</if>
<if test="query.remark != null and query.remark != ''"> and `bms_channel_point`.`remark` = #{query.remark}</if>
</where>
ORDER BY
bms_channel_point.id
</select>
<select id="selectUserPointList4MyUnder" resultType="com.qs.serve.modules.bms.entity.BmsChannelPoint">
SELECT
<include refid="bmsChannelPointSql"/>
FROM (
SELECT DISTINCT mu.point_id target_id
FROM `his_user_channel_point` mu
WHERE `his_user_channel_point`.del_flag = 0
AND (
<if test="query.userIdList!=null and query.userIdList.size > 0">
`his_user_channel_point`.user_id in
<foreach collection="query.userIdList" item="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.sourceIdsList!=null and query.sourceIdsList.size > 0">
<if test="query.userIdList!=null and query.userIdList.size > 0">
or
</if>
<foreach collection="query.sourceIdsList" item="selectId" index="i" open="(" close=")" separator="or">
`his_user_channel_point`.`source_ids` like concat(#{selectId},"_")
</foreach>
</if>
)
AND `his_user_channel_point`.tenant_id = #{query.tenantId}
) pmu
LEFT JOIN `bms_channel_point` `bms_channel_point` ON `bms_channel_point`.id = pmu.target_id LEFT JOIN `bms_channel_point` `bms_channel_point` ON `bms_channel_point`.id = pmu.target_id
<if test="query.supplierId!=null and query.supplierId!=''"> <if test="query.supplierId!=null and query.supplierId!=''">
LEFT JOIN bms_supplier_channel ON bms_supplier_channel.`channel_id` = `bms_channel_point`.`channel_id` LEFT JOIN bms_supplier_channel ON bms_supplier_channel.`channel_id` = `bms_channel_point`.`channel_id`

2
src/main/resources/mapper/goods/GoodsSkuMapper.xml

@ -99,6 +99,8 @@
FROM `goods_sku` `goods_sku` FROM `goods_sku` `goods_sku`
LEFT JOIN `goods_spu` ON `goods_sku`.`spu_id` = `goods_spu`.id LEFT JOIN `goods_spu` ON `goods_sku`.`spu_id` = `goods_spu`.id
<where> <where>
and `goods_sku`.`del_flag` = 0
and `goods_spu`.`del_flag` = 0
<if test="query.id != null"> and `goods_sku`.`id` = #{query.id}</if> <if test="query.id != null"> and `goods_sku`.`id` = #{query.id}</if>
<if test="query.skuCode != null and query.skuCode != ''"> and `goods_sku`.`sku_code` = #{query.skuCode}</if> <if test="query.skuCode != null and query.skuCode != ''"> and `goods_sku`.`sku_code` = #{query.skuCode}</if>
<if test="query.spuId != null"> and `goods_sku`.`spu_id` = #{query.spuId}</if> <if test="query.spuId != null"> and `goods_sku`.`spu_id` = #{query.spuId}</if>

75
src/main/resources/mapper/his/HisUserChannelPointMapper.xml

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qs.serve.modules.his.mapper.HisUserChannelPointMapper">
<resultMap id="hisUserChannelPointMap" type="com.qs.serve.modules.his.entity.HisUserChannelPoint" >
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="pointId" column="point_id"/>
<result property="sourceType" column="source_type"/>
<result property="sourceIds" column="source_ids"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="tenantId" column="tenant_id"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="costFlag" column="cost_flag"/>
</resultMap>
<sql id="hisUserChannelPointSql">
his_user_channel_point.`id`,
his_user_channel_point.`user_id`,
his_user_channel_point.`point_id`,
his_user_channel_point.`source_type`,
his_user_channel_point.`source_ids`,
his_user_channel_point.`remark`,
his_user_channel_point.`create_time`,
his_user_channel_point.`update_time`,
his_user_channel_point.`tenant_id`,
his_user_channel_point.`del_flag`,
his_user_channel_point.`create_by`,
his_user_channel_point.`update_by`,
his_user_channel_point.`cost_flag` </sql>
<select id="selectHisUserChannelPointList" parameterType="com.qs.serve.modules.his.entity.HisUserChannelPoint" resultMap="hisUserChannelPointMap">
SELECT <include refid="hisUserChannelPointSql"/> FROM `his_user_channel_point` `his_user_channel_point`
<where>
and `his_user_channel_point`.`cost_flag` = 0
<if test="query.id != null"> and `his_user_channel_point`.`id` = #{query.id}</if>
<if test="query.userId != null and query.userId != ''"> and `his_user_channel_point`.`user_id` = #{query.userId}</if>
<if test="query.pointId != null"> and `his_user_channel_point`.`point_id` = #{query.pointId}</if>
<if test="query.sourceType != null"> and `his_user_channel_point`.`source_type` = #{query.sourceType}</if>
<if test="query.sourceIds != null and query.sourceIds != ''"> and `his_user_channel_point`.`source_ids` = #{query.sourceIds}</if>
<if test="query.remark != null and query.remark != ''"> and `his_user_channel_point`.`remark` = #{query.remark}</if>
<if test="query.createTime != null"> and `his_user_channel_point`.`create_time` = #{query.createTime}</if>
<if test="query.updateTime != null"> and `his_user_channel_point`.`update_time` = #{query.updateTime}</if>
<if test="query.tenantId != null and query.tenantId != ''"> and `his_user_channel_point`.`tenant_id` = #{query.tenantId}</if>
<if test="query.createBy != null and query.createBy != ''"> and `his_user_channel_point`.`create_by` = #{query.createBy}</if>
<if test="query.updateBy != null and query.updateBy != ''"> and `his_user_channel_point`.`update_by` = #{query.updateBy}</if>
<if test="query.costFlag != null"> and `his_user_channel_point`.`cost_flag` = #{query.costFlag}</if>
<if test="query.sourceIdsList!=null and query.sourceIdsList.size > 0">
and
<foreach collection="query.sourceIdsList" item="selectId" index="i" open="(" close=")" separator=",">
<if test="idx!=0">
or
</if>
`his_user_channel_point`.`source_ids` like concat(#{selectId},"_")
</foreach>
</if>
<if test="query.userIdList!=null and query.userIdList.size > 0">
and `his_user_channel_point`.`user_id` in
<foreach collection="query.userIdList" item="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save