|
|
@ -26,21 +26,19 @@ |
|
|
|
package com.yxt.anrui.oa.biz.adexpatriateshomeapply; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.oa.biz.adexpatriatesapply.AdExpatriatesApplyDto; |
|
|
|
import com.yxt.anrui.oa.biz.adexpatriatesapply.AdExpatriatesApply; |
|
|
|
import com.yxt.anrui.oa.biz.adexpatriatesapply.AdExpatriatesApplyDetailVo; |
|
|
|
import com.yxt.anrui.oa.biz.adexpatriatesdetail.AdExpatriatesDetailDto; |
|
|
|
import com.yxt.anrui.oa.biz.oaappendix.OaAppendixService; |
|
|
|
import com.yxt.anrui.oa.biz.oaform.OaFormRuleEnum; |
|
|
|
import com.yxt.anrui.oa.biz.oaform.OaFormService; |
|
|
|
import com.yxt.anrui.oa.biz.oaform.*; |
|
|
|
import com.yxt.anrui.oa.biz.oaform.flowable.*; |
|
|
|
import com.yxt.anrui.oa.feign.file.OaFileEnum; |
|
|
|
import com.yxt.anrui.oa.feign.flowable.flow.ProcDefEnum; |
|
|
|
import com.yxt.anrui.oa.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.oa.feign.portal.sysorganization.SysOrganizationVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -57,19 +55,46 @@ public class AdExpatriatesHomeApplyService extends MybatisBaseService<AdExpatria |
|
|
|
private OaAppendixService oaAppendixService; |
|
|
|
@Autowired |
|
|
|
private OaFormService oaFormService; |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
|
|
|
|
public PagerVo<AdExpatriatesHomeApplyVo> listPageVo(PagerQuery<AdExpatriatesHomeApplyQuery> pq) { |
|
|
|
AdExpatriatesHomeApplyQuery query = pq.getParams(); |
|
|
|
QueryWrapper<AdExpatriatesHomeApply> qw = new QueryWrapper<>(); |
|
|
|
if (query != null) { |
|
|
|
if (StringUtils.isNotBlank(query.getBillNo())) { |
|
|
|
qw.like("ofm.billNo", query.getBillNo()); |
|
|
|
} |
|
|
|
public ResultBean<AdExpatriatesHomeApplyVo> getSaveInit(String userSid, String orgPath) { |
|
|
|
ResultBean<AdExpatriatesHomeApplyVo> rb = ResultBean.fireFail(); |
|
|
|
AdExpatriatesHomeApplyVo adExpatriatesHomeApplyVo = new AdExpatriatesHomeApplyVo(); |
|
|
|
adExpatriatesHomeApplyVo.setCreateBySid(userSid); |
|
|
|
adExpatriatesHomeApplyVo.setOrgSidPath(orgPath); |
|
|
|
return rb.success().setData(adExpatriatesHomeApplyVo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<AdExpatriatesHomeApplyVo> getUpdateInit(String sid) { |
|
|
|
ResultBean<AdExpatriatesHomeApplyVo> rb = ResultBean.fireFail(); |
|
|
|
AdExpatriatesHomeApplyVo adExpatriatesHomeApplyVo = new AdExpatriatesHomeApplyVo(); |
|
|
|
AdExpatriatesHomeApply adExpatriatesHomeApply = fetchBySid(sid); |
|
|
|
if (adExpatriatesHomeApply == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
IPage<AdExpatriatesHomeApply> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<AdExpatriatesHomeApplyVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<AdExpatriatesHomeApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
// adExpatriatesHomeApplyVo.setTestPage(adExpatriatesHomeApply.getTestPage());
|
|
|
|
OaForm oaForm = oaFormService.fetchBySid(sid); |
|
|
|
adExpatriatesHomeApplyVo.setTaskId(oaForm.getTaskId()); |
|
|
|
adExpatriatesHomeApplyVo.setProcInsId(oaForm.getProcInstId()); |
|
|
|
//根据部门sid获取orgPath并赋值
|
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(oaForm.getDeptSid()).getData(); |
|
|
|
String orgSidPath = organizationVo.getOrgSidPath(); |
|
|
|
adExpatriatesHomeApplyVo.setOrgSidPath(orgSidPath); |
|
|
|
adExpatriatesHomeApplyVo.setCreateBySid(oaForm.getCreateBySid()); |
|
|
|
BeanUtil.copyProperties(adExpatriatesHomeApply, adExpatriatesHomeApplyVo); |
|
|
|
adExpatriatesHomeApplyVo.setJobKey(adExpatriatesHomeApply.getPostSid()); |
|
|
|
adExpatriatesHomeApplyVo.setJobValue(adExpatriatesHomeApply.getPostName()); |
|
|
|
FormCommon jobObj = FormCommon.of(adExpatriatesHomeApplyVo.getJobKey(), adExpatriatesHomeApplyVo.getJobValue()); |
|
|
|
adExpatriatesHomeApplyVo.setJobObj(jobObj); |
|
|
|
FormCommon relationObj = FormCommon.of(adExpatriatesHomeApplyVo.getRelationKey(), adExpatriatesHomeApplyVo.getRelationValue()); |
|
|
|
adExpatriatesHomeApplyVo.setRelationObj(relationObj); |
|
|
|
List<String> files = oaAppendixService.selectByLinkSid(sid, "图片"); |
|
|
|
adExpatriatesHomeApplyVo.setFiles(files); |
|
|
|
List<String> appes = oaAppendixService.selectByLinkSid(sid, "文件"); |
|
|
|
adExpatriatesHomeApplyVo.setAppes(appes); |
|
|
|
adExpatriatesHomeApplyVo.setSid(sid); |
|
|
|
return rb.success().setData(adExpatriatesHomeApplyVo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<String> saveOrUpdateDto(AdExpatriatesHomeApplyDto dto) { |
|
|
@ -88,7 +113,6 @@ public class AdExpatriatesHomeApplyService extends MybatisBaseService<AdExpatria |
|
|
|
}else if ("2".equals(homeType)){ |
|
|
|
dto.setBillNo("ZWRYJSTQSQ"); |
|
|
|
} |
|
|
|
|
|
|
|
dto.setSid(entity.getSid()); |
|
|
|
ResultBean<String> resultBean = oaFormService.saveOaForm(dto); |
|
|
|
|
|
|
@ -117,11 +141,30 @@ public class AdExpatriatesHomeApplyService extends MybatisBaseService<AdExpatria |
|
|
|
oaAppendixService.saveFile(sid, files, attachType, fileType); |
|
|
|
} |
|
|
|
|
|
|
|
public AdExpatriatesHomeApplyVo fetchDetailsVoBySid(String sid) { |
|
|
|
AdExpatriatesHomeApply entity = fetchBySid(sid); |
|
|
|
AdExpatriatesHomeApplyVo vo = new AdExpatriatesHomeApplyVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
public ResultBean<AdExpatriatesHomeApplyDetailVo> details(String sid, String application) { |
|
|
|
ResultBean<AdExpatriatesHomeApplyDetailVo> rb = ResultBean.fireFail(); |
|
|
|
AdExpatriatesHomeApplyDetailVo adExpatriatesHomeApplyDetailVo = baseMapper.details(sid); |
|
|
|
if (adExpatriatesHomeApplyDetailVo == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
List<String> files = oaAppendixService.selectByLinkSid(sid, "图片"); |
|
|
|
List<String> appes = oaAppendixService.selectByLinkSid(sid, "文件"); |
|
|
|
adExpatriatesHomeApplyDetailVo.setFiles(files); |
|
|
|
adExpatriatesHomeApplyDetailVo.setAppes(appes); |
|
|
|
//基础字段赋值
|
|
|
|
BeanUtil.copyProperties(oaFormService.getDetails(sid), adExpatriatesHomeApplyDetailVo); |
|
|
|
return rb.success().setData(adExpatriatesHomeApplyDetailVo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean delAll(String[] sids) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//查询该sid中是否有流程不是待提交的
|
|
|
|
int count = baseMapper.selectBySid(StringUtils.join(sids, ",")); |
|
|
|
if (count > 0) { |
|
|
|
return rb.setMsg("删除的数据中包含已提交或已办结审批的数据,删除失败"); |
|
|
|
} |
|
|
|
delBySids(sids); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -143,14 +186,9 @@ public class AdExpatriatesHomeApplyService extends MybatisBaseService<AdExpatria |
|
|
|
submitDto.setBusinessSid(businessSid); |
|
|
|
|
|
|
|
Map<String, Object> formVariables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
//需和移动端沟通业务sid保存的属性具体值:appMap中sid不是固定的。移动端提供具体字段。
|
|
|
|
formVariables.put("app", appMap); |
|
|
|
formVariables = getMap(formVariables, businessSid); |
|
|
|
submitDto.setFormVariables(formVariables); |
|
|
|
submitDto.setProcDefId(ProcDefEnum.OAMENDAPPLY.getProDefId()); |
|
|
|
//若申请单中选择了下一处理人,则需赋值给下一处理人字段,若没有则删除
|
|
|
|
// submitDto.setNextNodeUserSids("");
|
|
|
|
submitDto.setProcDefId(ProcDefEnum.HIHIREAPPLY.getProDefId()); |
|
|
|
submitDto.setNextTaskId(dto.getTaskId()); |
|
|
|
submitDto.setRule(OaFormRuleEnum.DIRECTLY_UNDER.getRule()); |
|
|
|
return oaFormService.submit(submitDto); |
|
|
@ -164,11 +202,7 @@ public class AdExpatriatesHomeApplyService extends MybatisBaseService<AdExpatria |
|
|
|
*/ |
|
|
|
public ResultBean complete(CompleteDto dto) { |
|
|
|
Map<String, Object> formVariables = dto.getFormVariables(); |
|
|
|
//添加网关
|
|
|
|
// formVariables.put("", "");
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", dto.getBusinessSid()); |
|
|
|
formVariables.put("app", appMap); |
|
|
|
formVariables = getMap(formVariables, dto.getBusinessSid()); |
|
|
|
dto.setFormVariables(formVariables); |
|
|
|
BusinessVariablesDto businessVariablesDto = new BusinessVariablesDto(); |
|
|
|
BeanUtil.copyProperties(dto, businessVariablesDto); |
|
|
@ -183,61 +217,102 @@ public class AdExpatriatesHomeApplyService extends MybatisBaseService<AdExpatria |
|
|
|
*/ |
|
|
|
public ResultBean reject(TaskDto dto) { |
|
|
|
Map<String, Object> formVariables = dto.getFormVariables(); |
|
|
|
//添加网关
|
|
|
|
// formVariables.put("", "");
|
|
|
|
//若有移动端,则需和移动端沟通具体参数,若没有删去即可。
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", dto.getBusinessSid()); |
|
|
|
formVariables.put("app", appMap); |
|
|
|
formVariables = getMap(formVariables, dto.getBusinessSid()); |
|
|
|
dto.setFormVariables(formVariables); |
|
|
|
|
|
|
|
return oaFormService.reject(dto); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 提交时获取下一环节 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<List<NodeVo>> getNextNodesForSubmit(NodeQuery query) { |
|
|
|
Map<String, Object> formVariables = query.getFormVariables(); |
|
|
|
//添加网关
|
|
|
|
// formVariables.put("", "");
|
|
|
|
//若有移动端,则需和移动端沟通具体参数,若没有删去即可。
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", query.getBusinessSid()); |
|
|
|
formVariables.put("app", appMap); |
|
|
|
public ResultBean<String> getFlowOperateTitle(NodeQuery query) { |
|
|
|
// 默认失败返回
|
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
|
|
|
|
// 获取next值和formVariables
|
|
|
|
int next = query.getNext(); |
|
|
|
|
|
|
|
// 获取并更新formVariables
|
|
|
|
Map<String, Object> formVariables = getMap(query.getFormVariables(), query.getBusinessSid()); |
|
|
|
query.setFormVariables(formVariables); |
|
|
|
return oaFormService.getNextNodesForSubmit(query); |
|
|
|
|
|
|
|
// 校验next参数是否有效(只允许0或1)
|
|
|
|
if (next != 0 && next != 1) { |
|
|
|
return rb.setMsg("参数错误:next"); // 如果next不是0或1,返回错误信息
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取节点名称
|
|
|
|
String data = getNodeName(query, next); |
|
|
|
|
|
|
|
// 如果data为null,表示未获取到有效的节点信息
|
|
|
|
if (data == null) { |
|
|
|
return rb.setMsg("没有获取到节点信息"); // 返回错误消息
|
|
|
|
} |
|
|
|
|
|
|
|
// 返回成功的结果和获取到的节点名称
|
|
|
|
return rb.success().setData(data); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 驳回时获取上一环节 |
|
|
|
* 网关参数组成 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @param formVariables |
|
|
|
* @param sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<List<NodeVo>> getPreviousNodesForReject(NodeQuery query) { |
|
|
|
Map<String, Object> formVariables = query.getFormVariables(); |
|
|
|
//添加网关
|
|
|
|
// formVariables.put("", "");
|
|
|
|
//若有移动端,则需和移动端沟通具体参数,若没有删去即可。
|
|
|
|
public Map<String, Object> getMap(Map<String, Object> formVariables, String sid) { |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", query.getBusinessSid()); |
|
|
|
appMap.put("sid", sid); |
|
|
|
/*appMap.put("editUrl", "approval/#/pages/EditOnboradingApplyActivity?sid=" + sid); |
|
|
|
appMap.put("detailUrl", "approval/#/pages/DetailOnboradingApplyActivity?sid=" + sid); |
|
|
|
appMap.put("flowOperateUrl", "oa/v1/HrHireApply/getFlowOperateTitle"); |
|
|
|
appMap.put("agreeUrl", "oa/v1/HrHireApply/complete"); |
|
|
|
appMap.put("stopUrl", "oa/v1/oaform/breakProcess"); |
|
|
|
appMap.put("rejectUrl", "oa/v1/HrHireApply/reject"); |
|
|
|
appMap.put("recallUrl", "oa/v1/oaform/revokeProcess"); |
|
|
|
appMap.put("signUrl", "oa/v1/oaform/delegate"); |
|
|
|
appMap.put("transferUrl", "oa/v1/oaform/assignTask");*/ |
|
|
|
appMap.put(OaFormUrlEnum.HRHIREAPPLY_EDIT.getType(), OaFormUrlEnum.HRHIREAPPLY_EDIT.getUrl() + "?sid=" + sid); |
|
|
|
appMap.put(OaFormUrlEnum.HRHIREAPPLY_DETAIL.getType(), OaFormUrlEnum.HRHIREAPPLY_DETAIL.getUrl() + "?sid=" + sid); |
|
|
|
appMap.put(OaFormUrlEnum.HRHIREAPPLY_FLOWOPERATEURL.getType(), OaFormUrlEnum.HRHIREAPPLY_FLOWOPERATEURL.getUrl()); |
|
|
|
appMap.put(OaFormUrlEnum.HRHIREAPPLY_AGREEURL.getType(), OaFormUrlEnum.HRHIREAPPLY_AGREEURL.getUrl()); |
|
|
|
appMap.put(OaFormUrlEnum.STOPURL.getType(), OaFormUrlEnum.STOPURL.getUrl()); |
|
|
|
appMap.put(OaFormUrlEnum.HRHIREAPPLY_REJECTURL.getType(), OaFormUrlEnum.HRHIREAPPLY_REJECTURL.getUrl()); |
|
|
|
appMap.put(OaFormUrlEnum.RECALLURL.getType(), OaFormUrlEnum.RECALLURL.getUrl()); |
|
|
|
appMap.put(OaFormUrlEnum.SIGNURL.getType(), OaFormUrlEnum.SIGNURL.getUrl()); |
|
|
|
appMap.put(OaFormUrlEnum.TRANSFERURL.getType(), OaFormUrlEnum.TRANSFERURL.getUrl()); |
|
|
|
formVariables.put("app", appMap); |
|
|
|
query.setFormVariables(formVariables); |
|
|
|
return oaFormService.getPreviousNodesForReject(query); |
|
|
|
//根据组织查询是否是分公司
|
|
|
|
OaForm oaForm = oaFormService.fetchBySid(sid); |
|
|
|
AdExpatriatesHomeApply adExpatriatesHomeApply = fetchBySid(sid); |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(oaForm.getUseOrgSid()).getData(); |
|
|
|
//是否是分公司
|
|
|
|
formVariables.put("isTrue", sysOrganization.getIsDept() == 0); |
|
|
|
return formVariables; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean delAll(String[] sids) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//查询该sid中是否有流程不是待提交的
|
|
|
|
int count = baseMapper.selectBySid(StringUtils.join(sids, ",")); |
|
|
|
if (count > 0) { |
|
|
|
return rb.setMsg("删除的数据中包含已提交或已办结审批的数据,删除失败"); |
|
|
|
/** |
|
|
|
* 根据next的值获取前一个节点或下一个节点的名称。 |
|
|
|
* |
|
|
|
* @param query 包含查询所需参数的NodeQuery对象 |
|
|
|
* @param next 参数,0表示上一环节,1表示下一环节 |
|
|
|
* @return 节点名称,如果失败则返回null |
|
|
|
*/ |
|
|
|
private String getNodeName(NodeQuery query, int next) { |
|
|
|
// 根据next值选择相应的服务方法获取节点信息
|
|
|
|
ResultBean<List<NodeVo>> resultBean = (next == 0) |
|
|
|
? oaFormService.getPreviousNodesForReject(query) // 获取上一环节的节点
|
|
|
|
: oaFormService.getNextNodesForSubmit(query); // 获取下一环节的节点
|
|
|
|
// 如果服务调用成功
|
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
// 清除结果列表中的null值,避免空节点
|
|
|
|
resultBean.getData().removeAll(Collections.singleton(null)); |
|
|
|
// 如果结果列表非空,返回第一个节点的名称
|
|
|
|
if (!resultBean.getData().isEmpty()) { |
|
|
|
return resultBean.getData().get(0).getName(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 如果服务调用失败,返回null
|
|
|
|
return null; |
|
|
|
} |
|
|
|
delBySids(sids); |
|
|
|
return rb.success(); |
|
|
|
// 如果结果为空,返回null
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |