|
@@ -0,0 +1,148 @@
|
|
|
|
+package com.kingdee.eas.custom.compensation.service;
|
|
|
|
+
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.sql.SQLException;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+import org.apache.log4j.Logger;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
+import com.kingdee.bos.BOSException;
|
|
|
|
+import com.kingdee.bos.Context;
|
|
|
|
+import com.kingdee.bos.bsf.service.app.IHRMsfService;
|
|
|
|
+import com.kingdee.bos.dao.IObjectPK;
|
|
|
|
+import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
|
|
+import com.kingdee.bos.metadata.entity.EntityViewInfo;
|
|
|
|
+import com.kingdee.bos.metadata.entity.FilterInfo;
|
|
|
|
+import com.kingdee.bos.metadata.entity.FilterItemInfo;
|
|
|
|
+import com.kingdee.bos.metadata.entity.SelectorItemCollection;
|
|
|
|
+import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
|
+import com.kingdee.bos.util.BOSUuid;
|
|
|
|
+import com.kingdee.eas.basedata.person.IPerson;
|
|
|
|
+import com.kingdee.eas.basedata.person.PersonFactory;
|
|
|
|
+import com.kingdee.eas.basedata.person.PersonInfo;
|
|
|
|
+import com.kingdee.eas.common.EASBizException;
|
|
|
|
+import com.kingdee.eas.custom.shuiyou.interfacelog.LogInfoFactory;
|
|
|
|
+import com.kingdee.eas.custom.shuiyou.interfacelog.LogInfoInfo;
|
|
|
|
+import com.kingdee.eas.custom.shuiyou.task.MessageResult;
|
|
|
|
+import com.kingdee.eas.custom.shuiyou.utils.ClientProxyFactoryUtils;
|
|
|
|
+import com.kingdee.eas.util.app.DbUtil;
|
|
|
|
+import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
|
+import com.kingdee.shr.compensation.TaxDeclareStatusEnum;
|
|
|
|
+import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordFactory;
|
|
|
|
+import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordInfo;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.IIncomeTaxDeclar;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.ITaxDeclaration;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.IncomeTaxDeclarCollection;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.IncomeTaxDeclarFactory;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.IncomeTaxDeclarInfo;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxDeclarationCollection;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxDeclarationFactory;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxDeclarationInfo;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxUnitInfo;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.base.ITaxIncomeItem;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.base.TaxIncomeItemFactory;
|
|
|
|
+import com.kingdee.shr.compensation.app.tax.base.TaxIncomeItemInfo;
|
|
|
|
+
|
|
|
|
+import cn.com.servyou.dto.ApiResponse;
|
|
|
|
+import cn.com.servyou.dto.declare.Feedback;
|
|
|
|
+import cn.com.servyou.rmi.client.ClientProxyFactory;
|
|
|
|
+import cn.com.servyou.service.DeclarationRequest;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 撤销申报
|
|
|
|
+ * @author coyle
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+public class CancelDeclareService implements IHRMsfService {
|
|
|
|
+ Logger logger = Logger.getLogger("com.kingdee.eas.custom.compensation.service.CancelDeclareService");
|
|
|
|
+
|
|
|
|
+ public Object process(Context context, Map map) throws EASBizException, BOSException {
|
|
|
|
+ //接口日志实体
|
|
|
|
+ LogInfoInfo logInfo = new LogInfoInfo();
|
|
|
|
+ //入口
|
|
|
|
+ logInfo.setEntrance(this.getClass().getName());
|
|
|
|
+ logInfo.setBizDate(new Date());
|
|
|
|
+ Map resMap = new HashMap();
|
|
|
|
+ logger.error("CancelDeclareService----------OSF----Start");
|
|
|
|
+ JSONObject paramData = JSONObject.parseObject((String) map.get("paramData"));
|
|
|
|
+ logger.error("paramData--------" + paramData);
|
|
|
|
+ String requestId = paramData.getString("requestId");
|
|
|
|
+ JSONObject param = paramData.getJSONObject("param");
|
|
|
|
+ logger.error("requestId--------" + requestId);
|
|
|
|
+ logger.error("param--------" + param);
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
+ try {
|
|
|
|
+ //客户端代理工厂
|
|
|
|
+ ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
|
|
|
|
+ //算税请求接口
|
|
|
|
+ DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
|
|
|
|
+ //申报数据反馈 requestId:请求Id reportType:申报所得类型[1:综合所得;2:分类所得;3:非居民所得;4:限售股所得]
|
|
|
|
+ ApiResponse<Feedback> feedback = declarationRequest.getCancelFeedback(requestId, "1");
|
|
|
|
+ logInfo.setInterfaceAddress("/gateway/iit/report/getCancelFeedback");//接口地址
|
|
|
|
+ logInfo.setInterfaceName("getCancelFeedback");//接口名
|
|
|
|
+ logger.error("getCancelFeedback--------" + mapper.writeValueAsString(feedback));
|
|
|
|
+ String status = feedback.getHead().getStatus();
|
|
|
|
+ Feedback body = null;
|
|
|
|
+ if ("N".equals(status)) {
|
|
|
|
+ //请求失败响应
|
|
|
|
+ String msg = feedback.getHead().getMsg();
|
|
|
|
+ return MessageResult.FAILED(msg);
|
|
|
|
+ } else {
|
|
|
|
+ //调用成功
|
|
|
|
+ //请求id
|
|
|
|
+ body = feedback.getBody();
|
|
|
|
+ logInfo.setOutParameter(mapper.writeValueAsString(body));//回参
|
|
|
|
+ LogInfoFactory.getLocalInstance(context).addnew(logInfo);
|
|
|
|
+ saveTaxDeclaration(context, param);
|
|
|
|
+ }
|
|
|
|
+ return MessageResult.SUCCESS(mapper.writeValueAsString(body));
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ logInfo.setErrorInfo(e.getMessage());//错误信息
|
|
|
|
+ LogInfoFactory.getLocalInstance(context).save(logInfo);
|
|
|
|
+ //throw new BOSException(e);
|
|
|
|
+ return MessageResult.ERROR(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存个税申报结果
|
|
|
|
+ *
|
|
|
|
+ * @param param
|
|
|
|
+ */
|
|
|
|
+ public void saveTaxDeclaration(Context ctx, JSONObject param) throws BOSException, EASBizException {
|
|
|
|
+ logger.error("saveTaxDeclaration------------------");
|
|
|
|
+ //个税申报ID
|
|
|
|
+ String taxDeclarId = param.getString("taxDeclarId");
|
|
|
|
+
|
|
|
|
+ //个税申报批次号
|
|
|
|
+ String taxDeclarBatchNo = param.getString("taxDeclarBatchNo");
|
|
|
|
+ IIncomeTaxDeclar iIncomeTaxDeclar = IncomeTaxDeclarFactory.getLocalInstance(ctx);
|
|
|
|
+ IncomeTaxDeclarCollection incomeTaxDeclarCollection = iIncomeTaxDeclar.getIncomeTaxDeclarCollection("where batchNo = '" + taxDeclarBatchNo + "'");
|
|
|
|
+ SelectorItemCollection updateSic = new SelectorItemCollection();
|
|
|
|
+ updateSic.add("isCancelled");
|
|
|
|
+ if (incomeTaxDeclarCollection.size() > 0) {
|
|
|
|
+ IncomeTaxDeclarInfo incomeTaxDeclarInfo = incomeTaxDeclarCollection.get(0);
|
|
|
|
+ incomeTaxDeclarInfo.setIsCancelled(1);
|
|
|
|
+ iIncomeTaxDeclar.updatePartial(incomeTaxDeclarInfo, updateSic);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|