|
|
@@ -0,0 +1,1054 @@
|
|
|
+package com.kingdee.eas.custom.compensation.handler;
|
|
|
+
|
|
|
+import cn.com.servyou.dto.ApiResponse;
|
|
|
+import cn.com.servyou.dto.AsyncResult;
|
|
|
+import cn.com.servyou.dto.tax.*;
|
|
|
+import cn.com.servyou.rmi.client.ClientProxyFactory;
|
|
|
+import cn.com.servyou.service.TaxRequest;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.kingdee.bos.BOSException;
|
|
|
+import com.kingdee.bos.Context;
|
|
|
+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.eas.basedata.hraux.NationalityInfo;
|
|
|
+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.compensation.vo.TaxUnitAndPerson;
|
|
|
+import com.kingdee.eas.custom.individualback.ITaxPaymentBackCalculate;
|
|
|
+import com.kingdee.eas.custom.individualback.TaxPaymentBackCalculateCollection;
|
|
|
+import com.kingdee.eas.custom.individualback.TaxPaymentBackCalculateFactory;
|
|
|
+import com.kingdee.eas.custom.individualback.TaxPaymentBackCalculateInfo;
|
|
|
+import com.kingdee.eas.custom.shuiyou.interfacelog.LogInfoFactory;
|
|
|
+import com.kingdee.eas.custom.shuiyou.interfacelog.LogInfoInfo;
|
|
|
+import com.kingdee.eas.custom.shuiyou.six.osf.vo.SixTConfirmInfo;
|
|
|
+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.utils.ClientProxyFactoryUtils;
|
|
|
+import com.kingdee.eas.hr.emp.IPersonPosition;
|
|
|
+import com.kingdee.eas.hr.emp.PersonPositionCollection;
|
|
|
+import com.kingdee.eas.hr.emp.PersonPositionFactory;
|
|
|
+import com.kingdee.eas.hr.emp.PersonPositionInfo;
|
|
|
+import com.kingdee.eas.util.app.DbUtil;
|
|
|
+import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
+import com.kingdee.shr.base.syssetting.context.SHRContext;
|
|
|
+import com.kingdee.shr.base.syssetting.exception.SHRWebException;
|
|
|
+import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
|
|
|
+import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
|
|
|
+import com.kingdee.shr.compensation.*;
|
|
|
+import com.kingdee.shr.compensation.app.incomeTax.*;
|
|
|
+import com.kingdee.shr.compensation.app.tax.ITaxUnit;
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxItemPlanInfo;
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxUnitFactory;
|
|
|
+import com.kingdee.shr.compensation.app.tax.TaxUnitInfo;
|
|
|
+import com.kingdee.shr.custom.compensation.accrue.handler.CmpCalDynamicListHandlerExEx;
|
|
|
+import com.kingdee.util.StringUtils;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author qingwu
|
|
|
+ * @date 2024/8/30
|
|
|
+ * @apiNote BackCalculateService 反算服务 TaxPaymentBackCalculate
|
|
|
+ */
|
|
|
+public class CmpCalDynamicListHandlerExExEx extends CmpCalDynamicListHandlerExEx {
|
|
|
+ private Context ctx = SHRContext.getInstance().getContext();
|
|
|
+ Logger logger = Logger.getLogger("com.kingdee.eas.custom.compensation.handler.CmpCalDynamicListHandlerExExEx");
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 税款反算
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @param modelMap
|
|
|
+ * @throws ShrWebBizException
|
|
|
+ * @throws BOSException
|
|
|
+ */
|
|
|
+ public void taxPaymentBackCalculateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException, BOSException, EASBizException {
|
|
|
+ //计算规则ID
|
|
|
+ String cmpschemeid = request.getParameter("cmpschemeid");
|
|
|
+ if (StringUtils.isEmpty(cmpschemeid)) {
|
|
|
+ throw new ShrWebBizException("计算规则ID不可为空!!");
|
|
|
+ }
|
|
|
+ Map rseMap = new HashMap();
|
|
|
+ List resList = new ArrayList();
|
|
|
+ //接口日志实体
|
|
|
+ LogInfoInfo logInfo = new LogInfoInfo();
|
|
|
+ //入口
|
|
|
+ logInfo.setEntrance(this.getClass().getName());
|
|
|
+ logInfo.setBizDate(new Date());
|
|
|
+ try {
|
|
|
+ //计算规则
|
|
|
+ ICalScheme iCalScheme = CalSchemeFactory.getLocalInstance(ctx);
|
|
|
+ ITaxUnit iTaxUnit = TaxUnitFactory.getLocalInstance(ctx);
|
|
|
+ IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
+ SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
+ sic.add("taxItemPlanList.taxItemPlan.name");
|
|
|
+ sic.add("taxItemPlanList.taxItemPlan.number");
|
|
|
+ sic.add("*");
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("id", cmpschemeid, CompareType.EQUALS));
|
|
|
+ EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ CalSchemeInfo calSchemeInfo = iCalScheme.getCalSchemeCollection(entityViewInfo).get(0);
|
|
|
+ //获取当前的薪酬核算
|
|
|
+ CmpCalTableCollection cmpCalTableCollection = getCalSchemeColl(calSchemeInfo.getId().toString(), calSchemeInfo.getPeriodYear(), calSchemeInfo.getPeriodMonth());
|
|
|
+ logger.error("cmpCalTableCollection--------" + cmpCalTableCollection.size());
|
|
|
+ //获取所有人和纳税单位
|
|
|
+ List<TaxUnitAndPerson> taxUnitAndPeople = new ArrayList();
|
|
|
+ if (cmpCalTableCollection.size() > 0) {
|
|
|
+ for (int i = 0; i < cmpCalTableCollection.size(); i++) {
|
|
|
+ String personId = cmpCalTableCollection.get(i).getPerson().getId().toString();
|
|
|
+ //获取纳税单位
|
|
|
+ String sql = getSalaryOrgMappingByPersonId(personId);
|
|
|
+ logger.error("getSalaryOrgMappingByPersonId--------" + sql);
|
|
|
+ IRowSet iRowSet = DbUtil.executeQuery(ctx, sql);
|
|
|
+ if (iRowSet.size() <= 0) {
|
|
|
+ throw new ShrWebBizException("员工ID:" + personId + "未获取到纳税单位!!");
|
|
|
+ }
|
|
|
+ String taxUnitId = null;
|
|
|
+ while (iRowSet.next()) {
|
|
|
+ taxUnitId = iRowSet.getString("taxunit");
|
|
|
+ }
|
|
|
+ TaxUnitAndPerson taxUnitAndPerson = new TaxUnitAndPerson(taxUnitId, personId);
|
|
|
+ taxUnitAndPeople.add(taxUnitAndPerson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.error("taxUnitAndPeople-----------" + taxUnitAndPeople);
|
|
|
+ // 通过纳税单位分组
|
|
|
+ Map<String, List<TaxUnitAndPerson>> groupedPeople = new HashMap<>();
|
|
|
+ for (TaxUnitAndPerson taxUnitAndPerson : taxUnitAndPeople) {
|
|
|
+ String taxunitId = taxUnitAndPerson.getTaxunitId();
|
|
|
+ if (!groupedPeople.containsKey(taxunitId)) {
|
|
|
+ groupedPeople.put(taxunitId, new ArrayList<>());
|
|
|
+ }
|
|
|
+ groupedPeople.get(taxunitId).add(taxUnitAndPerson);
|
|
|
+ }
|
|
|
+ logger.error("groupedPeople-----------" + groupedPeople);
|
|
|
+ // 输出分组结果
|
|
|
+ for (Map.Entry<String, List<TaxUnitAndPerson>> entry : groupedPeople.entrySet()) {
|
|
|
+ logger.error("输出分组结果------------start");
|
|
|
+ logger.error("taxunitId: " + entry.getKey());
|
|
|
+ //自定义类 反算服务
|
|
|
+ SixTConfirmInfo sixTConfirmInfo = new SixTConfirmInfo();
|
|
|
+ //外部业务编号
|
|
|
+ sixTConfirmInfo.setBizNo(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ //纳税单位
|
|
|
+ String taxunitId = entry.getKey();
|
|
|
+ TaxUnitInfo taxUnitInfo = iTaxUnit.getTaxUnitInfo("where id = '" + taxunitId + "'");
|
|
|
+ //个税方案
|
|
|
+ TaxItemPlanInfo taxItemPlan = calSchemeInfo.getTaxItemPlanList().get(0).getTaxItemPlan();
|
|
|
+ String taxItemPlanNumber = taxItemPlan.getNumber();
|
|
|
+ String taxItemPlanName = taxItemPlan.getName();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("periodYear", calSchemeInfo.getPeriodYear());
|
|
|
+ jsonObject.put("periodMonth", calSchemeInfo.getPeriodMonth());
|
|
|
+ jsonObject.put("cmpschemeid", cmpschemeid);
|
|
|
+ jsonObject.put("taxItemPlanName", taxItemPlanName);
|
|
|
+ jsonObject.put("taxItemPlanNumber", taxItemPlanNumber);
|
|
|
+ logger.error("jsonObject-------------" + jsonObject);
|
|
|
+ //反算服务
|
|
|
+ ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
|
|
|
+ //算税请求接口
|
|
|
+ TaxRequest taxRequest = clientProxyFactory.getTaxRequest();
|
|
|
+ //获取请求参数
|
|
|
+ CalculateIndividualIncomeTaxRequest calculateIndividualIncomeTaxRequest = getCalculateIndividualIncomeTaxRequest(entry, taxUnitInfo, taxItemPlanNumber, taxItemPlanName, cmpschemeid, logInfo);
|
|
|
+ //调用反算服务接口
|
|
|
+ ApiResponse<AsyncResult> asyncResultApiResponse = clientProxyFactory.getTaxRequest().reverseCalculateASynIndividualIncomeTax(calculateIndividualIncomeTaxRequest);
|
|
|
+ logger.error("asyncResultApiResponse-----getCode-------" + asyncResultApiResponse.getHead().getCode());
|
|
|
+ logger.error("asyncResultApiResponse-----getMsg--------" + asyncResultApiResponse.getHead().getMsg());
|
|
|
+ if (asyncResultApiResponse.getHead().getCode().equals("00000000")) {
|
|
|
+ AsyncResult body = asyncResultApiResponse.getBody();
|
|
|
+ String requestId = body.getRequestId();
|
|
|
+ logger.error("requestId-----" + requestId);
|
|
|
+ //查询反算反馈结果
|
|
|
+ ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
|
|
|
+ //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
|
|
|
+ //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("requestId", requestId);
|
|
|
+ json.put("param", jsonObject.toString());
|
|
|
+ isyUtilsFacade.addTask("synIndividualIncomeTaxService", json.toJSONString(), TaskCatalogEnum.PERSON, "");
|
|
|
+ //isyUtilsFacade.backTask("https://test-openapi.17win.com/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
|
|
|
+ //查询反算反馈结果
|
|
|
+ //ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
|
|
|
+ //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
|
|
|
+ //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", "", TaskCatalogEnum.CAL_GET);
|
|
|
+ //isyUtilsFacade.backTask("https://test-openapi.17win.com/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
|
|
|
+ //ApiResponse<CalculateTaxResultRequest> aSynIndividualIncomeTaxFeedback = null;
|
|
|
+ //boolean istrue = true;
|
|
|
+ //while (istrue) {
|
|
|
+ // //ApiResponse<CalculateTaxResultRequest> aSynIndividualIncomeTaxFeedback = taxRequest.getReverseASynIndividualIncomeTaxFeedback(requestId);
|
|
|
+ // aSynIndividualIncomeTaxFeedback = taxRequest.getReverseASynIndividualIncomeTaxFeedback(requestId);
|
|
|
+ // //ApiResponse<CalculateTaxResultRequest> aSynIndividualIncomeTaxFeedback =taxRequest.getReverseASynIndividualIncomeTaxFeedback("9a538f46af784ec6b78fa6e2e10e7037");
|
|
|
+ // String code = aSynIndividualIncomeTaxFeedback.getHead().getCode();
|
|
|
+ // if (!"100004".equals(code)) {
|
|
|
+ // istrue = false;
|
|
|
+ // }
|
|
|
+ // logger.error("getCode---" + aSynIndividualIncomeTaxFeedback.getHead().getCode());
|
|
|
+ // logger.error("getMsg---" + aSynIndividualIncomeTaxFeedback.getHead().getMsg());
|
|
|
+ // // 等待一段时间再进行下一次轮询,这里设置为 5 秒(5000 毫秒)
|
|
|
+ // Thread.sleep(3000);
|
|
|
+ //}
|
|
|
+ //CalculateTaxResultRequest resBody = aSynIndividualIncomeTaxFeedback.getBody();
|
|
|
+ ////个税反算保存方法
|
|
|
+ //String saveId = addTaxPaymentBackCalculate(resBody, jsonObject);
|
|
|
+ //resList.add(saveId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logInfo.setErrorInfo(e.getMessage());//错误信息
|
|
|
+ LogInfoFactory.getLocalInstance(ctx).save(logInfo);
|
|
|
+ throw new SHRWebException(e);
|
|
|
+ }
|
|
|
+ JSONUtils.writeJson(response, "已增加至后台事务中执行!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取请求参数
|
|
|
+ *
|
|
|
+ * @param entry
|
|
|
+ * @param taxUnitInfo
|
|
|
+ * @param taxItemPlanNumber
|
|
|
+ * @param taxItemPlanName
|
|
|
+ * @param cmpschemeid
|
|
|
+ * @param logInfo
|
|
|
+ * @throws BOSException
|
|
|
+ * @throws EASBizException
|
|
|
+ * @throws SQLException
|
|
|
+ * @throws JsonProcessingException
|
|
|
+ */
|
|
|
+ private CalculateIndividualIncomeTaxRequest getCalculateIndividualIncomeTaxRequest(Map.Entry<String, List<TaxUnitAndPerson>> entry, TaxUnitInfo taxUnitInfo, String taxItemPlanNumber, String taxItemPlanName, String cmpschemeid, LogInfoInfo logInfo) throws BOSException, EASBizException, SQLException, JsonProcessingException {
|
|
|
+ CalculateIndividualIncomeTaxRequest calculateIndividualIncomeTaxRequest = new CalculateIndividualIncomeTaxRequest();
|
|
|
+ //外部业务编号
|
|
|
+ String replace = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ logger.error("BizNo" + replace);
|
|
|
+ calculateIndividualIncomeTaxRequest.setBizNo(replace);
|
|
|
+ //企业名称(纳税单位)
|
|
|
+ calculateIndividualIncomeTaxRequest.setName(taxUnitInfo.getName());
|
|
|
+ //calculateIndividualIncomeTaxRequest.setName("荆州九州通医药有限公司00");
|
|
|
+ //申报密码
|
|
|
+ String sbmm = new String(Base64.getDecoder().decode(taxUnitInfo.getDeclPassword()));
|
|
|
+ //String sbmm = new String(Base64.getDecoder().decode("QWExMjM0NTY="));
|
|
|
+ logger.error("sbmm----" + sbmm);
|
|
|
+ calculateIndividualIncomeTaxRequest.setDeclarePassword(sbmm);
|
|
|
+ //密码类型
|
|
|
+ calculateIndividualIncomeTaxRequest.setPasswordType(null);
|
|
|
+ //实名账号
|
|
|
+ calculateIndividualIncomeTaxRequest.setRealNameAccount(null);
|
|
|
+ //实名密码
|
|
|
+ calculateIndividualIncomeTaxRequest.setRealNamePassword(null);
|
|
|
+ //加密实名密码
|
|
|
+ calculateIndividualIncomeTaxRequest.setEncryptedRealNamePassword(null);
|
|
|
+ //登记序号
|
|
|
+ calculateIndividualIncomeTaxRequest.setRegistrationNumber(taxUnitInfo.getRegNumber());
|
|
|
+ //calculateIndividualIncomeTaxRequest.setRegistrationNumber("10117310124834931897");
|
|
|
+ //税号
|
|
|
+ calculateIndividualIncomeTaxRequest.setTaxNo(taxUnitInfo.getTaxNumber());
|
|
|
+ //calculateIndividualIncomeTaxRequest.setTaxNo("91310124834931897I");
|
|
|
+ //地区编号
|
|
|
+ calculateIndividualIncomeTaxRequest.setArea(taxUnitInfo.getAreaCode());
|
|
|
+ //calculateIndividualIncomeTaxRequest.setArea("310101");
|
|
|
+ //部门编号
|
|
|
+ calculateIndividualIncomeTaxRequest.setDeptNo(null);
|
|
|
+ //部门名称
|
|
|
+ calculateIndividualIncomeTaxRequest.setDeptName(null);
|
|
|
+ //税款所属期
|
|
|
+ //获取当前年月
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
|
|
+ String formattedDate = now.format(formatter);
|
|
|
+ calculateIndividualIncomeTaxRequest.setMonth(formattedDate);
|
|
|
+ //获取员工数据
|
|
|
+ IPersonPosition iPersonPosition = PersonPositionFactory.getLocalInstance(ctx);
|
|
|
+ Set personIds = new HashSet();
|
|
|
+ for (TaxUnitAndPerson taxUnitAndPerson : entry.getValue()) {
|
|
|
+ logger.error("personId" + taxUnitAndPerson.getPersonId());
|
|
|
+ String personId = taxUnitAndPerson.getPersonId();
|
|
|
+ personIds.add(personId);
|
|
|
+ }
|
|
|
+ FilterInfo personFilterInfo = new FilterInfo();
|
|
|
+ personFilterInfo.getFilterItems().add(new FilterItemInfo("person.id", personIds, CompareType.INCLUDE));
|
|
|
+ SelectorItemCollection personSic = new SelectorItemCollection();
|
|
|
+ personSic.add("*");
|
|
|
+ personSic.add("person.*");
|
|
|
+ personSic.add("person.employeeType.*");
|
|
|
+ personSic.add("person.nationality.*");
|
|
|
+ EntityViewInfo personEntityViewInfo = EntityViewInfo.getInstance(personFilterInfo, personSic, null);
|
|
|
+ PersonPositionCollection personPositionCollection = iPersonPosition.getPersonPositionCollection(personEntityViewInfo);
|
|
|
+ logger.error("personPositionCollection------------size" + personPositionCollection.size());
|
|
|
+ //综合所得对象
|
|
|
+ ComplexIncomeRequest complexIncomeRequest = getComplexIncomeRequest(taxItemPlanNumber, taxItemPlanName, personPositionCollection, cmpschemeid);
|
|
|
+ logger.error("complexIncomeRequest------------" + complexIncomeRequest);
|
|
|
+ //综合所得
|
|
|
+ calculateIndividualIncomeTaxRequest.setComplexIncomeRequest(complexIncomeRequest);
|
|
|
+ //非居民所得
|
|
|
+ //NonResidentsIncomeRequest nonResidentsIncomeRequest = getNonResidentsIncomeRequest(taxItemPlanName, personInfo, cmpschemeid);
|
|
|
+ logger.error("输出分组结果------------end");
|
|
|
+ logInfo.setInterfaceAddress("gateway/iit/reverseCalculateTax/calculateASynIndividualIncomeTax");//接口地址
|
|
|
+ logInfo.setInterfaceName("calculateASynIndividualIncomeTax");//接口名
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ logInfo.setInParameter(mapper.writeValueAsString(calculateIndividualIncomeTaxRequest));//入参
|
|
|
+ return calculateIndividualIncomeTaxRequest;
|
|
|
+ }
|
|
|
+ ///**
|
|
|
+ // * 税款反算
|
|
|
+ // *
|
|
|
+ // * @param request
|
|
|
+ // * @param response
|
|
|
+ // * @param modelMap
|
|
|
+ // * @throws ShrWebBizException
|
|
|
+ // * @throws BOSException
|
|
|
+ // */
|
|
|
+ //public void taxPaymentBackCalculateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException, BOSException, SQLException, EASBizException, InterruptedException {
|
|
|
+ // //计算规则ID
|
|
|
+ // String cmpschemeid = request.getParameter("cmpschemeid");
|
|
|
+ // if (StringUtils.isEmpty(cmpschemeid)) {
|
|
|
+ // throw new ShrWebBizException("计算规则ID不可为空!!");
|
|
|
+ // }
|
|
|
+ // //计算规则
|
|
|
+ // ICalScheme iCalScheme = CalSchemeFactory.getLocalInstance(ctx);
|
|
|
+ // ITaxUnit iTaxUnit = TaxUnitFactory.getLocalInstance(ctx);
|
|
|
+ // IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
+ // SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
+ // sic.add("taxItemPlanList.taxItemPlan.name");
|
|
|
+ // sic.add("taxItemPlanList.taxItemPlan.number");
|
|
|
+ // sic.add("*");
|
|
|
+ // FilterInfo filterInfo = new FilterInfo();
|
|
|
+ // filterInfo.getFilterItems().add(new FilterItemInfo("id", cmpschemeid, CompareType.EQUALS));
|
|
|
+ // EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ // CalSchemeInfo calSchemeInfo = iCalScheme.getCalSchemeCollection(entityViewInfo).get(0);
|
|
|
+ // //获取当前的薪酬核算
|
|
|
+ // CmpCalTableCollection cmpCalTableCollection = getCalSchemeColl(calSchemeInfo.getId().toString(), calSchemeInfo.getPeriodYear(), calSchemeInfo.getPeriodMonth());
|
|
|
+ // logger.error("cmpCalTableCollection--------" + cmpCalTableCollection.size());
|
|
|
+ // Map rseMap = new HashMap();
|
|
|
+ // List resList = new ArrayList();
|
|
|
+ // if (cmpCalTableCollection.size() > 0) {
|
|
|
+ // for (int i = 0; i < cmpCalTableCollection.size(); i++) {
|
|
|
+ // String personId = cmpCalTableCollection.get(i).getPerson().getId().toString();
|
|
|
+ // //自定义类 反算服务
|
|
|
+ // SixTConfirmInfo sixTConfirmInfo = new SixTConfirmInfo();
|
|
|
+ // //外部业务编号
|
|
|
+ // sixTConfirmInfo.setBizNo(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ // //获取纳税单位
|
|
|
+ // String sql = getSalaryOrgMappingByPersonId(personId);
|
|
|
+ // logger.error("getSalaryOrgMappingByPersonId--------" + sql);
|
|
|
+ // IRowSet iRowSet = DbUtil.executeQuery(ctx, sql);
|
|
|
+ // if (iRowSet.size() <= 0) {
|
|
|
+ // throw new ShrWebBizException("员工ID:" + personId + "未获取到纳税单位!!");
|
|
|
+ // }
|
|
|
+ // TaxUnitInfo taxUnitInfo = null;
|
|
|
+ // while (iRowSet.next()) {
|
|
|
+ // taxUnitInfo = iTaxUnit.getTaxUnitInfo("where id = '" + iRowSet.getString("taxunit") + "'");
|
|
|
+ // }
|
|
|
+ // //个税方案
|
|
|
+ // TaxItemPlanInfo taxItemPlan = calSchemeInfo.getTaxItemPlanList().get(0).getTaxItemPlan();
|
|
|
+ // String taxItemPlanNumber = taxItemPlan.getNumber();
|
|
|
+ // String taxItemPlanName = taxItemPlan.getName();
|
|
|
+ // //String taxItemPlanNumber = "2024083001";
|
|
|
+ // JSONObject jsonObject = new JSONObject();
|
|
|
+ // jsonObject.put("personId", personId);
|
|
|
+ // jsonObject.put("periodYear", calSchemeInfo.getPeriodYear());
|
|
|
+ // jsonObject.put("periodMonth", calSchemeInfo.getPeriodMonth());
|
|
|
+ // jsonObject.put("cmpschemeid", cmpschemeid);
|
|
|
+ // jsonObject.put("taxItemPlanName", taxItemPlanName);
|
|
|
+ // jsonObject.put("taxItemPlanNumber", taxItemPlanNumber);
|
|
|
+ // logger.error("jsonObject-------------" + jsonObject);
|
|
|
+ // ClientProxyFactory clientProxyFactory = new ClientProxyFactory(
|
|
|
+ // "46639607259987202405271637080",
|
|
|
+ // "oTmd/QGL2xOfIKItqFGKnw==",
|
|
|
+ // "https://test-openapi.17win.com");
|
|
|
+ // //反算服务
|
|
|
+ // //算税请求接口
|
|
|
+ // TaxRequest taxRequest = clientProxyFactory.getTaxRequest();
|
|
|
+ // CalculateIndividualIncomeTaxRequest calculateIndividualIncomeTaxRequest = new CalculateIndividualIncomeTaxRequest();
|
|
|
+ // //外部业务编号
|
|
|
+ // String replace = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ // logger.error("BizNo" + replace);
|
|
|
+ // calculateIndividualIncomeTaxRequest.setBizNo(replace);
|
|
|
+ // //企业名称(纳税单位)
|
|
|
+ // calculateIndividualIncomeTaxRequest.setName(taxUnitInfo.getName());
|
|
|
+ // //calculateIndividualIncomeTaxRequest.setName("荆州九州通医药有限公司00");
|
|
|
+ // //申报密码
|
|
|
+ // String sbmm = new String(Base64.getDecoder().decode(taxUnitInfo.getDeclPassword()));
|
|
|
+ // //String sbmm = new String(Base64.getDecoder().decode("QWExMjM0NTY="));
|
|
|
+ // logger.error("sbmm----" + sbmm);
|
|
|
+ // calculateIndividualIncomeTaxRequest.setDeclarePassword(sbmm);
|
|
|
+ // //密码类型
|
|
|
+ // calculateIndividualIncomeTaxRequest.setPasswordType(null);
|
|
|
+ // //实名账号
|
|
|
+ // calculateIndividualIncomeTaxRequest.setRealNameAccount(null);
|
|
|
+ // //实名密码
|
|
|
+ // calculateIndividualIncomeTaxRequest.setRealNamePassword(null);
|
|
|
+ // //加密实名密码
|
|
|
+ // calculateIndividualIncomeTaxRequest.setEncryptedRealNamePassword(null);
|
|
|
+ // //登记序号
|
|
|
+ // calculateIndividualIncomeTaxRequest.setRegistrationNumber(taxUnitInfo.getRegNumber());
|
|
|
+ // //calculateIndividualIncomeTaxRequest.setRegistrationNumber("10117310124834931897");
|
|
|
+ // //税号
|
|
|
+ // calculateIndividualIncomeTaxRequest.setTaxNo(taxUnitInfo.getTaxNumber());
|
|
|
+ // //calculateIndividualIncomeTaxRequest.setTaxNo("91310124834931897I");
|
|
|
+ // //地区编号
|
|
|
+ // calculateIndividualIncomeTaxRequest.setArea(taxUnitInfo.getAreaCode());
|
|
|
+ // //calculateIndividualIncomeTaxRequest.setArea("310101");
|
|
|
+ // //部门编号
|
|
|
+ // calculateIndividualIncomeTaxRequest.setDeptNo(null);
|
|
|
+ // //部门名称
|
|
|
+ // calculateIndividualIncomeTaxRequest.setDeptName(null);
|
|
|
+ // //税款所属期
|
|
|
+ // //获取当前年月
|
|
|
+ // LocalDateTime now = LocalDateTime.now();
|
|
|
+ // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
|
|
+ // String formattedDate = now.format(formatter);
|
|
|
+ // calculateIndividualIncomeTaxRequest.setMonth(formattedDate);
|
|
|
+ // //获取员工数据
|
|
|
+ // IPersonPosition iPersonPosition = PersonPositionFactory.getLocalInstance(ctx);
|
|
|
+ // PersonPositionInfo personPositionInfo = iPersonPosition.getPersonPositionInfo("select *,person.*,person.employeeType.* ,person.nationality.* where person.id = '" + personId + "'");
|
|
|
+ // //PersonInfo personInfo = iPerson.getPersonInfo(new ObjectUuidPK(personId));
|
|
|
+ // PersonInfo personInfo = personPositionInfo.getPerson();
|
|
|
+ // //综合所得对象
|
|
|
+ // ComplexIncomeRequest complexIncomeRequest = getComplexIncomeRequest(taxItemPlanNumber, taxItemPlanName, personInfo, cmpschemeid);
|
|
|
+ // //综合所得
|
|
|
+ // calculateIndividualIncomeTaxRequest.setComplexIncomeRequest(complexIncomeRequest);
|
|
|
+ // //非居民所得
|
|
|
+ // NonResidentsIncomeRequest nonResidentsIncomeRequest = getNonResidentsIncomeRequest(taxItemPlanName, personInfo, cmpschemeid);
|
|
|
+ // calculateIndividualIncomeTaxRequest.setNonResidentsIncomeRequest(nonResidentsIncomeRequest);
|
|
|
+ //
|
|
|
+ // ApiResponse<AsyncResult> asyncResultApiResponse = clientProxyFactory.getTaxRequest().reverseCalculateASynIndividualIncomeTax(calculateIndividualIncomeTaxRequest);
|
|
|
+ // logger.error("asyncResultApiResponse-----getCode-------" + asyncResultApiResponse.getHead().getCode());
|
|
|
+ // logger.error("asyncResultApiResponse-----getMsg--------" + asyncResultApiResponse.getHead().getMsg());
|
|
|
+ // if (asyncResultApiResponse.getHead().getCode().equals("00000000")) {
|
|
|
+ // AsyncResult body = asyncResultApiResponse.getBody();
|
|
|
+ // String requestId = body.getRequestId();
|
|
|
+ // logger.error("requestId-----" + requestId);
|
|
|
+ // //查询反算反馈结果
|
|
|
+ // //ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
|
|
|
+ // //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
|
|
|
+ // //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", "", TaskCatalogEnum.CAL_GET);
|
|
|
+ // //isyUtilsFacade.backTask("https://test-openapi.17win.com/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
|
|
|
+ // ApiResponse<CalculateTaxResultRequest> aSynIndividualIncomeTaxFeedback = null;
|
|
|
+ // boolean istrue = true;
|
|
|
+ // while (istrue) {
|
|
|
+ // //ApiResponse<CalculateTaxResultRequest> aSynIndividualIncomeTaxFeedback = taxRequest.getReverseASynIndividualIncomeTaxFeedback(requestId);
|
|
|
+ // aSynIndividualIncomeTaxFeedback = taxRequest.getReverseASynIndividualIncomeTaxFeedback(requestId);
|
|
|
+ // //ApiResponse<CalculateTaxResultRequest> aSynIndividualIncomeTaxFeedback =taxRequest.getReverseASynIndividualIncomeTaxFeedback("9a538f46af784ec6b78fa6e2e10e7037");
|
|
|
+ // String code = aSynIndividualIncomeTaxFeedback.getHead().getCode();
|
|
|
+ // if (!"100004".equals(code)) {
|
|
|
+ // istrue = false;
|
|
|
+ // }
|
|
|
+ // logger.error("getCode---" + aSynIndividualIncomeTaxFeedback.getHead().getCode());
|
|
|
+ // logger.error("getMsg---" + aSynIndividualIncomeTaxFeedback.getHead().getMsg());
|
|
|
+ // // 等待一段时间再进行下一次轮询,这里设置为 5 秒(5000 毫秒)
|
|
|
+ // Thread.sleep(3000);
|
|
|
+ // }
|
|
|
+ // CalculateTaxResultRequest resBody = aSynIndividualIncomeTaxFeedback.getBody();
|
|
|
+ // //个税反算保存方法
|
|
|
+ // String saveId = addTaxPaymentBackCalculate(resBody, jsonObject);
|
|
|
+ // resList.add(saveId);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // rseMap.put("resListSize", resList.size());
|
|
|
+ // rseMap.put("resList", resList);
|
|
|
+ // JSONUtils.writeJson(response, rseMap);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加个税反算数据
|
|
|
+ *
|
|
|
+ * @param resBody 查询反算反馈结果接口返回结果
|
|
|
+ * @param param 员工ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String addTaxPaymentBackCalculate(CalculateTaxResultRequest resBody, com.alibaba.fastjson.JSONObject param) throws BOSException, EASBizException {
|
|
|
+ logger.error("addTaxPaymentBackCalculate============Start===============");
|
|
|
+ String personId = param.getString("personId");//员工ID
|
|
|
+ String periodYear = param.getString("periodYear");//统计年
|
|
|
+ String periodMonth = param.getString("periodMonth");//统计月
|
|
|
+ String cmpschemeid = param.getString("cmpschemeid");//计算规则ID
|
|
|
+ String taxItemPlanName = param.getString("taxItemPlanName");//个税项目方案
|
|
|
+ String taxItemPlanNumber = param.getString("taxItemPlanNumber");//个税项目方案
|
|
|
+ //查询税款反算表是否存在该数据
|
|
|
+ ITaxPaymentBackCalculate iTaxPaymentBackCalculate = TaxPaymentBackCalculateFactory.getLocalInstance(ctx);
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("person", personId, CompareType.EQUALS));
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("periodMonth", periodMonth, CompareType.EQUALS));
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("periodYear", periodYear, CompareType.EQUALS));
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("cmpscheme", cmpschemeid, CompareType.EQUALS));
|
|
|
+ EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, null, null);
|
|
|
+ TaxPaymentBackCalculateCollection taxPaymentBackCalculateCollection = iTaxPaymentBackCalculate.getTaxPaymentBackCalculateCollection(entityViewInfo);
|
|
|
+ TaxPaymentBackCalculateInfo taxPaymentBackCalculateInfo = new TaxPaymentBackCalculateInfo();
|
|
|
+ if (taxPaymentBackCalculateCollection.size() > 0) {
|
|
|
+ taxPaymentBackCalculateInfo = taxPaymentBackCalculateCollection.get(0);
|
|
|
+ taxPaymentBackCalculateInfo.setId(taxPaymentBackCalculateCollection.get(0).getId());
|
|
|
+ }
|
|
|
+ //员工
|
|
|
+ taxPaymentBackCalculateInfo.setPerson(PersonFactory.getLocalInstance(ctx).getPersonInfo(new ObjectUuidPK(personId)));
|
|
|
+ //统计年
|
|
|
+ taxPaymentBackCalculateInfo.setPeriodYear(periodYear);
|
|
|
+ //统计月
|
|
|
+ taxPaymentBackCalculateInfo.setPeriodMonth(periodMonth);
|
|
|
+ //计算规则
|
|
|
+ taxPaymentBackCalculateInfo.setCmpscheme(CalSchemeFactory.getLocalInstance(ctx).getCalSchemeInfo(new ObjectUuidPK(cmpschemeid)));
|
|
|
+ //个税项目方案
|
|
|
+ taxPaymentBackCalculateInfo.setTaxItemPlan(taxItemPlanName);
|
|
|
+ ComplexTaxCalculateResult complexTaxCalculateResult = null;
|
|
|
+ //zhsd 综合所得
|
|
|
+ ComplexIncomeResultRequest complexIncomeResultRequest = resBody.getComplexIncomeResultRequest();
|
|
|
+ //全年一次性奖金
|
|
|
+ if ("2024083001".equals(taxItemPlanNumber)) {
|
|
|
+ //qnycxjjsslb 全年一次性奖金
|
|
|
+ complexTaxCalculateResult = complexIncomeResultRequest.getAnnualOneTimeBonusIncome();
|
|
|
+ }
|
|
|
+ //一般劳务报酬所得列表
|
|
|
+ if ("2024083003".equals(taxItemPlanNumber)) {
|
|
|
+ //lwbclb 一般劳务报酬所得列表
|
|
|
+ complexTaxCalculateResult = complexIncomeResultRequest.getLaborRemunerationIncome();
|
|
|
+ }
|
|
|
+ //正常工资薪金对象
|
|
|
+ if ("2024083004".equals(taxItemPlanNumber)) {
|
|
|
+ //zcgzxj 正常工资薪金对象
|
|
|
+ complexTaxCalculateResult = complexIncomeResultRequest.getNormalSalarySpecIncome();
|
|
|
+ }
|
|
|
+ List<ComplexIncome> successComplexIncomes = complexTaxCalculateResult.getSuccessComplexIncomes();
|
|
|
+ ComplexIncome complexIncome = successComplexIncomes.get(0);
|
|
|
+ //sre 收入额
|
|
|
+ BigDecimal income = complexIncome.getIncome();
|
|
|
+ taxPaymentBackCalculateInfo.setSalarySum(income);
|
|
|
+ //ybtse refundTax 应补退税额
|
|
|
+ BigDecimal refundTax = complexIncome.getRefundTax();
|
|
|
+ taxPaymentBackCalculateInfo.setIndividual(refundTax);
|
|
|
+ IObjectPK save = iTaxPaymentBackCalculate.save(taxPaymentBackCalculateInfo);
|
|
|
+ logger.error("addTaxPaymentBackCalculate============end===============");
|
|
|
+ return save.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取非居民所得 对象
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public NonResidentsIncomeRequest getNonResidentsIncomeRequest(String taxItemPlanName, PersonInfo personInfo, String cmpschemeid) throws SQLException, BOSException {
|
|
|
+ NonResidentsIncomeRequest nonResidentsIncomeRequest = new NonResidentsIncomeRequest();
|
|
|
+ List<NonResidentsIncome> foreignerWagesSalaryIncomes = new ArrayList();
|
|
|
+ NonResidentsIncome nonResidentsIncome = getNonResidentsIncome(taxItemPlanName, personInfo, cmpschemeid);
|
|
|
+ foreignerWagesSalaryIncomes.add(nonResidentsIncome);
|
|
|
+ nonResidentsIncomeRequest.setForeignerWagesSalaryIncomes(foreignerWagesSalaryIncomes);
|
|
|
+ return nonResidentsIncomeRequest;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 非居民所得-无住所个人正常工资薪金
|
|
|
+ * * taxItemPlanName 个税项目名称
|
|
|
+ * * personInfo 员工信息
|
|
|
+ * * cmpschemeid 计算规则ID
|
|
|
+ */
|
|
|
+ public NonResidentsIncome getNonResidentsIncome(String taxItemPlanName, PersonInfo personInfo, String cmpschemeid) throws SQLException, BOSException {
|
|
|
+ NonResidentsIncome nonResidentsIncome = new NonResidentsIncome();
|
|
|
+ //nonResidentsIncome.setName("何云");
|
|
|
+ //nonResidentsIncome.setLicenseType("居民身份证");
|
|
|
+ //nonResidentsIncome.setLicenseNumber("429004198601085125");
|
|
|
+ //nonResidentsIncome.setAbroadIncome(new BigDecimal("8000"));
|
|
|
+ //nonResidentsIncome.setIncomeItemName("无住所个人正常工资薪金");
|
|
|
+
|
|
|
+ //姓名
|
|
|
+ nonResidentsIncome.setName(personInfo.getName());
|
|
|
+ //complexIncome.setName("何云");
|
|
|
+ //居民身份证
|
|
|
+ if (personInfo.getIdCardNO() != null) {
|
|
|
+ //证照号码
|
|
|
+ nonResidentsIncome.setLicenseNumber(personInfo.getIdCardNO());
|
|
|
+ //证照类型
|
|
|
+ nonResidentsIncome.setLicenseType("居民身份证");
|
|
|
+ }
|
|
|
+ //中国护照不
|
|
|
+ if (personInfo.getPassportNO() != null) {
|
|
|
+ //证照类型
|
|
|
+ nonResidentsIncome.setLicenseType("中国护照");
|
|
|
+ //证照号码
|
|
|
+ nonResidentsIncome.setLicenseNumber(personInfo.getPassportNO());
|
|
|
+ }
|
|
|
+ Integer abroadIncome = getAbroadIncome(personInfo.getId().toString(), cmpschemeid);
|
|
|
+ //complexIncome.setLicenseNumber("429004198601085125");
|
|
|
+ //税后收入额
|
|
|
+ nonResidentsIncome.setAbroadIncome(new BigDecimal(abroadIncome));
|
|
|
+ nonResidentsIncome.setIncomeItemName(taxItemPlanName);
|
|
|
+ return nonResidentsIncome;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取综合所得
|
|
|
+ * taxItemPlanNumber 个税项目编码
|
|
|
+ * taxItemPlanName 个税项目名称
|
|
|
+ * personInfo 员工信息
|
|
|
+ * cmpschemeid 计算规则ID
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ComplexIncomeRequest getComplexIncomeRequest(String taxItemPlanNumber, String taxItemPlanName, PersonPositionCollection personPositionCollection, String cmpschemeid) throws BOSException, EASBizException, SQLException {
|
|
|
+ logger.error("getComplexIncomeRequest-----" + taxItemPlanNumber + "---" + taxItemPlanName + "---" + personPositionCollection + "---" + cmpschemeid);
|
|
|
+ ComplexIncomeRequest complexIncomeRequest = new ComplexIncomeRequest();
|
|
|
+ //全年一次性奖金
|
|
|
+ if (taxItemPlanNumber.equals("2024083001")) {
|
|
|
+ List<ComplexIncome> aOneBonusIncomeList = new ArrayList();
|
|
|
+ for (int i = 0; i < personPositionCollection.size(); i++) {
|
|
|
+ PersonPositionInfo personPositionInfo = personPositionCollection.get(i);
|
|
|
+ PersonInfo personInfo = personPositionInfo.getPerson();
|
|
|
+ ComplexIncome annualOneTimeBonusIncome = getAnnualOneTimeBonusIncome(personInfo, taxItemPlanName, cmpschemeid);
|
|
|
+ aOneBonusIncomeList.add(annualOneTimeBonusIncome);
|
|
|
+ complexIncomeRequest.setAnnualOneTimeBonusIncome(aOneBonusIncomeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //一般劳务报酬所得列表
|
|
|
+ if (taxItemPlanNumber.equals("2024083003")) {
|
|
|
+ List<ComplexIncome> complexIncomeList = new ArrayList();
|
|
|
+ for (int i = 0; i < personPositionCollection.size(); i++) {
|
|
|
+ PersonPositionInfo personPositionInfo = personPositionCollection.get(i);
|
|
|
+ PersonInfo personInfo = personPositionInfo.getPerson();
|
|
|
+ ComplexIncome laborRemunerationIncome = getLaborRemunerationIncome(personInfo, taxItemPlanName, cmpschemeid);
|
|
|
+ complexIncomeList.add(laborRemunerationIncome);
|
|
|
+ complexIncomeRequest.setLaborRemunerationIncome(complexIncomeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //正常工资薪金对象
|
|
|
+ if (taxItemPlanNumber.equals("2024083004")) {
|
|
|
+ NormalSalarySpecIncome normalSalarySpecIncome = getNormalSalarySpecIncome(personPositionCollection);
|
|
|
+ complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome);
|
|
|
+ }
|
|
|
+ return complexIncomeRequest;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取全年一次性奖金
|
|
|
+ * taxItemPlanName 个税项目名称
|
|
|
+ * cmpschemeid 计算规则ID
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ComplexIncome getAnnualOneTimeBonusIncome(PersonInfo personInfo, String taxItemPlanName, String cmpschemeid) throws SQLException, BOSException {
|
|
|
+ ComplexIncome complexIncome = new ComplexIncome();
|
|
|
+ //姓名
|
|
|
+ complexIncome.setName(personInfo.getName());
|
|
|
+ //complexIncome.setName("何云");
|
|
|
+ //居民身份证
|
|
|
+ if (personInfo.getIdCardNO() != null) {
|
|
|
+ //证照号码
|
|
|
+ complexIncome.setLicenseNumber(personInfo.getIdCardNO());
|
|
|
+ //证照类型
|
|
|
+ complexIncome.setLicenseType("居民身份证");
|
|
|
+ }
|
|
|
+ //中国护照不
|
|
|
+ if (personInfo.getPassportNO() != null) {
|
|
|
+ //证照类型
|
|
|
+ complexIncome.setLicenseType("中国护照");
|
|
|
+ //证照号码
|
|
|
+ complexIncome.setLicenseNumber(personInfo.getPassportNO());
|
|
|
+ }
|
|
|
+ Integer abroadIncome = getAbroadIncome(personInfo.getId().toString(), cmpschemeid);
|
|
|
+ //complexIncome.setLicenseNumber("429004198601085125");
|
|
|
+ //税后收入额
|
|
|
+ complexIncome.setAbroadIncome(new BigDecimal(abroadIncome));
|
|
|
+ complexIncome.setIncomeItemName(taxItemPlanName);
|
|
|
+ return complexIncome;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取一般劳务报酬所得
|
|
|
+ * taxItemPlanName 个税项目名称
|
|
|
+ * cmpschemeid 计算规则ID
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ComplexIncome getLaborRemunerationIncome(PersonInfo personInfo, String taxItemPlanName, String cmpschemeid) throws SQLException, BOSException {
|
|
|
+ ComplexIncome complexIncome = new ComplexIncome();
|
|
|
+ //姓名
|
|
|
+ complexIncome.setName(personInfo.getName());
|
|
|
+ //complexIncome.setName("何云");
|
|
|
+ //居民身份证
|
|
|
+ if (personInfo.getIdCardNO() != null) {
|
|
|
+ //证照号码
|
|
|
+ complexIncome.setLicenseNumber(personInfo.getIdCardNO());
|
|
|
+ //证照类型
|
|
|
+ complexIncome.setLicenseType("居民身份证");
|
|
|
+ }
|
|
|
+ //中国护照不
|
|
|
+ if (personInfo.getPassportNO() != null) {
|
|
|
+ //证照类型
|
|
|
+ complexIncome.setLicenseType("中国护照");
|
|
|
+ //证照号码
|
|
|
+ complexIncome.setLicenseNumber(personInfo.getPassportNO());
|
|
|
+ }
|
|
|
+ Integer abroadIncome = getAbroadIncome(personInfo.getId().toString(), cmpschemeid);
|
|
|
+ //complexIncome.setLicenseNumber("429004198601085125");
|
|
|
+ //税后收入额
|
|
|
+ complexIncome.setAbroadIncome(new BigDecimal(abroadIncome));
|
|
|
+ complexIncome.setIncomeItemName(taxItemPlanName);
|
|
|
+ return complexIncome;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取正常工资薪金对象
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public NormalSalarySpecIncome getNormalSalarySpecIncome(PersonPositionCollection personPositionCollection) throws BOSException, EASBizException {
|
|
|
+ //正常工资薪金对象
|
|
|
+ NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome();
|
|
|
+ //人员列表
|
|
|
+ List<DetailCompanyEmployee> companyEmployeeList = new ArrayList();
|
|
|
+ for (int i = 0; i < personPositionCollection.size(); i++) {
|
|
|
+ PersonPositionInfo personPositionInfo = personPositionCollection.get(i);
|
|
|
+ PersonInfo personInfo = personPositionInfo.getPerson();
|
|
|
+ //获取人员数据
|
|
|
+ DetailCompanyEmployee detailCompanyEmployee = getDetailCompanyEmployee(personInfo);
|
|
|
+ companyEmployeeList.add(detailCompanyEmployee);
|
|
|
+ }
|
|
|
+ normalSalarySpecIncome.setCompanyEmployeeList(companyEmployeeList);
|
|
|
+ return normalSalarySpecIncome;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 人员
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public DetailCompanyEmployee getDetailCompanyEmployee(PersonInfo personInfo) throws BOSException, EASBizException {
|
|
|
+
|
|
|
+ //人员对象
|
|
|
+ DetailCompanyEmployee detailCompanyEmployee = new DetailCompanyEmployee();
|
|
|
+ ////姓名
|
|
|
+ //detailCompanyEmployee.setName("何云");
|
|
|
+ ////证件类型
|
|
|
+ //detailCompanyEmployee.setLicenseType("居民身份证");
|
|
|
+ ////证照号码
|
|
|
+ //detailCompanyEmployee.setLicenseNumber("429004198601085125");
|
|
|
+ //姓名
|
|
|
+ detailCompanyEmployee.setName(personInfo.getName());
|
|
|
+ //complexIncome.setName("何云");
|
|
|
+ //居民身份证
|
|
|
+ if (personInfo.getIdCardNO() != null) {
|
|
|
+ //证照号码
|
|
|
+ detailCompanyEmployee.setLicenseNumber(personInfo.getIdCardNO());
|
|
|
+ //证照类型
|
|
|
+ detailCompanyEmployee.setLicenseType("居民身份证");
|
|
|
+ //人员地区
|
|
|
+ detailCompanyEmployee.setArea("境内");
|
|
|
+ }
|
|
|
+ //中国护照
|
|
|
+ if (personInfo.getPassportNO() != null) {
|
|
|
+ //证照类型
|
|
|
+ detailCompanyEmployee.setLicenseType("中国护照");
|
|
|
+ //证照号码
|
|
|
+ detailCompanyEmployee.setLicenseNumber(personInfo.getPassportNO());
|
|
|
+ //人员地区
|
|
|
+ detailCompanyEmployee.setArea("境外");
|
|
|
+ }
|
|
|
+ //电话号码
|
|
|
+ detailCompanyEmployee.setPhone(personInfo.getCell());
|
|
|
+
|
|
|
+ //人员状态
|
|
|
+ detailCompanyEmployee.setState(personInfo.getEmployeeType().getName());
|
|
|
+ //人员报税信息->任职受雇从业信息
|
|
|
+ ITaxPersonRecordEntry iTaxPersonRecordEntry = TaxPersonRecordEntryFactory.getLocalInstance(ctx);
|
|
|
+ TaxPersonRecordEntryCollection taxPersonRecordEntryCollection = iTaxPersonRecordEntry.getTaxPersonRecordEntryCollection("where person.id = '" + personInfo.getId() + "'");
|
|
|
+ TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntryCollection.get(0);
|
|
|
+ //任职受雇类型 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育)
|
|
|
+ //detailCompanyEmployee.setIsEmployee("其他");
|
|
|
+ detailCompanyEmployee.setIsEmployee(taxPersonRecordEntryInfo.getEmployedType().getAlias());
|
|
|
+ //受雇日期 YYYY-MM-DD,不能大于当前时间,任职受雇类型选择雇员、保险营销员、证券经纪人时必录
|
|
|
+ SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ detailCompanyEmployee.setEmployedDate(inputFormat.format(taxPersonRecordEntryInfo.getEmployedDate()));
|
|
|
+ //性别
|
|
|
+ detailCompanyEmployee.setGender(personInfo.getGender().getAlias());
|
|
|
+ //出生日期
|
|
|
+ detailCompanyEmployee.setBirthday(inputFormat.format(personInfo.getBirthday()));
|
|
|
+ //国籍 nationality
|
|
|
+ NationalityInfo nationality = personInfo.getNationality();
|
|
|
+ detailCompanyEmployee.setNationality(nationality.getName());
|
|
|
+
|
|
|
+ return detailCompanyEmployee;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取税后收入额 系统字段=税后保实发
|
|
|
+ *
|
|
|
+ * @param perosnId
|
|
|
+ * @param cmpschemeid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer getAbroadIncome(String perosnId, String cmpschemeid) throws BOSException, SQLException {
|
|
|
+ String sql = String.format("select S336 from T_HR_SCmpCalTable where FPERSONID = '%s' and FCALSCHEMEID = '%s'", perosnId, cmpschemeid);
|
|
|
+ logger.error("getAbroadIncomeSql---------------" + sql);
|
|
|
+ IRowSet iRowSet = DbUtil.executeQuery(ctx, sql);
|
|
|
+ Integer abroadIncome = null;
|
|
|
+ while (iRowSet.next()) {
|
|
|
+ abroadIncome = iRowSet.getInt("S336");
|
|
|
+ }
|
|
|
+ return abroadIncome;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取纳税单元
|
|
|
+ *
|
|
|
+ * @param personId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getSalaryOrgMappingByPersonId(String personId) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("select top 1 ").append("\n");
|
|
|
+ sb.append("cmpOrgUnitCus.FTAXUNITID as taxunit").append("\n");
|
|
|
+ sb.append("from CT_COM_CmpOrgUnitCus cmpOrgUnitCus").append("\n");
|
|
|
+ sb.append("left join T_HR_SPersonCmp personCmp on personCmp.Fid = cmpOrgUnitCus.FPERSONCMPID").append("\n");
|
|
|
+ sb.append("left join T_bd_person person on person.Fid = personCmp.FPERSONID").append("\n");
|
|
|
+ sb.append("where").append("\n");
|
|
|
+ sb.append("person.Fid = '").append(personId).append("'").append("\n");
|
|
|
+ sb.append("order by cmpOrgUnitCus.FLEFFECTTIME desc ").append("\n");
|
|
|
+ return sb.toString();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ///**
|
|
|
+ // * 同步人员纳税信息
|
|
|
+ // *
|
|
|
+ // * @param request
|
|
|
+ // * @param response
|
|
|
+ // * @param modelMap
|
|
|
+ // * @throws ShrWebBizException
|
|
|
+ // * @throws BOSException
|
|
|
+ // */
|
|
|
+ //public void synTaxPersonRecordAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws ShrWebBizException, BOSException {
|
|
|
+ // //计算规则ID
|
|
|
+ // String cmpschemeid = request.getParameter("cmpschemeid");
|
|
|
+ // if (StringUtils.isEmpty(cmpschemeid)) {
|
|
|
+ // throw new ShrWebBizException("计算规则ID不可为空!!");
|
|
|
+ // }
|
|
|
+ // //计算规则
|
|
|
+ // ICalScheme iCalScheme = CalSchemeFactory.getLocalInstance(ctx);
|
|
|
+ // try {
|
|
|
+ // CalSchemeInfo calSchemeInfo = iCalScheme.getCalSchemeInfo(new ObjectUuidPK(cmpschemeid));
|
|
|
+ // //获取上一个月的计算规则 统计年:periodYear 统计月:periodMonth
|
|
|
+ // LocalDate date = LocalDate.of(calSchemeInfo.getPeriodYear(), calSchemeInfo.getPeriodMonth(), 1);
|
|
|
+ // LocalDate previousMonthDate = date.minusMonths(1);
|
|
|
+ // //获取上个月的薪酬核算
|
|
|
+ // //CalSchemeInfo calSchemeUp = iCalScheme.getCalSchemeInfo("where periodYear = '" + previousMonthDate.getYear() + "' and periodMonth = '" + previousMonthDate.getMonthValue() + "'");
|
|
|
+ // CmpCalTableCollection cmpCalTableCollectionUp = getCalSchemeColl(calSchemeInfo.getId().toString(), previousMonthDate.getYear(), previousMonthDate.getMonthValue());
|
|
|
+ // logger.error("cmpCalTableCollectionUp--------" + cmpCalTableCollectionUp.size());
|
|
|
+ //
|
|
|
+ // //获取当前的薪酬核算
|
|
|
+ // CmpCalTableCollection cmpCalTableCollection = getCalSchemeColl(calSchemeInfo.getId().toString(), calSchemeInfo.getPeriodYear(), calSchemeInfo.getPeriodMonth());
|
|
|
+ // logger.error("cmpCalTableCollection--------" + cmpCalTableCollection.size());
|
|
|
+ //
|
|
|
+ // //保存上个月的核算人员
|
|
|
+ // List<String> listUp = new ArrayList<>();
|
|
|
+ // for (int i = 0; i < cmpCalTableCollectionUp.size(); i++) {
|
|
|
+ // listUp.add(cmpCalTableCollectionUp.get(i).getPerson().getId().toString());
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // //保存当前月的核算人员
|
|
|
+ // List<String> list = new ArrayList<>();
|
|
|
+ // for (int i = 0; i < cmpCalTableCollection.size(); i++) {
|
|
|
+ // list.add(cmpCalTableCollection.get(i).getPerson().getId().toString());
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // Set<String> setUp = new HashSet<>(listUp);
|
|
|
+ // Set<String> set = new HashSet<>(list);
|
|
|
+ //
|
|
|
+ // // 找出 上个月核算人员 中比 当前月核算人员 多的数据 为离职人员 修改人员纳税信息的 人员状态为非正常 离职日期为当前月最后一天
|
|
|
+ // Set<String> pseronIdsUp = new HashSet<>(setUp);
|
|
|
+ // pseronIdsUp.removeAll(set);
|
|
|
+ //
|
|
|
+ // // 找出 当前月核算人员 中比 上个月核算人员 多的数据 为新增人员 创建人员纳税信息和任职受雇从业信息 人员状态为正常 任职受雇从业日期为当前月1号
|
|
|
+ // Set<String> pseronIds = new HashSet<>(set);
|
|
|
+ // pseronIds.removeAll(setUp);
|
|
|
+ //
|
|
|
+ // SelectorItemCollection updateSic = new SelectorItemCollection();
|
|
|
+ // updateSic.add("personStatus");
|
|
|
+ // updateSic.add("departureDate");
|
|
|
+ // //处理修改的人员纳税信息
|
|
|
+ // ITaxPersonRecordEntry iTaxPersonRecordEntry = TaxPersonRecordEntryFactory.getLocalInstance(ctx);
|
|
|
+ // //判断修改人员ID大于0 则修改人员纳税信息
|
|
|
+ // if (pseronIdsUp.size() > 0) {
|
|
|
+ // //获取任职受雇从业信息 修改人员纳税信息的 人员状态为非正常 离职日期为当前月最后一天
|
|
|
+ // TaxPersonRecordEntryCollection taxPersonRecordEntryCollUp = getTaxPersonRecordEntryColl(pseronIdsUp, iTaxPersonRecordEntry);
|
|
|
+ // if (taxPersonRecordEntryCollUp.size() > 0) {
|
|
|
+ // for (int i = 0; i < taxPersonRecordEntryCollUp.size(); i++) {
|
|
|
+ // TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntryCollUp.get(i);
|
|
|
+ // //人员状态
|
|
|
+ // taxPersonRecordEntryInfo.setPersonStatus(PersonStatusEnum.NotNormal);
|
|
|
+ // //获取当前月的最后一天转成Date类型
|
|
|
+ // Date departureDate = Date.from(date.withDayOfMonth(date.lengthOfMonth()).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
+ // //离职日期为当前月最后一天
|
|
|
+ // taxPersonRecordEntryInfo.setDepartureDate(departureDate);
|
|
|
+ // iTaxPersonRecordEntry.updatePartial(taxPersonRecordEntryInfo, updateSic);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //调用新增人员纳税信息方法
|
|
|
+ // if (pseronIds.size() > 0) {
|
|
|
+ // //Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()) 当前月第一天
|
|
|
+ // addTaxPersonRecord(pseronIds, Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
|
|
+ // }
|
|
|
+ // Map res = new HashMap();
|
|
|
+ // res.put("update", pseronIdsUp.size());
|
|
|
+ // res.put("add", pseronIds.size());
|
|
|
+ // JSONUtils.writeJson(response, res);
|
|
|
+ // } catch (EASBizException e) {
|
|
|
+ // e.printStackTrace();
|
|
|
+ // throw new ShrWebBizException("计算规则ID【" + cmpschemeid + "】未获取到,请联系管理员!!");
|
|
|
+ // } catch (SQLException e) {
|
|
|
+ // throw new ShrWebBizException(e);
|
|
|
+ // } catch (SHRWebException e) {
|
|
|
+ // throw new ShrWebBizException(e);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ //}
|
|
|
+
|
|
|
+ ///**
|
|
|
+ // * 新增人员纳税信息
|
|
|
+ // *
|
|
|
+ // * @param pseronIds
|
|
|
+ // */
|
|
|
+ //public void addTaxPersonRecord(Set<String> pseronIds, Date oneDay) throws BOSException, EASBizException, SQLException {
|
|
|
+ // logger.error("addTaxPersonRecord--------新增开始");
|
|
|
+ // //pseronIds.forEach(id -> {});
|
|
|
+ // ITaxPersonRecord iTaxPersonRecord = TaxPersonRecordFactory.getLocalInstance(ctx);
|
|
|
+ // IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
+ // ITaxPersonRecordEntry iTaxPersonRecordEntry = TaxPersonRecordEntryFactory.getLocalInstance(ctx);
|
|
|
+ // //人员纳税分录对象
|
|
|
+ // TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = new TaxPersonRecordEntryInfo();
|
|
|
+ // SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
+ // sic.add("*");
|
|
|
+ // FilterInfo filterInfo = new FilterInfo();
|
|
|
+ // filterInfo.getFilterItems().add(new FilterItemInfo("id", pseronIds, CompareType.INCLUDE));
|
|
|
+ // EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ // PersonCollection personCollection = iPerson.getPersonCollection(entityViewInfo);
|
|
|
+ // if (personCollection.size() > 0) {
|
|
|
+ // for (int i = 0; i < personCollection.size(); i++) {
|
|
|
+ // PersonInfo personInfo = personCollection.get(i);
|
|
|
+ // boolean exists = iTaxPersonRecordEntry.exists("where person = '" + personInfo.getId().toString() + "'");
|
|
|
+ // if (!exists) {
|
|
|
+ //
|
|
|
+ // TaxPersonRecordInfo taxPersonRecordInfo = new TaxPersonRecordInfo();
|
|
|
+ // //人员
|
|
|
+ // taxPersonRecordInfo.setPerson(personInfo);
|
|
|
+ // //证件类型
|
|
|
+ // if (personInfo.getIdCardNO() != null || personInfo.getPassportNO() != null) {
|
|
|
+ // if (null == personInfo.getIdCardNO()) {
|
|
|
+ // //护照
|
|
|
+ // taxPersonRecordInfo.setCardType(CardTypeEnum.Passport);
|
|
|
+ // taxPersonRecordInfo.setCardNumber(personInfo.getPassportNO());
|
|
|
+ // //纳税人类型
|
|
|
+ // taxPersonRecordEntryInfo.setPayerType(PayerTypeEnum.NotResident);
|
|
|
+ // }
|
|
|
+ // if (null == personInfo.getPassportNO()) {
|
|
|
+ // //证件号
|
|
|
+ // taxPersonRecordInfo.setCardType(CardTypeEnum.IdCard);
|
|
|
+ // taxPersonRecordInfo.setCardNumber(personInfo.getIdCardNO());
|
|
|
+ // //纳税人类型
|
|
|
+ // taxPersonRecordEntryInfo.setPayerType(PayerTypeEnum.Resident);
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // logger.error(personInfo.getName() + "护照和身份证为空,证件类型保存失败!");
|
|
|
+ // }
|
|
|
+ // //性别
|
|
|
+ // taxPersonRecordInfo.setGender(personInfo.getGender());
|
|
|
+ // //出生日期
|
|
|
+ // taxPersonRecordInfo.setBirthday(personInfo.getBirthday());
|
|
|
+ // //国籍
|
|
|
+ // taxPersonRecordInfo.setNationality(personInfo.getNationality());
|
|
|
+ // //是否境外人员
|
|
|
+ // taxPersonRecordInfo.setIsOversea(IsOverseaEnum.NotOversea);
|
|
|
+ // //手机号码
|
|
|
+ // taxPersonRecordInfo.setPhoneNumber(personInfo.getCell());
|
|
|
+ // iTaxPersonRecord.save(taxPersonRecordInfo);
|
|
|
+ // //保存分录数据
|
|
|
+ // taxPersonRecordEntryInfo.setPerson(personInfo);
|
|
|
+ // taxPersonRecordEntryInfo.setBill(taxPersonRecordInfo);
|
|
|
+ // //获取纳税单位
|
|
|
+ // String sql = getSalaryOrgMappingByPersonId(personInfo.getId().toString());
|
|
|
+ // IRowSet iRowSet = DbUtil.executeQuery(ctx, sql);
|
|
|
+ // ITaxUnit iTaxUnit = TaxUnitFactory.getLocalInstance(ctx);
|
|
|
+ // if (iRowSet.size() > 0) {
|
|
|
+ // while (iRowSet.next()) {
|
|
|
+ // TaxUnitInfo taxUnitInfo = iTaxUnit.getTaxUnitInfo("where number = '" + iRowSet.getString("nsdwmc") + "'");
|
|
|
+ // taxPersonRecordEntryInfo.setTaxUnit(taxUnitInfo);
|
|
|
+ // //人员状态
|
|
|
+ // taxPersonRecordEntryInfo.setPersonStatus(PersonStatusEnum.Normal);
|
|
|
+ // //获取当前月的最后一天转成Date类型 //任职受雇从业日期为当前月第一天
|
|
|
+ // taxPersonRecordEntryInfo.setEmployedDate(oneDay);
|
|
|
+ // //报送状态
|
|
|
+ // taxPersonRecordEntryInfo.setSubmitStatus(SubmitStatusEnum.NotSubmit);
|
|
|
+ // iTaxPersonRecordEntry.save(taxPersonRecordEntryInfo);
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // logger.error("iRowSet-----Sql---" + sql);
|
|
|
+ // logger.error("iRowSet--------" + personInfo.getName() + "未获取到纳税单位,字段保存失败!!");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // logger.error("addTaxPersonRecord--------新增结束");
|
|
|
+ //}
|
|
|
+
|
|
|
+
|
|
|
+ ///**
|
|
|
+ // * 获取任职受雇从业信息
|
|
|
+ // *
|
|
|
+ // * @param pseronIds 员工ID集合
|
|
|
+ // * @return
|
|
|
+ // * @throws BOSException
|
|
|
+ // */
|
|
|
+ //public TaxPersonRecordEntryCollection getTaxPersonRecordEntryColl(Set<String> pseronIds, ITaxPersonRecordEntry iTaxPersonRecordEntry) throws BOSException {
|
|
|
+ // //获取当前月的薪酬计算
|
|
|
+ // FilterInfo filterInfo = new FilterInfo();
|
|
|
+ // filterInfo.getFilterItems().add(new FilterItemInfo("bill.person", pseronIds, CompareType.INCLUDE));
|
|
|
+ // EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, null, null);
|
|
|
+ // return iTaxPersonRecordEntry.getTaxPersonRecordEntryCollection(entityViewInfo);
|
|
|
+ //}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过计算规则id获取薪酬核算数据
|
|
|
+ *
|
|
|
+ * @param cmpschemeid
|
|
|
+ * @throws BOSException
|
|
|
+ */
|
|
|
+ public CmpCalTableCollection getCalSchemeColl(String cmpschemeid, int year, int month) throws BOSException {
|
|
|
+ ICmpCalTable iCmpCalTable = CmpCalTableFactory.getLocalInstance(ctx);
|
|
|
+ SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
+ sic.add("*");
|
|
|
+ sic.add("calScheme.*");
|
|
|
+ sic.add("person.*");
|
|
|
+ //获取当前月的薪酬计算
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("calScheme", cmpschemeid, CompareType.EQUALS));
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("periodYear", year, CompareType.EQUALS));
|
|
|
+ filterInfo.getFilterItems().add(new FilterItemInfo("periodMonth", month, CompareType.EQUALS));
|
|
|
+ EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ CmpCalTableCollection cmpCalTableCollection = iCmpCalTable.getCmpCalTableCollection(entityViewInfo);
|
|
|
+ return cmpCalTableCollection;
|
|
|
+ }
|
|
|
+}
|