diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.java index f66602fc..c5f12f05 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.java @@ -65,7 +65,12 @@ public class PrepaymentEntity extends BaseEntity { private String createdOn; //修改时间 private String modifiedOn; - + //数据状态 1、成功 2、失败 + private String dataStatus; + //数据状态描述 + private String dataMsg; + //用户手机号 + private String userPhone; public String getStartTime() { return startTime; } @@ -256,4 +261,28 @@ public class PrepaymentEntity extends BaseEntity { public void setCurrencyName(String currencyName) { this.currencyName = currencyName; } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getDataMsg() { + return dataMsg; + } + + public void setDataMsg(String dataMsg) { + this.dataMsg = dataMsg; + } + + public String getUserPhone() { + return userPhone; + } + + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.xml index 9ff70061..faa53702 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.xml +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/PrepaymentEntity.xml @@ -26,6 +26,9 @@ <result property="currencyName" column="currencyName" jdbcType="VARCHAR"/> <result property="createdOn" column="createdOn" jdbcType="VARCHAR"/> <result property="modifiedOn" column="modifiedOn" jdbcType="VARCHAR"/> + <result property="userPhone" column="userPhone" jdbcType="VARCHAR"/> + <result property="dataMsg" column="dataMsg" jdbcType="VARCHAR"/> + <result property="dataStatus" column="dataStatus" jdbcType="VARCHAR"/> </resultMap> <!-- 查询的字段--> <sql id = "PrepaymentEntity_Base_Column_List"> @@ -51,7 +54,10 @@ currencyCode, currencyName, createdOn, - modifiedOn + modifiedOn, + dataStatus, + dataMsg, + userPhone </sql> <!-- 查询 采用==查询 --> <select id="entity_list_base" resultMap="get-PrepaymentEntity-result" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.PrepaymentEntity"> @@ -84,6 +90,7 @@ <if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if> <if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if> <if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if> + and dataStatus is null </trim> order by v_hzya_u9c_payreq.modifiedOn desc </select> @@ -114,16 +121,25 @@ <if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if> <if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if> <if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if> + and dataStatus is null </trim> </select> <update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.PrepaymentEntity"> - update AP_PayReqBillHead set + update v_hzya_u9c_payreq set <trim suffix="" suffixOverrides=","> - <if test="businessDate != null and businessDate != ''"> businessDate = #{businessDate},</if> - <if test="status != null"> status = #{status},</if> + <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.PrepaymentEntity">--> +<!-- update AP_PayReqBillHead 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>--> </mapper> diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.java index 8f74f07d..7a59630f 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.java @@ -53,6 +53,12 @@ public class RequisitionEntity extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") //结束时间 查询用 private String endTime; + //数据状态 1、成功 2、失败 + private String dataStatus; + //数据状态描述 + private String dataMsg; + //用户手机号 + private String userPhone; public String getStartTime() { return startTime; @@ -205,4 +211,28 @@ public class RequisitionEntity extends BaseEntity { public void setCreatedOn(String createdOn) { this.createdOn = createdOn; } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getDataMsg() { + return dataMsg; + } + + public void setDataMsg(String dataMsg) { + this.dataMsg = dataMsg; + } + + public String getUserPhone() { + return userPhone; + } + + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.xml index 3650719a..6502d31f 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.xml +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/entity/RequisitionEntity.xml @@ -21,6 +21,9 @@ <result property="statusName" column="statusName"/> <result property="modifiedOn" column="modifiedOn"/> <result property="createdOn" column="createdOn"/> + <result property="userPhone" column="userPhone"/> + <result property="dataMsg" column="dataMsg"/> + <result property="dataStatus" column="dataStatus"/> </resultMap> <!-- 查询的字段--> <sql id = "RequisitionEntity_Base_Column_List"> @@ -41,7 +44,10 @@ status, statusName, modifiedOn, - createdOn + createdOn, + dataStatus, + dataMsg, + userPhone </sql> <!-- 查询 采用==查询 --> <select id="entity_list_base" resultMap="get-RequisitionEntity-result" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity"> @@ -69,6 +75,7 @@ <if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if> <if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if> <if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if> + and dataStatus is null </trim> order by v_hzya_u9c_pr_pr.modifiedOn desc </select> @@ -95,16 +102,25 @@ <if test="statusName != null and statusName != ''"> and statusName = #{statusName} </if> <if test="modifiedOn != null and modifiedOn != ''"> and modifiedOn = #{modifiedOn} </if> <if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if> + and dataStatus is null </trim> </select> <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=","> - <if test="businessDate != null and businessDate != ''"> businessDate = #{businessDate},</if> - <if test="status != null"> status = #{status},</if> + <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 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>--> </mapper> diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java index 3ac1edff..f3d90a03 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java @@ -64,7 +64,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService { String taskId = requestJson.getString("integration_task_living_details_id"); //查询U9C预付单 PrepaymentEntity prepaymentEntity = new PrepaymentEntity(); - prepaymentEntity.setDocNo("RE-1563"); + //prepaymentEntity.setDocNo("RE-1563"); prepaymentEntity.setDataSourceCode(datasourceCode); if (StrUtil.isEmpty(taskId)){ //prepaymentEntity.setStartTime(startTime); @@ -255,13 +255,26 @@ public class U9CPluginServiceImpl implements IU9CPluginService { String res = null; Boolean flag = false; try { - JSONObject token = getToken("admin", "800045", "8000450000"); - if(token.getBoolean("flag")){ - res = invokeEsb(param, "800045", "8000450001",token.getString("token")); - JSONObject jsonObject = JSONObject.parseObject(res); - flag = jsonObject.getBoolean("flag"); + //1、获取token + JSONObject nouserToken = getToken(null, "800045", "8000450000"); + if(nouserToken.getBoolean("flag")){ + //2、根据电话获取code + JSONObject usercode = getUsercode(nouserToken.getString("token"),prepayment.getUserPhone(), "800045", "8000450005"); + if(usercode.getBoolean("flag")){ + //3、根据code,再次获取token + JSONObject token = getToken(usercode.getString("code"), "800045", "8000450000"); + if(token.getBoolean("flag")){ + res = invokeEsb(param, "800045", "8000450001",token.getString("token")); + JSONObject jsonObject = JSONObject.parseObject(res); + flag = jsonObject.getBoolean("flag"); + }else { + res = token.getString("msg"); + } + }else { + res = usercode.getString("msg"); + } }else { - res = token.getString("msg"); + res = nouserToken.getString("msg"); } }catch (Exception e){ logger.error("调用oa接口出错:{}",e); @@ -279,9 +292,30 @@ public class U9CPluginServiceImpl implements IU9CPluginService { taskLivingDetail.setNewPushDate(new Date()); saveLog(taskId,flag,taskLivingDetail); logger.info("u9c预付单发起OA流程返回结果:{}",res); - //todo 发送完成修改主表状态 已完成或发送失败 flag判断 + // 发送完成修改主表状态 已完成或发送失败 flag判断 + if(flag){ + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("成功"); + prepaymentService.updateStatus(updatePrepayment); + }else { + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("失败:"+res); + prepaymentService.updateStatus(updatePrepayment); + } }else { - //todo 没有明细不发送,修改数据状态,已完成,没有明细不发送 + // 没有明细不发送,修改数据状态,已完成,没有明细不发送 + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("成功,没有明细不发送"); + prepaymentService.updateStatus(updatePrepayment); } } } @@ -291,7 +325,6 @@ public class U9CPluginServiceImpl implements IU9CPluginService { /** * u9c请购单发起OA请购单流程 - * * @param requestJson * @return */ @@ -406,7 +439,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService { JSONObject nouserToken = getToken(null, "800045", "8000450000"); if(nouserToken.getBoolean("flag")){ //2、根据电话获取code - JSONObject usercode = getUsercode(nouserToken.getString("token"),"13924608800", "800045", "8000450005"); + JSONObject usercode = getUsercode(nouserToken.getString("token"),requisition.getUserPhone(), "800045", "8000450005"); if(usercode.getBoolean("flag")){ //3、根据code,再次获取token JSONObject token = getToken(usercode.getString("code"), "800045", "8000450000"); @@ -439,9 +472,30 @@ public class U9CPluginServiceImpl implements IU9CPluginService { taskLivingDetail.setNewPushDate(new Date()); saveLog(taskId,flag,taskLivingDetail); logger.info("u9c请购单发起OA流程返回结果:{}",res); - //todo 发送完成修改主表状态 已完成或发送失败 flag判断 + // 发送完成修改主表状态 已完成或发送失败 flag判断 + if(flag){ + RequisitionEntity updateRequisition = new RequisitionEntity(); + updateRequisition.setDataSourceCode(datasourceCode); + updateRequisition.setId(requisition.getId()); + updateRequisition.setDataStatus("1"); + 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); + } }else { - //todo 没有明细不发送,修改数据状态,已完成,没有明细不发送 + // 没有明细不发送,修改数据状态,已完成,没有明细不发送 + RequisitionEntity updateRequisition = new RequisitionEntity(); + updateRequisition.setDataSourceCode(datasourceCode); + updateRequisition.setId(requisition.getId()); + updateRequisition.setDataStatus("1"); + updateRequisition.setDataMsg("成功,没有明细不发送"); + requisitionService.updateStatus(updateRequisition); } } } @@ -464,7 +518,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService { JSONObject jsonObject = JSONObject.parseObject(res); flag = jsonObject.getBoolean("flag"); if(flag){ - code = jsonObject.getJSONObject("attribute").getString("id"); + code = jsonObject.getJSONObject("attribute").getString("loginName"); } }catch (Exception e){ logger.error("调用oa接口出错:{}",e); @@ -472,9 +526,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService { } if(flag){ returnData.put("flag","true"); - //todo - returnData.put("code","admin"); - //returnData.put("code",code); + returnData.put("code",code); }else { returnData.put("flag","false"); returnData.put("msg",res); diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java index 935a07e6..706cf221 100644 --- a/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java +++ b/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java @@ -1853,7 +1853,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity, url.append(querys); } if (addquerys != null) { - url.append(querys); + url.append(addquerys); } Integer outTime = 6000; if (receiveApi.getTimeoutPeriod() != null && !"".equals(receiveApi.getTimeoutPeriod())) {