分组类型查询单据

This commit is contained in:
lvleigang 2024-11-02 11:21:14 +08:00
parent 06d06dddbe
commit 5209d7cfd5
5 changed files with 325 additions and 302 deletions

View File

@ -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;
}
} }

View File

@ -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>-->

View File

@ -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);
} }

View File

@ -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);
} }
} }

View File

@ -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请款单流程 (预付)
* *
@ -325,6 +326,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
/** /**
* u9c请购单发起OA请购单流程 * u9c请购单发起OA请购单流程
*
* @param requestJson * @param requestJson
* @return * @return
*/ */
@ -349,6 +351,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
} }
List<RequisitionEntity> requisitionList = requisitionService.queryList(requisitionEntity); List<RequisitionEntity> requisitionList = requisitionService.queryList(requisitionEntity);
if (CollectionUtils.isNotEmpty(requisitionList)) { if (CollectionUtils.isNotEmpty(requisitionList)) {
//1获取token
for (RequisitionEntity requisition : requisitionList) { for (RequisitionEntity requisition : requisitionList) {
//查询u9c请购单明细 //查询u9c请购单明细
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity(); RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
@ -360,32 +364,37 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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("field0002","");
//发起部门
formmain_0652.put("field0003","");
//发起时间
formmain_0652.put("field0004",DateUtil.now());
//需求人员 //需求人员
formmain_0652.put("field0005", requisition.getReqEmployeeName()); formmain_0652.put("field0005", requisition.getReqEmployeeName());
//来源类型
formmain_0652.put("field0006",requisition.getSourceTypeName());
//单号 //单号
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("field0009",requisitionDetailList.get(0).getSrcDocNo());
//日期 //日期
formmain_0652.put("field0010", requisition.getBusinessDate()); formmain_0652.put("field0010", requisition.getBusinessDate());
//项目
formmain_0652.put("field0011",requisitionDetailList.get(0).getProjectName());
//厂区 //厂区
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;
formmain_0652.put("field0030",""); Boolean flag = false;
JSONObject token = getToken(requisition.getSendPhone(), "800045", "8000450000");
//3根据code再次获取token
if (token.getBoolean("flag")) {
//发起人
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<>(); List<JSONObject> formsonList = new LinkedList<>();
for (RequisitionDetailEntity detail : requisitionDetailList) { for (RequisitionDetailEntity detail : requisitionDetailList) {
@ -410,12 +419,12 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
formson_0653.put("field0024", detail.getStoreUOM()); formson_0653.put("field0024", detail.getStoreUOM());
//单据备注 //单据备注
formson_0653.put("field0025", detail.getMemo()); formson_0653.put("field0025", detail.getMemo());
//需求交货日期 ////需求交货日期
formson_0653.put("field0026",detail.getRequiredDeliveryDate()); //formson_0653.put("field0026", detail.getRequiredDeliveryDate());
//来源单号明细 ////来源单号明细
formson_0653.put("field0027",detail.getSrcDocNo()); //formson_0653.put("field0027", detail.getSrcDocNo());
//库存可用量 ////库存可用量
formson_0653.put("field0028",detail.getpRInvQty()); //formson_0653.put("field0028", detail.getpRInvQty());
//状态明细 //状态明细
formson_0653.put("field0029", detail.getStatus()); formson_0653.put("field0029", detail.getStatus());
formsonList.add(formson_0653); formsonList.add(formson_0653);
@ -432,17 +441,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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;
Boolean flag = false;
try { try {
//1获取token
JSONObject nouserToken = getToken(null, "800045", "8000450000");
if(nouserToken.getBoolean("flag")){
//2根据电话获取code
JSONObject usercode = getUsercode(nouserToken.getString("token"),requisition.getUserPhone(), "800045", "8000450005");
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);
@ -450,12 +450,6 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
} else { } else {
res = token.getString("msg"); res = token.getString("msg");
} }
}else {
res = usercode.getString("msg");
}
}else {
res = nouserToken.getString("msg");
}
} catch (Exception e) { } catch (Exception e) {
logger.error("调用oa接口出错:{}", e); logger.error("调用oa接口出错:{}", e);
res = e.getMessage(); res = e.getMessage();
@ -473,6 +467,9 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
saveLog(taskId, flag, taskLivingDetail); saveLog(taskId, flag, taskLivingDetail);
logger.info("u9c请购单发起OA流程返回结果:{}", res); logger.info("u9c请购单发起OA流程返回结果:{}", res);
// 发送完成修改主表状态 已完成或发送失败 flag判断 // 发送完成修改主表状态 已完成或发送失败 flag判断
} else {
res = token.getString("msg");
}
if (flag) { if (flag) {
RequisitionEntity updateRequisition = new RequisitionEntity(); RequisitionEntity updateRequisition = new RequisitionEntity();
updateRequisition.setDataSourceCode(datasourceCode); updateRequisition.setDataSourceCode(datasourceCode);
@ -498,6 +495,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
requisitionService.updateStatus(updateRequisition); requisitionService.updateStatus(updateRequisition);
} }
} }
} }
return BaseResult.getSuccessMessageEntity("德广信U9C请购单推送OA插件执行成功"); return BaseResult.getSuccessMessageEntity("德广信U9C请购单推送OA插件执行成功");
} }
@ -511,6 +510,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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 {
@ -519,6 +520,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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);
@ -527,6 +530,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
if (flag) { if (flag) {
returnData.put("flag", "true"); returnData.put("flag", "true");
returnData.put("code", code); returnData.put("code", code);
returnData.put("bm", bm);
returnData.put("name", name);
} else { } else {
returnData.put("flag", "false"); returnData.put("flag", "false");
returnData.put("msg", res); returnData.put("msg", res);
@ -535,13 +540,13 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
} }
/** /**
* @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();
@ -555,13 +560,16 @@ 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 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);
@ -570,6 +578,8 @@ 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("name", name);
} else { } else {
returnData.put("flag", "false"); returnData.put("flag", "false");
returnData.put("msg", res); returnData.put("msg", res);