Compare commits

...

2 Commits

Author SHA1 Message Date
xiaofajia
cb3bea2ad3 修改 2024-12-20 15:27:01 +08:00
xiaofajia
e230c5ab09 修改 2024-12-20 14:19:45 +08:00
7 changed files with 64 additions and 24 deletions

View File

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

View File

@ -120,13 +120,13 @@ public class CompanyStaff extends TenantBaseDO {
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8") @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("转正时间") @ExcelProperty("转正时间")
private LocalDateTime formalDate; private Date formalDate;
/** 购买保险时间 */ /** 购买保险时间 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8") @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("购买保险时间") @ExcelProperty("购买保险时间")
private LocalDateTime safeDate; private Date safeDate;
/** 附件的名称们手动填写逗号分隔没有也要占位和下面的urls对应 */ /** 附件的名称们手动填写逗号分隔没有也要占位和下面的urls对应 */
private String fileNames; private String fileNames;

View File

@ -141,12 +141,12 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
CompanyStaffRespVO getMyAdviser(Long tenantId,String sysCode); CompanyStaffRespVO getMyAdviser(Long tenantId,String sysCode);
/** /**
* 创建员工信息在角色和用户已经存在的情况下用 * 创建修改员工信息在角色和用户已经存在的情况下用
* *
* @author 小李 * @author 小李
* @date 17:26 2024/12/19 * @date 17:26 2024/12/19
* @param staffRespVO 信息 * @param staffRespVO 信息
**/ **/
void createByExistUser(CompanyStaffRespVO staffRespVO); void updateByExistUser(CompanyStaffRespVO staffRespVO);
} }

View File

@ -689,26 +689,43 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
} }
/** /**
* 创建员工信息在角色和用户已经存在的情况下用 * 创建修改员工信息在角色和用户已经存在的情况下用
* *
* @author 小李 * @author 小李
* @date 17:26 2024/12/19 * @date 17:26 2024/12/19
* @param staffRespVO 信息 * @param staffRespVO 信息
**/ **/
public void createByExistUser(CompanyStaffRespVO staffRespVO){ @Override
AdminUserRespDTO loginUser = getLoginUser(); public void updateByExistUser(CompanyStaffRespVO staffRespVO){
// 设置新增员工部门 if (ObjectUtil.isEmpty(staffRespVO.getId())){
staffRespVO.setDeptId(loginUser.getDeptId()); AdminUserRespDTO loginUser = getLoginUser();
// 1 获取当前登录用户的企业信息给添加的员工 // 设置新增员工部门
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId()); staffRespVO.setDeptId(loginUser.getDeptId());
staffRespVO.setCorpId(loginDept.getCorpId()); // 1 获取当前登录用户的企业信息给添加的员工
// 2 生成唯一推广码 DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
String uniqueCode = uniqueCodeService.createUniqueCode(); staffRespVO.setCorpId(loginDept.getCorpId());
if (!ObjectUtil.isNotEmpty(uniqueCode)) { // 2 生成唯一推广码
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT); String uniqueCode = uniqueCodeService.createUniqueCode();
if (!ObjectUtil.isNotEmpty(uniqueCode)) {
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT);
}
staffRespVO.setUniqueCode(uniqueCode);
// 3 保存员工信息到数据库
baseMapper.insert(staffRespVO);
}else {
AdminUserRespDTO user = adminUserApi.getUser(staffRespVO.getUserId());
AdminUserRespDTO newUser = new AdminUserRespDTO();
newUser.setId(user.getId());
if (!user.getUsername().equals(staffRespVO.getTel())){
newUser.setUsername(staffRespVO.getTel());
}
if (!user.getNickname().equals(staffRespVO.getName())){
newUser.setNickname(staffRespVO.getName());
}
if (ObjectUtil.isNotEmpty(newUser.getUsername()) || ObjectUtil.isNotEmpty(newUser.getNickname())){
adminUserApi.updateUser(newUser);
}
baseMapper.updateById(staffRespVO);
} }
staffRespVO.setUniqueCode(uniqueCode);
// 3 保存员工信息到数据库
baseMapper.insert(staffRespVO);
} }
} }

View File

@ -213,7 +213,8 @@ where sig.partner_id =#{partnerId}
<select id="inspectionList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo"> <select id="inspectionList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT SELECT
info.id,info.worker_name,info.worker_phone,info.worker_avatar,info.`status`,info.is_pass,info.start_time,info.end_time,step.title as lastTitle, info.id,info.worker_name,info.worker_phone,info.worker_avatar,info.`status`,info.is_pass,info.start_time,info.end_time,step.title as lastTitle,
su.nickname buyName,su.mobile as buyPhone,oi.order_no as orderNo,oi.pay_money+oi.balance as realPayMoney,oi.goods_title as goodsName,info.car_num,info.is_retrial su.nickname buyName,su.mobile as buyPhone,oi.order_no as orderNo,oi.pay_money+oi.balance as realPayMoney,oi.goods_title as goodsName,info.car_num,info.is_retrial,
info.customer_source as customerSource, info.other_phone as otherPhone,oi.sku_id as skuId, oi.sku_name as skuName,oi.goods_price as goodsPrice
from from
inspection_info info inspection_info info
LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id

View File

@ -162,4 +162,13 @@ public interface AdminUserApi {
**/ **/
void setOpenId(Long userId,String openId); void setOpenId(Long userId,String openId);
/**
* 更新用户信息慎用
*
* @author 小李
* @date 11:47 2024/12/20
* @param newUser 新用户信息
**/
void updateUser(AdminUserRespDTO newUser);
} }

View File

@ -195,4 +195,17 @@ public class AdminUserApiImpl implements AdminUserApi {
userService.setOpenId(userId, openId); userService.setOpenId(userId, openId);
} }
/**
* 更新用户信息慎用
*
* @author 小李
* @date 11:47 2024/12/20
* @param newUser 新用户信息
**/
@Override
public void updateUser(AdminUserRespDTO newUser){
AdminUserDO bean = BeanUtil.toBean(newUser, AdminUserDO.class);
userService.updateById(bean);
}
} }