Commit 415f578e authored by zhkwei's avatar zhkwei

CIT报表公式ZC及QMYE

parent a35b8768
......@@ -48,7 +48,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static InputInvoiceDao inputInvoiceDao;
public static InputInvoiceMapper inputInvoiceMapper;
public static InputVatInvoiceMapper inputVatInvoiceMapper;
public static AssetsListMapper assetsListMapper;
public static CitAssetsListMapper assetsListMapper;
public static ProjectMapper projectMapper;
public static CellDataSourceMapper cellDataSourceMapper;
public static PeriodCellDataSourceMapper periodCellDataSourceMapper;
......@@ -121,7 +121,7 @@ public class SpringContextUtil implements ApplicationContextAware {
inputVatInvoiceMapper = webApplicationContext.getBean(InputVatInvoiceMapper.class);
inputInvoiceDao = webApplicationContext.getBean(InputInvoiceDao.class);
inputInvoiceMapper = webApplicationContext.getBean(InputInvoiceMapper.class);
assetsListMapper = webApplicationContext.getBean(AssetsListMapper.class);
assetsListMapper = webApplicationContext.getBean(CitAssetsListMapper.class);
projectMapper = webApplicationContext.getBean(ProjectMapper.class);
cellDataSourceMapper = webApplicationContext.getBean(CellDataSourceMapper.class);
periodCellDataSourceMapper = webApplicationContext.getBean(PeriodCellDataSourceMapper.class);
......
......@@ -225,7 +225,7 @@ public class AssetListServiceImpl extends BaseService {
importResult.setResultMsg("行数据为空或格式错误!");
}
//目前没有进行税法分类,标注状态
citAsset.setStatus(0);
// citAsset.setStatus(0);
citAssetsLists.add(citAsset);
}
......@@ -332,11 +332,15 @@ public class AssetListServiceImpl extends BaseService {
.filter(groupResult -> groupResult.getAssetName().equals(citAsset.getAssetGroupName())).collect(Collectors.toList());
//通过判断过滤后的集合来确认是否已经对该资产类别进行过分类
if(groupResults != null && groupResults.size()>0){
//目前已经进行税法分类,标注状态
citAsset.setStatus(1);
AssetDetailGroup assetDetailGroup = selectAssetDetailGroup(groupResults.get(0).getAssetDetailGroupId());
// Integer assetGroupType = selectAssetDetailGroup(groupResults.get(0).getAssetDetailGroupId()).getAssetGroupType();
//进行税务的计算
setCitAssetTaxData(citAsset,groupResults.get(0),assetDetailGroup);
}else{
//目前没有进行税法分类,标注状态
citAsset.setStatus(0);
//没有进行过分类,放入Set集合里面
assetNameSet.add(assetName);
}
......@@ -411,6 +415,7 @@ public class AssetListServiceImpl extends BaseService {
Calendar cal = Calendar.getInstance();
//设置税法分类
citAsset.setTaxGroupName(assetDetailGroup.getDetailGroupName());
citAsset.setAssetDetailGroupId(assetDetailGroup.getId());
Integer assetGroupType = assetDetailGroup.getAssetGroupType();
//获取税务折旧期限,此值根据分类查数据库带出的值不在此进行操作
citAsset.setTaxDepreciationPeriod(assetGroupResult.getTaxDepreciationPeriod());
......
......@@ -61,7 +61,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
public class CitReportServiceImpl extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(CitReportServiceImpl.class);
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR", "WPNAME", "WPTYPE", "SUM2", "RSUMIF", "QMYE"};
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR", "WPNAME", "WPTYPE", "SUM2", "RSUMIF", "QMYE", "ZC"};
@Autowired
private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper;
......@@ -197,7 +197,7 @@ public class CitReportServiceImpl extends BaseService {
Workbook workbook = reportGenerator.createWorkBookByPeriodTemplate(resources.getPeriodTemplates(), genJob);
reportGenerator.addFunctionsAndContext(workbook, functions, reportGenerator.initContext(resources, periodParam));
reportGenerator.addCitFunctionsAndContext(workbook, functions, reportGenerator.initContext(resources, periodParam));
reportGenerator.setConfigAndDataToWorkBook(workbook, resources);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
......
......@@ -539,16 +539,19 @@ public class ReportGeneratorImpl {
workbook.addToolPack(udfToolpack);
}
/**
* 注册所有的自定义方法到工作簿
* 为CIT复制的一份注册自定义公式,和上面的addFunctionsAndContext方法基本相同
* CIT 注册所有的自定义方法到工作簿
*
* @param workbook 工作簿
*/
public void addCitFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
//**************************** 为CIT复制的一份注册自定义公式 ****************************
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new PC(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext),
new JFFS(formulaContext), new WPSR(formulaContext), new WPNAME(formulaContext), new WPTYPE(formulaContext),
new SUM2(formulaContext), new RSUMIF(formulaContext), new QMYE(formulaContext)};
new SUM2(formulaContext), new RSUMIF(formulaContext), new QMYE(formulaContext), new ZC(formulaContext)}; //为CIT复制的一份注册自定义公式
//**************************** 为CIT复制的一份注册自定义公式 ****************************
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack);
......
......@@ -9,6 +9,7 @@ import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dpo.CitAssetDetailResultDto;
import pwc.taxtech.atms.dto.vatdto.AssetDetailDataSourceDto;
import pwc.taxtech.atms.vat.dpo.AssetDetailResultDto;
......@@ -53,31 +54,31 @@ public class ZC extends FunctionBase implements FreeRefFunction {
logger.debug(formulaExpression);
int curYear = formulaContext.getYear() + year;
String dbName =
SpringContextUtil.projectDao.getDbNameWithYearAndOrgId(formulaContext.getOrganizationId(), curYear);
// String dbName =
// SpringContextUtil.projectDao.getDbNameWithYearAndOrgId(formulaContext.getOrganizationId(), curYear);
List<AssetDetailResultDto> assetDetailResultDtos =
SpringContextUtil.assetsListMapper.getAssetDetialResult(dbName, assetType, assetDetailType);
List<CitAssetDetailResultDto> assetDetailResultDtos =
SpringContextUtil.assetsListMapper.getCitAssetDetialResult(assetType, assetDetailType);
List<AssetDetailDataSourceDto> dataSource = new ArrayList<>();
for (AssetDetailResultDto x : assetDetailResultDtos) {
for (CitAssetDetailResultDto x : assetDetailResultDtos) {
AssetDetailDataSourceDto assetDetailDataSourceDto = new AssetDetailDataSourceDto();
assetDetailDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
assetDetailDataSourceDto.setAssetNumber(x.getAssetsList().getAssetGroupName());
assetDetailDataSourceDto.setAssetGroupName(x.getAssetDetailGroup().getDetailGroupName());
assetDetailDataSourceDto.setAccountAcquisitionValue(FormulaHelper.roundValue(x.getAssetsList().getAccountAcquisitionValue(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getAccountMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountTotalepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTotalepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountTotalepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getAccountTotalDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setYearEndValue(FormulaHelper.roundValue(x.getAssetsList().getYearEndValue(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxToCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getToCurtYearDepreciateAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getToCurtYearDepreciateAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxToCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxToCurrentYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxCurrentYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTotalDifferenceAmount(FormulaHelper.roundValue(x.getAssetsList().getTotalDifferenceAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setYearDifferenceAmount(FormulaHelper.roundValue(x.getAssetsList().getYearDifferenceAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setDepreciationPeriod(x.getAssetsList().getDepreciationPeriod());
assetDetailDataSourceDto.setTaxDepreciationPeriod(x.getAssetsList().getTaxDepreciationPeriod());
assetDetailDataSourceDto.setIsRetain(x.getAssetsList().getIsRetain());
assetDetailDataSourceDto.setIsRetain(x.getAssetsList().getIsRetain()==0?false:true);
assetDetailDataSourceDto.setDataType(dataType);
assetDetailDataSourceDto.setName(Constant.DataSourceName.AssetListDataSource);
assetDetailDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
......
......@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.CitAssetDetailResultDto;
import pwc.taxtech.atms.dpo.CitAssetEamMappingDto;
import pwc.taxtech.atms.entity.CitAssetsList;
import pwc.taxtech.atms.entity.CitAssetsListExample;
......@@ -116,4 +117,7 @@ public interface CitAssetsListMapper extends MyMapper {
* @return Result<XxxxDO>
*/
List<CitAssetEamMappingDto> getAssetEamMapping(CitAssetsList citAsset);
List<CitAssetDetailResultDto> getCitAssetDetialResult(@Param("assetType") Integer assetType,
@Param("assetDetailType") Integer assetDetailType);
}
\ No newline at end of file
package pwc.taxtech.atms.dpo;
import pwc.taxtech.atms.entity.AssetDetailGroup;
import pwc.taxtech.atms.entity.CitAssetsList;
public class CitAssetDetailResultDto {
String id;
CitAssetsList assetsList;
AssetDetailGroup assetDetailGroup;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public CitAssetsList getAssetsList() {
return assetsList;
}
public void setAssetsList(CitAssetsList assetsList) {
this.assetsList = assetsList;
}
public AssetDetailGroup getAssetDetailGroup() {
return assetDetailGroup;
}
public void setAssetDetailGroup(AssetDetailGroup assetDetailGroup) {
this.assetDetailGroup = assetDetailGroup;
}
}
......@@ -221,4 +221,119 @@
from assets_list join cit_eam_assets_disposal on serial_number = asset_label_number where scrap_type='完全报废'
</select>
<resultMap id="citAssetDetailResultDto" type="pwc.taxtech.atms.dpo.CitAssetDetailResultDto">
<id column="ID" jdbcType="VARCHAR" property="id"/>
<association property="assetsList" javaType="pwc.taxtech.atms.entity.CitAssetsList">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="period" jdbcType="INTEGER" property="period" />
<result column="asset_number" jdbcType="VARCHAR" property="assetNumber" />
<result column="serial_number" jdbcType="VARCHAR" property="serialNumber" />
<result column="asset_group_name" jdbcType="VARCHAR" property="assetGroupName" />
<result column="asset_detail_group_id" jdbcType="BIGINT" property="assetDetailGroupId" />
<result column="asset_description" jdbcType="VARCHAR" property="assetDescription" />
<result column="buy_date" jdbcType="TIMESTAMP" property="buyDate" />
<result column="depreciation_date" jdbcType="TIMESTAMP" property="depreciationDate" />
<result column="depreciation_period" jdbcType="INTEGER" property="depreciationPeriod" />
<result column="acquisition_value" jdbcType="DECIMAL" property="acquisitionValue" />
<result column="adjustment_value" jdbcType="DECIMAL" property="adjustmentValue" />
<result column="disposed_date" jdbcType="TIMESTAMP" property="disposedDate" />
<result column="residual_rate" jdbcType="DECIMAL" property="residualRate" />
<result column="year_depreciation_amount" jdbcType="DECIMAL" property="yearDepreciationAmount" />
<result column="year_adjustment_amount" jdbcType="DECIMAL" property="yearAdjustmentAmount" />
<result column="year_end_value" jdbcType="DECIMAL" property="yearEndValue" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="account_acquisition_value" jdbcType="DECIMAL" property="accountAcquisitionValue" />
<result column="account_month_depreciation_amount" jdbcType="DECIMAL" property="accountMonthDepreciationAmount" />
<result column="account_year_depreciation_amount" jdbcType="DECIMAL" property="accountYearDepreciationAmount" />
<result column="account_total_depreciation_amount" jdbcType="DECIMAL" property="accountTotalDepreciationAmount" />
<result column="tax_depreciation_period" jdbcType="INTEGER" property="taxDepreciationPeriod" />
<result column="tax_to_last_year_depreciation_period" jdbcType="INTEGER" property="taxToLastYearDepreciationPeriod" />
<result column="tax_to_current_year_depreciation_period" jdbcType="INTEGER" property="taxToCurrentYearDepreciationPeriod" />
<result column="tax_year_depreciation_period" jdbcType="INTEGER" property="taxYearDepreciationPeriod" />
<result column="tax_month_depreciation_amount" jdbcType="DECIMAL" property="taxMonthDepreciationAmount" />
<result column="tax_to_current_year_depreciation_amount" jdbcType="DECIMAL" property="taxToCurrentYearDepreciationAmount" />
<result column="tax_current_year_depreciation_amount" jdbcType="DECIMAL" property="taxCurrentYearDepreciationAmount" />
<result column="total_difference_amount" jdbcType="DECIMAL" property="totalDifferenceAmount" />
<result column="year_difference_amount" jdbcType="DECIMAL" property="yearDifferenceAmount" />
<result column="is_retain" jdbcType="INTEGER" property="isRetain" />
<result column="asset_type" jdbcType="INTEGER" property="assetType" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="tax_account_compare" jdbcType="INTEGER" property="taxAccountCompare" />
<result column="tax_group_name" jdbcType="VARCHAR" property="taxGroupName" />
<result column="scrap_type" jdbcType="VARCHAR" property="scrapType" />
</association>
<association property="assetDetailGroup" javaType="pwc.taxtech.atms.entity.AssetDetailGroup">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="asset_group_id" jdbcType="BIGINT" property="assetGroupId" />
<result column="detail_group_name" jdbcType="VARCHAR" property="detailGroupName" />
<result column="asset_group_type" jdbcType="INTEGER" property="assetGroupType" />
<result column="group_year" jdbcType="INTEGER" property="groupYear" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="detail_group_type" jdbcType="INTEGER" property="detailGroupType" />
<result column="key_values" jdbcType="VARCHAR" property="keyValues" />
</association>
</resultMap>
<select id="getCitAssetDetialResult" resultMap="citAssetDetailResultDto">
SELECT
assets_list.id AS id,
assets_list.id,
assets_list.asset_number,
assets_list.asset_group_name,
assets_list.asset_detail_group_id,
assets_list.asset_description,
assets_list.buy_date,
assets_list.depreciation_date,
assets_list.depreciation_period,
assets_list.acquisition_value,
assets_list.adjustment_value,
assets_list.disposed_date,
assets_list.residual_rate,
assets_list.year_depreciation_amount,
assets_list.year_adjustment_amount,
assets_list.year_end_value,
assets_list.status,
assets_list.account_acquisition_value,
assets_list.account_month_depreciation_amount,
assets_list.account_year_depreciation_amount,
assets_list.account_total_depreciation_amount,
assets_list.tax_depreciation_period,
assets_list.tax_to_last_year_depreciation_period,
assets_list.tax_to_current_year_depreciation_period,
assets_list.tax_year_depreciation_period,
assets_list.tax_month_depreciation_amount,
assets_list.tax_to_current_year_depreciation_amount,
assets_list.tax_current_year_depreciation_amount,
assets_list.total_difference_amount,
assets_list.year_difference_amount,
assets_list.is_retain,
assets_list.create_time,
assets_list.update_time,
assets_list.asset_type,
asset_detail_group.id,
asset_detail_group.asset_group_id,
asset_detail_group.detail_group_name,
asset_detail_group.asset_group_type,
asset_detail_group.group_year,
asset_detail_group.create_time,
asset_detail_group.update_time,
asset_detail_group.detail_group_type,
asset_detail_group.key_values
FROM
assets_list
JOIN
asset_detail_group asset_detail_group
ON
assets_list.asset_detail_group_id = asset_detail_group.id
WHERE
assets_list.asset_detail_group_id IS NOT NULL
AND assets_list.asset_type IS NOT NULL
AND assets_list.asset_type = #{assetType,jdbcType=INTEGER}
AND asset_detail_group.asset_group_type = #{assetType,jdbcType=INTEGER}
AND asset_detail_group.detail_group_type = #{assetDetailType,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
......@@ -202,8 +202,9 @@
});
};
$scope.editRow = function (data) {
$scope.editRow = function (data,type) {
debugger;
$scope.assetGroupType = type;
$scope.isEdit = true;
$scope.fixedAssetsObject = angular.copy(data)
if (data.year) {
......@@ -275,7 +276,7 @@
$("<span class='span-btn' />")
.text($translate.instant('Edit'))
.on('click', function () {
$scope.editRow(data);
$scope.editRow(data,'1');
})
.appendTo(container);
......@@ -348,7 +349,7 @@
$("<span class='span-btn' />")
.text($translate.instant('Edit'))
.on('click', function () {
$scope.editRow(data);
$scope.editRow(data,'2');
})
.appendTo(container);
......@@ -421,7 +422,7 @@
$("<span class='span-btn' />")
.text($translate.instant('Edit'))
.on('click', function () {
$scope.editRow(data);
$scope.editRow(data,'3');
})
.appendTo(container);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment