标签模块开发,积分流水增加用户ID字段,平台参数前端页面开发

master
elliott 2 years ago
parent f13460cc40
commit 113dc648a0

@ -0,0 +1,213 @@
package com.flossom.common.core.domain.entity;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
/**
* sys_dept
*
* @author flossom
*/
public class SysTag extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 标签ID */
private Long id;
/** 父标签ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 标签名称 */
private String tagName;
/** 显示顺序 */
private Integer orderNum;
/** 负责人 */
private String leader;
/** 联系电话 */
private String phone;
/** 邮箱 */
private String email;
/** 标签状态:0正常,1停用 */
private String status;
/** 标签状态:1小程序标签,2企微标签 */
private String type;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 父标签名称 */
private String parentName;
/** 子标签 */
private List<SysTag> children = new ArrayList<SysTag>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public String getAncestors()
{
return ancestors;
}
public void setAncestors(String ancestors)
{
this.ancestors = ancestors;
}
@NotBlank(message = "标签名称不能为空")
@Size(min = 0, max = 30, message = "标签名称长度不能超过30个字符")
public String getTagName()
{
return tagName;
}
public void setTagName(String tagName)
{
this.tagName = tagName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
public String getLeader()
{
return leader;
}
public void setLeader(String leader)
{
this.leader = leader;
}
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone()
{
return phone;
}
public void setPhone(String phone)
{
this.phone = phone;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public List<SysTag> getChildren()
{
return children;
}
public void setChildren(List<SysTag> children)
{
this.children = children;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("tagName", getTagName())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())
.append("email", getEmail())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -18,6 +18,10 @@ public class WxUserIntegralLog extends BaseEntity
/** 主键ID */
private Long id;
/** 用户Id */
@Excel(name = "用户Id")
private Long userId;
/** 用户昵称 */
@Excel(name = "用户昵称")
private String userName;
@ -106,6 +110,14 @@ public class WxUserIntegralLog extends BaseEntity
return remarkContent;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -3,6 +3,7 @@ package com.flossom.common.core.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.flossom.common.core.domain.entity.SysDept;
import com.flossom.common.core.domain.entity.SysMenu;
import com.flossom.common.core.domain.entity.SysTag;
import java.io.Serializable;
import java.util.List;
@ -48,6 +49,12 @@ public class TreeSelect implements Serializable {
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(SysTag sysTag) {
this.id = sysTag.getId();
this.label = sysTag.getTagName();
this.children = sysTag.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}

@ -0,0 +1,118 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.SysTag;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author flossom
*/
public interface SysTagMapper {
/**
*
*
* @param tag
* @return
*/
public List<SysTag> selectDeptList(SysTag tag);
/**
* ID
*
* @param roleId ID
* @param deptCheckStrictly
* @return
*/
public List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
/**
* ID
*
* @param id ID
* @return
*/
public SysTag selectDeptById(Long id);
/**
* ID
*
* @param id ID
* @return
*/
public List<SysTag> selectChildrenDeptById(Long id);
/**
* ID
*
* @param id ID
* @return
*/
public int selectNormalChildrenDeptById(Long id);
/**
*
*
* @param id ID
* @return
*/
public int hasChildByDeptId(Long id);
/**
*
*
* @param id ID
* @return
*/
public int checkDeptExistUser(Long id);
/**
*
*
* @param tagName
* @param parentId ID
* @return
*/
public SysTag checkDeptNameUnique(@Param("tagName") String tagName, @Param("parentId") Long parentId);
/**
*
*
* @param tag
* @return
*/
public int insertDept(SysTag tag);
/**
*
*
* @param tag
* @return
*/
public int updateDept(SysTag tag);
/**
*
*
* @param deptIds ID
*/
public void updateDeptStatusNormal(Long[] deptIds);
/**
*
*
* @param tags
* @return
*/
public int updateDeptChildren(@Param("depts") List<SysTag> tags);
/**
*
*
* @param id ID
* @return
*/
public int deleteDeptById(Long id);
}

@ -0,0 +1,163 @@
<?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.flossom.common.core.mapper.SysTagMapper">
<resultMap type="SysTag" id="SysTagResult">
<id property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="tagName" column="tag_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="type" column="type" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDeptVo">
select d.id, d.parent_id, d.ancestors, d.tag_name, d.order_num, d.leader, d.phone, d.email, d.status, d.type, d.del_flag, d.create_by, d.create_time
from sys_tag d
</sql>
<select id="selectDeptList" parameterType="SysTag" resultMap="SysTagResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="id != null and id != 0">
AND id = #{id}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="tagName != null and tagName != ''">
AND tag_name like concat('%', #{tagName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="type != null and type != ''">
AND type = #{type}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.id
from sys_dept d
left join sys_role_dept rd on d.id = rd.id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.id = rd.id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysTagResult">
<include refid="selectDeptVo"/>
where id = #{id}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where id = #{id} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_tag
where del_flag = '0' and parent_id = #{id} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysTagResult">
select * from sys_tag where find_in_set(#{id}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_tag where status = 0 and del_flag = '0' and find_in_set(#{id}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysTagResult">
<include refid="selectDeptVo"/>
where tag_name=#{tagName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysTag">
insert into sys_tag(
<if test="id != null and id != 0">id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="tagName != null and tagName != ''">tag_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="id != null and id != 0">#{id},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="tagName != null and tagName != ''">#{tagName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="SysTag">
update sys_tag
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="tagName != null and tagName != ''">tag_name = #{tagName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_tag set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case id" close="end">
when #{item.id} then #{item.ancestors}
</foreach>
where id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_tag set status = '0' where id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_tag set del_flag = '2' where id = #{id}
</delete>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flossom.common.core.mapper.WxSystemSettingMapper">
<resultMap type="WxSystemSetting" id="WxSystemSettingResult">
<result property="id" column="id" />
<result property="key" column="key" />
@ -24,24 +24,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWxSystemSettingList" parameterType="WxSystemSetting" resultMap="WxSystemSettingResult">
<include refid="selectWxSystemSettingVo"/>
<where>
<if test="key != null and key != ''"> and key = #{key}</if>
<if test="value != null and value != ''"> and value = #{value}</if>
<where>
<if test="key != null and key != ''"> and `key` = #{key}</if>
<if test="value != null and value != ''"> and `value` = #{value}</if>
<if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxSystemSettingById" parameterType="Long" resultMap="WxSystemSettingResult">
<include refid="selectWxSystemSettingVo"/>
where id = #{id}
</select>
<insert id="insertWxSystemSetting" parameterType="WxSystemSetting" useGeneratedKeys="true" keyProperty="id">
insert into wx_system_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="key != null">key,</if>
<if test="value != null">value,</if>
<if test="key != null">`key`,</if>
<if test="value != null">`value`,</if>
<if test="instructions != null">instructions,</if>
<if test="pictureUrl != null">picture_url,</if>
<if test="status != null">status,</if>
@ -68,8 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateWxSystemSetting" parameterType="WxSystemSetting">
update wx_system_setting
<trim prefix="SET" suffixOverrides=",">
<if test="key != null">key = #{key},</if>
<if test="value != null">value = #{value},</if>
<if test="key != null">`key` = #{key},</if>
<if test="value != null">`value` = #{value},</if>
<if test="instructions != null">instructions = #{instructions},</if>
<if test="pictureUrl != null">picture_url = #{pictureUrl},</if>
<if test="status != null">status = #{status},</if>
@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteWxSystemSettingByIds" parameterType="String">
delete from wx_system_setting where id in
delete from wx_system_setting where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -103,4 +103,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by update_time desc
limit 1
</select>
</mapper>
</mapper>

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="WxUserIntegralLog" id="WxUserIntegralLogResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="userPhone" column="user_phone" />
<result property="source" column="source" />
@ -17,12 +18,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWxUserIntegralLogVo">
select id, user_name, user_phone, source, float_score, soure_id, remark_content, create_time, create_by from wx_user_integral_log
select id,user_id, user_name, user_phone, source, float_score, soure_id, remark_content, create_time, create_by from wx_user_integral_log
</sql>
<select id="selectWxUserIntegralLogList" parameterType="WxUserIntegralLog" resultMap="WxUserIntegralLogResult">
<include refid="selectWxUserIntegralLogVo"/>
<where>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
@ -40,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertWxUserIntegralLog" parameterType="WxUserIntegralLog" useGeneratedKeys="true" keyProperty="id">
insert into wx_user_integral_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="userPhone != null">user_phone,</if>
<if test="source != null">source,</if>
@ -50,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="userPhone != null">#{userPhone},</if>
<if test="source != null">#{source},</if>
@ -64,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateWxUserIntegralLog" parameterType="WxUserIntegralLog">
update wx_user_integral_log
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="userPhone != null">user_phone = #{userPhone},</if>
<if test="source != null">source = #{source},</if>

@ -0,0 +1,129 @@
package com.flossom.system.controller;
import com.flossom.common.core.constant.UserConstants;
import com.flossom.common.core.domain.entity.SysDept;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.system.service.ISysDeptService;
import com.flossom.system.service.ISysTagService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author flossom
*/
@RestController
@RequestMapping("/tagInfo")
public class SysTagController extends BaseController
{
@Autowired
private ISysTagService tagService;
/**
*
*/
@RequiresPermissions("system:dept:list")
@GetMapping("/list")
public AjaxResult list(SysTag sysTag)
{
List<SysTag> tags = tagService.selectDeptList(sysTag);
return success(tags);
}
/**
*
*/
@RequiresPermissions("system:tagInfo:list")
@GetMapping("/list/exclude/{id}")
public AjaxResult excludeChild(@PathVariable(value = "id", required = false) Long id)
{
List<SysTag> tags = tagService.selectDeptList(new SysTag());
tags.removeIf(d -> d.getId().intValue() == id || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), id + ""));
return success(tags);
}
/**
*
*/
@RequiresPermissions("system:tagInfo:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable Long id)
{
tagService.checkDeptDataScope(id);
return success(tagService.selectDeptById(id));
}
/**
*
*/
@RequiresPermissions("system:tagInfo:add")
@Log(title = "标签管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysTag tag)
{
if (!tagService.checkDeptNameUnique(tag))
{
return error("新增标签'" + tag.getTagName() + "'失败,标签名称已存在");
}
tag.setCreateBy(SecurityUtils.getUsername());
return toAjax(tagService.insertDept(tag));
}
/**
*
*/
@RequiresPermissions("system:tagInfo:edit")
@Log(title = "标签管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysTag tag)
{
Long id = tag.getId();
tagService.checkDeptDataScope(id);
if (!tagService.checkDeptNameUnique(tag))
{
return error("修改标签'" + tag.getTagName() + "'失败,标签名称已存在");
}
else if (tag.getParentId().equals(id))
{
return error("修改标签'" + tag.getTagName() + "'失败,上级标签不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, tag.getStatus()) && tagService.selectNormalChildrenDeptById(id) > 0)
{
return error("该标签包含未停用的子标签!");
}
tag.setUpdateBy(SecurityUtils.getUsername());
return toAjax(tagService.updateDept(tag));
}
/**
*
*/
@RequiresPermissions("system:dept:remove")
@Log(title = "标签管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
if (tagService.hasChildByDeptId(id))
{
return warn("存在下级标签,不允许删除");
}
// if (tagService.checkDeptExistUser(id))
// {
// return warn("标签存在用户,不允许删除");
// }
tagService.checkDeptDataScope(id);
return toAjax(tagService.deleteDeptById(id));
}
}

@ -0,0 +1,127 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.SysDept;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.domain.vo.TreeSelect;
import java.util.List;
/**
*
*
* @author flossom
*/
public interface ISysTagService
{
/**
*
*
* @param tag
* @return
*/
public List<SysTag> selectDeptList(SysTag tag);
/**
*
*
* @param tag
* @return
*/
public List<TreeSelect> selectDeptTreeList(SysTag tag);
/**
*
*
* @param tags
* @return
*/
public List<SysTag> buildDeptTree(List<SysTag> tags);
/**
*
*
* @param tags
* @return
*/
public List<TreeSelect> buildDeptTreeSelect(List<SysTag> tags);
/**
* ID
*
* @param roleId ID
* @return
*/
public List<Long> selectDeptListByRoleId(Long roleId);
/**
* ID
*
* @param id ID
* @return
*/
public SysTag selectDeptById(Long id);
/**
* ID
*
* @param id ID
* @return
*/
public int selectNormalChildrenDeptById(Long id);
/**
*
*
* @param id ID
* @return
*/
public boolean hasChildByDeptId(Long id);
/**
*
*
* @param id ID
* @return true false
*/
public boolean checkDeptExistUser(Long id);
/**
*
*
* @param tag
* @return
*/
public boolean checkDeptNameUnique(SysTag tag);
/**
*
*
* @param id id
*/
public void checkDeptDataScope(Long id);
/**
*
*
* @param tag
* @return
*/
public int insertDept(SysTag tag);
/**
*
*
* @param tag
* @return
*/
public int updateDept(SysTag tag);
/**
*
*
* @param id ID
* @return
*/
public int deleteDeptById(Long id);
}

@ -0,0 +1,347 @@
package com.flossom.system.service.impl;
import com.flossom.common.core.constant.UserConstants;
import com.flossom.common.core.domain.entity.SysDept;
import com.flossom.common.core.domain.entity.SysRole;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.domain.entity.SysUser;
import com.flossom.common.core.domain.vo.TreeSelect;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.mapper.SysDeptMapper;
import com.flossom.common.core.mapper.SysRoleMapper;
import com.flossom.common.core.mapper.SysTagMapper;
import com.flossom.common.core.text.Convert;
import com.flossom.common.core.utils.SpringUtils;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.datascope.annotation.DataScope;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.system.service.ISysDeptService;
import com.flossom.system.service.ISysTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
*
*
* @author flossom
*/
@Service
public class SysTagServiceImpl implements ISysTagService
{
@Autowired
private SysTagMapper tagMapper;
@Autowired
private SysRoleMapper roleMapper;
/**
*
*
* @param tag
* @return
*/
@Override
@DataScope(deptAlias = "d")
public List<SysTag> selectDeptList(SysTag tag)
{
return tagMapper.selectDeptList(tag);
}
/**
*
*
* @param tag
* @return
*/
@Override
public List<TreeSelect> selectDeptTreeList(SysTag tag)
{
List<SysTag> tags = SpringUtils.getAopProxy(this).selectDeptList(tag);
return buildDeptTreeSelect(tags);
}
/**
*
*
* @param tags
* @return
*/
@Override
public List<SysTag> buildDeptTree(List<SysTag> tags)
{
List<SysTag> returnList = new ArrayList<SysTag>();
List<Long> tempList = tags.stream().map(SysTag::getId).collect(Collectors.toList());
for (SysTag tag : tags)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(tag.getParentId()))
{
recursionFn(tags, tag);
returnList.add(tag);
}
}
if (returnList.isEmpty())
{
returnList = tags;
}
return returnList;
}
/**
*
*
* @param tags
* @return
*/
@Override
public List<TreeSelect> buildDeptTreeSelect(List<SysTag> tags)
{
List<SysTag> deptTrees = buildDeptTree(tags);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* ID
*
* @param roleId ID
* @return
*/
@Override
public List<Long> selectDeptListByRoleId(Long roleId)
{
SysRole role = roleMapper.selectRoleById(roleId);
return tagMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
}
/**
* ID
*
* @param id ID
* @return
*/
@Override
public SysTag selectDeptById(Long id)
{
return tagMapper.selectDeptById(id);
}
/**
* ID
*
* @param id ID
* @return
*/
@Override
public int selectNormalChildrenDeptById(Long id)
{
return tagMapper.selectNormalChildrenDeptById(id);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public boolean hasChildByDeptId(Long id)
{
int result = tagMapper.hasChildByDeptId(id);
return result > 0;
}
/**
*
*
* @param id ID
* @return true false
*/
@Override
public boolean checkDeptExistUser(Long id)
{
int result = tagMapper.checkDeptExistUser(id);
return result > 0;
}
/**
*
*
* @param tag
* @return
*/
@Override
public boolean checkDeptNameUnique(SysTag tag)
{
Long deptId = StringUtils.isNull(tag.getId()) ? -1L : tag.getId();
SysTag info = tagMapper.checkDeptNameUnique(tag.getTagName(), tag.getParentId());
if (StringUtils.isNotNull(info) && info.getId().longValue() != deptId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
*
*
* @param id id
*/
@Override
public void checkDeptDataScope(Long id)
{
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
{
SysTag tag = new SysTag();
tag.setId(id);
List<SysTag> tags = SpringUtils.getAopProxy(this).selectDeptList(tag);
if (StringUtils.isEmpty(tags))
{
throw new ServiceException("没有权限访问标签数据!");
}
}
}
/**
*
*
* @param
* @return
*/
@Override
public int insertDept(SysTag tag)
{
SysTag info = tagMapper.selectDeptById(tag.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
// if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
// {
// throw new ServiceException("标签停用,不允许新增");
// }
if(Objects.isNull(info)) {
tag.setAncestors("0");
tag.setParentId(0l);
}
return tagMapper.insertDept(tag);
}
/**
*
*
* @param
* @return
*/
@Override
public int updateDept(SysTag tag)
{
SysTag newParentDept = tagMapper.selectDeptById(tag.getParentId());
SysTag oldDept = tagMapper.selectDeptById(tag.getId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
{
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getId();
String oldAncestors = oldDept.getAncestors();
tag.setAncestors(newAncestors);
updateDeptChildren(tag.getId(), newAncestors, oldAncestors);
}
int result = tagMapper.updateDept(tag);
if (UserConstants.DEPT_NORMAL.equals(tag.getStatus()) && StringUtils.isNotEmpty(tag.getAncestors())
&& !StringUtils.equals("0", tag.getAncestors()))
{
// 如果该标签是启用状态,则启用该标签的所有上级标签
updateParentDeptStatusNormal(tag);
}
return result;
}
/**
*
*
* @param
*/
private void updateParentDeptStatusNormal(SysTag tag)
{
String ancestors = tag.getAncestors();
Long[] deptIds = Convert.toLongArray(ancestors);
tagMapper.updateDeptStatusNormal(deptIds);
}
/**
*
*
* @param
* @param newAncestors ID
* @param oldAncestors ID
*/
public void updateDeptChildren(Long id, String newAncestors, String oldAncestors)
{
List<SysTag> children = tagMapper.selectChildrenDeptById(id);
for (SysTag child : children)
{
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
}
if (children.size() > 0)
{
tagMapper.updateDeptChildren(children);
}
}
/**
*
*
* @param id ID
* @return
*/
@Override
public int deleteDeptById(Long id)
{
return tagMapper.deleteDeptById(id);
}
/**
*
*/
private void recursionFn(List<SysTag> list, SysTag t)
{
// 得到子节点列表
List<SysTag> childList = getChildList(list, t);
t.setChildren(childList);
for (SysTag tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
*
*/
private List<SysTag> getChildList(List<SysTag> list, SysTag t)
{
List<SysTag> tlist = new ArrayList<SysTag>();
Iterator<SysTag> it = list.iterator();
while (it.hasNext())
{
SysTag n = (SysTag) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
*
*/
private boolean hasChild(List<SysTag> list, SysTag t)
{
return getChildList(list, t).size() > 0 ? true : false;
}
}

@ -5,6 +5,7 @@ import java.util.List;
import com.flossom.common.core.domain.entity.WxSystemSetting;
import com.flossom.common.core.mapper.WxSystemSettingMapper;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxSystemSettingService;
@ -51,6 +52,7 @@ public class WxSystemSettingServiceImpl implements IWxSystemSettingService {
@Override
public int insertWxSystemSetting(WxSystemSetting wxSystemSetting) {
wxSystemSetting.setCreateTime(DateUtils.getNowDate());
wxSystemSetting.setCreateBy(SecurityUtils.getUsername());
return wxSystemSettingMapper.insertWxSystemSetting(wxSystemSetting);
}
@ -63,6 +65,7 @@ public class WxSystemSettingServiceImpl implements IWxSystemSettingService {
@Override
public int updateWxSystemSetting(WxSystemSetting wxSystemSetting) {
wxSystemSetting.setUpdateTime(DateUtils.getNowDate());
wxSystemSetting.setUpdateBy(SecurityUtils.getUsername());
return wxSystemSettingMapper.updateWxSystemSetting(wxSystemSetting);
}

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询部门列表
export function listDept(query) {
return request({
url: '/system/tagInfo/list',
method: 'get',
params: query
})
}
// 查询部门列表(排除节点)
export function listDeptExcludeChild(deptId) {
return request({
url: '/system/tagInfo/list/exclude/' + deptId,
method: 'get'
})
}
// 查询部门详细
export function getDept(deptId) {
return request({
url: '/system/tagInfo/' + deptId,
method: 'get'
})
}
// 新增部门
export function addDept(data) {
return request({
url: '/system/tagInfo',
method: 'post',
data: data
})
}
// 修改部门
export function updateDept(data) {
return request({
url: '/system/tagInfo',
method: 'put',
data: data
})
}
// 删除部门
export function delDept(deptId) {
return request({
url: '/system/tagInfo/' + deptId,
method: 'delete'
})
}

@ -0,0 +1,335 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="标签名称" prop="tagName">
<el-input
v-model="queryParams.tagName"
placeholder="请输入标签名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="标签状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['system:dept:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="deptList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="tagName" label="标签名称" ></el-table-column>
<el-table-column prop="orderNum" label="排序" ></el-table-column>
<el-table-column prop="status" label="状态" >
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:dept:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-plus"-->
<!-- @click="handleAdd(scope.row)"-->
<!-- v-hasPermi="['system:dept:add']"-->
<!-- >新增</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['system:dept:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<!-- 添加或修改标签对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级标签" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级标签" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="form.tagName" placeholder="请输入标签名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="负责人" prop="leader">-->
<!-- <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="联系电话" prop="phone">-->
<!-- <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="邮箱" prop="email">-->
<!-- <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="标签状态">-->
<!-- <el-radio-group v-model="form.status">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.sys_normal_disable"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/wechatTab";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Dept",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
//
loading: true,
//
showSearch: true,
//
deptList: [],
//
deptOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
tagName: undefined,
status: undefined
},
//
form: {},
//
rules: {
// parentId: [
// { required: true, message: "", trigger: "blur" }
// ],
tagName: [
{ required: true, message: "标签名称不能为空", trigger: "blur" }
],
orderNum: [
{ required: true, message: "显示排序不能为空", trigger: "blur" }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phone: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询标签列表 */
getList() {
this.loading = true;
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "id");
this.loading = false;
});
},
/** 转换标签数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.tagName,
children: node.children
};
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
parentId: undefined,
tagName: undefined,
orderNum: undefined,
leader: undefined,
phone: undefined,
email: undefined,
status: "0"
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
if (row != undefined) {
this.form.parentId = row.id;
}
this.open = true;
this.title = "添加标签";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
getDept(row.id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改标签";
});
listDeptExcludeChild(row.id).then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDept(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.tagName + '"的数据项?').then(function() {
return delDept(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

@ -1,136 +1,112 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="键" prop="key">
<el-input
v-model="queryParams.key"
placeholder="请输入键"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="说明" prop="instructions">
<el-input
v-model="queryParams.instructions"
placeholder="请输入说明"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="用户协议" name="userAgreement">
<el-form ref="form" :model="userAgreementFrom" label-width="80px">
<el-row>
<el-col :span="20">
<editor v-model="userAgreementFrom.userAgreement" :min-height="580"/>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="隐私政策" name="privacyAgreement">
<el-form ref="form" :model="privacyAgreementFrom" label-width="80px">
<el-row>
<el-col :span="20">
<editor v-model="privacyAgreementFrom.privacyAgreement" :min-height="580"/>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="积分规则" name="integralRule">
<el-form ref="form" :model="integralRuleFrom" label-width="80px">
<el-row>
<el-col :span="20">
<editor v-model="integralRuleFrom.integralRule" :min-height="580"/>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="关于我们" name="aboutUs">
<el-form ref="form" :model="aboutUsFrom" label-width="80px">
<el-row>
<el-col :span="20">
<editor v-model="aboutUsFrom.aboutUs" :min-height="580"/>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="蓝牙指引权限" name="bluetoothGuidancePermissions">
<el-form ref="form" :model="bluetoothGuidancePermissionsFrom" label-width="80px">
<el-row>
<el-col :span="20">
<editor v-model="bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissions" :min-height="580"/>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="定位指引权限" name="locationGuidancePermissions">
<el-form ref="form" :model="locationGuidancePermissionsFrom" label-width="80px">
<el-row>
<el-col :span="20">
<editor v-model="locationGuidancePermissionsFrom.locationGuidancePermissions" :min-height="580"/>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="联系客服" name="contactWorker">
<div class="block" style="float: left;margin-left: 3%;margin-top: 3%">
<el-image :src="contactWorkerFrom.contactWorkerSrc" style="width: 330px;height: 461px;">
<div slot="placeholder" class="image-slot"><span class="dot"></span>
</div>
</el-image>
</div>
<div style="float: left;margin-left: 10%;margin-top: 10%;">
<el-upload
ref="upload"
:limit="1"
accept=".jpg, .png, .jpeg"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">请上传联系客服页面图片建议尺寸为330px*461px</div>
</el-upload>
</div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:setting:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:setting:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:setting:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:setting:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="settingList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="键" align="center" prop="key" />
<el-table-column label="值" align="center" prop="value" show-overflow-tooltip="true" />
<el-table-column label="说明" align="center" prop="instructions" show-overflow-tooltip="true"/>
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:setting:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:setting:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改平台参数设置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="键" prop="key">
<el-input v-model="form.key" placeholder="请输入键" />
</el-form-item>
<el-form-item label="值" prop="value">
<el-input v-model="form.value" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="说明" prop="instructions">
<el-input v-model="form.instructions" placeholder="请输入说明" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</el-tab-pane>
<el-tab-pane label="商城链接/版本管理" name="otherSetting">
<el-form ref="form" :model="otherForm" :rules="rules" label-width="150px" style="margin-top: 1%">
<el-divider content-position="left">商城设置</el-divider>
<el-form-item label="跳转商城appid" prop="skipAppid">
<el-input v-model="otherForm.skipAppid" style="width: 70%"></el-input>
</el-form-item>
<el-form-item label="跳转商城路径:" prop="skipPath">
<el-input v-model="otherForm.skipPath" style="width: 70%"></el-input>
</el-form-item>
<el-divider content-position="left">版本管理设置</el-divider>
<el-form-item label="当前版本:" prop="sysVersion">
<el-input v-model="otherForm.sysVersion" style="width: 70%"></el-input>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<div style="margin-left: 76%;margin-top: 2%" v-show="this.activeName != 'contactWorker'">
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</div>
</template>
<script>
import { listSetting, getSetting, delSetting, addSetting, updateSetting } from "@/api/system/systemSetting";
import { listOtherSetting, addOtherSetting, updateOtherSetting} from "@/api/system/otherSetting";
import {getToken} from "@/utils/auth";
export default {
name: "Setting",
@ -148,12 +124,29 @@ export default {
showSearch: true,
//
total: 0,
src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
//
settingList: [],
//
title: "",
activeName: 'userAgreement',
//
open: false,
//
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/file/upload"
},
//
queryParams: {
pageNum: 1,
@ -163,10 +156,60 @@ export default {
instructions: null,
status: null,
},
otherQueryParams: {
pageNum: 1,
pageSize: 10,
skipAppid: null,
skipPath: null,
sysVersion: null,
status: null,
},
//
form: {},
form: {
},
otherForm: {
},
userAgreementFrom: {
userAgreement: null,
userAgreementId: null
},
privacyAgreementFrom: {
privacyAgreement: null,
privacyAgreementId: null,
},
integralRuleFrom: {
integralRule: null,
integralRuleId: null,
},
aboutUsFrom: {
aboutUs: null,
aboutUsId: null,
},
bluetoothGuidancePermissionsFrom: {
bluetoothGuidancePermissions: null,
bluetoothGuidancePermissionsId: null,
},
locationGuidancePermissionsFrom: {
locationGuidancePermissions: null,
locationGuidancePermissionsId: null
},
contactWorkerFrom: {
contactWorkerSrc: null,
contactWorkerId: null
},
//
rules: {
skipAppid: [
{ required: true, message: '请输入商城apppid', trigger: 'blur' },
],
skipPath: [
{ required: true, message: '请输入商城路径', trigger: 'blur' },
],
sysVersion: [
{ required: true, message: '请输入当前版本', trigger: 'blur' },
],
}
};
},
@ -174,13 +217,163 @@ export default {
this.getList();
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
/** 提交按钮 */
submitForm() {
if (this.activeName == 'userAgreement') {
if (this.userAgreementFrom.userAgreementId != null) {
this.form.id = this.userAgreementFrom.userAgreementId;
}
this.form.key = 'USER_AGREEMENT';
if (!this.userAgreementFrom.userAgreement) {
this.$modal.msgError('用户协议内容不能为空');
return ;
}
this.form.value = this.userAgreementFrom.userAgreement;
this.form.instructions = '用户协议';
}
if (this.activeName == 'privacyAgreement') {
if (this.privacyAgreementFrom.privacyAgreementId != null) {
this.form.id = this.privacyAgreementFrom.privacyAgreementId;
}
this.form.key = 'PRIVACY_AGREEMENT';
if (!this.privacyAgreementFrom.privacyAgreement) {
this.$modal.msgError('隐私协议内容不能为空');
return ;
}
this.form.instructions = '隐私协议';
this.form.value = this.privacyAgreementFrom.privacyAgreement;
}
if (this.activeName == 'integralRule') {
if (this.integralRuleFrom.integralRuleId != null) {
this.form.id = this.integralRuleFrom.integralRuleId;
}
this.form.key = 'INTEGRAL_RULE';
if (!this.integralRuleFrom.integralRule) {
this.$modal.msgError('积分规则内容不能为空');
return ;
}
this.form.instructions = '积分规则';
this.form.value = this.integralRuleFrom.integralRule;
}
if (this.activeName == 'aboutUs') {
if (this.aboutUsFrom.aboutUsId != null) {
this.form.id = this.aboutUsFrom.aboutUsId;
}
this.form.key = 'ABOUT_US';
if (!this.aboutUsFrom.aboutUs) {
this.$modal.msgError('关于我们内容不能为空');
return ;
}
this.form.instructions = '关于我们';
this.form.value = this.aboutUsFrom.aboutUs;
}
if (this.activeName == 'bluetoothGuidancePermissions') {
if (this.bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissionsId != null) {
this.form.id = this.bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissionsId;
}
this.form.key = 'BLUETOOTH_GUIDANCE_PERMISSIONS';
if (!this.bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissions) {
this.$modal.msgError('蓝牙指引权限内容不能为空');
return ;
}
this.form.instructions = '蓝牙指引权限';
this.form.value = this.bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissions;
}
if (this.activeName == 'locationGuidancePermissions') {
if (this.locationGuidancePermissionsFrom.locationGuidancePermissionsId != null) {
this.form.id = this.locationGuidancePermissionsFrom.locationGuidancePermissionsId;
}
this.form.key = 'LOCATION_GUIDANCE_PERMISSIONS';
if (!this.locationGuidancePermissionsFrom.locationGuidancePermissions) {
this.$modal.msgError('定位指引权限内容不能为空');
return ;
}
this.form.instructions = '定位指引权限';
this.form.value = this.locationGuidancePermissionsFrom.locationGuidancePermissions;
}
if (this.activeName != 'otherSetting') {
if (this.form.id != null) {
updateSetting(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSetting(this.form).then(response => {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.getList();
});
}
this.form.id = null;
this.form.value = null;
} else {
this.$refs["form"].validate(valid => {
if (valid) {
//
if (this.otherForm.id != null) {
updateOtherSetting(this.otherForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addOtherSetting(this.otherForm).then(response => {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.getList();
});
}
}
});
}
},
/** 查询平台参数设置列表 */
/** USER_AGREEMENT-用户协议 PRIVACY_AGREEMENT-隐私协议 INTEGRAL_RULE-积分规则 ABOUT_US-关于我们 BLUETOOTH_GUIDANCE_PERMISSIONS-蓝牙指引权限 LOCATION_GUIDANCE_PERMISSIONS - 定位指引权限 CONTACT_WORKER-联系客服 */
getList() {
this.loading = true;
listSetting(this.queryParams).then(response => {
this.settingList = response.rows;
this.total = response.total;
this.loading = false;
//
this.settingList.forEach((item)=>{
if (item.key == 'USER_AGREEMENT') {
this.userAgreementFrom.userAgreement = item.value;
this.userAgreementFrom.userAgreementId = item.id;
}
if (item.key == 'PRIVACY_AGREEMENT') {
this.privacyAgreementFrom.privacyAgreement = item.value;
this.privacyAgreementFrom.privacyAgreementId = item.id;
}
if (item.key == 'INTEGRAL_RULE') {
this.integralRuleFrom.integralRule = item.value;
this.integralRuleFrom.integralRuleId = item.id;
}
if (item.key == 'ABOUT_US') {
this.aboutUsFrom.aboutUs = item.value;
this.aboutUsFrom.aboutUsId = item.id;
}
if (item.key == 'BLUETOOTH_GUIDANCE_PERMISSIONS') {
this.bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissions = item.value;
this.bluetoothGuidancePermissionsFrom.bluetoothGuidancePermissionsId = item.id;
}
if (item.key == 'LOCATION_GUIDANCE_PERMISSIONS') {
this.locationGuidancePermissionsFrom.locationGuidancePermissions = item.value;
this.locationGuidancePermissionsFrom.locationGuidancePermissionsId = item.id;
}
if (item.key == 'CONTACT_WORKER') {
this.contactWorkerFrom.contactWorkerSrc = item.pictureUrl;
this.contactWorkerFrom.contactWorkerId = item.id;
}
})
});
listOtherSetting(this.otherQueryParams).then(response => {
this.otherForm = response.rows.length >0 ? response.rows[0]: {};
this.loading = false;
});
},
//
@ -236,25 +429,44 @@ export default {
this.title = "修改平台参数设置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateSetting(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSetting(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
//
handleFileUploadProgress(event, file, fileList) {
// this.upload.isUploading = true;
console.log('上传处理中==>',JSON.stringify(event))
},
//
handleFileSuccess(response, file, fileList) {
console.log('上传后的结果==>',JSON.stringify(response))
if(response.code == '200') {
this.contactWorkerFrom.contactWorkerSrc = response.data.url;
this.form.key = 'CONTACT_WORKER';
this.form.instructions = '联系客服';
this.form.pictureUrl = this.contactWorkerFrom.contactWorkerSrc;
if (this.contactWorkerFrom.contactWorkerId !=null){
this.form.id = this.contactWorkerFrom.contactWorkerId;
}
});
//
if (this.form.id != null) {
updateSetting(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSetting(this.form).then(response => {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.getList();
});
}
this.form.id = null;
this.form.pictureUrl = null;
}
// this.upload.open = false;
// this.upload.isUploading = false;
// this.$refs.upload.clearFiles();
// this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "", { dangerouslyUseHTMLString: true });
// this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {

@ -0,0 +1,335 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="标签名称" prop="tagName">
<el-input
v-model="queryParams.tagName"
placeholder="请输入标签名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="标签状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dept:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="deptList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="tagName" label="标签名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:dept:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['system:dept:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:dept:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改标签对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级标签" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级标签" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="form.tagName" placeholder="请输入标签名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="负责人" prop="leader">-->
<!-- <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="联系电话" prop="phone">-->
<!-- <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="邮箱" prop="email">-->
<!-- <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="标签状态">-->
<!-- <el-radio-group v-model="form.status">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.sys_normal_disable"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/wechatTab";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Dept",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
//
loading: true,
//
showSearch: true,
//
deptList: [],
//
deptOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
tagName: undefined,
status: undefined
},
//
form: {},
//
rules: {
// parentId: [
// { required: true, message: "", trigger: "blur" }
// ],
tagName: [
{ required: true, message: "标签名称不能为空", trigger: "blur" }
],
orderNum: [
{ required: true, message: "显示排序不能为空", trigger: "blur" }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phone: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询标签列表 */
getList() {
this.loading = true;
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "id");
this.loading = false;
});
},
/** 转换标签数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.tagName,
children: node.children
};
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
parentId: undefined,
tagName: undefined,
orderNum: undefined,
leader: undefined,
phone: undefined,
email: undefined,
status: "0"
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
if (row != undefined) {
this.form.parentId = row.id;
}
this.open = true;
this.title = "添加标签";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
getDept(row.id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改标签";
});
listDeptExcludeChild(row.id).then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDept(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.tagName + '"的数据项?').then(function() {
return delDept(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>
Loading…
Cancel
Save