Commit 19c33697 authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents 5e4f4c09 2d9565ed
......@@ -83,7 +83,7 @@ public class FileTypesServiceImpl {
}
} catch (Exception e) {
log.error("FileTypesServiceImpl addFileTypesList error : " + e.getMessage());
return false;
throw new RuntimeException("添加档案类型异常!请联系管理员! : " + e.getMessage());
}
}
......
......@@ -193,15 +193,6 @@ public class TaxDocumentServiceImpl {
@Transactional
public synchronized boolean addTaxDocumentList(MultipartFile file, TaxDocument taxDocument) {
try {
TaxDocumentExample taxDocumentExample = new TaxDocumentExample();
taxDocumentExample.createCriteria().andFileNameEqualTo(taxDocument.getFileName());
List<TaxDocument> list = taxDocumentMapper.selectByExample(taxDocumentExample);
if (list.size() > 0) {
return false;
}
//上传文件
if (StringUtils.isBlank(taxDocument.getFileUploadId())) {
......@@ -369,9 +360,7 @@ public class TaxDocumentServiceImpl {
}
/**
* 根据档案属性 档案类型 公司名称 档案名称 查询是否已存在数据
* 不存在则返回 true
* 已存在则返回 false
* 根据档案属性 档案类型 公司名称 查询是否已存在数据
*
* @param taxDocument
* @return
......@@ -397,10 +386,6 @@ public class TaxDocumentServiceImpl {
if (null != taxDocument.getOwnTime()) {
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
}
//档案名称 fileName
if (StringUtils.isNotBlank(taxDocument.getFileName())) {
criteria.andFileNameEqualTo(taxDocument.getFileName());
}
//业务线 businessLine
if (StringUtils.isNotBlank(taxDocument.getBusinessLine())) {
criteria.andBusinessLineEqualTo(taxDocument.getBusinessLine());
......@@ -435,7 +420,7 @@ public class TaxDocumentServiceImpl {
}
//创建人 creator
if (StringUtils.isNotBlank(taxDocument.getCreator())) {
criteria.andCreatorEqualTo(taxDocument.getCreator());
criteria.andCreatorEqualTo( taxDocument.getCreator());
}
//设置查询可用的数据
criteria.andEnableEqualTo("T");
......
......@@ -6,13 +6,10 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.grapecity.documents.excel.V;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
......@@ -59,7 +56,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -335,7 +331,11 @@ public class ReportServiceImpl extends BaseService {
TrialBalanceFinalExample example = new TrialBalanceFinalExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(Integer.valueOf(queryPeriod));
trialBalanceFinalMapper.deleteByExample(example);
trialBalanceFinalMapper.generateFinalData(projectId, Integer.valueOf(queryPeriod), lastProject == null ? "0" : lastProject.getId(), Integer.valueOf(lastPeriod));
List<TrialBalanceFinal> dataList = trialBalanceFinalMapper.queryGenerateFinalData(projectId, Integer.valueOf(queryPeriod), lastProject == null ? "0" : lastProject.getId(), Integer.valueOf(lastPeriod));
if (!CollectionUtils.isEmpty(dataList)) {
List<List<TrialBalanceFinal>> batchList = CommonUtils.subListWithLen(dataList, CommonUtils.BATCH_NUM_2000);
batchList.forEach(l -> trialBalanceFinalMapper.batchInsert(l));
}
}
public void assembleInvoiceRecord(String projectId, Integer period, Boolean isMergeManualData) {
......
......@@ -122,8 +122,10 @@ public interface TrialBalanceFinalMapper extends MyVatMapper {
@Param("period") Integer period,
@Param("queryDate") String queryDate);
int generateFinalData(@Param("projectId") String projectId,
List<TrialBalanceFinal> queryGenerateFinalData(@Param("projectId") String projectId,
@Param("period") Integer period,
@Param("lastProjectId") String lastProjectId,
@Param("lastPeriod") Integer lastPeriod);
int batchInsert(List<TrialBalanceFinal> list);
}
\ No newline at end of file
......@@ -74,10 +74,9 @@
order by detail.emptyCode
</select>
<insert id="generateFinalData" >
insert
into trial_balance_final
select balance.id,
<select id="queryGenerateFinalData" resultMap="BaseResultMap">
select
balance.id,
balance.organization_id,
balance.project_id,
balance.date,
......@@ -124,11 +123,11 @@ select balance.id,
balance.ytd_cr,
balance.beg_bal_beq,
balance.period_dr_beq + if(adjustment.period_dr_beq is null, 0, adjustment.period_dr_beq) -
if(last_adjustment.period_dr_beq is null, 0, last_adjustment.period_dr_beq),
if(last_adjustment.period_dr_beq is null, 0, last_adjustment.period_dr_beq) as period_dr_beq,
balance.period_cr_beq + if(adjustment.period_cr_beq is null, 0, adjustment.period_cr_beq) -
if(last_adjustment.period_cr_beq is null, 0, last_adjustment.period_cr_beq),
if(last_adjustment.period_cr_beq is null, 0, last_adjustment.period_cr_beq) as period_cr_beq,
balance.end_bal_beq + if(adjustment.end_bal_beq is null, 0, adjustment.end_bal_beq) -
if(last_adjustment.end_bal_beq is null, 0, last_adjustment.end_bal_beq),
if(last_adjustment.end_bal_beq is null, 0, last_adjustment.end_bal_beq) as end_bal_beq,
balance.qtd_dr_beq,
balance.qtd_cr_beq,
balance.ytd_dr_beq,
......@@ -194,5 +193,87 @@ where balance.project_id = #{projectId}
</select>
<insert id="batchInsert">
insert into trial_balance_final
(id, organization_id, project_id,
`date`, `source`, tms_period,
period, ledger_id, ledger_name,
currency_code, `status`, category,
account_category, acct_code1, acct_name1,
acct_name2, acct_name3, segment1,
segment2, segment3, segment4,
segment5, segment6, segment7,
segment8, segment9, segment10,
segment1_name, segment2_name, segment3_name,
segment4_name, segment5_name, segment6_name,
segment7_name, segment8_name, segment9_name,
segment10_name, beg_bal, period_dr,
period_cr, end_bal, qtd_dr,
qtd_cr, ytd_dr, ytd_cr,
beg_bal_beq, period_dr_beq, period_cr_beq,
end_bal_beq, qtd_dr_beq, qtd_cr_beq,
ytd_dr_beq, ytd_cr_beq, create_time,
update_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id,jdbcType=BIGINT},
#{item.organizationId,jdbcType=VARCHAR},
#{item.projectId,jdbcType=VARCHAR},
#{item.date,jdbcType=TIMESTAMP},
#{item.source,jdbcType=VARCHAR},
#{item.tmsPeriod,jdbcType=INTEGER},
#{item.period,jdbcType=INTEGER},
#{item.ledgerId,jdbcType=VARCHAR},
#{item.ledgerName,jdbcType=VARCHAR},
#{item.currencyCode,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR},
#{item.category,jdbcType=VARCHAR},
#{item.accountCategory,jdbcType=VARCHAR},
#{item.acctCode1,jdbcType=VARCHAR},
#{item.acctName1,jdbcType=VARCHAR},
#{item.acctName2,jdbcType=VARCHAR},
#{item.acctName3,jdbcType=VARCHAR},
#{item.segment1,jdbcType=VARCHAR},
#{item.segment2,jdbcType=VARCHAR},
#{item.segment3,jdbcType=VARCHAR},
#{item.segment4,jdbcType=VARCHAR},
#{item.segment5,jdbcType=VARCHAR},
#{item.segment6,jdbcType=VARCHAR},
#{item.segment7,jdbcType=VARCHAR},
#{item.segment8,jdbcType=VARCHAR},
#{item.segment9,jdbcType=VARCHAR},
#{item.segment10,jdbcType=VARCHAR},
#{item.segment1Name,jdbcType=VARCHAR},
#{item.segment2Name,jdbcType=VARCHAR},
#{item.segment3Name,jdbcType=VARCHAR},
#{item.segment4Name,jdbcType=VARCHAR},
#{item.segment5Name,jdbcType=VARCHAR},
#{item.segment6Name,jdbcType=VARCHAR},
#{item.segment7Name,jdbcType=VARCHAR},
#{item.segment8Name,jdbcType=VARCHAR},
#{item.segment9Name,jdbcType=VARCHAR},
#{item.segment10Name,jdbcType=VARCHAR},
#{item.begBal,jdbcType=DECIMAL},
#{item.periodDr,jdbcType=DECIMAL},
#{item.periodCr,jdbcType=DECIMAL},
#{item.endBal,jdbcType=DECIMAL},
#{item.qtdDr,jdbcType=DECIMAL},
#{item.qtdCr,jdbcType=DECIMAL},
#{item.ytdDr,jdbcType=DECIMAL},
#{item.ytdCr,jdbcType=DECIMAL},
#{item.begBalBeq,jdbcType=DECIMAL},
#{item.periodDrBeq,jdbcType=DECIMAL},
#{item.periodCrBeq,jdbcType=DECIMAL},
#{item.endBalBeq,jdbcType=DECIMAL},
#{item.qtdDrBeq,jdbcType=DECIMAL},
#{item.qtdCrBeq,jdbcType=DECIMAL},
#{item.ytdDrBeq,jdbcType=DECIMAL},
#{item.ytdCrBeq,jdbcType=DECIMAL},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -122,8 +122,9 @@ taxDocumentManageModule.controller('taxDocumentListController',
allowColumnReordering: true,
columns: [
{
dataField: "id",
dataField: "",
caption: "",
width: 40,
cellTemplate: function (container, options) {
var target = $('<input name="dataGridCheckBox" type="checkbox" ' +
'data-id="' + options.data.id + '" ' +
......@@ -132,8 +133,24 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.sniffCheckbox();
});
container.append(target);
if($("input[name='dataGridCheckBoxALL']").length==0){
var func = function () {
var targetall = $('<input name="dataGridCheckBoxALL" type="checkbox" data-id=""data-url=""/>');
targetall.off('click').on('click', function () {
$scope.sniffCheckboxAll();
});
$("tr td:first[role='columnheader']").append(targetall);
func= function(){};
};
func();
}
}
},
{
dataField: "id",
caption: "",
visible: false
},
{
dataField: "fileAttr",
caption: $translate.instant('DocumentAttr'),
......@@ -2121,7 +2138,19 @@ taxDocumentManageModule.directive('tempModule', function () {
});
console.info($scope.checkedItemIds.join(","));
};
$scope.sniffCheckboxAll=function(){
$("input[name='dataGridCheckBoxALL']").each(function (index, item) {
if(item.checked){
$("input[name='dataGridCheckBox']").each(function (index, item) {
item.checked=true;
});
}else{
$("input[name='dataGridCheckBox']").each(function (index, item) {
item.checked=false;
});
}
});
};
$scope.getMonthLastDate = function (year, month) {
year = year ? year : new Date().getFullYear();
month = month ? month : (new Date().getMonth() + 1);
......
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