|
|
@ -26,6 +26,7 @@ |
|
|
|
package com.yxt.anrui.as.biz.asoldpartreturnapply; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
@ -39,6 +40,7 @@ import com.yxt.anrui.as.api.asoldpartreturn.AsOldpartreturnExcelInfo; |
|
|
|
import com.yxt.anrui.as.api.asoldpartreturn.ReturnExcelInfo; |
|
|
|
import com.yxt.anrui.as.api.asoldpartreturnapply.flowable.*; |
|
|
|
import com.yxt.anrui.as.biz.asoldpartreturn.AsOldpartreturnService; |
|
|
|
import com.yxt.anrui.as.feign.base.billno.Rule; |
|
|
|
import com.yxt.anrui.as.feign.flowable.flow.*; |
|
|
|
import com.yxt.anrui.as.feign.flowable.flow2.FlowDelegateQuery; |
|
|
|
import com.yxt.anrui.as.feign.flowable.flow2.FlowFeign; |
|
|
@ -49,6 +51,8 @@ import com.yxt.anrui.as.feign.message.MessageFeign; |
|
|
|
import com.yxt.anrui.as.feign.message.MessageFlowVo; |
|
|
|
import com.yxt.anrui.as.feign.message.MessageFlowableQuery; |
|
|
|
import com.yxt.anrui.as.feign.portal.privilege.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.as.feign.portal.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.as.feign.portal.sysuser.SysUserFeign; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
@ -108,6 +112,8 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
@Autowired |
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
@ -144,16 +150,16 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
String orgLevelKey = defaultIdReltBean.getData(); |
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i1); |
|
|
|
qw.like("aoa.orgSidPath", orgSidPath); |
|
|
|
qw.like("s.orgSidPath", orgSidPath); |
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
qw.like("aoa.orgSidPath", orgSidPath); |
|
|
|
qw.like("s.orgSidPath", orgSidPath); |
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
qw.like("aoa.orgSidPath", orgSidPath); |
|
|
|
qw.like("s.orgSidPath", orgSidPath); |
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
qw.like("aoa.orgSidPath", orgSidPath); |
|
|
|
qw.like("s.orgSidPath", orgSidPath); |
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
qw.eq("aoa.createBySid", query.getUserSid()); |
|
|
|
} else { |
|
|
@ -168,8 +174,8 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
if (StringUtils.isNotBlank(query.getUseOrgName())){ |
|
|
|
qw.like("aoa.useOrgName",query.getUseOrgName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getCreateDeptName())){ |
|
|
|
qw.like("aoa.createDeptName",query.getCreateDeptName()); |
|
|
|
if (StringUtils.isNotBlank(query.getDeptName())){ |
|
|
|
qw.like("aoa.deptName",query.getDeptName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getCreateByName())){ |
|
|
|
qw.like("aoa.createByName",query.getCreateByName()); |
|
|
@ -177,6 +183,7 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
if (StringUtils.isNotBlank(query.getBillNo())){ |
|
|
|
qw.like("aoa.billNo",query.getBillNo()); |
|
|
|
} |
|
|
|
qw.groupBy("aoa.sid"); |
|
|
|
if (StringUtils.isNotBlank(query.getConfirmResult())){ |
|
|
|
qw.having("confirmResult = {0}", query.getConfirmResult()); |
|
|
|
} |
|
|
@ -199,7 +206,24 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
public String saveOrUpdateDto(AsOldpartreturnApplyDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
List<AsOldpartreturnDto> asOldpartreturnList = dto.getAsOldpartreturnList(); |
|
|
|
String deptSid = dto.getDeptSid(); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|
|
|
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(deptVo.getOrgSidPath()).getData(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
dto.setUseOrgSid(useOrgSid); |
|
|
|
dto.setUseOrgName(organizationVo.getName()); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
//生成单据编号
|
|
|
|
String billNo = ""; |
|
|
|
String date = DateUtil.format(DateUtil.date(), "yyyyMM"); |
|
|
|
billNo = "JJFC" + organizationVo.getOrgCode() + date; |
|
|
|
String i = baseMapper.selectNum(billNo); |
|
|
|
if (StringUtils.isNotBlank(i)) { |
|
|
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(i).intValue()); |
|
|
|
} else { |
|
|
|
billNo = Rule.getBillNo(billNo, 0); |
|
|
|
} |
|
|
|
dto.setBillNo(billNo); |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
for (AsOldpartreturnDto asOldpartreturnDto : asOldpartreturnList) { |
|
|
|
asOldpartreturnDto.setMainSid(sid); |
|
|
@ -290,7 +314,8 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(asOldpartreturnApply.getOrgSidPath()); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(asOldpartreturnApply.getDeptSid()).getData(); |
|
|
|
bv.setOrgSidPath(deptVo.getOrgSidPath()); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
@ -379,7 +404,8 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
variables = flowableFeign.getMap(flowProcessMapQuery).getData(); |
|
|
|
//=======================================
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setOrgSidPath(asOldpartreturnApply.getOrgSidPath()); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(asOldpartreturnApply.getDeptSid()).getData(); |
|
|
|
bv.setOrgSidPath(deptVo.getOrgSidPath()); |
|
|
|
if (bv.getTaskId().equals(asOldpartreturnApply.getTaskId())) { |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|