分组类型查询单据

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 userPhone;
//用户手机号
private String sendPhone;
public String getStartTime() {
return startTime;
@ -235,4 +237,12 @@ public class RequisitionEntity extends BaseEntity {
public void setUserPhone(String 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="dataMsg" column="dataMsg"/>
<result property="dataStatus" column="dataStatus"/>
<result property="sendPhone" column="sendPhone"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "RequisitionEntity_Base_Column_List">
@ -47,6 +48,7 @@
createdOn,
dataStatus,
dataMsg,
sendPhone,
userPhone
</sql>
<!-- 查询 采用==查询 -->
@ -114,11 +116,12 @@
</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>-->
<!-- <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>-->

View File

@ -25,5 +25,5 @@ public interface IPrepaymentService extends IBaseService<PrepaymentEntity,String
* @param entity
* @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")
@Override
public int updateStatus(PrepaymentEntity entity) {
return 0;
public void updateStatus(PrepaymentEntity entity) {
prepaymentDao.update(entity);
}
}

View File

@ -46,6 +46,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Value("${zt.url}")
private String url;
/**
* u9c预付单发起OA请款单流程 (预付)
*
@ -325,6 +326,7 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
/**
* u9c请购单发起OA请购单流程
*
* @param requestJson
* @return
*/
@ -349,6 +351,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
}
List<RequisitionEntity> requisitionList = requisitionService.queryList(requisitionEntity);
if (CollectionUtils.isNotEmpty(requisitionList)) {
//1获取token
for (RequisitionEntity requisition : requisitionList) {
//查询u9c请购单明细
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
@ -360,32 +364,37 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
JSONObject formmain_0652 = new JSONObject();
//单据类型
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("field0006",requisition.getSourceTypeName());
//单号
formmain_0652.put("field0007", requisition.getDocNo());
//需求部门
formmain_0652.put("field0008", requisition.getReqDepartmentName());
//来源单号
formmain_0652.put("field0009",requisitionDetailList.get(0).getSrcDocNo());
//日期
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("field0013", requisition.getStatusName());
//请购数量合计
formmain_0652.put("field0030","");
String res = null;
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<>();
for (RequisitionDetailEntity detail : requisitionDetailList) {
@ -410,12 +419,12 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
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("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);
@ -432,17 +441,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
param.put("data", data);
String paramStr = param.toString();
logger.info("u9c请购单发起OA流程请求参数:{}", paramStr);
String res = null;
Boolean flag = false;
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
JSONObject token = getToken(usercode.getString("code"), "800045", "8000450000");
if (token.getBoolean("flag")) {
res = invokeEsb(param, "800045", "8000450002", token.getString("token"));
JSONObject jsonObject = JSONObject.parseObject(res);
@ -450,12 +450,6 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
} else {
res = token.getString("msg");
}
}else {
res = usercode.getString("msg");
}
}else {
res = nouserToken.getString("msg");
}
} catch (Exception e) {
logger.error("调用oa接口出错:{}", e);
res = e.getMessage();
@ -473,6 +467,9 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
saveLog(taskId, flag, taskLivingDetail);
logger.info("u9c请购单发起OA流程返回结果:{}", res);
// 发送完成修改主表状态 已完成或发送失败 flag判断
} else {
res = token.getString("msg");
}
if (flag) {
RequisitionEntity updateRequisition = new RequisitionEntity();
updateRequisition.setDataSourceCode(datasourceCode);
@ -498,6 +495,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
requisitionService.updateStatus(updateRequisition);
}
}
}
return BaseResult.getSuccessMessageEntity("德广信U9C请购单推送OA插件执行成功");
}
@ -511,6 +510,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
String res = null;
String code = null;
String bm = null;
String name = null;
Boolean flag = false;
try {
@ -519,6 +520,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
flag = jsonObject.getBoolean("flag");
if (flag) {
code = jsonObject.getJSONObject("attribute").getString("loginName");
bm = jsonObject.getJSONObject("attribute").getString("orgDepartmentName");
name = jsonObject.getJSONObject("attribute").getString("name");
}
} catch (Exception e) {
logger.error("调用oa接口出错:{}", e);
@ -527,6 +530,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
if (flag) {
returnData.put("flag", "true");
returnData.put("code", code);
returnData.put("bm", bm);
returnData.put("name", name);
} else {
returnData.put("flag", "false");
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 appId
* @param apiCode
* @return com.alibaba.fastjson.JSONObject
* @Author lvleigang
* @Description 获取token
* @Date 11:53 上午 2024/10/28
**/
private JSONObject getToken(String code, String appId, String apiCode) {
JSONObject param = new JSONObject();
@ -555,13 +560,16 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
String res = null;
String token = null;
Boolean flag = false;
String bm = null;
String name = null;
try {
res = invokeEsb(param, appId, apiCode, null);
JSONObject jsonObject = JSONObject.parseObject(res);
flag = jsonObject.getBoolean("flag");
if (flag) {
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) {
logger.error("调用oa接口出错:{}", e);
@ -570,6 +578,8 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
if (flag) {
returnData.put("flag", "true");
returnData.put("token", token);
returnData.put("bm", bm);
returnData.put("name", name);
} else {
returnData.put("flag", "false");
returnData.put("msg", res);