1.6. 泛微-审核人更新api接口
This commit is contained in:
parent
07300e443a
commit
4802992537
|
|
@ -6,16 +6,16 @@ import kd.bos.dataentity.OperateOption;
|
|||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.operate.result.IOperateInfo;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.form.operate.MutexHelper;
|
||||
import kd.bos.mutex.DataMutex;
|
||||
import kd.bos.openapi.common.custom.annotation.ApiController;
|
||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||
import kd.bos.openapi.common.custom.annotation.ApiPostMapping;
|
||||
import kd.bos.openapi.common.result.CustomApiResult;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import tqq9.lc123.cloud.app.api.model.FWAuditorUpdModel;
|
||||
import tqq9.lc123.cloud.app.api.model.FWBillStateUpdModel;
|
||||
import tqq9.lc123.cloud.app.api.utils.ApiResultExt;
|
||||
|
||||
|
|
@ -45,6 +45,7 @@ public class FWBillStateUpdController {
|
|||
//日志
|
||||
DynamicObject approveLog = BusinessDataServiceHelper.newDynamicObject("tqq9_fwapprovelog");
|
||||
approveLog.set("name", KDBillType);
|
||||
approveLog.set("tqq9_logtype", "审批结果返回");
|
||||
approveLog.set("tqq9_billno", KDBillNumber);
|
||||
approveLog.set("tqq9_returnstring_tag", JSONObject.toJSONString(model));
|
||||
approveLog.set("tqq9_message", message);
|
||||
|
|
@ -124,4 +125,85 @@ public class FWBillStateUpdController {
|
|||
resultExt.setResult(results);
|
||||
return CustomApiResult.success(resultExt);
|
||||
}
|
||||
|
||||
@ApiPostMapping(value = "/FWAuditorUpd", desc = "泛微-审批人更新api接口")
|
||||
public CustomApiResult<ApiResultExt> auditorUpd
|
||||
(@NotNull @ApiParam(value = "入参", example = "") FWAuditorUpdModel model) {
|
||||
String KDBillNumber = model.getKDBillNumber();
|
||||
String KDBillType = model.getKDBillType();
|
||||
String UserID = model.getUserId();
|
||||
String message = model.getMessage();
|
||||
|
||||
ApiResultExt resultExt = new ApiResultExt();
|
||||
ApiResultExt.Error errors = new ApiResultExt.Error();
|
||||
ArrayList<String> errorList = new ArrayList<>();
|
||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||
resultBean.setBillStatus(true);
|
||||
resultBean.setBillIndex(0);
|
||||
resultBean.setNumber(KDBillNumber);
|
||||
|
||||
//日志
|
||||
DynamicObject approveLog = BusinessDataServiceHelper.newDynamicObject("tqq9_fwapprovelog");
|
||||
approveLog.set("name", KDBillType);
|
||||
approveLog.set("tqq9_logtype", "审批人更新");
|
||||
approveLog.set("tqq9_billno", KDBillNumber);
|
||||
approveLog.set("tqq9_returnstring_tag", JSONObject.toJSONString(model));
|
||||
approveLog.set("tqq9_message", message);
|
||||
approveLog.set("status", "A");
|
||||
approveLog.set("enable", "1");
|
||||
|
||||
//校验审批人id
|
||||
DynamicObject bos_user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("entryentity.tqq9_fwuserid", QCP.equals, UserID)});
|
||||
if (bos_user == null) {
|
||||
errorList.add("参数UserID[" + UserID + "]对应人员不存在");
|
||||
}
|
||||
|
||||
//校验单据标识是否正确
|
||||
DynamicObject bill = null;
|
||||
QFilter f1 = new QFilter("number", "=", KDBillType);
|
||||
DynamicObject[] bos_entityobjects = BusinessDataServiceHelper.load("bos_entityobject", "id,name,number,modeltype", new QFilter[]{f1});
|
||||
if (bos_entityobjects == null && bos_entityobjects.length == 0) {
|
||||
errorList.add("参数KDBillType[" + KDBillType + "]不是正确的标识");
|
||||
} else {
|
||||
DynamicObject bosEntity = bos_entityobjects[0];
|
||||
String modeltype = bosEntity.getString("modeltype");
|
||||
String enetityNumber = bosEntity.getString("number");
|
||||
String enetityName = bosEntity.getString("name");
|
||||
String billNoFieldName = "billno";
|
||||
if ("BaseFormModel".equals(modeltype) || "gl_voucher".equals(enetityNumber)) {
|
||||
billNoFieldName = "number";
|
||||
}
|
||||
if ("pm_xspurorderbill".equals(enetityNumber) || "conm_xpurcontract".equals(enetityNumber)) {
|
||||
billNoFieldName = "changebillno";
|
||||
}
|
||||
approveLog.set("tqq9_entityname", enetityName);
|
||||
//查询对应的安居
|
||||
QFilter qf1 = new QFilter(billNoFieldName, "=", KDBillNumber);
|
||||
DynamicObject[] billArr = BusinessDataServiceHelper.load(enetityNumber, "id,tqq9_issuccess", new QFilter[]{qf1});
|
||||
if (billArr == null || billArr.length == 0) {
|
||||
errorList.add("根据参数KDBillType[" + KDBillType + "]。KDBillNumber[" + KDBillNumber + "]没有查询到对应的" + enetityName + "信息");
|
||||
}else{
|
||||
bill = BusinessDataServiceHelper.loadSingle(billArr[0].getPkValue(), enetityNumber);
|
||||
}
|
||||
}
|
||||
if (errorList.size() > 0) {
|
||||
resultBean.setBillStatus(false);
|
||||
errors.setRowMsg(errorList);
|
||||
resultBean.setErrors(errors);
|
||||
resultExt.setFailCount(1);
|
||||
resultExt.setSuccessCount(0);
|
||||
} else {
|
||||
bill.set("tqq9_auditor", bos_user);
|
||||
approveLog.set("tqq9_issuccess", true);
|
||||
SaveServiceHelper.save(new DynamicObject[]{bill});
|
||||
//保存日志
|
||||
OperationServiceHelper.executeOperate("save", "tqq9_fwapprovelog", new DynamicObject[]{approveLog}, OperateOption.create());
|
||||
resultExt.setFailCount(0);
|
||||
resultExt.setSuccessCount(1);
|
||||
}
|
||||
results.add(resultBean);
|
||||
resultExt.setResult(results);
|
||||
return CustomApiResult.success(resultExt);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package tqq9.lc123.cloud.app.api.model;
|
||||
|
||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||
|
||||
public class FWAuditorUpdModel {
|
||||
|
||||
@ApiParam(value = "金蝶单据类型", example = "bd_material", required = true)
|
||||
private String KDBillType;
|
||||
@ApiParam(value = "金蝶单据编码", example = "M001", required = true)
|
||||
private String KDBillNumber;
|
||||
|
||||
@ApiParam(value = "泛微id", example = "001", required = true)
|
||||
private String UserId;
|
||||
|
||||
@ApiParam(value = "说明", example = "审核通过")
|
||||
private String message;
|
||||
|
||||
public String getKDBillType() {
|
||||
return KDBillType;
|
||||
}
|
||||
|
||||
public void setKDBillType(String KDBillType) {
|
||||
this.KDBillType = KDBillType;
|
||||
}
|
||||
|
||||
public String getKDBillNumber() {
|
||||
return KDBillNumber;
|
||||
}
|
||||
|
||||
public void setKDBillNumber(String KDBillNumber) {
|
||||
this.KDBillNumber = KDBillNumber;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return UserId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
UserId = userId;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue