预付款单推送

This commit is contained in:
lvleigang 2024-10-31 16:57:48 +08:00
parent a1eafd905f
commit 06d06dddbe
6 changed files with 170 additions and 27 deletions

View File

@ -65,7 +65,12 @@ public class PrepaymentEntity extends BaseEntity {
private String createdOn; private String createdOn;
//修改时间 //修改时间
private String modifiedOn; private String modifiedOn;
//数据状态 1成功 2失败
private String dataStatus;
//数据状态描述
private String dataMsg;
//用户手机号
private String userPhone;
public String getStartTime() { public String getStartTime() {
return startTime; return startTime;
} }
@ -256,4 +261,28 @@ public class PrepaymentEntity extends BaseEntity {
public void setCurrencyName(String currencyName) { public void setCurrencyName(String currencyName) {
this.currencyName = 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;
}
} }

View File

@ -26,6 +26,9 @@
<result property="currencyName" column="currencyName" jdbcType="VARCHAR"/> <result property="currencyName" column="currencyName" jdbcType="VARCHAR"/>
<result property="createdOn" column="createdOn" jdbcType="VARCHAR"/> <result property="createdOn" column="createdOn" jdbcType="VARCHAR"/>
<result property="modifiedOn" column="modifiedOn" 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> </resultMap>
<!-- 查询的字段--> <!-- 查询的字段-->
<sql id = "PrepaymentEntity_Base_Column_List"> <sql id = "PrepaymentEntity_Base_Column_List">
@ -51,7 +54,10 @@
currencyCode, currencyCode,
currencyName, currencyName,
createdOn, createdOn,
modifiedOn modifiedOn,
dataStatus,
dataMsg,
userPhone
</sql> </sql>
<!-- 查询 采用==查询 --> <!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-PrepaymentEntity-result" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.PrepaymentEntity"> <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="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if>
<if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if> <if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if>
<if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if> <if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if>
and dataStatus is null
</trim> </trim>
order by v_hzya_u9c_payreq.modifiedOn desc order by v_hzya_u9c_payreq.modifiedOn desc
</select> </select>
@ -114,16 +121,25 @@
<if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if> <if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if>
<if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if> <if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if>
<if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if> <if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if>
and dataStatus is null
</trim> </trim>
</select> </select>
<update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.PrepaymentEntity"> <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=","> <trim suffix="" suffixOverrides=",">
<if test="businessDate != null and businessDate != ''"> businessDate = #{businessDate},</if> <if test="dataStatus != null and dataStatus != ''"> dataStatus = #{dataStatus},</if>
<if test="status != null"> status = #{status},</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.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> </mapper>

View File

@ -53,6 +53,12 @@ public class RequisitionEntity extends BaseEntity {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//结束时间 查询用 //结束时间 查询用
private String endTime; private String endTime;
//数据状态 1成功 2失败
private String dataStatus;
//数据状态描述
private String dataMsg;
//用户手机号
private String userPhone;
public String getStartTime() { public String getStartTime() {
return startTime; return startTime;
@ -205,4 +211,28 @@ public class RequisitionEntity extends BaseEntity {
public void setCreatedOn(String createdOn) { public void setCreatedOn(String createdOn) {
this.createdOn = 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;
}
} }

View File

@ -21,6 +21,9 @@
<result property="statusName" column="statusName"/> <result property="statusName" column="statusName"/>
<result property="modifiedOn" column="modifiedOn"/> <result property="modifiedOn" column="modifiedOn"/>
<result property="createdOn" column="createdOn"/> <result property="createdOn" column="createdOn"/>
<result property="userPhone" column="userPhone"/>
<result property="dataMsg" column="dataMsg"/>
<result property="dataStatus" column="dataStatus"/>
</resultMap> </resultMap>
<!-- 查询的字段--> <!-- 查询的字段-->
<sql id = "RequisitionEntity_Base_Column_List"> <sql id = "RequisitionEntity_Base_Column_List">
@ -41,7 +44,10 @@
status, status,
statusName, statusName,
modifiedOn, modifiedOn,
createdOn createdOn,
dataStatus,
dataMsg,
userPhone
</sql> </sql>
<!-- 查询 采用==查询 --> <!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-RequisitionEntity-result" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity"> <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="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if>
<if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if> <if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if>
<if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if> <if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if>
and dataStatus is null
</trim> </trim>
order by v_hzya_u9c_pr_pr.modifiedOn desc order by v_hzya_u9c_pr_pr.modifiedOn desc
</select> </select>
@ -95,16 +102,25 @@
<if test="statusName != null and statusName != ''"> and statusName = #{statusName} </if> <if test="statusName != null and statusName != ''"> and statusName = #{statusName} </if>
<if test="modifiedOn != null and modifiedOn != ''"> and modifiedOn = #{modifiedOn} </if> <if test="modifiedOn != null and modifiedOn != ''"> and modifiedOn = #{modifiedOn} </if>
<if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if> <if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if>
and dataStatus is null
</trim> </trim>
</select> </select>
<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="businessDate != null and businessDate != ''"> businessDate = #{businessDate},</if> <if test="dataStatus != null and dataStatus != ''"> dataStatus = #{dataStatus},</if>
<if test="status != null"> status = #{status},</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 != ''"> dataStatus = #{dataStatus},</if>-->
<!-- <if test="dataMsg != null and dataMsg != ''"> dataMsg = #{dataMsg},</if>-->
<!-- </trim>-->
<!-- where id = #{id}-->
<!-- </update>-->
</mapper> </mapper>

View File

@ -64,7 +64,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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);
@ -255,13 +255,26 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
String res = null; String res = null;
Boolean flag = false; Boolean flag = false;
try { try {
JSONObject token = getToken("admin", "800045", "8000450000"); //1获取token
if(token.getBoolean("flag")){ JSONObject nouserToken = getToken(null, "800045", "8000450000");
res = invokeEsb(param, "800045", "8000450001",token.getString("token")); if(nouserToken.getBoolean("flag")){
JSONObject jsonObject = JSONObject.parseObject(res); //2根据电话获取code
flag = jsonObject.getBoolean("flag"); 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 { }else {
res = token.getString("msg"); res = nouserToken.getString("msg");
} }
}catch (Exception e){ }catch (Exception e){
logger.error("调用oa接口出错:{}",e); logger.error("调用oa接口出错:{}",e);
@ -279,9 +292,30 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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);
//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 { }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请购单流程 * u9c请购单发起OA请购单流程
*
* @param requestJson * @param requestJson
* @return * @return
*/ */
@ -406,7 +439,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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"),"13924608800", "800045", "8000450005"); JSONObject usercode = getUsercode(nouserToken.getString("token"),requisition.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");
@ -439,9 +472,30 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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);
//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 { }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); JSONObject jsonObject = JSONObject.parseObject(res);
flag = jsonObject.getBoolean("flag"); flag = jsonObject.getBoolean("flag");
if(flag){ if(flag){
code = jsonObject.getJSONObject("attribute").getString("id"); code = jsonObject.getJSONObject("attribute").getString("loginName");
} }
}catch (Exception e){ }catch (Exception e){
logger.error("调用oa接口出错:{}",e); logger.error("调用oa接口出错:{}",e);
@ -472,9 +526,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
} }
if(flag){ if(flag){
returnData.put("flag","true"); returnData.put("flag","true");
//todo returnData.put("code",code);
returnData.put("code","admin");
//returnData.put("code",code);
}else { }else {
returnData.put("flag","false"); returnData.put("flag","false");
returnData.put("msg",res); returnData.put("msg",res);

View File

@ -1853,7 +1853,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
url.append(querys); url.append(querys);
} }
if (addquerys != null) { if (addquerys != null) {
url.append(querys); url.append(addquerys);
} }
Integer outTime = 6000; Integer outTime = 6000;
if (receiveApi.getTimeoutPeriod() != null && !"".equals(receiveApi.getTimeoutPeriod())) { if (receiveApi.getTimeoutPeriod() != null && !"".equals(receiveApi.getTimeoutPeriod())) {