版本更新0.1.0

This commit is contained in:
磷叶 2025-02-11 18:15:13 +08:00
parent f52607018a
commit 932fcba303
43 changed files with 1033 additions and 127 deletions

View File

@ -53,4 +53,8 @@ public class CacheConstants
* 用户名称列表
*/
public static final String USER_NAME_LIST = "user_name_list";
/**
* 部门名称列表
*/
public static final String DEPT_NAME_LIST = "dept_name_list";
}

View File

@ -18,4 +18,8 @@ public class DictType {
public static final String TASK_STATUS = "task_status";
// 任务优先级
public static final String TASK_LEVEL = "task_level";
// 公告重要程度
public static final String NOTICE_LEVEL = "notice_level";
// 客户跟进方式
public static final String CUSTOMER_FOLLOW_TYPE = "customer_follow_type";
}

View File

@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.framework.security.context.PermissionContextHolder;
import java.util.ArrayList;
@ -104,31 +105,31 @@ public class DataScopeUtil {
break;
}
// 自定义数据范围
// else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
// if (scopeCustomIds.size() > 1) {
// // 多个自定数据权限使用in查询避免多次拼接
// sqlString.append(getForeachSql(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id in ({}) ) ", deptList, String.join(",", scopeCustomIds)));
// } else {
// sqlString.append(getForeachSql(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptList, role.getRoleId()));
// }
// }
// // 仅本部门
// else if (DATA_SCOPE_DEPT.equals(dataScope)) {
// sqlString.append(getForeachSql(" OR {}.dept_id = {} ", deptList, user.getDeptId()));
// }
// // 本部门及下级部门
// else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
// sqlString.append(getForeachSql(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptList, user.getDeptId(), user.getDeptId()));
// }
// // 仅本人
// else if (DATA_SCOPE_SELF.equals(dataScope)) {
// if (CollectionUtils.isNotEmpty(userList)) {
// sqlString.append(getForeachSql(" OR {}.user_id = {} ", userList, user.getUserId()));
// } else {
// // 数据权限为仅本人且没有userAlias别名不查询任何数据
// sqlString.append(" OR 1=0 ");
// }
// }
else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
if (scopeCustomIds.size() > 1) {
// 多个自定数据权限使用in查询避免多次拼接
sqlString.append(getForeachSql(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id in ({}) ) ", deptList, String.join(",", scopeCustomIds)));
} else {
sqlString.append(getForeachSql(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptList, role.getRoleId()));
}
}
// 仅本部门
else if (DATA_SCOPE_DEPT.equals(dataScope)) {
sqlString.append(getForeachSql(" OR {}.dept_id = {} ", deptList, user.getDeptId()));
}
// 本部门及下级部门
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
sqlString.append(getForeachSql(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptList, user.getDeptId(), user.getDeptId()));
}
// 仅本人
else if (DATA_SCOPE_SELF.equals(dataScope)) {
if (CollectionUtils.isNotEmpty(userList)) {
sqlString.append(getForeachSql(" OR {}.user_id = {} ", userList, user.getUserId()));
} else {
// 数据权限为仅本人且没有userAlias别名不查询任何数据
sqlString.append(" OR 1=0 ");
}
}
// 负责部门数据权限
else if (DATA_SCOPE_LEADER_DEPT.equals(dataScope)) {
String sql = getForeachSql(" OR {}.dept_id in ( SELECT dept_id FROM sys_dept WHERE find_in_set({}, leader_ids) )", deptList, user.getUserId());

View File

@ -33,8 +33,6 @@ public class Customer extends BaseEntity
@Excel(name = "客户编号")
@ApiModelProperty("客户编号")
@NotBlank(message = "客户编号不能为空", groups = {ValidGroup.Create.class})
@Size(max = 32, message = "客户编号长度不能超过32个字符")
private String code;
@Excel(name = "客户姓名")

View File

@ -1,8 +1,12 @@
package com.ruoyi.bst.customer.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CustomerVO extends Customer{
@ApiModelProperty("跟进人名称")
private String followName;
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.bst.customer.mapper;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@ -78,4 +79,12 @@ public interface CustomerMapper
* @return
*/
List<StringIntegerVO> selectCountGroupByStatus(@Param("query") CustomerQuery query);
/**
* 更新客户最近跟进时间
* @param customerId
* @param lastFollowTime
* @return
*/
int updateLastFollowTime(@Param("customerId") Long customerId, @Param("lastFollowTime") LocalDateTime lastFollowTime);
}

View File

@ -24,8 +24,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bc.remark,
bc.create_time,
bc.update_time,
bc.deleted
bc.deleted,
suf.nick_name as follow_name
from bst_customer bc
left join sys_user suf on suf.user_id = bc.follow_id
</sql>
<sql id="searchCondition">
@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.eqCode != null and query.eqCode != ''"> and bc.code = #{query.eqCode}</if>
<if test="query.excludeId != null "> and bc.id != #{query.excludeId}</if>
<if test="query.createDate != null "> and date(bc.create_time) = #{query.createDate}</if>
<if test="query.followName != null and query.followName != ''"> and suf.nick_name like concat('%', #{query.followName}, '%')</if>
<if test="query.ids != null and query.ids.size() > 0">
and bc.id in
<foreach collection="query.ids" item="item" open="(" separator="," close=")">
@ -159,4 +162,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
group by `key`
</select>
<update id="updateLastFollowTime">
update bst_customer
set last_follow_time = #{lastFollowTime}
where id = #{customerId}
and last_follow_time &lt; #{lastFollowTime}
</update>
</mapper>

View File

@ -1,6 +1,7 @@
package com.ruoyi.bst.customer.service;
import com.ruoyi.bst.customer.domain.Customer;
import com.ruoyi.bst.customerFollow.domain.CustomerFollow;
public interface CustomerConverter {
@ -17,5 +18,12 @@ public interface CustomerConverter {
* @return
*/
Customer toPoByUpdate(Customer customer);
/**
* 新增客户跟进记录 客户数据
* @param follow
* @return
*/
Customer toPo(CustomerFollow follow);
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.bst.customer.service;
import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.bst.customer.domain.Customer;
@ -83,4 +84,12 @@ public interface CustomerService
* @return
*/
List<StringIntegerVO> selectCountGroupByStatus(CustomerQuery customerQuery);
/**
* 更新客户最近跟进时间需要新的跟进时间大于当前跟进时间
* @param customerId 客户ID
* @param lastFollowTime 新的跟进时间
* @return
*/
int updateLastFollowTime(Long customerId, LocalDateTime lastFollowTime);
}

View File

@ -4,6 +4,7 @@ import org.springframework.stereotype.Service;
import com.ruoyi.bst.customer.domain.Customer;
import com.ruoyi.bst.customer.service.CustomerConverter;
import com.ruoyi.bst.customerFollow.domain.CustomerFollow;
@Service
public class CustomerConverterImpl implements CustomerConverter {
@ -14,7 +15,6 @@ public class CustomerConverterImpl implements CustomerConverter {
return null;
}
Customer po = new Customer();
po.setCode(customer.getCode());
po.setName(customer.getName());
po.setStatus(customer.getStatus());
po.setIntentLevel(customer.getIntentLevel());
@ -34,7 +34,6 @@ public class CustomerConverterImpl implements CustomerConverter {
}
Customer po = new Customer();
po.setId(customer.getId());
po.setCode(customer.getCode());
po.setName(customer.getName());
po.setStatus(customer.getStatus());
po.setIntentLevel(customer.getIntentLevel());
@ -47,4 +46,15 @@ public class CustomerConverterImpl implements CustomerConverter {
return po;
}
@Override
public Customer toPo(CustomerFollow follow) {
if (follow == null) {
return null;
}
Customer customer = new Customer();
customer.setId(follow.getCustomerId());
customer.setLastFollowTime(follow.getFollowTime());
return customer;
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.bst.customer.service.impl;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
@ -14,6 +15,7 @@ import com.ruoyi.bst.customer.mapper.CustomerMapper;
import com.ruoyi.bst.customer.service.CustomerService;
import com.ruoyi.bst.customer.service.CustomerValidator;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SnowFlakeUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.common.vo.StringIntegerVO;
@ -68,6 +70,7 @@ public class CustomerServiceImpl implements CustomerService
@Override
public int insertCustomer(Customer customer)
{
customer.setCode(String.valueOf(SnowFlakeUtil.newId()));
customer.setCreateTime(DateUtils.getNowDate());
Integer result = transactionTemplate.execute(status -> {
@ -148,4 +151,12 @@ public class CustomerServiceImpl implements CustomerService
public List<StringIntegerVO> selectCountGroupByStatus(CustomerQuery customerQuery) {
return customerMapper.selectCountGroupByStatus(customerQuery);
}
@Override
public int updateLastFollowTime(Long customerId, LocalDateTime lastFollowTime) {
if (customerId == null || lastFollowTime == null) {
return 0;
}
return customerMapper.updateLastFollowTime(customerId, lastFollowTime);
}
}

View File

@ -1,13 +1,23 @@
package com.ruoyi.bst.customerFollow.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import javax.validation.constraints.Future;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.DictType;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.system.valid.DictValid;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户跟进记录对象 bst_customer_follow
@ -24,14 +34,18 @@ public class CustomerFollow extends BaseEntity
@Excel(name = "客户ID")
@ApiModelProperty("客户ID")
@NotNull(message = "客户ID不能为空", groups = {ValidGroup.Create.class})
private Long customerId;
@Excel(name = "跟进方式", readConverterExp = "1=电话,2=微信,3=见面,4=其他")
@ApiModelProperty("跟进方式")
@DictValid(type = DictType.CUSTOMER_FOLLOW_TYPE, message = "非法的跟进方式")
@NotBlank(message = "跟进方式不能为空", groups = {ValidGroup.Create.class})
private String type;
@Excel(name = "跟进内容")
@ApiModelProperty("跟进内容")
@Size(max = 1000, message = "跟进内容不能超过1000个字符")
private String content;
@Excel(name = "图片")
@ -42,9 +56,15 @@ public class CustomerFollow extends BaseEntity
@ApiModelProperty("跟进人ID")
private Long userId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "下次跟进时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("下次跟进时间")
private Date nextFollowTime;
@Future(message = "下次跟进时间不能小于当前时间")
private LocalDateTime nextFollowTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "跟进时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("跟进时间")
@Past(message = "跟进时间不能大于当前时间")
private LocalDateTime followTime;
}

View File

@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bcf.user_id,
bcf.next_follow_time,
bcf.create_time,
bcf.follow_time,
bc.name as customer_name,
bc.code as customer_code,
su.nick_name as user_name
@ -57,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">picture,</if>
<if test="userId != null">user_id,</if>
<if test="nextFollowTime != null">next_follow_time,</if>
<if test="followTime != null">follow_time,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -66,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">#{picture},</if>
<if test="userId != null">#{userId},</if>
<if test="nextFollowTime != null">#{nextFollowTime},</if>
<if test="followTime != null">#{followTime},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
@ -85,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.userId != null">user_id = #{data.userId},</if>
<if test="data.nextFollowTime != null">next_follow_time = #{data.nextFollowTime},</if>
<if test="data.followTime != null">follow_time = #{data.followTime},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
</sql>

View File

@ -4,7 +4,10 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.bst.customer.service.CustomerConverter;
import com.ruoyi.bst.customer.service.CustomerService;
import com.ruoyi.bst.customerFollow.domain.CustomerFollow;
import com.ruoyi.bst.customerFollow.domain.CustomerFollowQuery;
import com.ruoyi.bst.customerFollow.domain.CustomerFollowVO;
@ -24,6 +27,15 @@ public class CustomerFollowServiceImpl implements CustomerFollowService
@Autowired
private CustomerFollowMapper customerFollowMapper;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private CustomerService customerService;
@Autowired
private CustomerConverter customerConverter;
/**
* 查询客户跟进记录
*
@ -58,7 +70,20 @@ public class CustomerFollowServiceImpl implements CustomerFollowService
public int insertCustomerFollow(CustomerFollow customerFollow)
{
customerFollow.setCreateTime(DateUtils.getNowDate());
return customerFollowMapper.insertCustomerFollow(customerFollow);
Integer result = transactionTemplate.execute(status -> {
// 新增客户跟进记录
int insert = customerFollowMapper.insertCustomerFollow(customerFollow);
if (insert > 0) {
// 更新客户最近跟进时间
customerService.updateLastFollowTime(customerFollow.getCustomerId(), customerFollow.getFollowTime());
}
return insert;
});
return result == null ? 0 : result;
}
/**
@ -68,9 +93,18 @@ public class CustomerFollowServiceImpl implements CustomerFollowService
* @return 结果
*/
@Override
public int updateCustomerFollow(CustomerFollow customerFollow)
{
return customerFollowMapper.updateCustomerFollow(customerFollow);
public int updateCustomerFollow(CustomerFollow customerFollow) {
Integer result = transactionTemplate.execute(status -> {
int update = customerFollowMapper.updateCustomerFollow(customerFollow);
if (update > 0) {
// 更新客户最近跟进时间
customerService.updateLastFollowTime(customerFollow.getCustomerId(), customerFollow.getFollowTime());
}
return update;
});
return result == null ? 0 : result;
}
/**

View File

@ -0,0 +1,68 @@
package com.ruoyi.bst.notice.domain;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.DictType;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.system.valid.DictValid;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 公告对象 bst_notice
*
* @author ruoyi
* @date 2025-02-10
*/
@Data
public class Notice extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
@Excel(name = "标题")
@ApiModelProperty("标题")
@NotBlank(message = "标题不能为空", groups = {ValidGroup.Create.class})
@Size(max = 50, message = "标题长度不能超过50个字符")
private String title;
@Excel(name = "内容")
@ApiModelProperty("内容")
private String content;
@Excel(name = "创建人ID")
@ApiModelProperty("创建人ID")
private Long userId;
@Excel(name = "重要程度", readConverterExp = "1=-一般,2=-重要,3=-紧急")
@ApiModelProperty("重要程度")
@NotBlank(message = "重要程度不能为空", groups = {ValidGroup.Create.class})
@DictValid(type = DictType.NOTICE_LEVEL, message = "非法的重要程度值")
private String level;
@Excel(name = "附件列表")
@ApiModelProperty("附件列表")
private String attaches;
@Excel(name = "是否置顶")
@ApiModelProperty("是否置顶")
@NotNull(message = "是否置顶不能为空", groups = {ValidGroup.Create.class})
private Boolean top;
@Excel(name = "接收用户ID列表")
@ApiModelProperty("接收用户ID列表")
private List<Long> receiveUserIds;
@Excel(name = "接收部门ID列表")
@ApiModelProperty("接收部门ID列表")
private List<Long> receiveDeptIds;
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.bst.notice.domain;
import lombok.Data;
@Data
public class NoticeQuery extends NoticeVO {
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.bst.notice.domain;
import java.util.List;
import com.ruoyi.system.dept.domain.vo.SysDeptNameVO;
import com.ruoyi.system.user.domain.vo.SysUserNameVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class NoticeVO extends Notice{
@ApiModelProperty("创建用户名称")
private String userName;
@ApiModelProperty("接收用户列表")
private List<SysUserNameVO> receiveUserList;
@ApiModelProperty("接收部门列表")
private List<SysDeptNameVO> receiveDeptList;
}

View File

@ -0,0 +1,66 @@
package com.ruoyi.bst.notice.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.bst.notice.domain.Notice;
import com.ruoyi.bst.notice.domain.NoticeQuery;
import com.ruoyi.bst.notice.domain.NoticeVO;
/**
* 公告Mapper接口
*
* @author ruoyi
* @date 2025-02-10
*/
public interface NoticeMapper
{
/**
* 查询公告
*
* @param id 公告主键
* @return 公告
*/
NoticeVO selectNoticeById(Long id);
/**
* 查询公告列表
*
* @param query 公告
* @return 公告集合
*/
List<NoticeVO> selectNoticeList(@Param("query")NoticeQuery query);
/**
* 新增公告
*
* @param notice 公告
* @return 结果
*/
int insertNotice(Notice notice);
/**
* 修改公告
*
* @param notice 公告
* @return 结果
*/
public int updateNotice(@Param("data") Notice notice);
/**
* 删除公告
*
* @param id 公告主键
* @return 结果
*/
int deleteNoticeById(Long id);
/**
* 批量删除公告
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNoticeByIds(Long[] ids);
}

View File

@ -0,0 +1,108 @@
<?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.ruoyi.bst.notice.mapper.NoticeMapper">
<resultMap type="NoticeVO" id="NoticeResult" autoMapping="true">
<result property="receiveUserIds" column="receive_user_ids" typeHandler="com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler"/>
<result property="receiveDeptIds" column="receive_dept_ids" typeHandler="com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler"/>
</resultMap>
<sql id="selectNoticeVo">
select
bn.id,
bn.title,
bn.content,
bn.create_time,
bn.user_id,
bn.level,
bn.attaches,
bn.top,
bn.receive_user_ids,
bn.receive_dept_ids,
su.nick_name as user_name
from bst_notice bn
left join sys_user su on su.user_id = bn.user_id
</sql>
<sql id="searchCondition">
<if test="query.id != null "> and bn.id = #{query.id}</if>
<if test="query.title != null and query.title != ''"> and bn.title like concat('%', #{query.title}, '%')</if>
<if test="query.content != null and query.content != ''"> and bn.content like concat('%', #{query.content}, '%')</if>
<if test="query.userId != null "> and bn.user_id = #{query.userId}</if>
<if test="query.level != null and query.level != ''"> and bn.level = #{query.level}</if>
<if test="query.top != null "> and bn.top = #{query.top}</if>
<if test="query.userName != null and query.userName != ''"> and su.nick_name like concat('%', #{query.userName}, '%')</if>
${query.params.dataScope}
</sql>
<select id="selectNoticeList" parameterType="NoticeQuery" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectNoticeById" parameterType="Long" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
where bn.id = #{id}
</select>
<insert id="insertNotice" parameterType="Notice" useGeneratedKeys="true" keyProperty="id">
insert into bst_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if>
<if test="content != null">content,</if>
<if test="createTime != null">create_time,</if>
<if test="userId != null">user_id,</if>
<if test="level != null and level != ''">level,</if>
<if test="attaches != null">attaches,</if>
<if test="top != null">top,</if>
<if test="receiveUserIds != null">receive_user_ids,</if>
<if test="receiveDeptIds != null">receive_dept_ids,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if>
<if test="content != null">#{content},</if>
<if test="createTime != null">#{createTime},</if>
<if test="userId != null">#{userId},</if>
<if test="level != null and level != ''">#{level},</if>
<if test="attaches != null">#{attaches},</if>
<if test="top != null">#{top},</if>
<if test="receiveUserIds != null">#{receiveUserIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
<if test="receiveDeptIds != null">#{receiveDeptIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
</trim>
</insert>
<update id="updateNotice" parameterType="Notice">
update bst_notice
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where id = #{data.id}
</update>
<sql id="updateColumns">
<if test="data.title != null and data.title != ''">title = #{data.title},</if>
<if test="data.content != null">content = #{data.content},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
<if test="data.userId != null">user_id = #{data.userId},</if>
<if test="data.level != null and data.level != ''">level = #{data.level},</if>
<if test="data.attaches != null">attaches = #{data.attaches},</if>
<if test="data.top != null">top = #{data.top},</if>
<if test="data.receiveUserIds != null">receive_user_ids = #{data.receiveUserIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
<if test="data.receiveDeptIds != null">receive_dept_ids = #{data.receiveDeptIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
</sql>
<delete id="deleteNoticeById" parameterType="Long">
delete from bst_notice where id = #{id}
</delete>
<delete id="deleteNoticeByIds" parameterType="String">
delete from bst_notice where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,13 @@
package com.ruoyi.bst.notice.service;
import java.util.List;
import com.ruoyi.bst.notice.domain.NoticeVO;
public interface NoticeAssembler {
void assembleReceiveUserList(List<NoticeVO> list);
void assembleReceiveDeptList(List<NoticeVO> list);
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.bst.notice.service;
import java.util.List;
import com.ruoyi.bst.notice.domain.Notice;
import com.ruoyi.bst.notice.domain.NoticeQuery;
import com.ruoyi.bst.notice.domain.NoticeVO;
/**
* 公告Service接口
*
* @author ruoyi
* @date 2025-02-10
*/
public interface NoticeService
{
/**
* 查询公告
*
* @param id 公告主键
* @return 公告
*/
public NoticeVO selectNoticeById(Long id);
/**
* 查询公告列表
*
* @param notice 公告
* @return 公告集合
*/
public List<NoticeVO> selectNoticeList(NoticeQuery notice);
/**
* 新增公告
*
* @param notice 公告
* @return 结果
*/
public int insertNotice(Notice notice);
/**
* 修改公告
*
* @param notice 公告
* @return 结果
*/
public int updateNotice(Notice notice);
/**
* 批量删除公告
*
* @param ids 需要删除的公告主键集合
* @return 结果
*/
public int deleteNoticeByIds(Long[] ids);
/**
* 删除公告信息
*
* @param id 公告主键
* @return 结果
*/
public int deleteNoticeById(Long id);
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.bst.notice.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.notice.domain.NoticeVO;
import com.ruoyi.bst.notice.service.NoticeAssembler;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.system.dept.domain.vo.SysDeptNameVO;
import com.ruoyi.system.dept.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.user.domain.vo.SysUserNameVO;
@Service
public class NoticeAssemblerImpl implements NoticeAssembler {
@Autowired
private ISysUserService userService;
@Autowired
private ISysDeptService deptService;
@Override
public void assembleReceiveUserList(List<NoticeVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
List<SysUserNameVO> userList = userService.selectAllUserNameList();
for (NoticeVO notice : list) {
if (notice.getReceiveUserIds() == null) {
notice.setReceiveUserList(Collections.emptyList());
continue;
}
List<SysUserNameVO> receiveUserList = userList.stream()
.filter(user -> notice.getReceiveUserIds().contains(user.getUserId()))
.collect(Collectors.toList());
notice.setReceiveUserList(receiveUserList);
}
}
@Override
public void assembleReceiveDeptList(List<NoticeVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
List<SysDeptNameVO> deptList = deptService.selectAllDeptNameList();
for (NoticeVO notice : list) {
if (notice.getReceiveDeptIds() == null) {
notice.setReceiveDeptList(Collections.emptyList());
continue;
}
List<SysDeptNameVO> receiveDeptList = deptList.stream()
.filter(dept -> notice.getReceiveDeptIds().contains(dept.getDeptId()))
.collect(Collectors.toList());
notice.setReceiveDeptList(receiveDeptList);
}
}
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.bst.notice.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.notice.domain.Notice;
import com.ruoyi.bst.notice.domain.NoticeQuery;
import com.ruoyi.bst.notice.domain.NoticeVO;
import com.ruoyi.bst.notice.mapper.NoticeMapper;
import com.ruoyi.bst.notice.service.NoticeService;
import com.ruoyi.common.utils.DateUtils;
/**
* 公告Service业务层处理
*
* @author ruoyi
* @date 2025-02-10
*/
@Service
public class NoticeServiceImpl implements NoticeService
{
@Autowired
private NoticeMapper noticeMapper;
/**
* 查询公告
*
* @param id 公告主键
* @return 公告
*/
@Override
public NoticeVO selectNoticeById(Long id)
{
return noticeMapper.selectNoticeById(id);
}
/**
* 查询公告列表
*
* @param notice 公告
* @return 公告
*/
@Override
public List<NoticeVO> selectNoticeList(NoticeQuery notice)
{
return noticeMapper.selectNoticeList(notice);
}
/**
* 新增公告
*
* @param notice 公告
* @return 结果
*/
@Override
public int insertNotice(Notice notice)
{
notice.setCreateTime(DateUtils.getNowDate());
return noticeMapper.insertNotice(notice);
}
/**
* 修改公告
*
* @param notice 公告
* @return 结果
*/
@Override
public int updateNotice(Notice notice)
{
return noticeMapper.updateNotice(notice);
}
/**
* 批量删除公告
*
* @param ids 需要删除的公告主键
* @return 结果
*/
@Override
public int deleteNoticeByIds(Long[] ids)
{
return noticeMapper.deleteNoticeByIds(ids);
}
/**
* 删除公告信息
*
* @param id 公告主键
* @return 结果
*/
@Override
public int deleteNoticeById(Long id)
{
return noticeMapper.deleteNoticeById(id);
}
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.bst.project.domain;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@ -103,4 +104,8 @@ public class Project extends BaseEntity
@Excel(name = "开发是否超期")
@ApiModelProperty("开发是否超期")
private Boolean devOverdue;
@Excel(name = "项目成员列表")
@ApiModelProperty("项目成员列表")
private List<Long> memberIds;
}

View File

@ -1,5 +1,9 @@
package com.ruoyi.bst.project.domain;
import java.util.List;
import com.ruoyi.system.user.domain.vo.SysUserNameVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -30,4 +34,7 @@ public class ProjectVO extends Project{
@ApiModelProperty("任务待确认数量(需组装)")
private Integer taskWaitConfirmCount;
@ApiModelProperty("项目成员列表(需组装)")
private List<SysUserNameVO> memberList;
}

View File

@ -4,7 +4,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bst.project.mapper.ProjectMapper">
<resultMap type="ProjectVO" id="ProjectResult" autoMapping="true"/>
<resultMap type="ProjectVO" id="ProjectResult" autoMapping="true">
<result property="memberIds" column="member_ids" typeHandler="com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler"/>
</resultMap>
<sql id="selectProjectVo">
select
@ -29,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.start_time,
bp.accept_time,
bp.dev_overdue,
bp.member_ids,
su.nick_name as owner_name,
sf.nick_name as follow_name,
sc.nick_name as create_name,
@ -106,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startTime != null">start_time,</if>
<if test="acceptTime != null">accept_time,</if>
<if test="devOverdue != null">dev_overdue,</if>
<if test="memberIds != null">member_ids,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="no != null and no != ''">#{no},</if>
@ -129,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startTime != null">#{startTime},</if>
<if test="acceptTime != null">#{acceptTime},</if>
<if test="devOverdue != null">#{devOverdue},</if>
<if test="memberIds != null">#{memberIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
</trim>
</insert>
@ -162,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.startTime != null">start_time = #{data.startTime},</if>
<if test="data.acceptTime != null">accept_time = #{data.acceptTime},</if>
<if test="data.devOverdue != null">dev_overdue = #{data.devOverdue},</if>
<if test="data.memberIds != null">member_ids = #{data.memberIds, typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
</sql>
<update id="logicDel" parameterType="String">

View File

@ -23,4 +23,10 @@ public interface ProjectAssembler {
* @param list
*/
void assembleTaskWaitConfirmCount(List<ProjectVO> list);
/**
* 组装项目成员列表
* @param list
*/
void assembleMemberList(List<ProjectVO> list);
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.bst.project.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -14,6 +15,8 @@ import com.ruoyi.bst.task.domain.enums.TaskStatus;
import com.ruoyi.bst.task.service.TaskService;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.common.vo.LongIntegerVO;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.user.domain.vo.SysUserNameVO;
@Service
public class ProjectAssemblerImpl implements ProjectAssembler {
@ -21,6 +24,9 @@ public class ProjectAssemblerImpl implements ProjectAssembler {
@Autowired
private TaskService taskService;
@Autowired
private ISysUserService userService;
@Override
public void assembleTaskCount(List<ProjectVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
@ -83,4 +89,24 @@ public class ProjectAssemblerImpl implements ProjectAssembler {
.collect(Collectors.toMap(LongIntegerVO::getKey, LongIntegerVO::getValue));
}
@Override
public void assembleMemberList(List<ProjectVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
List<SysUserNameVO> memberList = userService.selectAllUserNameList();
for (ProjectVO project : list) {
if (project.getMemberIds() == null) {
project.setMemberList(Collections.emptyList());
continue;
}
List<SysUserNameVO> projectMemberList = memberList.stream()
.filter(item -> project.getMemberIds().contains(item.getUserId()))
.collect(Collectors.toList());
project.setMemberList(projectMemberList);
}
}
}

View File

@ -34,6 +34,7 @@ public class ProjectConverterImpl implements ProjectConverter {
po.setCustomerId(data.getCustomerId());
po.setRemark(data.getRemark());
po.setCreateId(loginUser.getUserId());
po.setMemberIds(data.getMemberIds());
return po;
}
@ -54,7 +55,8 @@ public class ProjectConverterImpl implements ProjectConverter {
po.setAttaches(data.getAttaches());
po.setCustomerId(data.getCustomerId());
po.setRemark(data.getRemark());
po.setMemberIds(data.getMemberIds());
return po;
}

View File

@ -27,8 +27,12 @@ public class TaskBriefVO {
@ApiModelProperty("已完成")
private Integer completed;
@ApiModelProperty("驳回")
private Integer reject;
public TaskBriefVO(List<StringIntegerVO> statusMap) {
this.waitCompleted = statusMap.stream()
.filter(vo -> TaskStatus.WAIT_COMPLETED.getStatus().equals(vo.getKey()))
.findFirst().map(StringIntegerVO::getValue).orElse(0);
@ -44,6 +48,11 @@ public class TaskBriefVO {
.filter(vo -> TaskStatus.PASS.getStatus().equals(vo.getKey()))
.findFirst().map(StringIntegerVO::getValue).orElse(0);
this.reject = statusMap.stream()
.filter(vo -> TaskStatus.REJECT.getStatus().equals(vo.getKey()))
.findFirst().map(StringIntegerVO::getValue).orElse(0);
this.total = statusMap.stream().map(StringIntegerVO::getValue).reduce(0, Integer::sum);
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.system.dept.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class SysDeptNameVO {
@ApiModelProperty("部门ID")
private Long deptId;
@ApiModelProperty("部门名称")
private String deptName;
}

View File

@ -1,11 +1,13 @@
package com.ruoyi.system.dept.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.dept.domain.SysDeptQuery;
import com.ruoyi.system.dept.domain.SysDeptVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.ruoyi.system.dept.domain.vo.SysDeptNameVO;
/**
* 部门管理 数据层
@ -119,4 +121,9 @@ public interface SysDeptMapper
* @return 结果
*/
public int deleteDeptById(Long deptId);
/**
* 查询所有部门名称列表
*/
List<SysDeptNameVO> selectDeptNameList(SysDeptQuery query);
}

View File

@ -25,11 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.dept_name as parent_name
from sys_dept d
left join sys_dept p on d.parent_id = p.dept_id
</sql>
</sql>
<select id="selectDeptList" parameterType="SysDeptQuery" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<sql id="searchCondition">
AND d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND d.dept_id = #{deptId}
</if>
@ -60,6 +59,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
</sql>
<select id="selectDeptList" parameterType="SysDeptQuery" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
<where>
<include refid="searchCondition"/>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
@ -173,4 +179,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
<!-- selectDeptNameList -->
<select id="selectDeptNameList" parameterType="SysDeptQuery" resultType="SysDeptNameVO">
select d.dept_id, d.dept_name
from sys_dept d
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper>

View File

@ -1,12 +1,12 @@
package com.ruoyi.system.dept.service;
import java.util.List;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.dept.domain.SysDeptQuery;
import com.ruoyi.system.dept.domain.SysDeptVO;
import java.util.Collection;
import java.util.List;
import com.ruoyi.system.dept.domain.vo.SysDeptNameVO;
/**
* 部门管理 服务层
@ -143,7 +143,7 @@ public interface ISysDeptService
List<SysDeptVO> selectDeptListByNames(List<String> names);
/**
* 根据ERP ID 列表查询
* 查询所有部门名称列表
*/
List<SysDeptVO> selectByErpIds(Collection<String> erpIds);
List<SysDeptNameVO> selectAllDeptNameList();
}

View File

@ -1,11 +1,23 @@
package com.ruoyi.system.dept.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
@ -14,14 +26,10 @@ import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.dept.domain.SysDeptQuery;
import com.ruoyi.system.dept.domain.SysDeptVO;
import com.ruoyi.system.dept.domain.vo.SysDeptNameVO;
import com.ruoyi.system.dept.mapper.SysDeptMapper;
import com.ruoyi.system.dept.service.ISysDeptService;
import com.ruoyi.system.mapper.SysRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 部门管理 服务实现
@ -37,6 +45,12 @@ public class SysDeptServiceImpl implements ISysDeptService
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private RedisCache redisCache;
@Autowired
private TransactionTemplate transactionTemplate;
/**
* 查询部门管理数据
*
@ -211,15 +225,23 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override
public int insertDept(SysDept dept)
{
// SysDept info = deptMapper.selectDeptById(dept.getParentId(), false);
// // 如果父节点不为正常状态,则不允许新增子节点
// if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
// {
// throw new ServiceException("部门停用,不允许新增");
// }
SysDept info = deptMapper.selectDeptById(dept.getParentId(), false);
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new ServiceException("部门停用,不允许新增");
}
dept.setAncestors(String.valueOf(dept.getParentId()));
return deptMapper.insertDept(dept);
Integer result = transactionTemplate.execute(status -> {
int insert = deptMapper.insertDept(dept);
if (insert > 0) {
clearCache();
}
return insert;
});
return result == null ? 0 : result;
}
/**
@ -231,23 +253,31 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override
public int updateDept(SysDept dept)
{
// SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId(), false);
// SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId(), false);
// if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
// {
// String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
// String oldAncestors = oldDept.getAncestors();
// dept.setAncestors(newAncestors);
// updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
// }
int result = deptMapper.updateDept(dept);
// if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
// && !StringUtils.equals("0", dept.getAncestors()))
// {
// // 如果该部门是启用状态则启用该部门的所有上级部门
// updateParentDeptStatusNormal(dept);
// }
return result;
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId(), false);
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId(), false);
Integer result = transactionTemplate.execute(status -> {
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
{
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
int update = deptMapper.updateDept(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
&& !StringUtils.equals("0", dept.getAncestors()))
{
// 如果该部门是启用状态则启用该部门的所有上级部门
updateParentDeptStatusNormal(dept);
}
clearCache();
return update;
});
return result == null ? 0 : result;
}
/**
@ -291,7 +321,15 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override
public int deleteDeptById(Long deptId)
{
return deptMapper.deleteDeptById(deptId);
Integer result = transactionTemplate.execute(status -> {
int delete = deptMapper.deleteDeptById(deptId);
if (delete > 0) {
clearCache();
}
return delete;
});
return result == null ? 0 : result;
}
@Override
@ -304,14 +342,21 @@ public class SysDeptServiceImpl implements ISysDeptService
return this.selectDeptList(query);
}
@Override
public List<SysDeptVO> selectByErpIds(Collection<String> erpIds) {
if (CollectionUtils.isEmptyElement(erpIds)) {
return Collections.emptyList();
public List<SysDeptNameVO> selectAllDeptNameList() {
List<SysDeptNameVO> deptNameList = redisCache.getCacheList(CacheConstants.DEPT_NAME_LIST);
if (CollectionUtils.isEmptyElement(deptNameList)) {
deptNameList = deptMapper.selectDeptNameList(new SysDeptQuery());
if (CollectionUtils.isNotEmptyElement(deptNameList)) {
redisCache.setCacheList(CacheConstants.DEPT_NAME_LIST, deptNameList);
}
}
SysDeptQuery query = new SysDeptQuery();
query.setErpIds(erpIds);
return deptMapper.selectDeptList(query);
return deptNameList;
}
private void clearCache() {
redisCache.deleteObject(CacheConstants.DEPT_NAME_LIST);
}
/**

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.user.domain.SysUserQuery;
import com.ruoyi.system.user.domain.SysUserShiftQuery;
import com.ruoyi.system.user.domain.SysUserVO;
import com.ruoyi.system.user.domain.vo.SysUserNameVO;
@ -235,11 +234,6 @@ public interface ISysUserService
*/
int unbindWx(Long userId);
/**
* 查询调班用户列表
*/
List<SysUserVO> selectUserWithShiftList(SysUserShiftQuery query);
/**
* 查询用户列表
*/
@ -249,4 +243,11 @@ public interface ISysUserService
* 查询所有用户名称列表
*/
List<SysUserNameVO> selectAllUserNameList();
/**
* 根据ID列表查询用户列表
* @param ids
* @return
*/
List<SysUserVO> selectByIds(List<Long> ids);
}

View File

@ -45,7 +45,6 @@ import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.user.domain.SysUserQuery;
import com.ruoyi.system.user.domain.SysUserShiftQuery;
import com.ruoyi.system.user.domain.SysUserVO;
import com.ruoyi.system.user.domain.vo.SysUserNameVO;
import com.ruoyi.system.user.mapper.SysUserMapper;
@ -667,11 +666,6 @@ public class SysUserServiceImpl implements ISysUserService
return userMapper.unbindWxOpenId(userId);
}
@Override
public List<SysUserVO> selectUserWithShiftList(SysUserShiftQuery query) {
return userMapper.selectUserWithShiftList(query);
}
@Override
public List<SysUserVO> selectUserList(SysUserQuery query) {
return userMapper.selectUserList(query);
@ -689,6 +683,16 @@ public class SysUserServiceImpl implements ISysUserService
return list;
}
@Override
public List<SysUserVO> selectByIds(List<Long> ids) {
if (CollectionUtils.isEmptyElement(ids)) {
return Collections.emptyList();
}
SysUserQuery query = new SysUserQuery();
query.setUserIds(ids);
return userMapper.selectUserList(query);
}
private SysUserVO selectOne(SysUserQuery query) {
PageHelper.startPage(1, 1);
List<SysUserVO> list = userMapper.selectUserList(query);

View File

@ -1,12 +1,11 @@
package com.ruoyi.system.user.domain;
import com.ruoyi.common.core.domain.entity.SysUser;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author wjh
* 2024/10/22

View File

@ -1,11 +1,17 @@
package com.ruoyi.system.user.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class SysUserNameVO {
@ApiModelProperty("用户ID")
private Long userId;
@ApiModelProperty("用户昵称")
private String nickName;
@ApiModelProperty("用户头像")
private String avatar;
}

View File

@ -242,21 +242,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectUserWithShiftList" resultMap="SysUserResult">
<include refid="selectListVo"/>
left join bst_shift bs on FIND_IN_SET(u.user_id, bs.user_ids)
left join sys_dept sdt on sdt.dept_id = bs.target_dept_id
<where>
<include refid="searchCondition"/>
<if test="shiftDate != null and targetDeptId != null">
AND (
u.dept_id = #{targetDeptId} or
(DATE ( bs.shift_time_start ) &lt;= #{shiftDate} and DATE ( bs.shift_time_end ) >= #{shiftDate} and bs.target_dept_id = #{targetDeptId})
)
</if>
</where>
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>
@ -362,15 +347,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- selectNameList -->
<select id="selectNameList">
<select id="selectNameList" resultType="SysUserNameVO">
select
u.user_id,
u.nick_name
u.nick_name,
u.avatar
from sys_user u
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper>

View File

@ -85,6 +85,7 @@ public class CustomerFollowController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) CustomerFollow customerFollow)
{
customerFollow.setUserId(getUserId());
return toAjax(customerFollowService.insertCustomerFollow(customerFollow));
}

View File

@ -0,0 +1,119 @@
package com.ruoyi.web.bst;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.bst.notice.domain.Notice;
import com.ruoyi.bst.notice.domain.NoticeQuery;
import com.ruoyi.bst.notice.domain.NoticeVO;
import com.ruoyi.bst.notice.service.NoticeAssembler;
import com.ruoyi.bst.notice.service.NoticeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 公告Controller
*
* @author ruoyi
* @date 2025-02-10
*/
@RestController
@RequestMapping("/bst/notice")
public class NoticeController extends BaseController
{
@Autowired
private NoticeService noticeService;
@Autowired
private NoticeAssembler noticeAssembler;
/**
* 查询公告列表
*/
@PreAuthorize("@ss.hasPermi('bst:notice:list')")
@GetMapping("/list")
public TableDataInfo list(NoticeQuery query)
{
startPage();
startOrderBy();
List<NoticeVO> list = noticeService.selectNoticeList(query);
noticeAssembler.assembleReceiveUserList(list);
noticeAssembler.assembleReceiveDeptList(list);
return getDataTable(list);
}
/**
* 导出公告列表
*/
@PreAuthorize("@ss.hasPermi('bst:notice:export')")
@Log(title = "公告", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, NoticeQuery query)
{
List<NoticeVO> list = noticeService.selectNoticeList(query);
ExcelUtil<NoticeVO> util = new ExcelUtil<NoticeVO>(NoticeVO.class);
util.exportExcel(response, list, "公告数据");
}
/**
* 获取公告详细信息
*/
@PreAuthorize("@ss.hasPermi('bst:notice:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(noticeService.selectNoticeById(id));
}
/**
* 新增公告
*/
@PreAuthorize("@ss.hasPermi('bst:notice:add')")
@Log(title = "公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) Notice notice)
{
notice.setUserId(getUserId());
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改公告
*/
@PreAuthorize("@ss.hasPermi('bst:notice:edit')")
@Log(title = "公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Notice notice)
{
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除公告
*/
@PreAuthorize("@ss.hasPermi('bst:notice:remove')")
@Log(title = "公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(noticeService.deleteNoticeByIds(ids));
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.bst;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -96,7 +97,10 @@ public class ProjectController extends BaseController
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(projectService.selectProjectById(id));
ProjectVO project = projectService.selectProjectById(id);
List<ProjectVO> list = Collections.singletonList(project);
projectAssembler.assembleMemberList(list);
return success(project);
}
/**