@ -41,6 +41,7 @@ import com.yxt.anrui.as.api.asserviceaccommapply.flowable.*;
import com.yxt.anrui.as.api.asserviceaccommdetail.AsServiceAccommDetailDetailsVo ;
import com.yxt.anrui.as.api.asserviceaccommdetail.AsServiceAccommDetailDetailsVo ;
import com.yxt.anrui.as.api.asserviceaccommdetail.AsServiceAccommDetailDto ;
import com.yxt.anrui.as.api.asserviceaccommdetail.AsServiceAccommDetailDto ;
import com.yxt.anrui.as.biz.asappendix.AsAppendixService ;
import com.yxt.anrui.as.biz.asappendix.AsAppendixService ;
import com.yxt.anrui.as.biz.asserviceaccomm.AsServiceAccommService ;
import com.yxt.anrui.as.biz.asserviceaccommdetail.AsServiceAccommDetailService ;
import com.yxt.anrui.as.biz.asserviceaccommdetail.AsServiceAccommDetailService ;
import com.yxt.anrui.as.feign.base.billno.Rule ;
import com.yxt.anrui.as.feign.base.billno.Rule ;
import com.yxt.anrui.as.feign.file.AsFileEnum ;
import com.yxt.anrui.as.feign.file.AsFileEnum ;
@ -93,503 +94,514 @@ import java.util.stream.Collectors;
@Service
@Service
public class AsServiceAccommApplyService extends MybatisBaseService < AsServiceAccommApplyMapper , AsServiceAccommApply > {
public class AsServiceAccommApplyService extends MybatisBaseService < AsServiceAccommApplyMapper , AsServiceAccommApply > {
@Autowired
@Autowired
private SysUserFeign sysUserFeign ;
private SysUserFeign sysUserFeign ;
@Autowired
@Autowired
private SysStaffOrgFeign sysStaffOrgFeign ;
private SysStaffOrgFeign sysStaffOrgFeign ;
@Autowired
@Autowired
private SysOrganizationFeign sysOrganizationFeign ;
private SysOrganizationFeign sysOrganizationFeign ;
@Autowired
@Autowired
private AsServiceAccommDetailService asServiceAccommDetailService ;
private AsServiceAccommDetailService asServiceAccommDetailService ;
@Autowired
@Autowired
private FileUploadComponent fileUploadComponent ;
private AsServiceAccommService asServiceAccommService ;
@Autowired
@Autowired
private AsAppendixService asAppendixService ;
private FileUploadComponent fileUploadComponent ;
@Autowired
@Autowired
private FlowableFeign flowableFeign ;
private AsAppendixService asAppendixService ;
@Autowired
@Autowired
private FlowTaskFeign flowTaskFeign ;
private FlowableFeign flowableFeign ;
@Autowired
@Autowired
private FlowFeign flowFeign ;
private FlowTaskFeign flowTaskFeign ;
@Autowired
@Autowired
private MessageFeign messageFeign ;
private FlowFeign flowFeign ;
@Autowired
private MessageFeign messageFeign ;
public PagerVo < AsServiceAccommApplyVo > listPageVo ( PagerQuery < AsServiceAccommApplyQuery > pq ) {
public PagerVo < AsServiceAccommApplyVo > listPageVo ( PagerQuery < AsServiceAccommApplyQuery > pq ) {
AsServiceAccommApplyQuery query = pq . getParams ( ) ;
AsServiceAccommApplyQuery query = pq . getParams ( ) ;
QueryWrapper < AsServiceAccommApply > qw = new QueryWrapper < > ( ) ;
QueryWrapper < AsServiceAccommApply > qw = new QueryWrapper < > ( ) ;
if ( StringUtils . isNotBlank ( query . getMenuUrl ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getMenuUrl ( ) ) ) {
PrivilegeQuery privilegeQuery = new PrivilegeQuery ( ) ;
PrivilegeQuery privilegeQuery = new PrivilegeQuery ( ) ;
privilegeQuery . setOrgPath ( query . getOrgPath ( ) ) ;
privilegeQuery . setOrgPath ( query . getOrgPath ( ) ) ;
privilegeQuery . setMenuUrl ( query . getMenuUrl ( ) ) ;
privilegeQuery . setMenuUrl ( query . getMenuUrl ( ) ) ;
privilegeQuery . setUserSid ( query . getUserSid ( ) ) ;
privilegeQuery . setUserSid ( query . getUserSid ( ) ) ;
ResultBean < String > defaultIdReltBean = sysUserFeign . selectPrivilegeLevel ( privilegeQuery ) ;
ResultBean < String > defaultIdReltBean = sysUserFeign . selectPrivilegeLevel ( privilegeQuery ) ;
if ( StringUtils . isNotBlank ( defaultIdReltBean . getData ( ) ) ) {
if ( StringUtils . isNotBlank ( defaultIdReltBean . getData ( ) ) ) {
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
String orgSidPath = query . getOrgPath ( ) ;
String orgSidPath = query . getOrgPath ( ) ;
orgSidPath = orgSidPath + "/" ;
orgSidPath = orgSidPath + "/" ;
int i1 = orgSidPath . indexOf ( "/" ) ;
int i1 = orgSidPath . indexOf ( "/" ) ;
int i2 = orgSidPath . indexOf ( "/" , i1 + 1 ) ;
int i2 = orgSidPath . indexOf ( "/" , i1 + 1 ) ;
int i3 = orgSidPath . indexOf ( "/" , i2 + 1 ) ;
int i3 = orgSidPath . indexOf ( "/" , i2 + 1 ) ;
int i4 = orgSidPath . indexOf ( "/" , i3 + 1 ) ;
int i4 = orgSidPath . indexOf ( "/" , i3 + 1 ) ;
String orgLevelKey = defaultIdReltBean . getData ( ) ;
String orgLevelKey = defaultIdReltBean . getData ( ) ;
if ( "1" . equals ( orgLevelKey ) ) {
if ( "1" . equals ( orgLevelKey ) ) {
orgSidPath = orgSidPath . substring ( 0 , i1 ) ;
orgSidPath = orgSidPath . substring ( 0 , i1 ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
} else if ( "2" . equals ( orgLevelKey ) ) {
} else if ( "2" . equals ( orgLevelKey ) ) {
orgSidPath = orgSidPath . substring ( 0 , i2 ) ;
orgSidPath = orgSidPath . substring ( 0 , i2 ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
} else if ( "3" . equals ( orgLevelKey ) ) {
} else if ( "3" . equals ( orgLevelKey ) ) {
orgSidPath = orgSidPath . substring ( 0 , i3 ) ;
orgSidPath = orgSidPath . substring ( 0 , i3 ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
} else if ( "4" . equals ( orgLevelKey ) ) {
} else if ( "4" . equals ( orgLevelKey ) ) {
orgSidPath = orgSidPath . substring ( 0 , i4 ) ;
orgSidPath = orgSidPath . substring ( 0 , i4 ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
qw . like ( "s.orgSidPath" , orgSidPath ) ;
} else if ( "5" . equals ( orgLevelKey ) ) {
} else if ( "5" . equals ( orgLevelKey ) ) {
qw . eq ( "aaa.createBySid" , query . getUserSid ( ) ) ;
qw . eq ( "aaa.createBySid" , query . getUserSid ( ) ) ;
} else {
} else {
PagerVo < AsServiceAccommApplyVo > p = new PagerVo < > ( ) ;
PagerVo < AsServiceAccommApplyVo > p = new PagerVo < > ( ) ;
return p ;
return p ;
}
}
} else {
} else {
PagerVo < AsServiceAccommApplyVo > p = new PagerVo < > ( ) ;
PagerVo < AsServiceAccommApplyVo > p = new PagerVo < > ( ) ;
return p ;
return p ;
}
}
}
}
if ( StringUtils . isNotBlank ( query . getUseOrgName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getUseOrgName ( ) ) ) {
qw . like ( "aaa.useOrgName" , query . getUseOrgName ( ) ) ;
qw . like ( "aaa.useOrgName" , query . getUseOrgName ( ) ) ;
}
}
if ( StringUtils . isNotBlank ( query . getDeptName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getDeptName ( ) ) ) {
qw . like ( "aaa.deptName" , query . getDeptName ( ) ) ;
qw . like ( "aaa.deptName" , query . getDeptName ( ) ) ;
}
}
if ( StringUtils . isNotBlank ( query . getCreateByName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getCreateByName ( ) ) ) {
qw . like ( "aaa.createByName" , query . getCreateByName ( ) ) ;
qw . like ( "aaa.createByName" , query . getCreateByName ( ) ) ;
}
}
if ( StringUtils . isNotBlank ( query . getBillNo ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getBillNo ( ) ) ) {
qw . like ( "aaa.billNo" , query . getBillNo ( ) ) ;
qw . like ( "aaa.billNo" , query . getBillNo ( ) ) ;
}
}
String createTimeStart = query . getCreateTimeStart ( ) ;
String createTimeStart = query . getCreateTimeStart ( ) ;
String createTimeEnd = query . getCreateTimeEnd ( ) ;
String createTimeEnd = query . getCreateTimeEnd ( ) ;
qw . apply ( StringUtils . isNotEmpty ( createTimeStart ) , "date_format (aaa.createTime,'%Y-%m-%d') >= date_format('" + createTimeStart + "','%Y-%m-%d')" ) .
qw . apply ( StringUtils . isNotEmpty ( createTimeStart ) , "date_format (aaa.createTime,'%Y-%m-%d') >= date_format('" + createTimeStart + "','%Y-%m-%d')" ) .
apply ( StringUtils . isNotEmpty ( createTimeEnd ) , "date_format (aaa.createTime,'%Y-%m-%d') <= date_format('" + createTimeEnd + "','%Y-%m-%d')"
apply ( StringUtils . isNotEmpty ( createTimeEnd ) , "date_format (aaa.createTime,'%Y-%m-%d') <= date_format('" + createTimeEnd + "','%Y-%m-%d')"
) ;
) ;
String finishTimeStart = query . getFinishTimeStart ( ) ;
String finishTimeStart = query . getFinishTimeStart ( ) ;
String finishTimeEnd = query . getFinishTimeEnd ( ) ;
String finishTimeEnd = query . getFinishTimeEnd ( ) ;
qw . apply ( StringUtils . isNotEmpty ( finishTimeStart ) , "date_format (aaa.finishTime,'%Y-%m-%d') >= date_format('" + finishTimeStart + "','%Y-%m-%d')" ) .
qw . apply ( StringUtils . isNotEmpty ( finishTimeStart ) , "date_format (aaa.finishTime,'%Y-%m-%d') >= date_format('" + finishTimeStart + "','%Y-%m-%d')" ) .
apply ( StringUtils . isNotEmpty ( finishTimeEnd ) , "date_format (aaa.finishTime,'%Y-%m-%d') <= date_format('" + finishTimeEnd + "','%Y-%m-%d')"
apply ( StringUtils . isNotEmpty ( finishTimeEnd ) , "date_format (aaa.finishTime,'%Y-%m-%d') <= date_format('" + finishTimeEnd + "','%Y-%m-%d')"
) ;
) ;
qw . orderByDesc ( "aaa.createTime" ) ;
qw . orderByDesc ( "aaa.createTime" ) ;
IPage < AsServiceAccommApply > page = PagerUtil . queryToPage ( pq ) ;
IPage < AsServiceAccommApply > page = PagerUtil . queryToPage ( pq ) ;
IPage < AsServiceAccommApplyVo > pagging = baseMapper . selectPageVo ( page , qw ) ;
IPage < AsServiceAccommApplyVo > pagging = baseMapper . selectPageVo ( page , qw ) ;
PagerVo < AsServiceAccommApplyVo > p = PagerUtil . pageToVo ( pagging , null ) ;
PagerVo < AsServiceAccommApplyVo > p = PagerUtil . pageToVo ( pagging , null ) ;
return p ;
return p ;
}
}
public String saveOrUpdateDto ( AsServiceAccommApplyDto dto ) {
public String saveOrUpdateDto ( AsServiceAccommApplyDto dto ) {
String dtoSid = dto . getSid ( ) ;
String dtoSid = dto . getSid ( ) ;
List < AsServiceAccommDetailDto > asServiceAccommDetailList = dto . getAsServiceAccommDetailList ( ) ;
List < AsServiceAccommDetailDto > asServiceAccommDetailList = dto . getAsServiceAccommDetailList ( ) ;
List < AsServiceAccommFile > fileList = dto . getFileList ( ) ;
List < AsServiceAccommFile > fileList = dto . getFileList ( ) ;
String deptSid = dto . getDeptSid ( ) ;
String deptSid = dto . getDeptSid ( ) ;
SysOrganizationVo deptVo = sysOrganizationFeign . fetchBySid ( deptSid ) . getData ( ) ;
SysOrganizationVo deptVo = sysOrganizationFeign . fetchBySid ( deptSid ) . getData ( ) ;
String useOrgSid = sysStaffOrgFeign . getOrgSidByPath ( deptVo . getOrgSidPath ( ) ) . getData ( ) ;
String useOrgSid = sysStaffOrgFeign . getOrgSidByPath ( deptVo . getOrgSidPath ( ) ) . getData ( ) ;
SysOrganizationVo organizationVo = sysOrganizationFeign . fetchBySid ( useOrgSid ) . getData ( ) ;
SysOrganizationVo organizationVo = sysOrganizationFeign . fetchBySid ( useOrgSid ) . getData ( ) ;
dto . setUseOrgSid ( useOrgSid ) ;
dto . setUseOrgSid ( useOrgSid ) ;
dto . setUseOrgName ( organizationVo . getName ( ) ) ;
dto . setUseOrgName ( organizationVo . getName ( ) ) ;
if ( StringUtils . isBlank ( dtoSid ) ) {
if ( StringUtils . isBlank ( dtoSid ) ) {
//生成单据编号
//生成单据编号
String billNo = "" ;
String billNo = "" ;
String date = DateUtil . format ( DateUtil . date ( ) , "yyyyMM" ) ;
String date = DateUtil . format ( DateUtil . date ( ) , "yyyyMM" ) ;
billNo = "PJXSTC" + organizationVo . getOrgCode ( ) + date ;
billNo = "PJXSTC" + organizationVo . getOrgCode ( ) + date ;
String i = baseMapper . selectNum ( billNo ) ;
String i = baseMapper . selectNum ( billNo ) ;
if ( StringUtils . isNotBlank ( i ) ) {
if ( StringUtils . isNotBlank ( i ) ) {
billNo = Rule . getBillNo ( billNo , Integer . valueOf ( i ) . intValue ( ) ) ;
billNo = Rule . getBillNo ( billNo , Integer . valueOf ( i ) . intValue ( ) ) ;
} else {
} else {
billNo = Rule . getBillNo ( billNo , 0 ) ;
billNo = Rule . getBillNo ( billNo , 0 ) ;
}
}
dto . setBillNo ( billNo ) ;
dto . setBillNo ( billNo ) ;
String sid = this . insertByDto ( dto ) ;
String sid = this . insertByDto ( dto ) ;
for ( AsServiceAccommDetailDto asServiceAccommDetailDto : asServiceAccommDetailList ) {
for ( AsServiceAccommDetailDto asServiceAccommDetailDto : asServiceAccommDetailList ) {
asServiceAccommDetailDto . setMainSid ( sid ) ;
asServiceAccommDetailDto . setMainSid ( sid ) ;
asServiceAccommDetailService . insertByDto ( asServiceAccommDetailDto ) ;
asServiceAccommDetailService . insertByDto ( asServiceAccommDetailDto ) ;
}
}
for ( AsServiceAccommFile asServiceAccommFile : fileList ) {
for ( AsServiceAccommFile asServiceAccommFile : fileList ) {
String filePath = asServiceAccommFile . getUrl ( ) . replace ( fileUploadComponent . getUrlPrefix ( ) , "" ) ;
String filePath = asServiceAccommFile . getUrl ( ) . replace ( fileUploadComponent . getUrlPrefix ( ) , "" ) ;
AsAppendix asAppendix = new AsAppendix ( ) ;
AsAppendix asAppendix = new AsAppendix ( ) ;
asAppendix . setLinkSid ( sid ) ;
asAppendix . setLinkSid ( sid ) ;
asAppendix . setAttachType ( AsFileEnum . ASSERVICEACCOMMAPPLY . getAttachType ( ) ) ;
asAppendix . setAttachType ( AsFileEnum . ASSERVICEACCOMMAPPLY . getAttachType ( ) ) ;
asAppendix . setFilePath ( filePath ) ;
asAppendix . setFilePath ( filePath ) ;
asAppendixService . save ( asAppendix ) ;
asAppendixService . save ( asAppendix ) ;
}
}
return sid ;
return sid ;
}
this . updateByDto ( dto ) ;
asServiceAccommDetailService . delByMainSid ( dtoSid ) ;
for ( AsServiceAccommDetailDto asServiceAccommDetailDto : asServiceAccommDetailList ) {
asServiceAccommDetailDto . setMainSid ( dtoSid ) ;
asServiceAccommDetailService . insertByDto ( asServiceAccommDetailDto ) ;
}
asAppendixService . delByLinkSid ( dtoSid ) ;
for ( AsServiceAccommFile asServiceAccommFile : fileList ) {
String filePath = asServiceAccommFile . getUrl ( ) . replace ( fileUploadComponent . getUrlPrefix ( ) , "" ) ;
AsAppendix asAppendix = new AsAppendix ( ) ;
asAppendix . setLinkSid ( dtoSid ) ;
asAppendix . setAttachType ( AsFileEnum . ASSERVICEACCOMMAPPLY . getAttachType ( ) ) ;
asAppendix . setFilePath ( filePath ) ;
asAppendixService . save ( asAppendix ) ;
}
}
this . updateByDto ( dto ) ;
return dtoSid ;
asServiceAccommDetailService . delByMainSid ( dtoSid ) ;
}
for ( AsServiceAccommDetailDto asServiceAccommDetailDto : asServiceAccommDetailList ) {
asServiceAccommDetailDto . setMainSid ( dtoSid ) ;
asServiceAccommDetailService . insertByDto ( asServiceAccommDetailDto ) ;
}
asAppendixService . delByLinkSid ( dtoSid ) ;
for ( AsServiceAccommFile asServiceAccommFile : fileList ) {
String filePath = asServiceAccommFile . getUrl ( ) . replace ( fileUploadComponent . getUrlPrefix ( ) , "" ) ;
AsAppendix asAppendix = new AsAppendix ( ) ;
asAppendix . setLinkSid ( dtoSid ) ;
asAppendix . setAttachType ( AsFileEnum . ASSERVICEACCOMMAPPLY . getAttachType ( ) ) ;
asAppendix . setFilePath ( filePath ) ;
asAppendixService . save ( asAppendix ) ;
}
return dtoSid ;
}
public String insertByDto ( AsServiceAccommApplyDto dto ) {
public String insertByDto ( AsServiceAccommApplyDto dto ) {
AsServiceAccommApply entity = new AsServiceAccommApply ( ) ;
AsServiceAccommApply entity = new AsServiceAccommApply ( ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
entity . setNodeState ( "待提交" ) ;
entity . setNodeState ( "待提交" ) ;
baseMapper . insert ( entity ) ;
baseMapper . insert ( entity ) ;
return entity . getSid ( ) ;
return entity . getSid ( ) ;
}
}
public void updateByDto ( AsServiceAccommApplyDto dto ) {
public void updateByDto ( AsServiceAccommApplyDto dto ) {
String dtoSid = dto . getSid ( ) ;
String dtoSid = dto . getSid ( ) ;
if ( StringUtils . isBlank ( dtoSid ) ) {
if ( StringUtils . isBlank ( dtoSid ) ) {
return ;
return ;
}
}
AsServiceAccommApply entity = fetchBySid ( dtoSid ) ;
AsServiceAccommApply entity = fetchBySid ( dtoSid ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
BeanUtil . copyProperties ( dto , entity , "id" , "sid" ) ;
baseMapper . updateById ( entity ) ;
baseMapper . updateById ( entity ) ;
}
}
public AsServiceAccommApplyDetailsVo fetchDetailsVoBySid ( String sid ) {
AsServiceAccommApply entity = fetchBySid ( sid ) ;
AsServiceAccommApplyDetailsVo vo = new AsServiceAccommApplyDetailsVo ( ) ;
BeanUtil . copyProperties ( entity , vo ) ;
List < AsServiceAccommDetailDetailsVo > asServiceAccommDetailDetailsVos = asServiceAccommDetailService . selByMainSid ( sid ) ;
vo . setAsServiceAccommDetailList ( asServiceAccommDetailDetailsVos ) ;
List < AsAppendix > asAppendices = asAppendixService . fetchByLinkSid ( sid ) ;
List < AsServiceAccommFile > asServiceAccommFiles = new ArrayList < > ( ) ;
for ( AsAppendix asAppendix : asAppendices ) {
AsServiceAccommFile asServiceAccommFile = new AsServiceAccommFile ( ) ;
String url = fileUploadComponent . getUrlPrefix ( ) + asAppendix . getFilePath ( ) ;
asServiceAccommFile . setUrl ( url ) ;
asServiceAccommFiles . add ( asServiceAccommFile ) ;
}
vo . setFileList ( asServiceAccommFiles ) ;
return vo ;
}
public ResultBean delAll ( String [ ] sids ) {
public AsServiceAccommApplyDetailsVo fetchDetailsVoBySid ( String sid ) {
ResultBean rb = ResultBean . fireFail ( ) ;
AsServiceAccommApply entity = fetchBySid ( sid ) ;
//查询该sid中是否有流程不是待提交的
AsServiceAccommApplyDetailsVo vo = new AsServiceAccommApplyDetailsVo ( ) ;
int count = baseMapper . selectBySid ( StringUtils . join ( sids , "," ) ) ;
BeanUtil . copyProperties ( entity , vo ) ;
if ( count > 0 ) {
List < AsServiceAccommDetailDetailsVo > asServiceAccommDetailDetailsVos = asServiceAccommDetailService . selByMainSid ( sid ) ;
return rb . setMsg ( "删除的数据中包含已提交或已办结审批的数据,删除失败" ) ;
vo . setAsServiceAccommDetailList ( asServiceAccommDetailDetailsVos ) ;
}
List < AsAppendix > asAppendices = asAppendixService . fetchByLinkSid ( sid ) ;
delBySids ( sids ) ;
List < AsServiceAccommFile > asServiceAccommFiles = new ArrayList < > ( ) ;
for ( String sid : sids ) {
for ( AsAppendix asAppendix : asAppendices ) {
asServiceAccommDetailService . delByMainSid ( sid ) ;
AsServiceAccommFile asServiceAccommFile = new AsServiceAccommFile ( ) ;
asAppendixService . delByLinkSid ( sid ) ;
String url = fileUploadComponent . getUrlPrefix ( ) + asAppendix . getFilePath ( ) ;
}
asServiceAccommFile . setUrl ( url ) ;
return rb . success ( ) ;
asServiceAccommFiles . add ( asServiceAccommFile ) ;
}
}
vo . setFileList ( asServiceAccommFiles ) ;
return vo ;
}
public ResultBean submitApply ( SubmitServiceAccommDto dto ) {
public ResultBean delAll ( String [ ] sids ) {
ResultBean rb = ResultBean . fireFail ( ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( dto . getSid ( ) ) ;
//查询该sid中是否有流程不是待提交的
int r = submitBusinessData ( dto , asServiceAccommApply ) ;
int count = baseMapper . selectBySid ( StringUtils . join ( sids , "," ) ) ;
if ( r = = 3 ) {
if ( count > 0 ) {
return rb . setMsg ( "该申请不存在" ) ;
return rb . setMsg ( "删除的数据中包含已提交或已办结审批的数据,删除失败" ) ;
}
}
if ( r = = 0 ) {
delBySids ( sids ) ;
return rb . setMsg ( "操作失败!提交的数据不一致" ) ;
for ( String sid : sids ) {
}
asServiceAccommDetailService . delByMainSid ( sid ) ;
String businessSid = saveOrUpdateDto ( dto ) ;
asAppendixService . delByLinkSid ( sid ) ;
asServiceAccommApply = fetchBySid ( businessSid ) ;
}
//创建BusinessVariables实体对象
return rb . success ( ) ;
BusinessVariables bv = new BusinessVariables ( ) ;
}
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
appMap . put ( "sid" , businessSid ) ;
variables . put ( "app" , appMap ) ;
//用户的部门全路径sid
SysOrganizationVo sysOrganization = sysOrganizationFeign . fetchBySid ( asServiceAccommApply . getDeptSid ( ) ) . getData ( ) ;
if ( sysOrganization ! = null ) {
bv . setOrgSidPath ( sysOrganization . getOrgSidPath ( ) ) ;
}
bv . setBusinessSid ( businessSid ) ;
bv . setUserSid ( dto . getCreateBySid ( ) ) ;
bv . setFormVariables ( variables ) ;
if ( r = = 1 ) {
//ToDo:流程定义id
bv . setModelId ( ProcDefEnum . ASSERVICEACCOMMAPPLY . getProDefId ( ) ) ;
ResultBean < UpdateFlowFieldVo > voResultBean = flowFeign . startProcess ( bv ) ;
if ( ! voResultBean . getSuccess ( ) ) {
return rb . setMsg ( voResultBean . getMsg ( ) ) ;
}
UpdateFlowFieldVo ufVo = voResultBean . getData ( ) ;
updateFlowFiled ( BeanUtil . beanToMap ( ufVo ) ) ;
asServiceAccommApply = fetchBySid ( businessSid ) ;
//==================================添加线程
try {
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder ( )
. setNameFormat ( "demo-pool-%d" ) . build ( ) ;
ExecutorService pool = new ThreadPoolExecutor ( 2 , 100 ,
0L , TimeUnit . MILLISECONDS ,
new LinkedBlockingQueue < Runnable > ( 1024 ) , namedThreadFactory , new ThreadPoolExecutor . AbortPolicy ( ) ) ;
AsServiceAccommApply finalAsServiceAccommApply = asServiceAccommApply ;
Future future1 = pool . submit ( ( ) - > {
//极光推送
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery ( ) ;
MessageFlowVo messageFlowVo = new MessageFlowVo ( ) ;
BeanUtil . copyProperties ( ufVo , messageFlowVo ) ;
messageFlowableQuery . setUfVo ( messageFlowVo ) ;
messageFlowableQuery . setAppMap ( appMap ) ;
messageFlowableQuery . setBusinessSid ( businessSid ) ;
messageFlowableQuery . setModuleName ( "配件销售提成备案申请" ) ;
messageFlowableQuery . setMsgContent ( finalAsServiceAccommApply . getCreateByName ( ) + "提交的" + messageFlowableQuery . getModuleName ( ) + ",请审批" ) ;
messageFlowableQuery . setMsgTitle ( "配件销售提成备案申请" ) ;
ResultBean < String > stringResultBean = messageFeign . pushMessage ( messageFlowableQuery ) ;
} ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
//==================================添加线程
return voResultBean ;
}
if ( r = = 2 ) {
// ToDo:驳回到发起人后再次提交
if ( StringUtils . isBlank ( dto . getInstanceId ( ) ) ) {
return rb . setMsg ( "参数错误:instanceId" ) ;
}
bv . setTaskId ( asServiceAccommApply . getTaskId ( ) ) ;
bv . setTaskDefKey ( asServiceAccommApply . getNodeId ( ) ) ;
bv . setComment ( "重新提交" ) ;
bv . setInstanceId ( dto . getInstanceId ( ) ) ;
return complete ( bv ) ;
}
return rb ;
}
private int updateFlowFiled ( Map < String , Object > beanToMap ) {
public ResultBean submitApply ( SubmitServiceAccommDto dto ) {
return baseMapper . updateFlowFiled ( beanToMap ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
}
AsServiceAccommApply asServiceAccommApply = fetchBySid ( dto . getSid ( ) ) ;
int r = submitBusinessData ( dto , asServiceAccommApply ) ;
if ( r = = 3 ) {
return rb . setMsg ( "该申请不存在" ) ;
}
if ( r = = 0 ) {
return rb . setMsg ( "操作失败!提交的数据不一致" ) ;
}
String businessSid = saveOrUpdateDto ( dto ) ;
asServiceAccommApply = fetchBySid ( businessSid ) ;
//创建BusinessVariables实体对象
BusinessVariables bv = new BusinessVariables ( ) ;
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
appMap . put ( "sid" , businessSid ) ;
variables . put ( "app" , appMap ) ;
//用户的部门全路径sid
SysOrganizationVo sysOrganization = sysOrganizationFeign . fetchBySid ( asServiceAccommApply . getDeptSid ( ) ) . getData ( ) ;
if ( sysOrganization ! = null ) {
bv . setOrgSidPath ( sysOrganization . getOrgSidPath ( ) ) ;
}
bv . setBusinessSid ( businessSid ) ;
bv . setUserSid ( dto . getCreateBySid ( ) ) ;
bv . setFormVariables ( variables ) ;
if ( r = = 1 ) {
//ToDo:流程定义id
bv . setModelId ( ProcDefEnum . ASSERVICEACCOMMAPPLY . getProDefId ( ) ) ;
ResultBean < UpdateFlowFieldVo > voResultBean = flowFeign . startProcess ( bv ) ;
if ( ! voResultBean . getSuccess ( ) ) {
return rb . setMsg ( voResultBean . getMsg ( ) ) ;
}
UpdateFlowFieldVo ufVo = voResultBean . getData ( ) ;
updateFlowFiled ( BeanUtil . beanToMap ( ufVo ) ) ;
asServiceAccommApply = fetchBySid ( businessSid ) ;
List < AsServiceAccommDetailDto > asServiceAccommDetailList = dto . getAsServiceAccommDetailList ( ) ;
for ( AsServiceAccommDetailDto asServiceAccommDetailDto : asServiceAccommDetailList ) {
asServiceAccommService . updateState ( asServiceAccommDetailDto . getAccommSid ( ) , 2 ) ;
}
//==================================添加线程
try {
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder ( )
. setNameFormat ( "demo-pool-%d" ) . build ( ) ;
ExecutorService pool = new ThreadPoolExecutor ( 2 , 100 ,
0L , TimeUnit . MILLISECONDS ,
new LinkedBlockingQueue < Runnable > ( 1024 ) , namedThreadFactory , new ThreadPoolExecutor . AbortPolicy ( ) ) ;
AsServiceAccommApply finalAsServiceAccommApply = asServiceAccommApply ;
Future future1 = pool . submit ( ( ) - > {
//极光推送
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery ( ) ;
MessageFlowVo messageFlowVo = new MessageFlowVo ( ) ;
BeanUtil . copyProperties ( ufVo , messageFlowVo ) ;
messageFlowableQuery . setUfVo ( messageFlowVo ) ;
messageFlowableQuery . setAppMap ( appMap ) ;
messageFlowableQuery . setBusinessSid ( businessSid ) ;
messageFlowableQuery . setModuleName ( "配件销售提成备案申请" ) ;
messageFlowableQuery . setMsgContent ( finalAsServiceAccommApply . getCreateByName ( ) + "提交的" + messageFlowableQuery . getModuleName ( ) + ",请审批" ) ;
messageFlowableQuery . setMsgTitle ( "配件销售提成备案申请" ) ;
ResultBean < String > stringResultBean = messageFeign . pushMessage ( messageFlowableQuery ) ;
} ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
//==================================添加线程
return voResultBean ;
}
if ( r = = 2 ) {
// ToDo:驳回到发起人后再次提交
if ( StringUtils . isBlank ( dto . getInstanceId ( ) ) ) {
return rb . setMsg ( "参数错误:instanceId" ) ;
}
bv . setTaskId ( asServiceAccommApply . getTaskId ( ) ) ;
bv . setTaskDefKey ( asServiceAccommApply . getNodeId ( ) ) ;
bv . setComment ( "重新提交" ) ;
bv . setInstanceId ( dto . getInstanceId ( ) ) ;
return complete ( bv ) ;
}
return rb ;
}
private int updateFlowFiled ( Map < String , Object > beanToMap ) {
return baseMapper . updateFlowFiled ( beanToMap ) ;
}
private int submitBusinessData ( SubmitServiceAccommDto dto , AsServiceAccommApply asServiceAccommApply ) {
int r = 0 ;
if ( StringUtils . isBlank ( dto . getSid ( ) ) ) {
r = 1 ;
} else {
if ( asServiceAccommApply ! = null ) {
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
if ( StringUtils . isBlank ( businessTaskId ) & & StringUtils . isBlank ( dto . getTaskId ( ) ) ) {
//新提交
r = 1 ;
} else if ( StringUtils . isNotBlank ( businessTaskId ) & & businessTaskId . equals ( dto . getTaskId ( ) ) ) {
//二次提交//只有数据一致的时候才能进行下一步
r = 2 ;
}
} else {
r = 3 ;
}
}
return r ;
}
public ResultBean complete ( BusinessVariables bv ) {
private int submitBusinessData ( SubmitServiceAccommDto dto , AsServiceAccommApply asServiceAccommApply ) {
ResultBean rb = ResultBean . fireFail ( ) ;
int r = 0 ;
String businessSid = bv . getBusinessSid ( ) ;
if ( StringUtils . isBlank ( dto . getSid ( ) ) ) {
AsServiceAccommApply asServiceAccommApply = fetchBySid ( businessSid ) ;
r = 1 ;
Map < String , Object > variables = new HashMap < > ( ) ;
} else {
Map < String , Object > appMap = new HashMap < > ( ) ;
if ( asServiceAccommApply ! = null ) {
appMap . put ( "sid" , businessSid ) ;
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
variables . put ( "app" , appMap ) ;
if ( StringUtils . isBlank ( businessTaskId ) & & StringUtils . isBlank ( dto . getTaskId ( ) ) ) {
bv . setFormVariables ( variables ) ;
//新提交
SysOrganizationVo sysOrganization = sysOrganizationFeign . fetchBySid ( asServiceAccommApply . getDeptSid ( ) ) . getData ( ) ;
r = 1 ;
if ( sysOrganization ! = null ) {
} else if ( StringUtils . isNotBlank ( businessTaskId ) & & businessTaskId . equals ( dto . getTaskId ( ) ) ) {
bv . setOrgSidPath ( sysOrganization . getOrgSidPath ( ) ) ;
//二次提交//只有数据一致的时候才能进行下一步
}
r = 2 ;
bv . setModelId ( asServiceAccommApply . getProcDefId ( ) ) ;
}
if ( bv . getTaskId ( ) . equals ( asServiceAccommApply . getTaskId ( ) ) ) {
} else {
ResultBean < UpdateFlowFieldVo > resultBean = flowFeign . handleProsess ( bv ) ;
r = 3 ;
if ( ! resultBean . getSuccess ( ) ) {
}
return rb . setMsg ( resultBean . getMsg ( ) ) ;
}
}
return r ;
UpdateFlowFieldVo ufVo = resultBean . getData ( ) ;
}
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
if ( "Event_end" . equals ( resultBean . getData ( ) . getTaskDefKey ( ) ) ) {
} else {
public ResultBean complete ( BusinessVariables bv ) {
//极光推送
ResultBean rb = ResultBean . fireFail ( ) ;
asServiceAccommApply = fetchBySid ( businessSid ) ;
String businessSid = bv . getBusinessSid ( ) ;
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery ( ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( businessSid ) ;
MessageFlowVo messageFlowVo = new MessageFlowVo ( ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
BeanUtil . copyProperties ( ufVo , messageFlowVo ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
messageFlowVo . setProcDefId ( asServiceAccommApply . getProcDefId ( ) ) ;
appMap . put ( "sid" , businessSid ) ;
messageFlowVo . setProcInsId ( asServiceAccommApply . getProcInstId ( ) ) ;
variables . put ( "app" , appMap ) ;
messageFlowableQuery . setUfVo ( messageFlowVo ) ;
bv . setFormVariables ( variables ) ;
messageFlowableQuery . setAppMap ( appMap ) ;
SysOrganizationVo sysOrganization = sysOrganizationFeign . fetchBySid ( asServiceAccommApply . getDeptSid ( ) ) . getData ( ) ;
messageFlowableQuery . setBusinessSid ( businessSid ) ;
if ( sysOrganization ! = null ) {
messageFlowableQuery . setModuleName ( "配件销售提成备案申请" ) ;
bv . setOrgSidPath ( sysOrganization . getOrgSidPath ( ) ) ;
messageFlowableQuery . setMsgContent ( asServiceAccommApply . getCreateByName ( ) + "提交的" + messageFlowableQuery . getModuleName ( ) + ",请审批" ) ;
}
messageFlowableQuery . setMsgTitle ( "配件销售提成备案申请" ) ;
bv . setModelId ( asServiceAccommApply . getProcDefId ( ) ) ;
ResultBean < String > stringResultBean = messageFeign . pushMessage ( messageFlowableQuery ) ;
if ( bv . getTaskId ( ) . equals ( asServiceAccommApply . getTaskId ( ) ) ) {
}
ResultBean < UpdateFlowFieldVo > resultBean = flowFeign . handleProsess ( bv ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
if ( ! resultBean . getSuccess ( ) ) {
} else {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
return rb . setMsg ( "操作失败!提交的数据不一致" ) ;
}
}
UpdateFlowFieldVo ufVo = resultBean . getData ( ) ;
}
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
if ( "Event_end" . equals ( resultBean . getData ( ) . getTaskDefKey ( ) ) ) {
List < AsServiceAccommDetailDetailsVo > asServiceAccommDetailDetailsVos = asServiceAccommDetailService . selByMainSid ( businessSid ) ;
for ( AsServiceAccommDetailDetailsVo asServiceAccommDetailDetailsVo : asServiceAccommDetailDetailsVos ) {
asServiceAccommService . updateState ( asServiceAccommDetailDetailsVo . getAccommSid ( ) , 0 ) ;
asServiceAccommService . updateIsBa ( asServiceAccommDetailDetailsVo . getAccommSid ( ) , 1 ) ;
asServiceAccommService . updateCommRatio ( asServiceAccommDetailDetailsVo . getAccommSid ( ) , asServiceAccommDetailDetailsVo . getCommRatio ( ) . toString ( ) ) ;
}
} else {
//极光推送
asServiceAccommApply = fetchBySid ( businessSid ) ;
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery ( ) ;
MessageFlowVo messageFlowVo = new MessageFlowVo ( ) ;
BeanUtil . copyProperties ( ufVo , messageFlowVo ) ;
messageFlowVo . setProcDefId ( asServiceAccommApply . getProcDefId ( ) ) ;
messageFlowVo . setProcInsId ( asServiceAccommApply . getProcInstId ( ) ) ;
messageFlowableQuery . setUfVo ( messageFlowVo ) ;
messageFlowableQuery . setAppMap ( appMap ) ;
messageFlowableQuery . setBusinessSid ( businessSid ) ;
messageFlowableQuery . setModuleName ( "配件销售提成备案申请" ) ;
messageFlowableQuery . setMsgContent ( asServiceAccommApply . getCreateByName ( ) + "提交的" + messageFlowableQuery . getModuleName ( ) + ",请审批" ) ;
messageFlowableQuery . setMsgTitle ( "配件销售提成备案申请" ) ;
ResultBean < String > stringResultBean = messageFeign . pushMessage ( messageFlowableQuery ) ;
}
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
} else {
return rb . setMsg ( "操作失败!提交的数据不一致" ) ;
}
}
public ResultBean < List < ServiceAccommNodeVo > > getPreviousNodesForReject ( ServiceAccommNodeQuery query ) {
public ResultBean < List < ServiceAccommNodeVo > > getPreviousNodesForReject ( ServiceAccommNodeQuery query ) {
ResultBean < List < ServiceAccommNodeVo > > rb = ResultBean . fireFail ( ) ;
ResultBean < List < ServiceAccommNodeVo > > rb = ResultBean . fireFail ( ) ;
BusinessVariables bv = new BusinessVariables ( ) ;
BusinessVariables bv = new BusinessVariables ( ) ;
BeanUtil . copyProperties ( query , bv ) ;
BeanUtil . copyProperties ( query , bv ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
bv . setModelId ( asServiceAccommApply . getProcDefId ( ) ) ;
bv . setModelId ( asServiceAccommApply . getProcDefId ( ) ) ;
ResultBean < List < Map < String , Object > > > resultBean = flowTaskFeign . getPreviousNodesForReject ( bv ) ;
ResultBean < List < Map < String , Object > > > resultBean = flowTaskFeign . getPreviousNodesForReject ( bv ) ;
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
List < ServiceAccommNodeVo > voList = Optional . ofNullable ( resultBean . getData ( ) ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , ServiceAccommNodeVo . class ) ) . collect ( Collectors . toList ( ) ) ;
List < ServiceAccommNodeVo > voList = Optional . ofNullable ( resultBean . getData ( ) ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , ServiceAccommNodeVo . class ) ) . collect ( Collectors . toList ( ) ) ;
return rb . success ( ) . setData ( voList ) ;
return rb . success ( ) . setData ( voList ) ;
}
}
public ResultBean < List < ServiceAccommNodeVo > > getNextNodesForSubmit ( ServiceAccommNodeQuery query ) {
public ResultBean < List < ServiceAccommNodeVo > > getNextNodesForSubmit ( ServiceAccommNodeQuery query ) {
ResultBean < List < ServiceAccommNodeVo > > rb = ResultBean . fireFail ( ) ;
ResultBean < List < ServiceAccommNodeVo > > rb = ResultBean . fireFail ( ) ;
BusinessVariables bv = new BusinessVariables ( ) ;
BusinessVariables bv = new BusinessVariables ( ) ;
BeanUtil . copyProperties ( query , bv ) ;
BeanUtil . copyProperties ( query , bv ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
bv . setModelId ( asServiceAccommApply . getProcDefId ( ) ) ;
bv . setModelId ( asServiceAccommApply . getProcDefId ( ) ) ;
ResultBean < List < Map < String , Object > > > resultBean = flowTaskFeign . getNextNodesForSubmit ( bv ) ;
ResultBean < List < Map < String , Object > > > resultBean = flowTaskFeign . getNextNodesForSubmit ( bv ) ;
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
List < ServiceAccommNodeVo > voList = Optional . ofNullable ( resultBean . getData ( ) ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , ServiceAccommNodeVo . class ) ) . collect ( Collectors . toList ( ) ) ;
List < ServiceAccommNodeVo > voList = Optional . ofNullable ( resultBean . getData ( ) ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , ServiceAccommNodeVo . class ) ) . collect ( Collectors . toList ( ) ) ;
return rb . success ( ) . setData ( voList ) ;
return rb . success ( ) . setData ( voList ) ;
}
}
public ResultBean taskReject ( ServiceAccommTaskQuery query ) {
public ResultBean taskReject ( ServiceAccommTaskQuery query ) {
ResultBean rb = ResultBean . fireFail ( ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
String businessSid = query . getBusinessSid ( ) ;
String businessSid = query . getBusinessSid ( ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( businessSid ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( businessSid ) ;
if ( asServiceAccommApply = = null ) {
if ( asServiceAccommApply = = null ) {
return rb . setMsg ( "该申请不存在" ) ;
return rb . setMsg ( "该申请不存在" ) ;
}
}
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
if ( StringUtils . isNotBlank ( businessTaskId ) ) {
if ( StringUtils . isNotBlank ( businessTaskId ) ) {
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
if ( StringUtils . isBlank ( query . getComment ( ) ) ) {
if ( StringUtils . isBlank ( query . getComment ( ) ) ) {
return rb . setMsg ( "请填写意见" ) ;
return rb . setMsg ( "请填写意见" ) ;
}
}
if ( StringUtils . isBlank ( query . getUserSid ( ) ) ) {
if ( StringUtils . isBlank ( query . getUserSid ( ) ) ) {
return rb . setMsg ( "参数错误:userSid" ) ;
return rb . setMsg ( "参数错误:userSid" ) ;
}
}
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
appMap . put ( "sid" , businessSid ) ;
appMap . put ( "sid" , businessSid ) ;
variables . put ( "app" , appMap ) ;
variables . put ( "app" , appMap ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . taskReject ( flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . taskReject ( flowTaskVo ) ;
if ( ! resultBean . getSuccess ( ) ) {
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
return rb . setMsg ( resultBean . getMsg ( ) ) ;
}
}
UpdateFlowFieldVo ufVo = resultBean . getData ( ) ;
UpdateFlowFieldVo ufVo = resultBean . getData ( ) ;
Map < String , Object > map = BeanUtil . beanToMap ( ufVo ) ;
Map < String , Object > map = BeanUtil . beanToMap ( ufVo ) ;
//更新业务中的流程相关的参数
//更新业务中的流程相关的参数
updateFlowFiled ( map ) ;
updateFlowFiled ( map ) ;
//极光推送
//极光推送
asServiceAccommApply = fetchBySid ( businessSid ) ;
asServiceAccommApply = fetchBySid ( businessSid ) ;
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery ( ) ;
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery ( ) ;
MessageFlowVo messageFlowVo = new MessageFlowVo ( ) ;
MessageFlowVo messageFlowVo = new MessageFlowVo ( ) ;
BeanUtil . copyProperties ( ufVo , messageFlowVo ) ;
BeanUtil . copyProperties ( ufVo , messageFlowVo ) ;
String procId = asServiceAccommApply . getProcInstId ( ) ;
String procId = asServiceAccommApply . getProcInstId ( ) ;
messageFlowVo . setProcInsId ( procId ) ;
messageFlowVo . setProcInsId ( procId ) ;
messageFlowVo . setProcDefId ( asServiceAccommApply . getProcDefId ( ) ) ;
messageFlowVo . setProcDefId ( asServiceAccommApply . getProcDefId ( ) ) ;
messageFlowableQuery . setUfVo ( messageFlowVo ) ;
messageFlowableQuery . setUfVo ( messageFlowVo ) ;
messageFlowableQuery . setAppMap ( appMap ) ;
messageFlowableQuery . setAppMap ( appMap ) ;
messageFlowableQuery . setBusinessSid ( businessSid ) ;
messageFlowableQuery . setBusinessSid ( businessSid ) ;
messageFlowableQuery . setModuleName ( "配件销售提成备案申请" ) ;
messageFlowableQuery . setModuleName ( "配件销售提成备案申请" ) ;
ResultBean < List < LatestTaskVo > > listResultBean = flowTaskFeign . getLatestTasks ( procId ) ;
ResultBean < List < LatestTaskVo > > listResultBean = flowTaskFeign . getLatestTasks ( procId ) ;
String nextName = listResultBean . getData ( ) . get ( 0 ) . getName_ ( ) ;
String nextName = listResultBean . getData ( ) . get ( 0 ) . getName_ ( ) ;
String nextNodeUserSids = listResultBean . getData ( ) . get ( 0 ) . getASSIGNEE_ ( ) ;
String nextNodeUserSids = listResultBean . getData ( ) . get ( 0 ) . getASSIGNEE_ ( ) ;
if ( "发起申请" . equals ( nextName ) ) {
if ( "发起申请" . equals ( nextName ) ) {
messageFlowableQuery . setMsgContent ( "您提交的" + messageFlowableQuery . getModuleName ( ) + "已被驳回,请重新提交" ) ;
messageFlowableQuery . setMsgContent ( "您提交的" + messageFlowableQuery . getModuleName ( ) + "已被驳回,请重新提交" ) ;
} else {
} else {
messageFlowableQuery . setMsgContent ( asServiceAccommApply . getCreateByName ( ) + "提交的" + messageFlowableQuery . getModuleName ( ) + ",请审批" ) ;
messageFlowableQuery . setMsgContent ( asServiceAccommApply . getCreateByName ( ) + "提交的" + messageFlowableQuery . getModuleName ( ) + ",请审批" ) ;
}
}
messageFlowableQuery . setMsgTitle ( "配件销售提成备案申请" ) ;
messageFlowableQuery . setMsgTitle ( "配件销售提成备案申请" ) ;
ResultBean < String > stringResultBean = messageFeign . pushMessage ( messageFlowableQuery ) ;
ResultBean < String > stringResultBean = messageFeign . pushMessage ( messageFlowableQuery ) ;
return rb . success ( ) ;
return rb . success ( ) ;
}
}
}
}
return rb . setMsg ( "操作失败!提交的数据不一致!" ) ;
return rb . setMsg ( "操作失败!提交的数据不一致!" ) ;
}
}
public ResultBean revokeProcess ( ServiceAccommTaskQuery query ) {
public ResultBean revokeProcess ( ServiceAccommTaskQuery query ) {
ResultBean rb = ResultBean . fireFail ( ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
if ( StringUtils . isBlank ( query . getUserSid ( ) ) ) {
if ( StringUtils . isBlank ( query . getUserSid ( ) ) ) {
return rb . setMsg ( "参数错误:userSid" ) ;
return rb . setMsg ( "参数错误:userSid" ) ;
}
}
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
if ( StringUtils . isNotBlank ( businessTaskId ) ) {
if ( StringUtils . isNotBlank ( businessTaskId ) ) {
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . revokeProcess ( flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . revokeProcess ( flowTaskVo ) ;
if ( ! resultBean . getSuccess ( ) ) {
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
return rb . setMsg ( resultBean . getMsg ( ) ) ;
}
}
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
}
}
}
}
return rb . setMsg ( "操作失败,提交的数据不一致!" ) ;
return rb . setMsg ( "操作失败,提交的数据不一致!" ) ;
}
}
public ResultBean breakProcess ( ServiceAccommTaskQuery query ) {
public ResultBean breakProcess ( ServiceAccommTaskQuery query ) {
ResultBean rb = ResultBean . fireFail ( ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
if ( StringUtils . isBlank ( query . getInstanceId ( ) ) ) {
if ( StringUtils . isBlank ( query . getInstanceId ( ) ) ) {
return rb . setMsg ( "参数错误:instanceId" ) ;
return rb . setMsg ( "参数错误:instanceId" ) ;
}
}
if ( StringUtils . isBlank ( query . getUserSid ( ) ) ) {
if ( StringUtils . isBlank ( query . getUserSid ( ) ) ) {
return rb . setMsg ( "参数错误:userSid" ) ;
return rb . setMsg ( "参数错误:userSid" ) ;
}
}
if ( StringUtils . isBlank ( query . getComment ( ) ) ) {
if ( StringUtils . isBlank ( query . getComment ( ) ) ) {
return rb . setMsg ( "请填写意见" ) ;
return rb . setMsg ( "请填写意见" ) ;
}
}
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
AsServiceAccommApply asServiceAccommApply = fetchBySid ( query . getBusinessSid ( ) ) ;
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
String businessTaskId = asServiceAccommApply . getTaskId ( ) ;
if ( StringUtils . isNotBlank ( businessTaskId ) ) {
if ( StringUtils . isNotBlank ( businessTaskId ) ) {
if ( query . getUserSid ( ) . equals ( asServiceAccommApply . getCreateBySid ( ) ) ) {
if ( query . getUserSid ( ) . equals ( asServiceAccommApply . getCreateBySid ( ) ) ) {
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . breakProcess ( flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . breakProcess ( flowTaskVo ) ;
if ( ! resultBean . getSuccess ( ) ) {
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
return rb . setMsg ( resultBean . getMsg ( ) ) ;
}
}
Map < String , Object > map = BeanUtil . beanToMap ( resultBean . getData ( ) ) ;
Map < String , Object > map = BeanUtil . beanToMap ( resultBean . getData ( ) ) ;
updateFlowFiled ( map ) ;
updateFlowFiled ( map ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
} else {
} else {
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . breakProcess ( flowTaskVo ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . breakProcess ( flowTaskVo ) ;
if ( ! resultBean . getSuccess ( ) ) {
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
return rb . setMsg ( resultBean . getMsg ( ) ) ;
}
}
Map < String , Object > map = BeanUtil . beanToMap ( resultBean . getData ( ) ) ;
Map < String , Object > map = BeanUtil . beanToMap ( resultBean . getData ( ) ) ;
updateFlowFiled ( map ) ;
updateFlowFiled ( map ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
}
}
}
}
}
}
return rb . setMsg ( "操作失败!提交的数据不一致!" ) ;
return rb . setMsg ( "操作失败!提交的数据不一致!" ) ;
}
}
public ResultBean delegate ( ServiceAccommDelegateQuery query ) {
public ResultBean delegate ( ServiceAccommDelegateQuery query ) {
ResultBean rb = ResultBean . fireFail ( ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
FlowDelegateQuery delegateQuery = new FlowDelegateQuery ( ) ;
FlowDelegateQuery delegateQuery = new FlowDelegateQuery ( ) ;
BeanUtil . copyProperties ( query , delegateQuery ) ;
BeanUtil . copyProperties ( query , delegateQuery ) ;
flowFeign . delegate ( delegateQuery ) ;
flowFeign . delegate ( delegateQuery ) ;
return rb . success ( ) ;
return rb . success ( ) ;
}
}
}
}