|
|
@@ -10,11 +10,16 @@ import com.kingdee.bos.BOSException;
|
|
|
import com.kingdee.bos.Context;
|
|
|
import com.kingdee.bos.bsf.service.app.IHRMsfService;
|
|
|
import com.kingdee.bos.ctrl.swing.StringUtils;
|
|
|
+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;
|
|
|
@@ -23,6 +28,9 @@ 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.*;
|
|
|
import com.kingdee.shr.compensation.app.tax.base.ITaxIncomeItem;
|
|
|
import com.kingdee.shr.compensation.app.tax.base.TaxIncomeItemFactory;
|
|
|
@@ -84,9 +92,8 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
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();
|
|
|
@@ -102,11 +109,22 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
*
|
|
|
* @param param
|
|
|
*/
|
|
|
- public void saveTaxDeclaration(Context ctx, JSONObject param) throws BOSException {
|
|
|
+ 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("declareStatus");
|
|
|
+ if (incomeTaxDeclarCollection.size() > 0) {
|
|
|
+ IncomeTaxDeclarInfo incomeTaxDeclarInfo = incomeTaxDeclarCollection.get(0);
|
|
|
+ incomeTaxDeclarInfo.setDeclareStatus(TaxDeclareStatusEnum.DECLARE_SUCCESS);
|
|
|
+ iIncomeTaxDeclar.updatePartial(incomeTaxDeclarInfo, updateSic);
|
|
|
+ }
|
|
|
////个税应用+税款计算最终拆分明细表
|
|
|
//ITaxCalConfigDetail taxCalConfigDetail = TaxCalConfigDetailFactory.getLocalInstance(ctx);
|
|
|
//TaxCalConfigDetailCollection taxCalConfigDetailCollection = taxCalConfigDetail.getTaxCalConfigDetailCollection("select *,incomeItem.*, person.* where batchNo = '" + taxDeclarBatchNo + "' and state = '20'");
|
|
|
@@ -120,11 +138,12 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
ITaxDeclaration iTaxDeclaration = TaxDeclarationFactory.getLocalInstance(ctx);
|
|
|
//个税项目
|
|
|
ITaxIncomeItem iTaxIncomeItem = TaxIncomeItemFactory.getLocalInstance(ctx);
|
|
|
+ IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
List<Map<String, Object>> taxDeclarationDate = getTaxDeclarationDate(ctx, taxDeclarBatchNo);
|
|
|
for (int i = 0; i < taxDeclarationDate.size(); i++) {
|
|
|
Map<String, Object> map = taxDeclarationDate.get(i);
|
|
|
TaxIncomeItemInfo taxIncomeItemInfo = iTaxIncomeItem.getTaxIncomeItemCollection("where id = '" + map.get("incomeitmemId") + "'").get(0);
|
|
|
-
|
|
|
+ logger.error("taxIncomeItemInfo------------------" + taxIncomeItemInfo);
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
filterInfo.getFilterItems().add(new FilterItemInfo("person", map.get("personId"), CompareType.EQUALS));
|
|
|
filterInfo.getFilterItems().add(new FilterItemInfo("taxUnit", map.get("taxunitId"), CompareType.EQUALS));
|
|
|
@@ -133,12 +152,18 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
filterInfo.getFilterItems().add(new FilterItemInfo("proceedItem", taxIncomeItemInfo.getName(), CompareType.EQUALS));
|
|
|
EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, null, null);
|
|
|
TaxDeclarationCollection taxDeclarationCollection = iTaxDeclaration.getTaxDeclarationCollection(entityViewInfo);
|
|
|
+ logger.error("taxDeclarationCollection.size------------------" + taxDeclarationCollection.size());
|
|
|
if (taxDeclarationCollection.size() <= 0) {
|
|
|
TaxDeclarationInfo taxDeclarationInfo = new TaxDeclarationInfo();
|
|
|
//员工
|
|
|
- PersonInfo personInfo = new PersonInfo();
|
|
|
- personInfo.setId(BOSUuid.read((String) map.get("personId")));
|
|
|
+ PersonInfo personInfo = iPerson.getPersonInfo(new ObjectUuidPK((String) map.get("personId")));
|
|
|
taxDeclarationInfo.setPerson(personInfo);
|
|
|
+ //证件号
|
|
|
+ taxDeclarationInfo.setIdNO(personInfo.getIdCardNO());
|
|
|
+ //证件类型
|
|
|
+ TaxPersonRecordInfo taxPersonRecordInfo = TaxPersonRecordFactory.getLocalInstance(ctx).getTaxPersonRecordCollection("where person = '" + personInfo.getId() + "'").get(0);
|
|
|
+ String alias = taxPersonRecordInfo.getCardType().getAlias();
|
|
|
+ taxDeclarationInfo.setIdType(alias);
|
|
|
//纳税单位
|
|
|
TaxUnitInfo taxUnitInfo = new TaxUnitInfo();
|
|
|
taxUnitInfo.setId(BOSUuid.read((String) map.get("taxunitId")));
|
|
|
@@ -174,7 +199,10 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
taxDeclarationInfo.setTaxSupOrRefund((BigDecimal) map.get("t38"));//应补/退税额
|
|
|
taxDeclarationInfo.setInFantSum((BigDecimal) map.get("t45"));//累计婴幼儿照护费用
|
|
|
taxDeclarationInfo.setPersonalPension((BigDecimal) map.get("t46"));//累计个人养老金
|
|
|
- iTaxDeclaration.save(taxDeclarationInfo);
|
|
|
+ logger.error("taxDeclarationInfo------------------" + taxDeclarationInfo);
|
|
|
+ IObjectPK save = iTaxDeclaration.save(taxDeclarationInfo);
|
|
|
+ logger.error("taxDeclarationInfo----------save--------" + save);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
} catch (SQLException e) {
|
|
|
@@ -194,6 +222,7 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
public List<Map<String, Object>> getTaxDeclarationDate(Context ctx, String batchNo) throws BOSException, SQLException {
|
|
|
List list = new ArrayList();
|
|
|
String sql = getSql(batchNo);
|
|
|
+ logger.error("getTaxDeclarationDate------sql--------" + sql);
|
|
|
IRowSet iRowSet = DbUtil.executeQuery(ctx, sql);
|
|
|
while (iRowSet.next()) {
|
|
|
Map map = new HashMap();
|
|
|
@@ -202,35 +231,36 @@ public class SynIncomeTaxDeclareService implements IHRMsfService {
|
|
|
map.put("periodbegin", iRowSet.getDate("periodbegin"));//税款所属期间起始时间
|
|
|
map.put("periodend", iRowSet.getDate("periodend"));//税款所属期间截止时间
|
|
|
map.put("incomeitmemId", iRowSet.getString("incomeitmemId"));//个税项目Id
|
|
|
- map.put("t25", iRowSet.getBigDecimal("t25"));//本期收入
|
|
|
- map.put("t1", iRowSet.getBigDecimal(" t1"));//本期免税收入
|
|
|
- map.put("t2", iRowSet.getBigDecimal("t2"));//基本养老保险费
|
|
|
- map.put("t3", iRowSet.getBigDecimal("t3"));//基本医疗保险费
|
|
|
- map.put("t4", iRowSet.getBigDecimal("t4"));//失业保险费
|
|
|
- map.put("t5", iRowSet.getBigDecimal("t5"));//住房公积金
|
|
|
- map.put("t6", iRowSet.getBigDecimal("t6"));//累计子女教育
|
|
|
- map.put("t7", iRowSet.getBigDecimal("t7"));//累计继续教育
|
|
|
- map.put("t8", iRowSet.getBigDecimal("t8"));//累计住房贷款利息
|
|
|
- map.put("t9", iRowSet.getBigDecimal("t9"));//累计住房租金
|
|
|
- map.put("t10", iRowSet.getBigDecimal("t10"));//累计赡养老人
|
|
|
- map.put("t11", iRowSet.getBigDecimal("t11"));//其他
|
|
|
- map.put("t15", iRowSet.getBigDecimal("t15"));//本期累计收入
|
|
|
- map.put("t20", iRowSet.getBigDecimal("t20"));//本期累计免税收入
|
|
|
- map.put("t22", iRowSet.getBigDecimal("t22"));//累计减除费用
|
|
|
- map.put("t24", iRowSet.getBigDecimal("t24"));//累计专项扣除
|
|
|
- map.put("t26", iRowSet.getBigDecimal("t26"));//累计其他扣除
|
|
|
- map.put("t28", iRowSet.getBigDecimal("t28"));//累计准予扣除的捐赠
|
|
|
- map.put("t29", iRowSet.getBigDecimal("t29"));//累计应纳税所得额
|
|
|
- map.put("t30", iRowSet.getBigDecimal("t30"));//税率
|
|
|
- map.put("t31", iRowSet.getBigDecimal("t31"));//速算扣除数
|
|
|
- map.put("t32", iRowSet.getBigDecimal("t32"));//累计应纳税额
|
|
|
- map.put("t33", iRowSet.getBigDecimal("t33"));//累计减免税额
|
|
|
- map.put("t34", iRowSet.getBigDecimal("t34"));//累计应扣缴税额
|
|
|
- map.put("t35", iRowSet.getBigDecimal("t35"));//累计已预缴税额
|
|
|
- map.put("t36", iRowSet.getBigDecimal("t36"));//本期应补(退)税额
|
|
|
- map.put("t38", iRowSet.getBigDecimal("t38"));//备注
|
|
|
- map.put("t41", iRowSet.getBigDecimal("t41"));//累计婴幼儿照护费用
|
|
|
- map.put("t45", iRowSet.getBigDecimal("t45"));//累计个人养老金
|
|
|
+ logger.error("getTaxDeclarationDate------iRowSet.getBigDecimal(t1)--------" + iRowSet.getBigDecimal("t1"));
|
|
|
+ map.put("t1", iRowSet.getBigDecimal("t1") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t1"));//本期免税收入
|
|
|
+ map.put("t2", iRowSet.getBigDecimal("t2") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t2"));//基本养老保险费
|
|
|
+ map.put("t3", iRowSet.getBigDecimal("t3") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t3"));//基本医疗保险费
|
|
|
+ map.put("t4", iRowSet.getBigDecimal("t4") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t4"));//失业保险费
|
|
|
+ map.put("t5", iRowSet.getBigDecimal("t5") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t5"));//住房公积金
|
|
|
+ map.put("t6", iRowSet.getBigDecimal("t6") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t6"));//累计子女教育
|
|
|
+ map.put("t7", iRowSet.getBigDecimal("t7") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t7"));//累计继续教育
|
|
|
+ map.put("t8", iRowSet.getBigDecimal("t8") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t8"));//累计住房贷款利息
|
|
|
+ map.put("t9", iRowSet.getBigDecimal("t9") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t9"));//累计住房租金
|
|
|
+ map.put("t10", iRowSet.getBigDecimal("t10") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t10"));//累计赡养老人
|
|
|
+ map.put("t25", iRowSet.getBigDecimal("t25") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t25"));//本期收入
|
|
|
+ map.put("t11", iRowSet.getBigDecimal("t11") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t11"));//其他
|
|
|
+ map.put("t15", iRowSet.getBigDecimal("t15") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t15"));//本期累计收入
|
|
|
+ map.put("t20", iRowSet.getBigDecimal("t20") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t20"));//本期累计免税收入
|
|
|
+ map.put("t22", iRowSet.getBigDecimal("t22") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t22"));//累计减除费用
|
|
|
+ map.put("t24", iRowSet.getBigDecimal("t24") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t24"));//累计专项扣除
|
|
|
+ map.put("t26", iRowSet.getBigDecimal("t26") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t26"));//累计其他扣除
|
|
|
+ map.put("t28", iRowSet.getBigDecimal("t28") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t28"));//累计准予扣除的捐赠
|
|
|
+ map.put("t29", iRowSet.getBigDecimal("t29") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t29"));//累计应纳税所得额
|
|
|
+ map.put("t30", iRowSet.getBigDecimal("t30") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t30"));//税率
|
|
|
+ map.put("t31", iRowSet.getBigDecimal("t31") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t31"));//速算扣除数
|
|
|
+ map.put("t32", iRowSet.getBigDecimal("t32") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t32"));//累计应纳税额
|
|
|
+ map.put("t33", iRowSet.getBigDecimal("t33") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t33"));//累计减免税额
|
|
|
+ map.put("t34", iRowSet.getBigDecimal("t34") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t34"));//累计应扣缴税额
|
|
|
+ map.put("t35", iRowSet.getBigDecimal("t35") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t35"));//累计已预缴税额
|
|
|
+ map.put("t36", iRowSet.getBigDecimal("t36") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t36"));//本期应补(退)税额
|
|
|
+ map.put("t38", iRowSet.getBigDecimal("t38") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t38"));//备注
|
|
|
+ map.put("t41", iRowSet.getBigDecimal("t41") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t41"));//累计婴幼儿照护费用
|
|
|
+ map.put("t45", iRowSet.getBigDecimal("t45") == null ? BigDecimal.ZERO : iRowSet.getBigDecimal("t45"));//累计个人养老金
|
|
|
list.add(map);
|
|
|
}
|
|
|
return list;
|