分组类型查询单据
This commit is contained in:
parent
06d06dddbe
commit
5209d7cfd5
|
@ -59,6 +59,8 @@ public class RequisitionEntity extends BaseEntity {
|
||||||
private String dataMsg;
|
private String dataMsg;
|
||||||
//用户手机号
|
//用户手机号
|
||||||
private String userPhone;
|
private String userPhone;
|
||||||
|
//用户手机号
|
||||||
|
private String sendPhone;
|
||||||
|
|
||||||
public String getStartTime() {
|
public String getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
|
@ -235,4 +237,12 @@ public class RequisitionEntity extends BaseEntity {
|
||||||
public void setUserPhone(String userPhone) {
|
public void setUserPhone(String userPhone) {
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSendPhone() {
|
||||||
|
return sendPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSendPhone(String sendPhone) {
|
||||||
|
this.sendPhone = sendPhone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<result property="userPhone" column="userPhone"/>
|
<result property="userPhone" column="userPhone"/>
|
||||||
<result property="dataMsg" column="dataMsg"/>
|
<result property="dataMsg" column="dataMsg"/>
|
||||||
<result property="dataStatus" column="dataStatus"/>
|
<result property="dataStatus" column="dataStatus"/>
|
||||||
|
<result property="sendPhone" column="sendPhone"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<!-- 查询的字段-->
|
<!-- 查询的字段-->
|
||||||
<sql id = "RequisitionEntity_Base_Column_List">
|
<sql id = "RequisitionEntity_Base_Column_List">
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
createdOn,
|
createdOn,
|
||||||
dataStatus,
|
dataStatus,
|
||||||
dataMsg,
|
dataMsg,
|
||||||
|
sendPhone,
|
||||||
userPhone
|
userPhone
|
||||||
</sql>
|
</sql>
|
||||||
<!-- 查询 采用==查询 -->
|
<!-- 查询 采用==查询 -->
|
||||||
|
@ -114,11 +116,12 @@
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- <update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">-->
|
<!-- <update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">-->
|
||||||
<!-- update PR_PR set-->
|
<!-- update PR_PR set-->
|
||||||
<!-- <trim suffix="" suffixOverrides=",">-->
|
<!-- <trim suffix="" suffixOverrides=",">-->
|
||||||
<!-- <if test="dataStatus != null and dataStatus != ''"> dataStatus = #{dataStatus},</if>-->
|
<!-- <if test="dataStatus != null and dataStatus != ''"> DescFlexField_PrivateDescSeg2 = #{dataStatus},</if>-->
|
||||||
<!-- <if test="dataMsg != null and dataMsg != ''"> dataMsg = #{dataMsg},</if>-->
|
<!-- <if test="dataMsg != null and dataMsg != ''"> DescFlexField_PrivateDescSeg1 = #{dataMsg},</if>-->
|
||||||
<!-- </trim>-->
|
<!-- </trim>-->
|
||||||
<!-- where id = #{id}-->
|
<!-- where id = #{id}-->
|
||||||
<!-- </update>-->
|
<!-- </update>-->
|
||||||
|
|
|
@ -25,5 +25,5 @@ public interface IPrepaymentService extends IBaseService<PrepaymentEntity,String
|
||||||
* @param entity
|
* @param entity
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int updateStatus(PrepaymentEntity entity);
|
void updateStatus(PrepaymentEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class PrepaymentServiceImpl extends BaseService<PrepaymentEntity,String>
|
||||||
*/
|
*/
|
||||||
@DS("#entity.dataSourceCode")
|
@DS("#entity.dataSourceCode")
|
||||||
@Override
|
@Override
|
||||||
public int updateStatus(PrepaymentEntity entity) {
|
public void updateStatus(PrepaymentEntity entity) {
|
||||||
return 0;
|
prepaymentDao.update(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||||
@Value("${zt.url}")
|
@Value("${zt.url}")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* u9c预付单发起OA请款单流程 (预付)
|
* u9c预付单发起OA请款单流程 (预付)
|
||||||
*
|
*
|
||||||
|
@ -57,23 +58,23 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
//数据源编码
|
//数据源编码
|
||||||
String datasourceCode = requestJson.getString("sourceCode");
|
String datasourceCode = requestJson.getString("sourceCode");
|
||||||
//开始时间
|
//开始时间
|
||||||
String startTime = DateUtil.format(requestJson.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");
|
String startTime = DateUtil.format(requestJson.getDate("startTime"), "yyyy-MM-dd HH:mm:ss");
|
||||||
//结束时间
|
//结束时间
|
||||||
String endTime = DateUtil.format(requestJson.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");
|
String endTime = DateUtil.format(requestJson.getDate("endTime"), "yyyy-MM-dd HH:mm:ss");
|
||||||
//重试id
|
//重试id
|
||||||
String taskId = requestJson.getString("integration_task_living_details_id");
|
String taskId = requestJson.getString("integration_task_living_details_id");
|
||||||
//查询U9C预付单
|
//查询U9C预付单
|
||||||
PrepaymentEntity prepaymentEntity = new PrepaymentEntity();
|
PrepaymentEntity prepaymentEntity = new PrepaymentEntity();
|
||||||
//prepaymentEntity.setDocNo("RE-1563");
|
//prepaymentEntity.setDocNo("RE-1563");
|
||||||
prepaymentEntity.setDataSourceCode(datasourceCode);
|
prepaymentEntity.setDataSourceCode(datasourceCode);
|
||||||
if (StrUtil.isEmpty(taskId)){
|
if (StrUtil.isEmpty(taskId)) {
|
||||||
//prepaymentEntity.setStartTime(startTime);
|
//prepaymentEntity.setStartTime(startTime);
|
||||||
//prepaymentEntity.setEndTime(endTime);
|
//prepaymentEntity.setEndTime(endTime);
|
||||||
}else {
|
} else {
|
||||||
prepaymentEntity.setId(taskId);
|
prepaymentEntity.setId(taskId);
|
||||||
}
|
}
|
||||||
List<PrepaymentEntity> prepaymentList = prepaymentService.queryList(prepaymentEntity);
|
List<PrepaymentEntity> prepaymentList = prepaymentService.queryList(prepaymentEntity);
|
||||||
if (CollectionUtils.isNotEmpty(prepaymentList)){
|
if (CollectionUtils.isNotEmpty(prepaymentList)) {
|
||||||
for (PrepaymentEntity prepayment : prepaymentList) {
|
for (PrepaymentEntity prepayment : prepaymentList) {
|
||||||
//查询u9c预付单供应商明细 第一个页签
|
//查询u9c预付单供应商明细 第一个页签
|
||||||
PrepaymentSuppEntity prepaymentSuppEntity = new PrepaymentSuppEntity();
|
PrepaymentSuppEntity prepaymentSuppEntity = new PrepaymentSuppEntity();
|
||||||
|
@ -85,199 +86,199 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
prepaymentDetailEntity.setMainId(prepayment.getId());
|
prepaymentDetailEntity.setMainId(prepayment.getId());
|
||||||
prepaymentDetailEntity.setDataSourceCode(datasourceCode);
|
prepaymentDetailEntity.setDataSourceCode(datasourceCode);
|
||||||
List<PrepaymentDetailEntity> prepaymentDetailList = prepaymentDetailServiceImpl.queryDetails(prepaymentDetailEntity);
|
List<PrepaymentDetailEntity> prepaymentDetailList = prepaymentDetailServiceImpl.queryDetails(prepaymentDetailEntity);
|
||||||
if (CollectionUtils.isNotEmpty(prepaymentDetailList) && CollectionUtils.isNotEmpty(prepaymentSuppList)){
|
if (CollectionUtils.isNotEmpty(prepaymentDetailList) && CollectionUtils.isNotEmpty(prepaymentSuppList)) {
|
||||||
//主表
|
//主表
|
||||||
JSONObject zb = new JSONObject();
|
JSONObject zb = new JSONObject();
|
||||||
//单据类型
|
//单据类型
|
||||||
zb.put("field0001",prepayment.getDocumentTypeName());
|
zb.put("field0001", prepayment.getDocumentTypeName());
|
||||||
//币种
|
//币种
|
||||||
zb.put("field0002",prepayment.getCurrencyName());
|
zb.put("field0002", prepayment.getCurrencyName());
|
||||||
//单号
|
//单号
|
||||||
zb.put("field0003",prepayment.getDocNo());
|
zb.put("field0003", prepayment.getDocNo());
|
||||||
//业务员
|
//业务员
|
||||||
zb.put("field0004",prepayment.getTransactorName());
|
zb.put("field0004", prepayment.getTransactorName());
|
||||||
//申请日期
|
//申请日期
|
||||||
zb.put("field0005",prepayment.getPayRFDate());
|
zb.put("field0005", prepayment.getPayRFDate());
|
||||||
//部门
|
//部门
|
||||||
zb.put("field0006",prepayment.getDeptName());
|
zb.put("field0006", prepayment.getDeptName());
|
||||||
//预计付款日
|
//预计付款日
|
||||||
zb.put("field0007",prepayment.getExpectPayDate());
|
zb.put("field0007", prepayment.getExpectPayDate());
|
||||||
//付款方式
|
//付款方式
|
||||||
zb.put("field0008",prepayment.getPayModeCode());
|
zb.put("field0008", prepayment.getPayModeCode());
|
||||||
//请款对象
|
//请款对象
|
||||||
zb.put("field0009",prepayment.getRequestObjTypeCode());
|
zb.put("field0009", prepayment.getRequestObjTypeCode());
|
||||||
//状态
|
//状态
|
||||||
zb.put("field0010",prepayment.getDocStatusName());
|
zb.put("field0010", prepayment.getDocStatusName());
|
||||||
//请款用途
|
//请款用途
|
||||||
zb.put("field0011",prepaymentDetailList.get(0).getReqFundUseName());
|
zb.put("field0011", prepaymentDetailList.get(0).getReqFundUseName());
|
||||||
//出纳确认
|
//出纳确认
|
||||||
zb.put("field0012",prepayment.getCashierConfirmed());
|
zb.put("field0012", prepayment.getCashierConfirmed());
|
||||||
//折扣前请款金额合计
|
//折扣前请款金额合计
|
||||||
zb.put("field0044","");
|
zb.put("field0044", "");
|
||||||
//请款对应折扣合计
|
//请款对应折扣合计
|
||||||
zb.put("field0045","");
|
zb.put("field0045", "");
|
||||||
//折扣后请款金额合计
|
//折扣后请款金额合计
|
||||||
zb.put("field0046","");
|
zb.put("field0046", "");
|
||||||
//付款本币金额合计
|
//付款本币金额合计
|
||||||
zb.put("field0047","");
|
zb.put("field0047", "");
|
||||||
//请款金额合计
|
//请款金额合计
|
||||||
zb.put("field0053","");
|
zb.put("field0053", "");
|
||||||
//请款数量合计
|
//请款数量合计
|
||||||
zb.put("field0061","");
|
zb.put("field0061", "");
|
||||||
//请款金额和明细合计
|
//请款金额和明细合计
|
||||||
zb.put("field0063","");
|
zb.put("field0063", "");
|
||||||
//单据编号
|
//单据编号
|
||||||
zb.put("field0070","");
|
zb.put("field0070", "");
|
||||||
//发起人
|
//发起人
|
||||||
zb.put("field0071","");
|
zb.put("field0071", "");
|
||||||
//发起部门
|
//发起部门
|
||||||
zb.put("field0072","");
|
zb.put("field0072", "");
|
||||||
//发起时间
|
//发起时间
|
||||||
zb.put("field0073","");
|
zb.put("field0073", "");
|
||||||
//子表
|
//子表
|
||||||
List<JSONObject> gysList = new LinkedList<>();//供应商
|
List<JSONObject> gysList = new LinkedList<>();//供应商
|
||||||
List<JSONObject> qkList = new LinkedList<>();//请款
|
List<JSONObject> qkList = new LinkedList<>();//请款
|
||||||
for (PrepaymentSuppEntity detail : prepaymentSuppList){
|
for (PrepaymentSuppEntity detail : prepaymentSuppList) {
|
||||||
JSONObject gys = new JSONObject();
|
JSONObject gys = new JSONObject();
|
||||||
//行号
|
//行号
|
||||||
gys.put("field0013",detail.getLineNum());
|
gys.put("field0013", detail.getLineNum());
|
||||||
//供应商
|
//供应商
|
||||||
gys.put("field0014",detail.getSuppName());
|
gys.put("field0014", detail.getSuppName());
|
||||||
//选单
|
//选单
|
||||||
gys.put("field0015","");//有问题,不知道字段
|
gys.put("field0015", "");//有问题,不知道字段
|
||||||
//折扣前请款金额
|
//折扣前请款金额
|
||||||
gys.put("field0016",detail.getRfTotalMoney());
|
gys.put("field0016", detail.getRfTotalMoney());
|
||||||
//请款对应折扣
|
//请款对应折扣
|
||||||
gys.put("field0017",detail.getRfDisCount());
|
gys.put("field0017", detail.getRfDisCount());
|
||||||
//折扣后请款金额
|
//折扣后请款金额
|
||||||
gys.put("field0018",detail.getRfaMoney());
|
gys.put("field0018", detail.getRfaMoney());
|
||||||
//付款本币金额
|
//付款本币金额
|
||||||
gys.put("field0019",detail.getAcmPayFCMoney());
|
gys.put("field0019", detail.getAcmPayFCMoney());
|
||||||
//结算方式
|
//结算方式
|
||||||
gys.put("field0020",detail.getPayType());
|
gys.put("field0020", detail.getPayType());
|
||||||
//收款银行帐号
|
//收款银行帐号
|
||||||
gys.put("field0021",detail.getOppAccBkAccount());
|
gys.put("field0021", detail.getOppAccBkAccount());
|
||||||
//收款账号名称
|
//收款账号名称
|
||||||
gys.put("field0022",detail.getRecBkAccName());
|
gys.put("field0022", detail.getRecBkAccName());
|
||||||
//开户银行
|
//开户银行
|
||||||
gys.put("field0023",detail.getOppAccBk());
|
gys.put("field0023", detail.getOppAccBk());
|
||||||
//收支项目
|
//收支项目
|
||||||
gys.put("field0024",detail.getIncomeExpendItemName());
|
gys.put("field0024", detail.getIncomeExpendItemName());
|
||||||
//部门-供应商
|
//部门-供应商
|
||||||
gys.put("field0025",detail.getDeptName());
|
gys.put("field0025", detail.getDeptName());
|
||||||
//业务员-供应商
|
//业务员-供应商
|
||||||
gys.put("field0026",detail.getTransactorName());
|
gys.put("field0026", detail.getTransactorName());
|
||||||
//项目-供应商
|
//项目-供应商
|
||||||
gys.put("field0027","");
|
gys.put("field0027", "");
|
||||||
//预付款类型
|
//预付款类型
|
||||||
gys.put("field0051","");
|
gys.put("field0051", "");
|
||||||
//请款金额
|
//请款金额
|
||||||
gys.put("field0052","");
|
gys.put("field0052", "");
|
||||||
//料品
|
//料品
|
||||||
gys.put("field0054",detail.getItemName());
|
gys.put("field0054", detail.getItemName());
|
||||||
gysList.add(gys);
|
gysList.add(gys);
|
||||||
}
|
}
|
||||||
for (PrepaymentDetailEntity detail : prepaymentDetailList) {
|
for (PrepaymentDetailEntity detail : prepaymentDetailList) {
|
||||||
JSONObject qk = new JSONObject();
|
JSONObject qk = new JSONObject();
|
||||||
//单据类型明细
|
//单据类型明细
|
||||||
qk.put("field0028",detail.getDocType());
|
qk.put("field0028", detail.getDocType());
|
||||||
//应付单
|
//应付单
|
||||||
qk.put("field0029",detail.getDocCode());
|
qk.put("field0029", detail.getDocCode());
|
||||||
//折扣前可请款金额
|
//折扣前可请款金额
|
||||||
qk.put("field0030",detail.getCanDisposeMoney());
|
qk.put("field0030", detail.getCanDisposeMoney());
|
||||||
//可享受折扣
|
//可享受折扣
|
||||||
qk.put("field0031",detail.getRfDisCount());
|
qk.put("field0031", detail.getRfDisCount());
|
||||||
//折扣前请款金额明细
|
//折扣前请款金额明细
|
||||||
qk.put("field0032",detail.getRfTotalMoney());
|
qk.put("field0032", detail.getRfTotalMoney());
|
||||||
//请款享受折扣
|
//请款享受折扣
|
||||||
qk.put("field0033",detail.getRfDisCount());
|
qk.put("field0033", detail.getRfDisCount());
|
||||||
//折扣后请款金额明细
|
//折扣后请款金额明细
|
||||||
qk.put("field0034",detail.getRaTotalMoney());
|
qk.put("field0034", detail.getRaTotalMoney());
|
||||||
//累计确认对应金额
|
//累计确认对应金额
|
||||||
qk.put("field0035",detail.getCfmMoney());
|
qk.put("field0035", detail.getCfmMoney());
|
||||||
//发票号
|
//发票号
|
||||||
qk.put("field0036",detail.getInvoiceNum());
|
qk.put("field0036", detail.getInvoiceNum());
|
||||||
//发票日期
|
//发票日期
|
||||||
qk.put("field0037",detail.getInvoiceDate());
|
qk.put("field0037", detail.getInvoiceDate());
|
||||||
//立账日期
|
//立账日期
|
||||||
qk.put("field0038",detail.getAccrueDate());
|
qk.put("field0038", detail.getAccrueDate());
|
||||||
//记账日期
|
//记账日期
|
||||||
qk.put("field0039",detail.getPostPeriod());
|
qk.put("field0039", detail.getPostPeriod());
|
||||||
//到期日
|
//到期日
|
||||||
qk.put("field0040",detail.getMaturity());
|
qk.put("field0040", detail.getMaturity());
|
||||||
//付款条件
|
//付款条件
|
||||||
qk.put("field0041",detail.getPayTermName());
|
qk.put("field0041", detail.getPayTermName());
|
||||||
//部门明细
|
//部门明细
|
||||||
qk.put("field0042",detail.getDetpName());
|
qk.put("field0042", detail.getDetpName());
|
||||||
//业务员明细
|
//业务员明细
|
||||||
qk.put("field0043",detail.getTransactorName());
|
qk.put("field0043", detail.getTransactorName());
|
||||||
//预付款类型明细
|
//预付款类型明细
|
||||||
qk.put("field0055","");//有问题,不知道字段
|
qk.put("field0055", "");//有问题,不知道字段
|
||||||
//单号明细
|
//单号明细
|
||||||
qk.put("field0056","");//有问题,不知道字段
|
qk.put("field0056", "");//有问题,不知道字段
|
||||||
//单价
|
//单价
|
||||||
qk.put("field0057","");//有问题,不知道字段
|
qk.put("field0057", "");//有问题,不知道字段
|
||||||
//数量
|
//数量
|
||||||
qk.put("field0058","");//有问题,不知道字段
|
qk.put("field0058", "");//有问题,不知道字段
|
||||||
//单位
|
//单位
|
||||||
qk.put("field0059","");//有问题,不知道字段
|
qk.put("field0059", "");//有问题,不知道字段
|
||||||
//请款数量
|
//请款数量
|
||||||
qk.put("field0060","");//有问题,不知道字段
|
qk.put("field0060", "");//有问题,不知道字段
|
||||||
//请款金额明细
|
//请款金额明细
|
||||||
qk.put("field0062","");//有问题,不知道字段
|
qk.put("field0062", "");//有问题,不知道字段
|
||||||
//费用
|
//费用
|
||||||
qk.put("field0064","");//有问题,不知道字段
|
qk.put("field0064", "");//有问题,不知道字段
|
||||||
//料号
|
//料号
|
||||||
qk.put("field0065","");//有问题,不知道字段
|
qk.put("field0065", "");//有问题,不知道字段
|
||||||
//料品明细
|
//料品明细
|
||||||
qk.put("field0066","");//有问题,不知道字段
|
qk.put("field0066", "");//有问题,不知道字段
|
||||||
//项目
|
//项目
|
||||||
qk.put("field0067",detail.getProjectName());
|
qk.put("field0067", detail.getProjectName());
|
||||||
//立账供应商
|
//立账供应商
|
||||||
qk.put("field0068",detail.getSuppName());
|
qk.put("field0068", detail.getSuppName());
|
||||||
//单据状态
|
//单据状态
|
||||||
qk.put("field0069",prepayment.getDocumentTypeName());
|
qk.put("field0069", prepayment.getDocumentTypeName());
|
||||||
qkList.add(qk);
|
qkList.add(qk);
|
||||||
}
|
}
|
||||||
JSONObject formData = new JSONObject(new LinkedHashMap<>());
|
JSONObject formData = new JSONObject(new LinkedHashMap<>());
|
||||||
formData.put("formmain_0664",zb);//主表
|
formData.put("formmain_0664", zb);//主表
|
||||||
formData.put("formson_0665",gysList);
|
formData.put("formson_0665", gysList);
|
||||||
formData.put("formson_0666",qkList);
|
formData.put("formson_0666", qkList);
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("templateCode","formmain_0664");
|
data.put("templateCode", "formmain_0664");
|
||||||
data.put("draft","0");
|
data.put("draft", "0");
|
||||||
data.put("data",formData);
|
data.put("data", formData);
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("appName","collaboration");
|
param.put("appName", "collaboration");
|
||||||
param.put("data",data);
|
param.put("data", data);
|
||||||
String paramStr = param.toString();
|
String paramStr = param.toString();
|
||||||
logger.info("u9c预付单发起OA流程请求参数:{}",paramStr);
|
logger.info("u9c预付单发起OA流程请求参数:{}", paramStr);
|
||||||
String res = null;
|
String res = null;
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try {
|
try {
|
||||||
//1、获取token
|
//1、获取token
|
||||||
JSONObject nouserToken = getToken(null, "800045", "8000450000");
|
JSONObject nouserToken = getToken(null, "800045", "8000450000");
|
||||||
if(nouserToken.getBoolean("flag")){
|
if (nouserToken.getBoolean("flag")) {
|
||||||
//2、根据电话获取code
|
//2、根据电话获取code
|
||||||
JSONObject usercode = getUsercode(nouserToken.getString("token"),prepayment.getUserPhone(), "800045", "8000450005");
|
JSONObject usercode = getUsercode(nouserToken.getString("token"), prepayment.getUserPhone(), "800045", "8000450005");
|
||||||
if(usercode.getBoolean("flag")){
|
if (usercode.getBoolean("flag")) {
|
||||||
//3、根据code,再次获取token
|
//3、根据code,再次获取token
|
||||||
JSONObject token = getToken(usercode.getString("code"), "800045", "8000450000");
|
JSONObject token = getToken(usercode.getString("code"), "800045", "8000450000");
|
||||||
if(token.getBoolean("flag")){
|
if (token.getBoolean("flag")) {
|
||||||
res = invokeEsb(param, "800045", "8000450001",token.getString("token"));
|
res = invokeEsb(param, "800045", "8000450001", token.getString("token"));
|
||||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||||
flag = jsonObject.getBoolean("flag");
|
flag = jsonObject.getBoolean("flag");
|
||||||
}else {
|
} else {
|
||||||
res = token.getString("msg");
|
res = token.getString("msg");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
res = usercode.getString("msg");
|
res = usercode.getString("msg");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
res = nouserToken.getString("msg");
|
res = nouserToken.getString("msg");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
logger.error("调用oa接口出错:{}",e);
|
logger.error("调用oa接口出错:{}", e);
|
||||||
res = e.getMessage();
|
res = e.getMessage();
|
||||||
}
|
}
|
||||||
//保存日志
|
//保存日志
|
||||||
|
@ -290,25 +291,25 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
taskLivingDetail.setRootAppNewData(paramStr);
|
taskLivingDetail.setRootAppNewData(paramStr);
|
||||||
taskLivingDetail.setNewTransmitInfo(res);
|
taskLivingDetail.setNewTransmitInfo(res);
|
||||||
taskLivingDetail.setNewPushDate(new Date());
|
taskLivingDetail.setNewPushDate(new Date());
|
||||||
saveLog(taskId,flag,taskLivingDetail);
|
saveLog(taskId, flag, taskLivingDetail);
|
||||||
logger.info("u9c预付单发起OA流程返回结果:{}",res);
|
logger.info("u9c预付单发起OA流程返回结果:{}", res);
|
||||||
// 发送完成修改主表状态 已完成或发送失败 flag判断
|
// 发送完成修改主表状态 已完成或发送失败 flag判断
|
||||||
if(flag){
|
if (flag) {
|
||||||
PrepaymentEntity updatePrepayment = new PrepaymentEntity();
|
PrepaymentEntity updatePrepayment = new PrepaymentEntity();
|
||||||
updatePrepayment.setDataSourceCode(datasourceCode);
|
updatePrepayment.setDataSourceCode(datasourceCode);
|
||||||
updatePrepayment.setId(prepayment.getId());
|
updatePrepayment.setId(prepayment.getId());
|
||||||
updatePrepayment.setDataStatus("1");
|
updatePrepayment.setDataStatus("1");
|
||||||
updatePrepayment.setDataMsg("成功");
|
updatePrepayment.setDataMsg("成功");
|
||||||
prepaymentService.updateStatus(updatePrepayment);
|
prepaymentService.updateStatus(updatePrepayment);
|
||||||
}else {
|
} else {
|
||||||
PrepaymentEntity updatePrepayment = new PrepaymentEntity();
|
PrepaymentEntity updatePrepayment = new PrepaymentEntity();
|
||||||
updatePrepayment.setDataSourceCode(datasourceCode);
|
updatePrepayment.setDataSourceCode(datasourceCode);
|
||||||
updatePrepayment.setId(prepayment.getId());
|
updatePrepayment.setId(prepayment.getId());
|
||||||
updatePrepayment.setDataStatus("1");
|
updatePrepayment.setDataStatus("1");
|
||||||
updatePrepayment.setDataMsg("失败:"+res);
|
updatePrepayment.setDataMsg("失败:" + res);
|
||||||
prepaymentService.updateStatus(updatePrepayment);
|
prepaymentService.updateStatus(updatePrepayment);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
// 没有明细不发送,修改数据状态,已完成,没有明细不发送
|
// 没有明细不发送,修改数据状态,已完成,没有明细不发送
|
||||||
PrepaymentEntity updatePrepayment = new PrepaymentEntity();
|
PrepaymentEntity updatePrepayment = new PrepaymentEntity();
|
||||||
updatePrepayment.setDataSourceCode(datasourceCode);
|
updatePrepayment.setDataSourceCode(datasourceCode);
|
||||||
|
@ -325,6 +326,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* u9c请购单发起OA请购单流程
|
* u9c请购单发起OA请购单流程
|
||||||
|
*
|
||||||
* @param requestJson
|
* @param requestJson
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -333,246 +335,254 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
//数据源编码
|
//数据源编码
|
||||||
String datasourceCode = requestJson.getString("sourceCode");
|
String datasourceCode = requestJson.getString("sourceCode");
|
||||||
//开始时间
|
//开始时间
|
||||||
String startTime = DateUtil.format(requestJson.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");
|
String startTime = DateUtil.format(requestJson.getDate("startTime"), "yyyy-MM-dd HH:mm:ss");
|
||||||
//结束时间
|
//结束时间
|
||||||
String endTime = DateUtil.format(requestJson.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");
|
String endTime = DateUtil.format(requestJson.getDate("endTime"), "yyyy-MM-dd HH:mm:ss");
|
||||||
//重试id
|
//重试id
|
||||||
String taskId = requestJson.getString("integration_task_living_details_id");
|
String taskId = requestJson.getString("integration_task_living_details_id");
|
||||||
//查询u9c请购单
|
//查询u9c请购单
|
||||||
RequisitionEntity requisitionEntity = new RequisitionEntity();
|
RequisitionEntity requisitionEntity = new RequisitionEntity();
|
||||||
requisitionEntity.setDataSourceCode(datasourceCode);
|
requisitionEntity.setDataSourceCode(datasourceCode);
|
||||||
if (StrUtil.isEmpty(taskId)){
|
if (StrUtil.isEmpty(taskId)) {
|
||||||
//requisitionEntity.setStartTime(startTime);
|
//requisitionEntity.setStartTime(startTime);
|
||||||
//requisitionEntity.setEndTime(endTime);
|
//requisitionEntity.setEndTime(endTime);
|
||||||
}else {
|
} else {
|
||||||
requisitionEntity.setId(taskId);
|
requisitionEntity.setId(taskId);
|
||||||
}
|
}
|
||||||
List<RequisitionEntity> requisitionList = requisitionService.queryList(requisitionEntity);
|
List<RequisitionEntity> requisitionList = requisitionService.queryList(requisitionEntity);
|
||||||
if (CollectionUtils.isNotEmpty(requisitionList)){
|
if (CollectionUtils.isNotEmpty(requisitionList)) {
|
||||||
for (RequisitionEntity requisition : requisitionList) {
|
//1、获取token
|
||||||
//查询u9c请购单明细
|
|
||||||
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
|
for (RequisitionEntity requisition : requisitionList) {
|
||||||
requisitionDetail.setPr(requisition.getId());
|
//查询u9c请购单明细
|
||||||
requisitionDetail.setDataSourceCode(datasourceCode);
|
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
|
||||||
List<RequisitionDetailEntity> requisitionDetailList = requisitionDetailServiceImpl.queryDetails(requisitionDetail);
|
requisitionDetail.setPr(requisition.getId());
|
||||||
if (CollectionUtils.isNotEmpty(requisitionDetailList)){
|
requisitionDetail.setDataSourceCode(datasourceCode);
|
||||||
//主表
|
List<RequisitionDetailEntity> requisitionDetailList = requisitionDetailServiceImpl.queryDetails(requisitionDetail);
|
||||||
JSONObject formmain_0652 = new JSONObject();
|
if (CollectionUtils.isNotEmpty(requisitionDetailList)) {
|
||||||
//单据类型
|
//主表
|
||||||
formmain_0652.put("field0001",requisition.getpRDocTypeName());
|
JSONObject formmain_0652 = new JSONObject();
|
||||||
//发起人
|
//单据类型
|
||||||
formmain_0652.put("field0002","");
|
formmain_0652.put("field0001", requisition.getpRDocTypeName());
|
||||||
//发起部门
|
//需求人员
|
||||||
formmain_0652.put("field0003","");
|
formmain_0652.put("field0005", requisition.getReqEmployeeName());
|
||||||
//发起时间
|
//单号
|
||||||
formmain_0652.put("field0004",DateUtil.now());
|
formmain_0652.put("field0007", requisition.getDocNo());
|
||||||
//需求人员
|
//需求部门
|
||||||
formmain_0652.put("field0005",requisition.getReqEmployeeName());
|
formmain_0652.put("field0008", requisition.getReqDepartmentName());
|
||||||
//来源类型
|
//日期
|
||||||
formmain_0652.put("field0006",requisition.getSourceTypeName());
|
formmain_0652.put("field0010", requisition.getBusinessDate());
|
||||||
//单号
|
//厂区
|
||||||
formmain_0652.put("field0007",requisition.getDocNo());
|
formmain_0652.put("field0012", requisitionDetailList.get(0).getFactoryName());
|
||||||
//需求部门
|
//状态
|
||||||
formmain_0652.put("field0008",requisition.getReqDepartmentName());
|
formmain_0652.put("field0013", requisition.getStatusName());
|
||||||
//来源单号
|
String res = null;
|
||||||
formmain_0652.put("field0009",requisitionDetailList.get(0).getSrcDocNo());
|
Boolean flag = false;
|
||||||
//日期
|
JSONObject token = getToken(requisition.getSendPhone(), "800045", "8000450000");
|
||||||
formmain_0652.put("field0010",requisition.getBusinessDate());
|
//3、根据code,再次获取token
|
||||||
//项目
|
if (token.getBoolean("flag")) {
|
||||||
formmain_0652.put("field0011",requisitionDetailList.get(0).getProjectName());
|
//发起人
|
||||||
//厂区
|
formmain_0652.put("field0002", token.getString("name"));
|
||||||
formmain_0652.put("field0012",requisitionDetailList.get(0).getFactoryName());
|
//发起部门
|
||||||
//状态
|
formmain_0652.put("field0003", token.getString("bm"));
|
||||||
formmain_0652.put("field0013",requisition.getStatusName());
|
//发起时间
|
||||||
//请购数量合计
|
formmain_0652.put("field0004", DateUtil.now());
|
||||||
formmain_0652.put("field0030","");
|
//来源类型 不要
|
||||||
//子表
|
//formmain_0652.put("field0006",requisition.getSourceTypeName());
|
||||||
List<JSONObject> formsonList = new LinkedList<>();
|
//来源单号 不要
|
||||||
for (RequisitionDetailEntity detail : requisitionDetailList) {
|
//formmain_0652.put("field0009",requisitionDetailList.get(0).getSrcDocNo());
|
||||||
JSONObject formson_0653 = new JSONObject();
|
////项目 不要
|
||||||
//行号
|
//formmain_0652.put("field0011",requisitionDetailList.get(0).getProjectName());
|
||||||
formson_0653.put("field0014",detail.getDocLineNo());
|
//请购数量合计 不要
|
||||||
//需求分类
|
//formmain_0652.put("field0030","");
|
||||||
formson_0653.put("field0015",detail.getDemandCode());
|
//子表
|
||||||
//厂区明细
|
List<JSONObject> formsonList = new LinkedList<>();
|
||||||
formson_0653.put("field0016",detail.getFactoryName());
|
for (RequisitionDetailEntity detail : requisitionDetailList) {
|
||||||
//项目明细
|
JSONObject formson_0653 = new JSONObject();
|
||||||
formson_0653.put("field0017",detail.getProjectName());
|
//行号
|
||||||
//料号
|
formson_0653.put("field0014", detail.getDocLineNo());
|
||||||
formson_0653.put("field0018",detail.getMaterialCode());
|
//需求分类
|
||||||
//品名
|
formson_0653.put("field0015", detail.getDemandCode());
|
||||||
formson_0653.put("field0021",detail.getMaterialName());
|
//厂区明细
|
||||||
//规格
|
formson_0653.put("field0016", detail.getFactoryName());
|
||||||
formson_0653.put("field0022",detail.getSpecs());
|
//项目明细
|
||||||
//请购数量
|
formson_0653.put("field0017", detail.getProjectName());
|
||||||
formson_0653.put("field0023",detail.getReqQtyTU());
|
//料号
|
||||||
//单位
|
formson_0653.put("field0018", detail.getMaterialCode());
|
||||||
formson_0653.put("field0024",detail.getStoreUOM());
|
//品名
|
||||||
//单据备注
|
formson_0653.put("field0021", detail.getMaterialName());
|
||||||
formson_0653.put("field0025",detail.getMemo());
|
//规格
|
||||||
//需求交货日期
|
formson_0653.put("field0022", detail.getSpecs());
|
||||||
formson_0653.put("field0026",detail.getRequiredDeliveryDate());
|
//请购数量
|
||||||
//来源单号明细
|
formson_0653.put("field0023", detail.getReqQtyTU());
|
||||||
formson_0653.put("field0027",detail.getSrcDocNo());
|
//单位
|
||||||
//库存可用量
|
formson_0653.put("field0024", detail.getStoreUOM());
|
||||||
formson_0653.put("field0028",detail.getpRInvQty());
|
//单据备注
|
||||||
//状态明细
|
formson_0653.put("field0025", detail.getMemo());
|
||||||
formson_0653.put("field0029",detail.getStatus());
|
////需求交货日期
|
||||||
formsonList.add(formson_0653);
|
//formson_0653.put("field0026", detail.getRequiredDeliveryDate());
|
||||||
}
|
////来源单号明细
|
||||||
JSONObject formData = new JSONObject();
|
//formson_0653.put("field0027", detail.getSrcDocNo());
|
||||||
formData.put("formmain_0673",formmain_0652);
|
////库存可用量
|
||||||
formData.put("formson_0674",formsonList);
|
//formson_0653.put("field0028", detail.getpRInvQty());
|
||||||
JSONObject data = new JSONObject();
|
//状态明细
|
||||||
data.put("templateCode","formmain_0673");
|
formson_0653.put("field0029", detail.getStatus());
|
||||||
data.put("draft","0");
|
formsonList.add(formson_0653);
|
||||||
data.put("data",formData);
|
}
|
||||||
JSONObject param = new JSONObject();
|
JSONObject formData = new JSONObject();
|
||||||
param.put("appName","collaboration");
|
formData.put("formmain_0673", formmain_0652);
|
||||||
param.put("data",data);
|
formData.put("formson_0674", formsonList);
|
||||||
String paramStr = param.toString();
|
JSONObject data = new JSONObject();
|
||||||
logger.info("u9c请购单发起OA流程请求参数:{}",paramStr);
|
data.put("templateCode", "formmain_0673");
|
||||||
String res = null;
|
data.put("draft", "0");
|
||||||
Boolean flag = false;
|
data.put("data", formData);
|
||||||
try {
|
JSONObject param = new JSONObject();
|
||||||
//1、获取token
|
param.put("appName", "collaboration");
|
||||||
JSONObject nouserToken = getToken(null, "800045", "8000450000");
|
param.put("data", data);
|
||||||
if(nouserToken.getBoolean("flag")){
|
String paramStr = param.toString();
|
||||||
//2、根据电话获取code
|
logger.info("u9c请购单发起OA流程请求参数:{}", paramStr);
|
||||||
JSONObject usercode = getUsercode(nouserToken.getString("token"),requisition.getUserPhone(), "800045", "8000450005");
|
try {
|
||||||
if(usercode.getBoolean("flag")){
|
|
||||||
//3、根据code,再次获取token
|
//3、根据code,再次获取token
|
||||||
JSONObject token = getToken(usercode.getString("code"), "800045", "8000450000");
|
if (token.getBoolean("flag")) {
|
||||||
if(token.getBoolean("flag")){
|
res = invokeEsb(param, "800045", "8000450002", token.getString("token"));
|
||||||
res = invokeEsb(param, "800045", "8000450002",token.getString("token"));
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||||
flag = jsonObject.getBoolean("flag");
|
flag = jsonObject.getBoolean("flag");
|
||||||
}else {
|
} else {
|
||||||
res = token.getString("msg");
|
res = token.getString("msg");
|
||||||
}
|
}
|
||||||
}else {
|
} catch (Exception e) {
|
||||||
res = usercode.getString("msg");
|
logger.error("调用oa接口出错:{}", e);
|
||||||
|
res = e.getMessage();
|
||||||
}
|
}
|
||||||
}else {
|
//保存日志
|
||||||
res = nouserToken.getString("msg");
|
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
taskLivingDetail.setCreate_time(new Date());
|
||||||
|
taskLivingDetail.setModify_time(new Date());
|
||||||
|
taskLivingDetail.setRootAppPk(requisition.getId());
|
||||||
|
taskLivingDetail.setRootAppBill(requisition.getDocNo());
|
||||||
|
taskLivingDetail.setPluginId("U9CRequisitionPlugin");
|
||||||
|
taskLivingDetail.setRootAppNewData(paramStr);
|
||||||
|
taskLivingDetail.setNewTransmitInfo(res);
|
||||||
|
taskLivingDetail.setNewPushDate(new Date());
|
||||||
|
saveLog(taskId, flag, taskLivingDetail);
|
||||||
|
logger.info("u9c请购单发起OA流程返回结果:{}", res);
|
||||||
|
// 发送完成修改主表状态 已完成或发送失败 flag判断
|
||||||
|
} else {
|
||||||
|
res = token.getString("msg");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
if (flag) {
|
||||||
logger.error("调用oa接口出错:{}",e);
|
RequisitionEntity updateRequisition = new RequisitionEntity();
|
||||||
res = e.getMessage();
|
updateRequisition.setDataSourceCode(datasourceCode);
|
||||||
}
|
updateRequisition.setId(requisition.getId());
|
||||||
//保存日志
|
updateRequisition.setDataStatus("1");
|
||||||
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
|
updateRequisition.setDataMsg("成功");
|
||||||
taskLivingDetail.setCreate_time(new Date());
|
requisitionService.updateStatus(updateRequisition);
|
||||||
taskLivingDetail.setModify_time(new Date());
|
} else {
|
||||||
taskLivingDetail.setRootAppPk(requisition.getId());
|
RequisitionEntity updateRequisition = new RequisitionEntity();
|
||||||
taskLivingDetail.setRootAppBill(requisition.getDocNo());
|
updateRequisition.setDataSourceCode(datasourceCode);
|
||||||
taskLivingDetail.setPluginId("U9CRequisitionPlugin");
|
updateRequisition.setId(requisition.getId());
|
||||||
taskLivingDetail.setRootAppNewData(paramStr);
|
updateRequisition.setDataStatus("2");
|
||||||
taskLivingDetail.setNewTransmitInfo(res);
|
updateRequisition.setDataMsg("失败:" + res);
|
||||||
taskLivingDetail.setNewPushDate(new Date());
|
requisitionService.updateStatus(updateRequisition);
|
||||||
saveLog(taskId,flag,taskLivingDetail);
|
}
|
||||||
logger.info("u9c请购单发起OA流程返回结果:{}",res);
|
} else {
|
||||||
// 发送完成修改主表状态 已完成或发送失败 flag判断
|
// 没有明细不发送,修改数据状态,已完成,没有明细不发送
|
||||||
if(flag){
|
|
||||||
RequisitionEntity updateRequisition = new RequisitionEntity();
|
RequisitionEntity updateRequisition = new RequisitionEntity();
|
||||||
updateRequisition.setDataSourceCode(datasourceCode);
|
updateRequisition.setDataSourceCode(datasourceCode);
|
||||||
updateRequisition.setId(requisition.getId());
|
updateRequisition.setId(requisition.getId());
|
||||||
updateRequisition.setDataStatus("1");
|
updateRequisition.setDataStatus("1");
|
||||||
updateRequisition.setDataMsg("成功");
|
updateRequisition.setDataMsg("成功,没有明细不发送");
|
||||||
requisitionService.updateStatus(updateRequisition);
|
|
||||||
}else {
|
|
||||||
RequisitionEntity updateRequisition = new RequisitionEntity();
|
|
||||||
updateRequisition.setDataSourceCode(datasourceCode);
|
|
||||||
updateRequisition.setId(requisition.getId());
|
|
||||||
updateRequisition.setDataStatus("2");
|
|
||||||
updateRequisition.setDataMsg("失败:"+res);
|
|
||||||
requisitionService.updateStatus(updateRequisition);
|
requisitionService.updateStatus(updateRequisition);
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
// 没有明细不发送,修改数据状态,已完成,没有明细不发送
|
|
||||||
RequisitionEntity updateRequisition = new RequisitionEntity();
|
|
||||||
updateRequisition.setDataSourceCode(datasourceCode);
|
|
||||||
updateRequisition.setId(requisition.getId());
|
|
||||||
updateRequisition.setDataStatus("1");
|
|
||||||
updateRequisition.setDataMsg("成功,没有明细不发送");
|
|
||||||
requisitionService.updateStatus(updateRequisition);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("德广信U9C请购单推送OA插件执行成功");
|
return BaseResult.getSuccessMessageEntity("德广信U9C请购单推送OA插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject getUsercode(String token, String phone, String appId,String apiCode) {
|
private JSONObject getUsercode(String token, String phone, String appId, String apiCode) {
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("phone",phone);
|
param.put("phone", phone);
|
||||||
param.put("token",token);
|
param.put("token", token);
|
||||||
|
|
||||||
JSONObject returnData = new JSONObject();
|
JSONObject returnData = new JSONObject();
|
||||||
|
|
||||||
String res = null;
|
String res = null;
|
||||||
String code = null;
|
String code = null;
|
||||||
|
String bm = null;
|
||||||
|
String name = null;
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res = invokeEsb(param, appId, apiCode,null);
|
res = invokeEsb(param, appId, apiCode, null);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||||
flag = jsonObject.getBoolean("flag");
|
flag = jsonObject.getBoolean("flag");
|
||||||
if(flag){
|
if (flag) {
|
||||||
code = jsonObject.getJSONObject("attribute").getString("loginName");
|
code = jsonObject.getJSONObject("attribute").getString("loginName");
|
||||||
|
bm = jsonObject.getJSONObject("attribute").getString("orgDepartmentName");
|
||||||
|
name = jsonObject.getJSONObject("attribute").getString("name");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
logger.error("调用oa接口出错:{}",e);
|
logger.error("调用oa接口出错:{}", e);
|
||||||
res = e.getMessage();
|
res = e.getMessage();
|
||||||
}
|
}
|
||||||
if(flag){
|
if (flag) {
|
||||||
returnData.put("flag","true");
|
returnData.put("flag", "true");
|
||||||
returnData.put("code",code);
|
returnData.put("code", code);
|
||||||
}else {
|
returnData.put("bm", bm);
|
||||||
returnData.put("flag","false");
|
returnData.put("name", name);
|
||||||
returnData.put("msg",res);
|
} else {
|
||||||
|
returnData.put("flag", "false");
|
||||||
|
returnData.put("msg", res);
|
||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author lvleigang
|
|
||||||
* @Description 获取token
|
|
||||||
* @Date 11:53 上午 2024/10/28
|
|
||||||
* @param code
|
* @param code
|
||||||
* @param appId
|
* @param appId
|
||||||
* @param apiCode
|
* @param apiCode
|
||||||
* @return com.alibaba.fastjson.JSONObject
|
* @return com.alibaba.fastjson.JSONObject
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 获取token
|
||||||
|
* @Date 11:53 上午 2024/10/28
|
||||||
**/
|
**/
|
||||||
private JSONObject getToken(String code,String appId,String apiCode) {
|
private JSONObject getToken(String code, String appId, String apiCode) {
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("userName","hzyaRest");
|
param.put("userName", "hzyaRest");
|
||||||
param.put("password","3ca9a8d7-43df-4101-8de2-8bb113cb9145");
|
param.put("password", "3ca9a8d7-43df-4101-8de2-8bb113cb9145");
|
||||||
if(code != null){
|
if (code != null) {
|
||||||
param.put("loginName",code);
|
param.put("loginName", code);
|
||||||
}
|
}
|
||||||
JSONObject returnData = new JSONObject();
|
JSONObject returnData = new JSONObject();
|
||||||
|
|
||||||
String res = null;
|
String res = null;
|
||||||
String token = null;
|
String token = null;
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
|
String bm = null;
|
||||||
|
String name = null;
|
||||||
try {
|
try {
|
||||||
res = invokeEsb(param, appId, apiCode,null);
|
res = invokeEsb(param, appId, apiCode, null);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||||
flag = jsonObject.getBoolean("flag");
|
flag = jsonObject.getBoolean("flag");
|
||||||
if(flag){
|
if (flag) {
|
||||||
token = jsonObject.getJSONObject("attribute").getString("id");
|
token = jsonObject.getJSONObject("attribute").getString("id");
|
||||||
|
bm = jsonObject.getJSONObject("attribute").getJSONObject("bindingUser").getString("orgDepartmentName");
|
||||||
|
name = jsonObject.getJSONObject("attribute").getJSONObject("bindingUser").getString("name");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
logger.error("调用oa接口出错:{}",e);
|
logger.error("调用oa接口出错:{}", e);
|
||||||
res = e.getMessage();
|
res = e.getMessage();
|
||||||
}
|
}
|
||||||
if(flag){
|
if (flag) {
|
||||||
returnData.put("flag","true");
|
returnData.put("flag", "true");
|
||||||
returnData.put("token",token);
|
returnData.put("token", token);
|
||||||
}else {
|
returnData.put("bm", bm);
|
||||||
returnData.put("flag","false");
|
returnData.put("name", name);
|
||||||
returnData.put("msg",res);
|
} else {
|
||||||
|
returnData.put("flag", "false");
|
||||||
|
returnData.put("msg", res);
|
||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
@ -588,56 +598,56 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail) {
|
public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail) {
|
||||||
try {
|
try {
|
||||||
//判断,成功调用这个方法
|
//判断,成功调用这个方法
|
||||||
if (StrUtil.isEmpty(integration_task_living_details_id)){
|
if (StrUtil.isEmpty(integration_task_living_details_id)) {
|
||||||
if (flag){
|
if (flag) {
|
||||||
taskLivingDetailsService.saveLogToSuccess(taskLivingDetail);
|
taskLivingDetailsService.saveLogToSuccess(taskLivingDetail);
|
||||||
}else {
|
} else {
|
||||||
//失败 调用这个方法
|
//失败 调用这个方法
|
||||||
taskLivingDetailsService.saveLogToFail(taskLivingDetail);
|
taskLivingDetailsService.saveLogToFail(taskLivingDetail);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
taskLivingDetail.setId(integration_task_living_details_id);
|
taskLivingDetail.setId(integration_task_living_details_id);
|
||||||
if (flag){
|
if (flag) {
|
||||||
//如果是重试 成功调这个方法
|
//如果是重试 成功调这个方法
|
||||||
taskLivingDetailsService.saveLogFailToSuccess(taskLivingDetail);
|
taskLivingDetailsService.saveLogFailToSuccess(taskLivingDetail);
|
||||||
}else {
|
} else {
|
||||||
//如果是重试 失败调这个方法
|
//如果是重试 失败调这个方法
|
||||||
taskLivingDetailsService.updateLogFailToSuccess(taskLivingDetail);
|
taskLivingDetailsService.updateLogFailToSuccess(taskLivingDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
logger.error("保存日志出错:{}",e);
|
logger.error("保存日志出错:{}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用注册好的esb接口
|
//调用注册好的esb接口
|
||||||
private String invokeEsb(JSONObject jsonObject,String appId,String apiCode,String token){
|
private String invokeEsb(JSONObject jsonObject, String appId, String apiCode, String token) {
|
||||||
String param = jsonObject.toString();
|
String param = jsonObject.toString();
|
||||||
logger.info("调用:{},请求参数:{}",apiCode,param);
|
logger.info("调用:{},请求参数:{}", apiCode, param);
|
||||||
String result = null;
|
String result = null;
|
||||||
if(token != null){
|
if (token != null) {
|
||||||
result = HttpRequest.post(url)
|
result = HttpRequest.post(url)
|
||||||
.header("token",token)//token
|
.header("token", token)//token
|
||||||
.header("appId",appId)//目标应用
|
.header("appId", appId)//目标应用
|
||||||
.header("apiCode",apiCode)//目标api
|
.header("apiCode", apiCode)//目标api
|
||||||
.header("publicKey","ZJYAh1QkjBK/pIrl8+vYvw190Jg/Oh84xuvDYe8sPbEtO65Ce7eDIk+3zDUT+v578prj")//调用方key
|
.header("publicKey", "ZJYAh1QkjBK/pIrl8+vYvw190Jg/Oh84xuvDYe8sPbEtO65Ce7eDIk+3zDUT+v578prj")//调用方key
|
||||||
.header("secretKey","oS2ELoTO92eVwuu0wsFvvHivg3rt8iyJqZTNDxa3iiZHzw7KU9LjmJqJDi2kQNo5j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//调用方密钥
|
.header("secretKey", "oS2ELoTO92eVwuu0wsFvvHivg3rt8iyJqZTNDxa3iiZHzw7KU9LjmJqJDi2kQNo5j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//调用方密钥
|
||||||
.body(param)
|
.body(param)
|
||||||
.timeout(30000)
|
.timeout(30000)
|
||||||
.execute()
|
.execute()
|
||||||
.body();
|
.body();
|
||||||
}else {
|
} else {
|
||||||
result = HttpRequest.post(url)
|
result = HttpRequest.post(url)
|
||||||
.header("appId",appId)//目标应用
|
.header("appId", appId)//目标应用
|
||||||
.header("apiCode",apiCode)//目标api
|
.header("apiCode", apiCode)//目标api
|
||||||
.header("publicKey","ZJYAh1QkjBK/pIrl8+vYvw190Jg/Oh84xuvDYe8sPbEtO65Ce7eDIk+3zDUT+v578prj")//调用方key
|
.header("publicKey", "ZJYAh1QkjBK/pIrl8+vYvw190Jg/Oh84xuvDYe8sPbEtO65Ce7eDIk+3zDUT+v578prj")//调用方key
|
||||||
.header("secretKey","oS2ELoTO92eVwuu0wsFvvHivg3rt8iyJqZTNDxa3iiZHzw7KU9LjmJqJDi2kQNo5j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//调用方密钥
|
.header("secretKey", "oS2ELoTO92eVwuu0wsFvvHivg3rt8iyJqZTNDxa3iiZHzw7KU9LjmJqJDi2kQNo5j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//调用方密钥
|
||||||
.body(param)
|
.body(param)
|
||||||
.timeout(30000)
|
.timeout(30000)
|
||||||
.execute()
|
.execute()
|
||||||
.body();
|
.body();
|
||||||
}
|
}
|
||||||
logger.info("调用:{},返回参数:{}",apiCode,result);
|
logger.info("调用:{},返回参数:{}", apiCode, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +656,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
public SysExtensionApiEntity setQueryUrl(SysExtensionApiEntity sysExtensionApiEntity) {
|
public SysExtensionApiEntity setQueryUrl(SysExtensionApiEntity sysExtensionApiEntity) {
|
||||||
String bodys = sysExtensionApiEntity.getBodys();
|
String bodys = sysExtensionApiEntity.getBodys();
|
||||||
JSONObject jsonObject = JSON.parseObject(bodys);
|
JSONObject jsonObject = JSON.parseObject(bodys);
|
||||||
String url = jsonObject.getString("phone")+"?token="+jsonObject.getString("token");
|
String url = jsonObject.getString("phone") + "?token=" + jsonObject.getString("token");
|
||||||
sysExtensionApiEntity.setAddQuerys(url);
|
sysExtensionApiEntity.setAddQuerys(url);
|
||||||
return sysExtensionApiEntity;
|
return sysExtensionApiEntity;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue