|
|
@ -5,8 +5,11 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.base.api.basemodelmodprice.BaseModelModprice; |
|
|
|
import com.yxt.anrui.base.api.basemodelmodprice.flow.SubmitBaseModelModPriceDto; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAppendix; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.*; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.AppSubmitContractInfoDto; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractNodeQuery; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractNodeVo; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractTaskQuery; |
|
|
@ -42,6 +45,7 @@ import com.yxt.anrui.portal.api.dictcommon.DictCommonFeign; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonVo; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
@ -982,8 +986,6 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
*/ |
|
|
|
public PagerVo<AppCommonContractPageVo> getContractList(PagerQuery<AppCommonContractQuery> pagerQuery) { |
|
|
|
AppCommonContractQuery query = pagerQuery.getParams(); |
|
|
|
String staffSid = sysUserFeign.getUserOrgInfoByUserSid(query.getUserSid()).getData().getStaffSid(); |
|
|
|
query.setStaffSid(staffSid); |
|
|
|
QueryWrapper<CommonContract> qw = appCreateQueryWrapper(query); |
|
|
|
IPage<CommonContract> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
IPage<AppCommonContractPageVo> iPage = baseMapper.getContractList(page, qw); |
|
|
@ -997,9 +999,9 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
QueryWrapper<CommonContract> qw = new QueryWrapper<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getType())) { //合同类型
|
|
|
|
qw.eq("contractTypeKey", query.getType()); |
|
|
|
} |
|
|
|
// if (StringUtils.isNotBlank(query.getType())) { //合同类型
|
|
|
|
// qw.eq("contractTypeKey", query.getType());
|
|
|
|
// }
|
|
|
|
if (StringUtils.isNotBlank(query.getNames())) { // 甲方名称
|
|
|
|
qw.like("partyA", query.getNames()); |
|
|
|
} |
|
|
@ -1009,8 +1011,11 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
if (StringUtils.isNotBlank(query.getNames())) { // 其他方名称
|
|
|
|
qw.like("partyC", query.getNames()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getStaffSid())) { // 业务员sid
|
|
|
|
qw.eq("staffSid", query.getStaffSid()); |
|
|
|
if (StringUtils.isNotBlank(query.getUserSid())) { // 业务员sid
|
|
|
|
qw.eq("staffSid", query.getUserSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getType())) { // 业务员sid
|
|
|
|
qw.eq("state", query.getType()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
@ -1023,8 +1028,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public AppCommonContractInitVo getContractInfo(String contractSid, String userSid) { |
|
|
|
String staffSid = sysUserFeign.getUserOrgInfoByUserSid(userSid).getData().getStaffSid(); |
|
|
|
AppCommonContractInitVo vo = baseMapper.getContractInfo(contractSid, staffSid); |
|
|
|
AppCommonContractInitVo vo = baseMapper.getContractInfo(contractSid, userSid); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
vo.setUserSid(userSid); |
|
|
|
if (StringUtils.isNotBlank(vo.getAppdixUrl())) { |
|
|
@ -1089,7 +1093,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContract.setPartyB(dto.getPartyB()); |
|
|
|
commonContract.setContractAmount(dto.getContractPrice()); |
|
|
|
commonContract.setCustomerSid(dto.getCustomerSid()); |
|
|
|
commonContract.setStaffSid(data.getStaffSid()); |
|
|
|
commonContract.setStaffSid(dto.getUserSid()); |
|
|
|
commonContract.setStaffName(data.getStaffName()); |
|
|
|
commonContract.setOrgSid(data.getOrgSid()); |
|
|
|
String s1 = ""; |
|
|
@ -1125,7 +1129,115 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} |
|
|
|
} |
|
|
|
updateById(commonContract); |
|
|
|
return rb.success(); |
|
|
|
return rb.success().setData(commonContract.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submitContractInfo(AppSubmitContractInfoDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//根据用户sid获取staffSid
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
|
} |
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
ResultBean<SysStaffOrg> orgByStaffSid = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|
|
|
if (!orgByStaffSid.getSuccess()) { |
|
|
|
return rb.setMsg(orgByStaffSid.getMsg()); |
|
|
|
} |
|
|
|
//用户的组织全路径
|
|
|
|
String orgSidPath = orgByStaffSid.getData().getOrgSidPath(); |
|
|
|
CommonContract commonContract = fetchBySid(dto.getContractSid()); |
|
|
|
int r = submitBusinessData(dto, commonContract); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
ResultBean<String> resultBean = saveContractInfo(dto); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
baseMapper.updateBySidAndState(businessSid, "2"); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
//流程中的参数赋值
|
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(orgSidPath); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
//若app移动端有此功能,则传递appMap参数
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//需和移动端沟通业务sid保存的属性具体值:appMap中sid不是固定的。移动端提供具体字段。
|
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.CONTRACTAPPLY.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
//极光推送
|
|
|
|
commonContract = fetchBySid(businessSid); |
|
|
|
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(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("业务"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return voResultBean; |
|
|
|
} |
|
|
|
if (r == 2) { |
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|
if (StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
bv.setTaskId(commonContract.getTaskId()); |
|
|
|
bv.setTaskDefKey(commonContract.getNodeId()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private synchronized int submitBusinessData(AppSubmitContractInfoDto dto, CommonContract commonContract) { |
|
|
|
int r = 0; |
|
|
|
if (StringUtils.isBlank(dto.getContractSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (commonContract != null) { |
|
|
|
String businessTaskId = commonContract.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<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
@ -1332,13 +1444,13 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContract = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo,messageFlowVo); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
ufVo.setProcInsId(commonContract.getProcInstId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("合同审核申请"); |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName()+"提交的"+messageFlowableQuery.getModuleName()+",请审批"); |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("业务中心"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
} |
|
|
@ -1416,20 +1528,20 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContract = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo,messageFlowVo); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
String procId = commonContract.getProcInstId(); |
|
|
|
ufVo.setProcInsId(procId); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("合同审核申请"); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(procId); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(procId); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
if(receiveSidList.size() == 1 && receiveSidList.get(0).equals(commonContract.getStaffSid())){ |
|
|
|
messageFlowableQuery.setMsgContent("您提交的"+messageFlowableQuery.getModuleName()+"已被驳回,请重新提交"); |
|
|
|
}else{ |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName()+"提交的"+messageFlowableQuery.getModuleName()+",请审批"); |
|
|
|
if (receiveSidList.size() == 1 && receiveSidList.get(0).equals(commonContract.getStaffSid())) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("业务中心"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|