package com.kingdee.eas.custom.shuiyou.six.osf;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.bsf.service.app.IHRMsfService;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.shuiyou.vo.SpecialAmountInfo;
import com.kingdee.eas.custom.shuiyou.task.MessageResult;
import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum;
import com.kingdee.eas.custom.shuiyou.uitls.ISYUtilsFacade;
import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory;
import com.kingdee.eas.custom.shuiyou.uitls.URLConfigEnum;
import org.apache.log4j.Logger;
import java.util.Map;
/**
* 人员专项附加扣除金额查询
* description: querySpecialAmountService
* date: 2024/9/6 15:53
* author: lhbj
* version: 1.0
*/
public class QuerySpecialAmountService implements IHRMsfService {
private static final Logger LOG = Logger.getLogger(GetPreDeductConfirmFeedBack.class);
@Override
public Object process(Context ctx, Map map) throws EASBizException, BOSException {
String this_taskid= (String) map.get("this_taskId");
String param= (String) map.get("paramData");
ISYUtilsFacade facade = SYUtilsFacadeFactory.getLocalInstance(ctx);
Map config = facade.getConfig();
String url = config.get("ip") + URLConfigEnum.QUERYSPECIALAMOUNT_VALUE;
String result = facade.post(url, param);
JSONObject jsonObject = JSONUtil.parseObj(result);
JSONObject head = jsonObject.getJSONObject("head");
String code = head.getStr("code");
String msg = head.getStr("msg");
JSONObject body = jsonObject.getJSONObject("body");
SpecialAmountInfo info = JSONUtil.toBean(param,SpecialAmountInfo.class);
MessageResult msgr = null;
if ("00000000".equals(code)) {
body.set("initIds", info.getTaxPersonRecordEntryIDS());
body.set("parent_taskid", this_taskid);
String tastId = facade.addTask("getQuerySpecialAmountFeedback", JSONUtil.toJsonStr(body), TaskCatalogEnum.TAXSPEADDDEDREPERSON_GET, null);
msgr = MessageResult.AWAIT_W();
}else if("00000004".equals(head.getStr("code"))) {
msgr = MessageResult.AGAIN();
}else{
msgr = MessageResult.FAILED(msg);
}
return msgr;
}
}