Compare commits

...

2 Commits

Author SHA1 Message Date
xiaofajia
4b6d66e9b4 修改 2024-12-19 17:48:24 +08:00
xiaofajia
dbe91094ec 修改 2024-12-19 14:50:52 +08:00
12 changed files with 128 additions and 8 deletions

View File

@ -104,6 +104,19 @@ public class CompanyStaffController {
return CommonResult.ok();
}
/**
* 创建员工信息在角色和用户已经存在的情况下用
*
* @author 小李
* @date 17:26 2024/12/19
* @param staffRespVO 信息
**/
@PostMapping("/createByExistUser")
public CommonResult<?> createByExistUser(@RequestBody CompanyStaffRespVO staffRespVO){
staffService.createByExistUser(staffRespVO);
return CommonResult.ok();
}
/**
* 修改员工
*

View File

@ -16,6 +16,7 @@ import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@ -110,4 +111,23 @@ public class CompanyStaff extends TenantBaseDO {
@TableField(exist = false)
@ExcelProperty("员工角色")
private String roleNames;
/** 身份证号 */
@ExcelProperty("身份证号")
private String IdNumber;
/** 转正时间 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("转正时间")
private LocalDateTime formalDate;
/** 购买保险时间 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("购买保险时间")
private LocalDateTime safeDate;
/** 附件的名称们手动填写逗号分隔没有也要占位和下面的urls对应 */
private String fileNames;
}

View File

@ -139,4 +139,14 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
* @return cn.iocoder.yudao.module.staff.entity.CompanyStaff
**/
CompanyStaffRespVO getMyAdviser(Long tenantId,String sysCode);
/**
* 创建员工信息在角色和用户已经存在的情况下用
*
* @author 小李
* @date 17:26 2024/12/19
* @param staffRespVO 信息
**/
void createByExistUser(CompanyStaffRespVO staffRespVO);
}

View File

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.log.Log;
import cn.iocoder.yudao.common.*;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
@ -685,4 +687,28 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
// 啥也不是
return "";
}
/**
* 创建员工信息在角色和用户已经存在的情况下用
*
* @author 小李
* @date 17:26 2024/12/19
* @param staffRespVO 信息
**/
public void createByExistUser(CompanyStaffRespVO staffRespVO){
AdminUserRespDTO loginUser = getLoginUser();
// 设置新增员工部门
staffRespVO.setDeptId(loginUser.getDeptId());
// 1 获取当前登录用户的企业信息给添加的员工
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
staffRespVO.setCorpId(loginDept.getCorpId());
// 2 生成唯一推广码
String uniqueCode = uniqueCodeService.createUniqueCode();
if (!ObjectUtil.isNotEmpty(uniqueCode)) {
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT);
}
staffRespVO.setUniqueCode(uniqueCode);
// 3 保存员工信息到数据库
baseMapper.insert(staffRespVO);
}
}

View File

@ -93,6 +93,9 @@ public enum InspectionRoleCommon {
/** 安全检验员 */
AQJYY("aqjyy", 4),
/** 授权签字人 */
JCSQQZR("jcsqqzr", 4),
/** 检测员工 */
JCWORKER("jcworker", 4);

View File

@ -164,6 +164,12 @@ public class AppNewsController extends BaseController {
inspectionNews.setPublishUnit(partners.getPartnerName());
}
if (ObjectUtil.isEmpty(inspectionNews.getType()) || inspectionNews.getType().equals("null")){
if (ObjectUtil.isNotEmpty(inspectionNews.getIfShow())){
inspectionNews.setType(inspectionNews.getIfShow().equals("01") ? "staff" : "user");
}
}
//判断是否为当前登录用户创建的
return toAjax(inspectionNewsService.insertInspectionNews(inspectionNews));
}

View File

@ -56,4 +56,8 @@ public class InspectionNews extends TenantBaseDO
@TableField(exist = false)
private String isRead;
/** 设置可见 */
@TableField(exist = false)
private String ifShow;
}

View File

@ -81,6 +81,6 @@ public interface InspectionNewsMapper extends BaseMapper<InspectionNews>
void addReadNum(Long id);
IPage<InspectionNews> collectionNews(Page<InspectionNews> page, @Param("userId") Long userId,@Param("newsName")String newsName);
Integer newMsgNum(@Param("partnerId") Long partnerId);
IPage<InspectionNews> msgList(Page<InspectionNews> page, @Param("partnerId") Long partnerId);
IPage<InspectionNews> msgList(Page<InspectionNews> page, @Param("ifShow") String ifShow);
List<String> listGfClass(@Param("type") String type);
}

View File

@ -4,10 +4,15 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -28,6 +33,8 @@ import cn.iocoder.yudao.module.inspection.utils.HtmlFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 请填写功能名称Service业务层处理
*
@ -44,6 +51,10 @@ public class InspectionNewsServiceImpl extends ServiceImpl<InspectionNewsMapper,
private AdminUserService userService;
@Autowired
private IInspectionNewsCommentService commentService;
@Resource
private PermissionApi permissionApi;
@Resource
private RoleApi roleApi;
/**
* 查询请填写功能名称
@ -106,7 +117,7 @@ public class InspectionNewsServiceImpl extends ServiceImpl<InspectionNewsMapper,
public int insertInspectionNews(InspectionNews inspectionNews)
{
return baseMapper.insertInspectionNews(inspectionNews);
return baseMapper.insert(inspectionNews);
}
/**
@ -266,9 +277,27 @@ public class InspectionNewsServiceImpl extends ServiceImpl<InspectionNewsMapper,
}
@Override
@TenantIgnore
// @TenantIgnore
public IPage<InspectionNews> msgList(Page<InspectionNews> page, Long partnerId) {
IPage<InspectionNews> news = baseMapper.msgList(page, partnerId);
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<RoleReqDTO> collect = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
String ifShow = "";
if (CollUtil.isNotEmpty(collect)){
List<String> collect1 = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList());
// 检测用户
if (collect1.contains("jcyh")){
ifShow = "user";
}
// else if (collect1.contains("jcgf") || collect1.contains("jcshop") || collect1.contains("dealers") || collect1.contains("partners")){
// // 检测官方 检测商户 经销商 合作商
// ifShow = "";
// }
else {
ifShow = "staff";
}
}
IPage<InspectionNews> news = baseMapper.msgList(page, ifShow);
news.getRecords().forEach(it->{
it.setNewsContent(HtmlFilter.dealFunction(it.getNewsContent()));
});

View File

@ -167,8 +167,14 @@
news.*,IF(ina.id is null,0,1) as isRead
FROM
inspection_news news
left JOIN inspection_news_association ina ON ina.news_id = news.id and ina.user_id = #{partnerId} and ina.type = 'read'
WHERE news.category = 'jcztz' or news.category = 'zflm'
left JOIN inspection_news_association ina ON ina.news_id = news.id and ina.type = 'read'
WHERE news.category = 'zflm'
<if test="ifShow != null and ifShow != ''">
or news.category = 'jcztz'
or news.type = #{ifShow}
or news.type = 'null'
</if>
group by news.id
order by isRead,news.create_time desc
</select>
<select id="listGfClass" resultType="java.lang.String">

View File

@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.config.CommonStr.SUPER_ADMIN_ID;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -349,8 +350,10 @@ public class RoleServiceImpl implements RoleService {
*/
@Override
public List<RoleDO> pageByQuery(RoleDO roleDO) {
return roleMapper.selectList(new LambdaQueryWrapper<RoleDO>()
//去年检测用户
List<RoleDO> roleDOS = roleMapper.selectList(new LambdaQueryWrapper<RoleDO>()
.eq(RoleDO::getServicePackageId, roleDO.getServicePackageId()));
return roleDOS.stream().filter(item -> !item.getCode().equals("jcyh")).collect(Collectors.toList());
}
@Override

View File

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join system_user_role sr on su.id = sr.user_id
left join system_role sr2 on sr.role_id = sr2.id
<where>
su.deleted = 0 and sr2.service_package_id = 'jiance'
su.deleted = 0 and sr2.service_package_id = 'jiance' and sr2.code != 'jcyh'
<if test="role.roleId != null">
and sr.role_id = #{role.roleId}
</if>