分组类型查询单据
This commit is contained in:
parent
5209d7cfd5
commit
537b70f510
|
@ -108,22 +108,22 @@
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">
|
|
||||||
update v_hzya_u9c_pr_pr set
|
|
||||||
<trim suffix="" suffixOverrides=",">
|
|
||||||
<if test="dataStatus != null and dataStatus != ''"> dataStatus = #{dataStatus},</if>
|
|
||||||
<if test="dataMsg != null and dataMsg != ''"> dataMsg = #{dataMsg},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</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 v_hzya_u9c_pr_pr set-->
|
||||||
<!-- <trim suffix="" suffixOverrides=",">-->
|
<!-- <trim suffix="" suffixOverrides=",">-->
|
||||||
<!-- <if test="dataStatus != null and dataStatus != ''"> DescFlexField_PrivateDescSeg2 = #{dataStatus},</if>-->
|
<!-- <if test="dataStatus != null and dataStatus != ''"> dataStatus = #{dataStatus},</if>-->
|
||||||
<!-- <if test="dataMsg != null and dataMsg != ''"> DescFlexField_PrivateDescSeg1 = #{dataMsg},</if>-->
|
<!-- <if test="dataMsg != null and dataMsg != ''"> dataMsg = #{dataMsg},</if>-->
|
||||||
<!-- </trim>-->
|
<!-- </trim>-->
|
||||||
<!-- where id = #{id}-->
|
<!-- where id = #{id}-->
|
||||||
<!-- </update>-->
|
<!-- </update>-->
|
||||||
|
|
||||||
|
<update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">
|
||||||
|
update PR_PR set
|
||||||
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
<if test="dataStatus != null and dataStatus != ''"> DescFlexField_PrivateDescSeg2 = #{dataStatus},</if>
|
||||||
|
<if test="dataMsg != null and dataMsg != ''"> DescFlexField_PrivateDescSeg1 = #{dataMsg},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -256,14 +256,14 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
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(prepayment.getUserPhone(), "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);
|
||||||
|
@ -271,12 +271,12 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
} 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();
|
||||||
|
@ -353,148 +353,144 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
if (CollectionUtils.isNotEmpty(requisitionList)) {
|
if (CollectionUtils.isNotEmpty(requisitionList)) {
|
||||||
//1、获取token
|
//1、获取token
|
||||||
|
|
||||||
for (RequisitionEntity requisition : requisitionList) {
|
for (RequisitionEntity requisition : requisitionList) {
|
||||||
//查询u9c请购单明细
|
//查询u9c请购单明细
|
||||||
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
|
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
|
||||||
requisitionDetail.setPr(requisition.getId());
|
requisitionDetail.setPr(requisition.getId());
|
||||||
requisitionDetail.setDataSourceCode(datasourceCode);
|
requisitionDetail.setDataSourceCode(datasourceCode);
|
||||||
List<RequisitionDetailEntity> requisitionDetailList = requisitionDetailServiceImpl.queryDetails(requisitionDetail);
|
List<RequisitionDetailEntity> requisitionDetailList = requisitionDetailServiceImpl.queryDetails(requisitionDetail);
|
||||||
if (CollectionUtils.isNotEmpty(requisitionDetailList)) {
|
if (CollectionUtils.isNotEmpty(requisitionDetailList)) {
|
||||||
//主表
|
//主表
|
||||||
JSONObject formmain_0652 = new JSONObject();
|
JSONObject formmain_0652 = new JSONObject();
|
||||||
//单据类型
|
//单据类型
|
||||||
formmain_0652.put("field0001", requisition.getpRDocTypeName());
|
formmain_0652.put("field0001", requisition.getpRDocTypeName());
|
||||||
//需求人员
|
//需求人员
|
||||||
formmain_0652.put("field0005", requisition.getReqEmployeeName());
|
formmain_0652.put("field0005", requisition.getReqEmployeeName());
|
||||||
//单号
|
//单号
|
||||||
formmain_0652.put("field0007", requisition.getDocNo());
|
formmain_0652.put("field0007", requisition.getDocNo());
|
||||||
//需求部门
|
//需求部门
|
||||||
formmain_0652.put("field0008", requisition.getReqDepartmentName());
|
formmain_0652.put("field0008", requisition.getReqDepartmentName());
|
||||||
//日期
|
//日期
|
||||||
formmain_0652.put("field0010", requisition.getBusinessDate());
|
formmain_0652.put("field0010", requisition.getBusinessDate());
|
||||||
//厂区
|
//厂区
|
||||||
formmain_0652.put("field0012", requisitionDetailList.get(0).getFactoryName());
|
formmain_0652.put("field0012", requisitionDetailList.get(0).getFactoryName());
|
||||||
//状态
|
//状态
|
||||||
formmain_0652.put("field0013", requisition.getStatusName());
|
formmain_0652.put("field0013", requisition.getStatusName());
|
||||||
String res = null;
|
|
||||||
Boolean flag = false;
|
//发起人
|
||||||
|
//formmain_0652.put("field0002", token.getString("name"));
|
||||||
|
//发起部门
|
||||||
|
//formmain_0652.put("field0003", token.getString("bm"));
|
||||||
|
//发起时间
|
||||||
|
formmain_0652.put("field0004", DateUtil.now());
|
||||||
|
//来源类型 不要
|
||||||
|
//formmain_0652.put("field0006",requisition.getSourceTypeName());
|
||||||
|
//来源单号 不要
|
||||||
|
//formmain_0652.put("field0009",requisitionDetailList.get(0).getSrcDocNo());
|
||||||
|
////项目 不要
|
||||||
|
//formmain_0652.put("field0011",requisitionDetailList.get(0).getProjectName());
|
||||||
|
//请购数量合计 不要
|
||||||
|
//formmain_0652.put("field0030","");
|
||||||
|
//子表
|
||||||
|
List<JSONObject> formsonList = new LinkedList<>();
|
||||||
|
for (RequisitionDetailEntity detail : requisitionDetailList) {
|
||||||
|
JSONObject formson_0653 = new JSONObject();
|
||||||
|
//行号
|
||||||
|
formson_0653.put("field0014", detail.getDocLineNo());
|
||||||
|
//需求分类
|
||||||
|
formson_0653.put("field0015", detail.getDemandCode());
|
||||||
|
//厂区明细
|
||||||
|
formson_0653.put("field0016", detail.getFactoryName());
|
||||||
|
//项目明细
|
||||||
|
formson_0653.put("field0017", detail.getProjectName());
|
||||||
|
//料号
|
||||||
|
formson_0653.put("field0018", detail.getMaterialCode());
|
||||||
|
//品名
|
||||||
|
formson_0653.put("field0021", detail.getMaterialName());
|
||||||
|
//规格
|
||||||
|
formson_0653.put("field0022", detail.getSpecs());
|
||||||
|
//请购数量
|
||||||
|
formson_0653.put("field0023", detail.getReqQtyTU());
|
||||||
|
//单位
|
||||||
|
formson_0653.put("field0024", detail.getStoreUOM());
|
||||||
|
//单据备注
|
||||||
|
formson_0653.put("field0025", detail.getMemo());
|
||||||
|
////需求交货日期
|
||||||
|
//formson_0653.put("field0026", detail.getRequiredDeliveryDate());
|
||||||
|
////来源单号明细
|
||||||
|
//formson_0653.put("field0027", detail.getSrcDocNo());
|
||||||
|
////库存可用量
|
||||||
|
//formson_0653.put("field0028", detail.getpRInvQty());
|
||||||
|
//状态明细
|
||||||
|
formson_0653.put("field0029", detail.getStatus());
|
||||||
|
formsonList.add(formson_0653);
|
||||||
|
}
|
||||||
|
JSONObject formData = new JSONObject();
|
||||||
|
formData.put("formmain_0673", formmain_0652);
|
||||||
|
formData.put("formson_0674", formsonList);
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.put("templateCode", "formmain_0673");
|
||||||
|
data.put("draft", "0");
|
||||||
|
data.put("data", formData);
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("appName", "collaboration");
|
||||||
|
param.put("data", data);
|
||||||
|
String paramStr = param.toString();
|
||||||
|
logger.info("u9c请购单发起OA流程请求参数:{}", paramStr);
|
||||||
|
String res = null;
|
||||||
|
Boolean flag = false;
|
||||||
|
try {
|
||||||
JSONObject token = getToken(requisition.getSendPhone(), "800045", "8000450000");
|
JSONObject token = getToken(requisition.getSendPhone(), "800045", "8000450000");
|
||||||
//3、根据code,再次获取token
|
//3、根据code,再次获取token
|
||||||
if (token.getBoolean("flag")) {
|
if (token.getBoolean("flag")) {
|
||||||
//发起人
|
res = invokeEsb(param, "800045", "8000450002", token.getString("token"));
|
||||||
formmain_0652.put("field0002", token.getString("name"));
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||||
//发起部门
|
flag = jsonObject.getBoolean("flag");
|
||||||
formmain_0652.put("field0003", token.getString("bm"));
|
|
||||||
//发起时间
|
|
||||||
formmain_0652.put("field0004", DateUtil.now());
|
|
||||||
//来源类型 不要
|
|
||||||
//formmain_0652.put("field0006",requisition.getSourceTypeName());
|
|
||||||
//来源单号 不要
|
|
||||||
//formmain_0652.put("field0009",requisitionDetailList.get(0).getSrcDocNo());
|
|
||||||
////项目 不要
|
|
||||||
//formmain_0652.put("field0011",requisitionDetailList.get(0).getProjectName());
|
|
||||||
//请购数量合计 不要
|
|
||||||
//formmain_0652.put("field0030","");
|
|
||||||
//子表
|
|
||||||
List<JSONObject> formsonList = new LinkedList<>();
|
|
||||||
for (RequisitionDetailEntity detail : requisitionDetailList) {
|
|
||||||
JSONObject formson_0653 = new JSONObject();
|
|
||||||
//行号
|
|
||||||
formson_0653.put("field0014", detail.getDocLineNo());
|
|
||||||
//需求分类
|
|
||||||
formson_0653.put("field0015", detail.getDemandCode());
|
|
||||||
//厂区明细
|
|
||||||
formson_0653.put("field0016", detail.getFactoryName());
|
|
||||||
//项目明细
|
|
||||||
formson_0653.put("field0017", detail.getProjectName());
|
|
||||||
//料号
|
|
||||||
formson_0653.put("field0018", detail.getMaterialCode());
|
|
||||||
//品名
|
|
||||||
formson_0653.put("field0021", detail.getMaterialName());
|
|
||||||
//规格
|
|
||||||
formson_0653.put("field0022", detail.getSpecs());
|
|
||||||
//请购数量
|
|
||||||
formson_0653.put("field0023", detail.getReqQtyTU());
|
|
||||||
//单位
|
|
||||||
formson_0653.put("field0024", detail.getStoreUOM());
|
|
||||||
//单据备注
|
|
||||||
formson_0653.put("field0025", detail.getMemo());
|
|
||||||
////需求交货日期
|
|
||||||
//formson_0653.put("field0026", detail.getRequiredDeliveryDate());
|
|
||||||
////来源单号明细
|
|
||||||
//formson_0653.put("field0027", detail.getSrcDocNo());
|
|
||||||
////库存可用量
|
|
||||||
//formson_0653.put("field0028", detail.getpRInvQty());
|
|
||||||
//状态明细
|
|
||||||
formson_0653.put("field0029", detail.getStatus());
|
|
||||||
formsonList.add(formson_0653);
|
|
||||||
}
|
|
||||||
JSONObject formData = new JSONObject();
|
|
||||||
formData.put("formmain_0673", formmain_0652);
|
|
||||||
formData.put("formson_0674", formsonList);
|
|
||||||
JSONObject data = new JSONObject();
|
|
||||||
data.put("templateCode", "formmain_0673");
|
|
||||||
data.put("draft", "0");
|
|
||||||
data.put("data", formData);
|
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
param.put("appName", "collaboration");
|
|
||||||
param.put("data", data);
|
|
||||||
String paramStr = param.toString();
|
|
||||||
logger.info("u9c请购单发起OA流程请求参数:{}", paramStr);
|
|
||||||
try {
|
|
||||||
//3、根据code,再次获取token
|
|
||||||
if (token.getBoolean("flag")) {
|
|
||||||
res = invokeEsb(param, "800045", "8000450002", token.getString("token"));
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
||||||
flag = jsonObject.getBoolean("flag");
|
|
||||||
} else {
|
|
||||||
res = token.getString("msg");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("调用oa接口出错:{}", e);
|
|
||||||
res = e.getMessage();
|
|
||||||
}
|
|
||||||
//保存日志
|
|
||||||
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 {
|
} else {
|
||||||
res = token.getString("msg");
|
res = token.getString("msg");
|
||||||
}
|
}
|
||||||
if (flag) {
|
} catch (Exception e) {
|
||||||
RequisitionEntity updateRequisition = new RequisitionEntity();
|
logger.error("调用oa接口出错:{}", e);
|
||||||
updateRequisition.setDataSourceCode(datasourceCode);
|
res = e.getMessage();
|
||||||
updateRequisition.setId(requisition.getId());
|
}
|
||||||
updateRequisition.setDataStatus("1");
|
//保存日志
|
||||||
updateRequisition.setDataMsg("成功");
|
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
|
||||||
requisitionService.updateStatus(updateRequisition);
|
taskLivingDetail.setCreate_time(new Date());
|
||||||
} else {
|
taskLivingDetail.setModify_time(new Date());
|
||||||
RequisitionEntity updateRequisition = new RequisitionEntity();
|
taskLivingDetail.setRootAppPk(requisition.getId());
|
||||||
updateRequisition.setDataSourceCode(datasourceCode);
|
taskLivingDetail.setRootAppBill(requisition.getDocNo());
|
||||||
updateRequisition.setId(requisition.getId());
|
taskLivingDetail.setPluginId("U9CRequisitionPlugin");
|
||||||
updateRequisition.setDataStatus("2");
|
taskLivingDetail.setRootAppNewData(paramStr);
|
||||||
updateRequisition.setDataMsg("失败:" + res);
|
taskLivingDetail.setNewTransmitInfo(res);
|
||||||
requisitionService.updateStatus(updateRequisition);
|
taskLivingDetail.setNewPushDate(new Date());
|
||||||
}
|
saveLog(taskId, flag, taskLivingDetail);
|
||||||
} else {
|
logger.info("u9c请购单发起OA流程返回结果:{}", res);
|
||||||
// 没有明细不发送,修改数据状态,已完成,没有明细不发送
|
// 发送完成修改主表状态 已完成或发送失败 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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -560,7 +556,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
String res = null;
|
String res = null;
|
||||||
String token = null;
|
String token = null;
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
String bm = null;
|
//String bm = null;
|
||||||
String name = null;
|
String name = null;
|
||||||
try {
|
try {
|
||||||
res = invokeEsb(param, appId, apiCode, null);
|
res = invokeEsb(param, appId, apiCode, null);
|
||||||
|
@ -568,7 +564,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
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");
|
//bm = jsonObject.getJSONObject("attribute").getJSONObject("bindingUser").getString("orgDepartmentName");
|
||||||
name = jsonObject.getJSONObject("attribute").getJSONObject("bindingUser").getString("name");
|
name = jsonObject.getJSONObject("attribute").getJSONObject("bindingUser").getString("name");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -578,7 +574,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
returnData.put("flag", "true");
|
returnData.put("flag", "true");
|
||||||
returnData.put("token", token);
|
returnData.put("token", token);
|
||||||
returnData.put("bm", bm);
|
//returnData.put("bm", bm);
|
||||||
returnData.put("name", name);
|
returnData.put("name", name);
|
||||||
} else {
|
} else {
|
||||||
returnData.put("flag", "false");
|
returnData.put("flag", "false");
|
||||||
|
|
Loading…
Reference in New Issue