Merge branch 'dev' of http://47.97.8.94:19527/yj/zn-cloud into dev
This commit is contained in:
commit
93d95e7ce6
@ -35,6 +35,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode OA_INCENTIVE_NOT_EXISTS = new ErrorCode(1_009_001_110, "奖惩申请不存在");
|
||||
ErrorCode OA_WORK_TASK_NOT_EXISTS = new ErrorCode(1_009_001_110, "工作任务不存在");
|
||||
ErrorCode OA_ENTRY_NOT_EXISTS = new ErrorCode(1_009_001_111, "入职申请不存在");
|
||||
ErrorCode OA_GOOut_NOT_EXISTS = new ErrorCode(1_009_001_112, "外出申请不存在");
|
||||
|
||||
// ========== 流程模型 1-009-002-000 ==========
|
||||
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
|
||||
|
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAGoOutConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAGoOutService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* OA 外出申请 Controller
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Tag(name = "管理后台 - OA 外出申请")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/oa/goOut")
|
||||
@Validated
|
||||
public class BpmOAGoOutController {
|
||||
|
||||
@Resource
|
||||
private BpmOAGoOutService goOutService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建外出申请")
|
||||
public CommonResult<Long> createGoOut(@Valid @RequestBody BpmOAGoOutCreateReqVO createReqVO) {
|
||||
|
||||
return success(goOutService.createGoOut(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得入职申请")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOAGoOutRespVO> getGoOut(@RequestParam("id") Long id) {
|
||||
|
||||
BpmOAGoOutDO goOut = goOutService.getGoOut(id);
|
||||
|
||||
return success(BpmOAGoOutConvert.INSTANCE.convert(goOut));
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得外出申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOAGoOutRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
|
||||
|
||||
BpmOAGoOutDO goOut = goOutService.getByProcessInstanceId(processInstanceId);
|
||||
return success(BpmOAGoOutConvert.INSTANCE.convert(goOut));
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 出差申请 创建 Request VO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 出差申请创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode()
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAGoOutCreateReqVO {
|
||||
|
||||
@Schema(description = "外出事由", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "外出事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "外出地点")
|
||||
private String location;
|
||||
|
||||
@Schema(description = "外出的开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "开始时间不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 出差申请 创建 Request VO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 出差申请创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAGoOutRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "外出事由")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "外出地点")
|
||||
private String location;
|
||||
|
||||
@Schema(description = "外出的开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举", example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "上传文件")
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.bpm.convert.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 外出申请 Convert
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface BpmOAGoOutConvert {
|
||||
|
||||
BpmOAGoOutConvert INSTANCE = Mappers.getMapper(BpmOAGoOutConvert.class);
|
||||
|
||||
BpmOAGoOutDO convert(BpmOAGoOutCreateReqVO bean);
|
||||
|
||||
BpmOAGoOutRespVO convert(BpmOAGoOutDO bean);
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OA 外出申请 DO
|
||||
*
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@TableName(value ="bpm_oa_go_out", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmOAGoOutDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 出差表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人的用户编号
|
||||
* 关联 AdminUserDO 的 id 属性
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 外出事由
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 外出地点
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 出差的结果
|
||||
* 枚举 {@link BpmProcessInstanceResultEnum}
|
||||
* 考虑到简单,所以直接复用了 BpmProcessInstanceResultEnum 枚举,也可以自己定义一个枚举哈
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 对应的流程编号
|
||||
* 关联 ProcessInstance 的 id 属性
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 附件基本信息
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<UploadUserFile> fileItems ;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 外出申请 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface BpmOAGoOutMapper extends BaseMapperX<BpmOAGoOutDO> {
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||
|
||||
public interface BpmOAGoOutService {
|
||||
|
||||
/**
|
||||
* 创建外出申请
|
||||
* @param loginUserId 登录用户ID
|
||||
* @param createReqVO 创建信息
|
||||
* @return 外出申请ID
|
||||
*/
|
||||
Long createGoOut(Long loginUserId, BpmOAGoOutCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新外出申请的状态
|
||||
*
|
||||
* @param id 编号
|
||||
* @param result 结果
|
||||
*/
|
||||
void updateGoOutResult(String processInstanceId, Long id, Integer result);
|
||||
|
||||
/**
|
||||
* 获得外出申请
|
||||
* @param processInstanceId 流程实例编号
|
||||
* @return 外出申请
|
||||
*/
|
||||
BpmOAGoOutDO getByProcessInstanceId(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获得外出申请
|
||||
* @param id 外出申请ID
|
||||
* @return 外出申请
|
||||
*/
|
||||
BpmOAGoOutDO getGoOut(Long id);
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAGoOutConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAGoOutMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_GOOut_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* OA 外出申请 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BpmOAGoOutServiceImpl extends BpmOABaseService implements BpmOAGoOutService{
|
||||
|
||||
/**
|
||||
* OA 外出对应的流程定义 KEY
|
||||
*/
|
||||
public static final String PROCESS_KEY = "oa_go_out_2";
|
||||
|
||||
@Resource
|
||||
private BpmOAGoOutMapper goOutMapper;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Override
|
||||
public Long createGoOut(Long userId, BpmOAGoOutCreateReqVO createReqVO) {
|
||||
|
||||
//插入OA 出差申请
|
||||
BpmOAGoOutDO goOut = BpmOAGoOutConvert.INSTANCE.convert(createReqVO).setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
goOutMapper.insert(goOut) ;
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceService.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(goOut.getId())));
|
||||
|
||||
// 将工作流的编号,更新到 OA 请假单中
|
||||
goOutMapper.updateById(new BpmOAGoOutDO().setId(goOut.getId()).setProcessInstanceId(processInstanceId));
|
||||
|
||||
// 判断是否为重新发起的流程
|
||||
if (createReqVO.getProcessInstanceId() != null && createReqVO.getResult() == 3) {
|
||||
|
||||
historyProcessInstanceService.createHistoryProcessInstance(processInstanceId, createReqVO.getProcessInstanceId());
|
||||
}
|
||||
|
||||
List<UploadUserFile> fileItems = createReqVO.getFileItems() ;
|
||||
//这里的逻辑,如果fileItems不为空,且有数据,那么说明是上传了附件的,则需要更工作流文件表对应的实例Id
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
||||
}
|
||||
|
||||
// 发起外出申请后,设置外勤打卡权限
|
||||
userApi.updateFieldwork(getLoginUserId(), 1);
|
||||
|
||||
return goOut.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateGoOutResult(String processInstanceId, Long id, Integer result) {
|
||||
validateLeaveExists(id);
|
||||
|
||||
// -- 自己取消
|
||||
// -- 审核拒绝
|
||||
//所有关联的采购申请改为 未支付状态
|
||||
if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.BACK.getResult().equals(result)) {
|
||||
|
||||
// 发起外出申请后,设置关闭外勤打卡权限
|
||||
userApi.updateFieldwork(getLoginUserId(), 0);
|
||||
}
|
||||
|
||||
goOutMapper.updateById(new BpmOAGoOutDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAGoOutDO getByProcessInstanceId(String processInstanceId) {
|
||||
|
||||
return goOutMapper.selectOne(BpmOAGoOutDO::getProcessInstanceId, processInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAGoOutDO getGoOut(Long id) {
|
||||
return goOutMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (goOutMapper.selectById(id) == null) {
|
||||
throw exception(OA_GOOut_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa.listener;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
|
||||
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAGoOutService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAGoOutServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* OA 外出申请单的结果的监听器实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Component
|
||||
public class BpmOAGoOutResultListener extends BpmProcessInstanceResultEventListener {
|
||||
|
||||
@Resource
|
||||
private BpmOAGoOutService goOutService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return BpmOAGoOutServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceResultEvent event) {
|
||||
goOutService.updateGoOutResult(event.getId(), Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -77,6 +77,13 @@ public interface AdminUserApi {
|
||||
@Operation(summary = "创建用户")
|
||||
CommonResult<Long> createUser(@RequestBody UserSaveRespDTO saveRespDTO);
|
||||
|
||||
@PostMapping(PREFIX + "/updateFieldwork")
|
||||
@Operation(summary = "修改用户外勤打卡权限")
|
||||
@Parameter(name = "userId", description = "用户id", example = "1024", required = true)
|
||||
@Parameter(name = "fieldworkFlag", description = "是否可外勤打卡 | 0否 1是", example = "1", required = true)
|
||||
void updateFieldwork(@RequestParam("userId") Long userId,
|
||||
@RequestParam("fieldworkFlag") Integer fieldworkFlag);
|
||||
|
||||
@GetMapping(PREFIX + "/getUserIdsByUserNature")
|
||||
@Operation(summary = "获取所有用户性质为外勤的用户")
|
||||
@Parameter(name = "userNature", description = "用户性质", example = "3", required = true)
|
||||
|
@ -54,4 +54,7 @@ public class UserSaveRespDTO {
|
||||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "是否为外勤人员", example = "1")
|
||||
private Integer fieldworkFlag;
|
||||
}
|
||||
|
@ -90,6 +90,12 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
return success(userService.createUser(BeanUtils.toBean(saveRespDTO, UserSaveReqVO.class)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFieldwork(Long userId, Integer fieldworkFlag) {
|
||||
|
||||
userService.updateFieldwork(userId, fieldworkFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Long>> getUserIdsByUserNature(Integer userNature) {
|
||||
|
||||
|
@ -178,6 +178,7 @@ public class DeptController {
|
||||
|
||||
@GetMapping("/getCompanyDept")
|
||||
@Operation(summary = "获取部门类型为公司的部门信息")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<DeptSimpleRespVO>> getCompanyDept() {
|
||||
List<DeptDO> list = deptService.getCompanyDept();
|
||||
|
||||
|
@ -71,6 +71,9 @@ public class UserSaveReqVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate birthdayDay;
|
||||
|
||||
@Schema(description = "用户性质", example = "1")
|
||||
private Integer userStaffing;
|
||||
|
||||
// ========== 仅【创建】时,需要传递的字段 ==========
|
||||
|
||||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
|
||||
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -70,4 +72,40 @@ public interface NoticeConvert {
|
||||
message.setPage("/subPages/notice/detail?id=" + notice.getId());
|
||||
return message;
|
||||
}
|
||||
|
||||
default SubscribeMessageReqDTO convertBirthday(String openId, String miniProgramState) {
|
||||
|
||||
SubscribeMessageReqDTO message = new SubscribeMessageReqDTO();
|
||||
message.setToUser(openId);
|
||||
message.setTemplateId("fH29xjNb8pe-7onQ-wE3QrBAC-y8aaC_oosYZKNMtzM");
|
||||
|
||||
//消息类型
|
||||
MsgData noticeType = new MsgData();
|
||||
noticeType.setName("phrase8");
|
||||
noticeType.setValue("生日提醒");
|
||||
message.addData(noticeType);
|
||||
|
||||
//发送人
|
||||
MsgData publishMan = new MsgData();
|
||||
publishMan.setName("thing16");
|
||||
publishMan.setValue("系统");
|
||||
message.addData(publishMan);
|
||||
|
||||
//发送时间
|
||||
MsgData createTime = new MsgData();
|
||||
createTime.setName("time3");
|
||||
createTime.setValue(DateUtils.dateFormat(new Date(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
|
||||
message.addData(createTime);
|
||||
|
||||
//消息内容
|
||||
MsgData content = new MsgData();
|
||||
content.setName("thing2");
|
||||
content.setValue("今天有人过生日,请前往PC端查看!");
|
||||
message.addData(content);
|
||||
|
||||
message.setMiniprogramState(miniProgramState);
|
||||
message.setPage("");
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.model.BpmModelApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAGoOutApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
@ -8,6 +9,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class})
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class, BpmOAGoOutApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -131,6 +131,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 默认赋予用户 普通角色
|
||||
permissionService.assignUserRole(user.getId(), Collections.singleton(2L));
|
||||
|
||||
// 判断用户是工厂部门的用户 并且userType != 2时
|
||||
if (deptService.getDept(user.getDeptId()).getFactoryId() != null) {
|
||||
// 工厂用户添加到GPS定位系统中
|
||||
gpsIncrementalSynchronizationOfUsers(user);
|
||||
}
|
||||
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ public class FactoryUserServiceImpl implements FactoryUserService{
|
||||
usersExtDO.setDeptId(deptDO.getId());
|
||||
usersExtDO.setAttendanceMachineNos(convertList(attendanceMachineDOS, AttendanceMachineDO::getDeviceNo));
|
||||
// usersExtService.createUsers(usersExtDO);
|
||||
// 工厂用户添加到GPS定位系统中
|
||||
adminUserService.gpsIncrementalSynchronizationOfUsers(user);
|
||||
// // 工厂用户添加到GPS定位系统中
|
||||
// adminUserService.gpsIncrementalSynchronizationOfUsers(user);
|
||||
try {
|
||||
|
||||
for (AttendanceMachineDO machineDO : attendanceMachineDOS) {
|
||||
|
Loading…
Reference in New Issue
Block a user