提交 8b2e59d6 编写于 作者: 水库浪子

企业用户登录系统客户数据权限处理;素材分类删除BUG修复;素材上传BUG修复

上级 a11bd69a
package com.linkwechat.web.controller.wecom;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController;
......@@ -78,21 +79,23 @@ public class WeCategoryController extends BaseController {
/**
* 删除类目
*/
// @PreAuthorize("@ss.hasPermi('wechat:category:remove')")
// @PreAuthorize("@ss.hasPermi('wechat:category:remove')") Constants.DELETE_CODE
@Log(title = "删除类目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除类目")
public AjaxResult remove(@PathVariable Long[] ids) {
List<WeCategory> categorys=new ArrayList<>();
for (Long id:ids) {
categorys.add(
WeCategory.builder()
.id(id)
.delFlag(Constants.DELETE_CODE)
.build()
);
}
weCategoryService.updateBatchById(categorys);
weCategoryService.deleteWeCategoryById(ids);
// List<WeCategory> categorys=new ArrayList<>();
// for (Long id:ids) {
// categorys.add(
// WeCategory.builder()
// .id(id)
// .delFlag("55")
// .build()
// );
// }
// weCategoryService.updateBatchById(categorys);
return AjaxResult.success();
}
......
......@@ -154,7 +154,7 @@ public class WeMaterialController extends BaseController {
// weMediaDto.setFileName(file.getResource().getFilename());
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, MediaType.IMAGE.getType());
weMediaDto.setFileName(weMaterialFileVO.getMaterialName());
weMediaDto.setUrl(weMaterialFileVO.getMaterialUrl());
weMediaDto.setUrl(weMaterialFileVO.getMaterialUrl()+weMaterialFileVO.getMaterialName());
return AjaxResult.success(weMediaDto);
}
......
......@@ -102,9 +102,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://127.0.0.1:3306/link-wechat-prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://127.0.0.1:10179/lw-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
password: root
# 从库数据源
slave:
# 从数据源开关/默认关闭
......@@ -247,8 +247,8 @@ xss:
elasticsearch:
schema: http
address:
userName:
password:
userName: "elastic"
password: "0p-0p-0p-"
connectTimeout: 10000
socketTimeout: 10000
connectionRequestTimeout: 10000
......@@ -323,13 +323,13 @@ wecome:
- we_tag_group
#企微回调通知配置
callBack:
appIdOrCorpId: ww38152475d1bca752
token: Fm05d6n0NpuFrvOlgVxIbeSXtjgz
encodingAesKey: laevP8xCEG7BUqv5GuYXfg9HaRecxe4MU5F5cmnAI7n
appIdOrCorpId:
token:
encodingAesKey:
# JS SDK 身份校验url
authorizeUrl: https://open.weixin.qq.com/connect/oauth2/authorize
authorizeUrl:
# JS SDK身份校验成功后的redirect url
authorizeRedirectUrl: http://linkwechat.cn/mobile/#/task
authorizeRedirectUrl:
weixin:
appid:
......
......@@ -50,6 +50,9 @@ public class SysUser extends BaseEntity
/** 用户类型(00系统用户)(11:企业微信用户) */
private String userType;
/**当前微信用户对应微信端的id*/
private String weUserId;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
......
package com.linkwechat.framework.web.service;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.constant.Constants;
......@@ -26,6 +27,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -71,7 +73,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
if (StringUtils.isNull(user))
{
// //查询企业管理相关账号
//查询企业管理相关账号
WeCorpAccount weCorpByAccount = iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
if(null != weCorpByAccount){
......@@ -87,31 +89,31 @@ public class UserDetailsServiceImpl implements UserDetailsService
.build();
} else{
//we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中
WeUser weUser
= new WeUser();
try {
weUser=iWeUserService.getOne(new LambdaQueryWrapper<WeUser>()
.eq(WeUser::getUserId,username));
}catch (Exception e){
e.printStackTrace();
}
WeUser weUser=iWeUserService.getOne(new LambdaQueryWrapper<WeUser>()
.eq(WeUser::getMobile,username)
.ne(WeUser::getIsActivate,new Integer(6)));
if(null == weUser){
throw new BaseException("对不起,您的账号:" + username + " 不存在");
}
if(StrUtil.isBlank(weUser.getMobile())){
throw new BaseException("请填写当前企业员工的手机号:" + username + " 然后再登录");
}
//注册到we_user表中
user=SysUser.builder()
.userName(weUser.getUserId())
.userName(username)
.nickName(weUser.getName())
.userType(Constants.USER_TYPE_WECOME)
.email(weUser.getEmail())
.phonenumber(weUser.getMobile())
.sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString())
.avatar(weUser.getAvatarMediaid())
.weUserId(weUser.getUserId())
.roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_ROLE_KEY)
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
.build();
}
if(user != null){
......
......@@ -50,7 +50,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @return 角色数据集合信息
*/
@Override
@DataScope(deptAlias = "d")
// @DataScope(deptAlias = "d")
public List<SysRole> selectRoleList(SysRole role)
{
return roleMapper.selectRoleList(role);
......
......@@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="weUserId" column="we_user_id" />
<result property="userType" column="user_type"/>
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
......@@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
select u.user_id, u.we_user_id,u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,u.user_type,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
......@@ -57,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id,u.we_user_id,u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userName != null and userName != ''">
......@@ -119,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="weUserId != null and weUserId != ''">we_user_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
......@@ -134,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="weUserId != null and weUserId != ''">#{weUserId},</if>
sysdate()
)
</insert>
......
......@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WeCategoryMapper extends BaseMapper<WeCategory> {
void deleteWeCategoryById(Long[] ids);
}
......@@ -34,6 +34,8 @@ public interface IWeCategoryService extends IService<WeCategory> {
*/
List<? extends Tree<?>> findWeCategoryByMediaType(@Param("mediaType") String mediaType);
void deleteWeCategoryById(Long[] ids);
}
......@@ -34,7 +34,7 @@ public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCatego
if (null != weCategory) {
throw new WeComException("名称已存在!");
}
category.setCreateTime(DateUtil.date());
// category.setCreateTime(DateUtil.date());
category.setId(SnowFlakeUtil.nextId());
this.save(category);
}
......@@ -50,7 +50,7 @@ public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCatego
if (null != weCategory) {
throw new WeComException("名称已存在!");
}
category.setUpdateTime(DateUtil.date());
// category.setUpdateTime(DateUtil.date());
this.updateById(category);
}
......@@ -74,6 +74,10 @@ public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCatego
return TreeUtil.build(weCategoryVos);
}
@Override
public void deleteWeCategoryById(Long[] ids) {
this.baseMapper.deleteWeCategoryById(ids);
}
}
......@@ -117,7 +117,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
//当前登录用户为企业用户
if(Constants.USER_TYPE_WECOME
.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
weCustomer.setUserIds((SecurityUtils.getLoginUser().getUser().getUserName()));
weCustomer.setUserIds((SecurityUtils.getLoginUser().getUser().getWeUserId()));
}
return weCustomerMapper.selectWeCustomerList(weCustomer);
......@@ -478,7 +478,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
public List<WeUser> getCustomersByUserId(String externalUserid) {
String userId=null;
if(Constants.USER_TYPE_WECOME.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
userId=SecurityUtils.getLoginUser().getUser().getUserName();
userId=SecurityUtils.getLoginUser().getUser().getWeUserId();
}
return this.baseMapper.getCustomersByUserId(externalUserid,userId);
}
......
......@@ -46,7 +46,7 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
private WeMediaClient weMediaClient;
@Autowired
private CosConfig cosConfig;
private RuoYiConfig ruoYiConfig;
@Override
public WeMaterialFileVO uploadWeMaterialFile(MultipartFile file, String type) {
......@@ -79,7 +79,7 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
//构造返回结果
// return WeMaterialFileVO.builder().materialUrl(url).materialName(file.getOriginalFilename()).build();
return WeMaterialFileVO.builder().materialUrl(cosConfig.getImgUrlPrefix()).materialName(FileUploadUtils.upload2Cos(file, cosConfig)).build();
return WeMaterialFileVO.builder().materialUrl(ruoYiConfig.getFile().getImgUrlPrefix()).materialName(FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos())).build();
} catch (Exception e) {
throw new WeComException(e.getMessage());
}
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.ServerConfig;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.img.ImageUtils;
......@@ -15,6 +16,7 @@ import com.linkwechat.wecom.service.IWePosterFontService;
import com.linkwechat.wecom.service.IWePosterService;
import com.linkwechat.wecom.service.IWePosterSubassemblyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -37,23 +39,27 @@ import java.util.stream.Collectors;
@Service
public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> implements IWePosterService {
@Resource
private WePosterMapper wePosterMapper;
// @Resource
// private WePosterMapper wePosterMapper;
@Resource
@Autowired
private IWePosterSubassemblyService posterSubassemblyService;
@Resource
@Autowired
private IWePosterFontService posterFontService;
@Resource
private ServerConfig serverConfig;
@Resource
private IWeCategoryService weCategoryService;
@Autowired
private RuoYiConfig ruoYiConfig;
@Resource
private CosConfig cosConfig;
// @Resource
// private ServerConfig serverConfig;
//
// @Resource
// private IWeCategoryService weCategoryService;
// @Resource
// private CosConfig cosConfig;
/**
* 查询一条
......@@ -136,6 +142,8 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
.collect(Collectors.toMap(wePosterSubassembly -> {
return wePosterSubassembly.getFontId() + "_" + wePosterSubassembly.getFontSize() + "_" + wePosterSubassembly.getFontStyle();
}, wePosterSubassembly -> posterFontService.getFont(wePosterSubassembly.getFontId(), wePosterSubassembly.getFontSize(), wePosterSubassembly.getFontStyle())));
Map<String, NetFileUtils.FileCallable> fileCallableMap = poster.getPosterSubassemblyList().stream().map(WePosterSubassembly::getImgPath).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toMap(s -> s, NetFileUtils::getNetFile));
if (CollectionUtils.isEmpty(fileCallableMap)) {
fileCallableMap = new HashMap<>();
......@@ -193,8 +201,8 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
ImageIO.write(backgroundImg, "png", byteArrayOutputStream);
NetFileUtils.StreamMultipartFile streamMultipartFile = new NetFileUtils.StreamMultipartFile(System.currentTimeMillis() + ".jpg", byteArrayOutputStream.toByteArray());
byteArrayOutputStream.close();
String path = FileUploadUtils.upload2Cos(streamMultipartFile, cosConfig);
poster.setSampleImgPath(cosConfig.getImgUrlPrefix() + path);
String path = FileUploadUtils.upload2Cos(streamMultipartFile, ruoYiConfig.getFile().getCos());
poster.setSampleImgPath(ruoYiConfig.getFile().getImgUrlPrefix() + path);
return poster.getSampleImgPath();
} catch (IOException e) {
e.printStackTrace();
......
......@@ -5,4 +5,14 @@
<mapper namespace="com.linkwechat.wecom.mapper.WeCategoryMapper">
<select id="deleteWeCategoryById">
UPDATE we_category
set del_flag=2
<where>
id in
<foreach collection="array" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -276,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
DISTINCT wt.`name` as tagName,
wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册