|
@@ -0,0 +1,76 @@
|
|
|
|
+package com.fjhx.oa.flow;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
|
+import com.fjhx.flow.core.FlowDelegate;
|
|
|
|
+import com.fjhx.flow.enums.FlowStatusEnum;
|
|
|
|
+import com.fjhx.oa.entity.promotion.dto.PromotionApplyDto;
|
|
|
|
+import com.fjhx.oa.entity.promotion.po.PromotionApply;
|
|
|
|
+import com.fjhx.oa.entity.user.dto.UserSalaryManageDto;
|
|
|
|
+import com.fjhx.oa.entity.user.vo.UserSalaryManageVo;
|
|
|
|
+import com.fjhx.oa.service.promotion.PromotionApplyService;
|
|
|
|
+import com.fjhx.oa.service.user.UserSalaryManageService;
|
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+
|
|
|
|
+@Component
|
|
|
|
+public class PromotionApplyFlow extends FlowDelegate {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private PromotionApplyService promotionApplyService;
|
|
|
|
+ @Resource
|
|
|
|
+ private UserSalaryManageService userSalaryManageService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getFlowKey() {
|
|
|
|
+ return "promotion_apply_flow";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Long start(Long flowId, JSONObject submitData) {
|
|
|
|
+ PromotionApplyDto dto = submitData.toJavaObject(PromotionApplyDto.class);
|
|
|
|
+ dto.setFlowId(flowId);
|
|
|
|
+ dto.setStatus(FlowStatusEnum1.UNDER_REVIEW.getKey());
|
|
|
|
+
|
|
|
|
+ //回填用户名
|
|
|
|
+ String nickName = SecurityUtils.getLoginUser().getUser().getNickName();
|
|
|
|
+ submitData.put("userName", nickName);
|
|
|
|
+
|
|
|
|
+ promotionApplyService.saveOrUpdate(dto);
|
|
|
|
+ return dto.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
|
|
|
|
+ promotionApplyService.update(q -> q
|
|
|
|
+ .eq(PromotionApply::getId, businessId)
|
|
|
|
+ .set(PromotionApply::getStatus, FlowStatusEnum1.REJECT.getKey())
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
|
|
|
|
+ promotionApplyService.update(q -> q
|
|
|
|
+ .eq(PromotionApply::getId, businessId)
|
|
|
|
+ .set(PromotionApply::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void end(Long flowId, Long businessId, JSONObject submitData) {
|
|
|
|
+ PromotionApply byId = promotionApplyService.getById(businessId);
|
|
|
|
+ promotionApplyService.update(q -> q
|
|
|
|
+ .eq(PromotionApply::getId, businessId)
|
|
|
|
+ .set(PromotionApply::getStatus, FlowStatusEnum1.PASS.getKey())
|
|
|
|
+ );
|
|
|
|
+ //更新用户薪资
|
|
|
|
+ UserSalaryManageVo detail = userSalaryManageService.detail(byId.getCreateUser());
|
|
|
|
+ UserSalaryManageDto userSalaryManageDto = BeanUtil.copyProperties(detail, UserSalaryManageDto.class);
|
|
|
|
+ userSalaryManageDto.setEmployeeType(byId.getEmployeeType());
|
|
|
|
+ userSalaryManageDto.setFullTimeDate(byId.getPromotionDate());
|
|
|
|
+ userSalaryManageService.edit(userSalaryManageDto);
|
|
|
|
+ }
|
|
|
|
+}
|