Commit 3c3b17c0 authored by zhkwei's avatar zhkwei

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

parents 8f71b0e0 42353df0
......@@ -6,7 +6,7 @@ import pwc.taxtech.atms.dto.billDetail.BillDetailParam;
import pwc.taxtech.atms.dto.billDetail.BillDetailResult;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.service.impl.BillDetailService;
import pwc.taxtech.atms.vat.entity.BillDetail;
import pwc.taxtech.atms.vat.entity.InvoiceRecord;
import javax.annotation.Resource;
import java.util.List;
......@@ -30,7 +30,7 @@ public class BillDetailController extends BaseController {
return billDetailService.queryBillTypeGroupBy(projectId,period);
}
@PostMapping("update")
public ApiResultDto updateConf(@RequestBody BillDetail billDetail) {
public ApiResultDto updateConf(@RequestBody InvoiceRecord billDetail) {
billDetailService.updateBillDetail(billDetail);
return ApiResultDto.success();
}
......
......@@ -70,10 +70,11 @@ public class CellCommentController {
//加载分录表格数据
@RequestMapping("loadEntryListDataList")
public OperationResultDto loadEntryListDataList(String code) {
public OperationResultDto loadEntryListDataList(String code, String projectId) {
OperationResultDto operationResultDto = new OperationResultDto();
CitJournalEntryAdjust citJournalEntryAdjust = new CitJournalEntryAdjust();
citJournalEntryAdjust.setSubjectCode(code);
citJournalEntryAdjust.setProjectId(projectId);
List<CitJournalEntryAdjust> journalMerge = citJournalEntryAdjustMapper.getJournalMerge(citJournalEntryAdjust);
operationResultDto.setData(journalMerge);
operationResultDto.setResultMsg("success");
......
......@@ -39,6 +39,7 @@ public class BillDetailResult implements Serializable {
private String revenueConfName;
@JsonSerialize(using = PwCIdSerialize.class)
private Long revenueCofId;
private Integer emptyCode;
......
package pwc.taxtech.atms.dto.revenuconf;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.constant.enums.RevenueConfEnum;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
public class RevenueConfResult extends RevenueConfig {
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
public String getAccountTypeStr() {
return RevenueConfEnum.AccountType.MAPPING.get(this.getAccountType());
}
......
......@@ -7,8 +7,8 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dpo.BillDetailDto;
import pwc.taxtech.atms.dto.billDetail.BillDetailParam;
import pwc.taxtech.atms.dto.billDetail.BillDetailResult;
import pwc.taxtech.atms.vat.dao.BillDetailMapper;
import pwc.taxtech.atms.vat.entity.BillDetail;
import pwc.taxtech.atms.vat.dao.InvoiceRecordMapper;
import pwc.taxtech.atms.vat.entity.InvoiceRecord;
import javax.annotation.Resource;
import java.util.List;
......@@ -18,13 +18,13 @@ import java.util.stream.Collectors;
public class BillDetailService extends BaseService {
@Resource
private BillDetailMapper billDetailMapper;
private InvoiceRecordMapper invoiceRecordMapper;
public PageInfo<BillDetailResult> queryPage(BillDetailParam param) {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
List<BillDetailDto> dataList = billDetailMapper.queryBillWithRevenueConf(param.getBillType(), param.getCustomer(), param.getBillNumber(), param.getRevenueCofId(), param.getBillContent(), param.getDepartment(), param.getBillTaxRat(), param.getBillDate(), param.getProjectId(), param.getPeriod(), param.getQueryDate());
List<BillDetailDto> dataList = invoiceRecordMapper.queryBillWithRevenueConf(param.getBillType(), param.getCustomer(), param.getBillNumber(), param.getRevenueCofId(), param.getBillContent(), param.getDepartment(), param.getBillTaxRat(), param.getBillDate(), param.getProjectId(), param.getPeriod(), param.getQueryDate());
PageInfo<BillDetailResult> pageInfo = new PageInfo<>(dataList.stream()
.map(o -> beanUtil.copyProperties(o, new BillDetailResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal());
......@@ -32,10 +32,11 @@ public class BillDetailService extends BaseService {
}
public List<String> queryBillTypeGroupBy(String projectId,Integer period){
return billDetailMapper.queryBillTypeGroupBy(projectId,period);
return invoiceRecordMapper.queryBillTypeGroupBy(projectId,period);
}
public void updateBillDetail(BillDetail billDetail) {
billDetailMapper.updateByPrimaryKeySelective(billDetail);
public void updateBillDetail(InvoiceRecord billDetail) {
invoiceRecordMapper.updateByPrimaryKeySelective(billDetail);
}
}
......@@ -53,6 +53,7 @@ public class ReportUploadService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
ReportUploadExample example = new ReportUploadExample();
example.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPeriodEqualTo(param.getPeriod());
example.setOrderByClause(" create_time DESC ");
List<ReportUpload> dataList = reportUploadMapper.selectByExample(example);
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(dataList.stream()
......
......@@ -187,7 +187,7 @@ public class FormulaAgent {
if(getSql){
tableName = tableName.toLowerCase();
sql = "select * from " + tableName + " where 1=1 and " + filter + filterValue;
return sql;
return sql + " and project_id = '" + formulaContext.getProjectId() + "'";
}else{
sql = "select sum(" + getField + ") as " + getField + " from " + tableName + " where 1=1 and " + filter + filterValue;
}
......@@ -210,6 +210,7 @@ public class FormulaAgent {
}
if (bool)
sql += " and period = " + year;
sql += " and project_id = '" + formulaContext.getProjectId() + "'";
return sql;
}
......
......@@ -124,6 +124,10 @@ public class ReportServiceImpl extends BaseService {
private PeriodApproveMapper periodApprovalMapper;
@Resource
RevenueConfigMapper revenueConfigMapper;
@Resource
RevenueTypeMappingMapper revenueTypeMappingMapper;
@Resource
InvoiceRecordMapper invoiceRecordMapper;
@Autowired
private HttpFileService httpFileService;
@Autowired
......@@ -291,12 +295,47 @@ public class ReportServiceImpl extends BaseService {
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
//根据收入类型映射生成开票记录关联数据
assembleInvoiceRecord(projectId,period);
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period);
setStatus(job, STATUS_END);
periodJobMapper.updateByPrimaryKey(job);
}
public void assembleInvoiceRecord(String projectId,Integer period){
Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
String queryDate = project.getYear()+"-"+(period<10?("0"+period):(period+""));
RevenueTypeMappingExample mappingExample = new RevenueTypeMappingExample();
mappingExample.createCriteria().andOrgIdEqualTo(project.getOrganizationId()).
andStartDateLessThanOrEqualTo(queryDate).andEndDateGreaterThanOrEqualTo(queryDate).
andStatusEqualTo(0);
List<RevenueTypeMapping> mappingList = revenueTypeMappingMapper.selectByExample(mappingExample);
Map<String,Long> map = new HashMap<>();
for(RevenueTypeMapping mapping:mappingList){
if(!map.containsKey(mapping.getContent())){
RevenueConfigExample configExample = new RevenueConfigExample();
configExample.createCriteria().andNameEqualTo(mapping.getRevenueTypeName()).
andStatusEqualTo(0).andOrgIdEqualTo(mapping.getOrgId()).
andStartDateLessThanOrEqualTo(queryDate).andEndDateGreaterThanOrEqualTo(queryDate);
List<RevenueConfig> configs = revenueConfigMapper.selectByExample(configExample);
if(CollectionUtils.isNotEmpty(configs)){
map.put(mapping.getContent(),configs.get(0).getId());
}
}
if(map.containsKey(mapping.getContent())){
InvoiceRecord destRecord = new InvoiceRecord();
destRecord.setRevenueCofId(map.get(mapping.getContent()));
InvoiceRecordExample recordExample = new InvoiceRecordExample();
recordExample.createCriteria().andProjectIdEqualTo(projectId)
.andOrganizationIdEqualTo(mapping.getOrgId()).andBillingContentEqualTo(mapping.getContent()).
andPeriodEqualTo(Integer.valueOf(queryDate.replace("-","")));
invoiceRecordMapper.updateByExampleSelective(destRecord,recordExample);
}
}
}
private List<Template> getTemplatesByProjectId(String projectId) {
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION);
Project project = projectMapper.selectByPrimaryKey(projectId);
......
......@@ -40,6 +40,11 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<table tableName="invoice_record" domainObjectName="InvoiceRecord">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--
......@@ -89,11 +94,7 @@
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="invoice_record" domainObjectName="InvoiceRecord">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="revenue_config" domainObjectName="RevenueConfig">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
......
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.dpo.CashFlowCondition;
import pwc.taxtech.atms.dpo.BillDetailDto;
import pwc.taxtech.atms.vat.dpo.InvoiceRecordCondition;
import pwc.taxtech.atms.vat.entity.CashFlow;
import pwc.taxtech.atms.vat.entity.InvoiceRecord;
import pwc.taxtech.atms.vat.entity.InvoiceRecordExample;
import java.math.BigDecimal;
import java.util.List;
@Mapper
public interface InvoiceRecordMapper extends MyVatMapper {
/**
......@@ -113,4 +114,19 @@ public interface InvoiceRecordMapper extends MyVatMapper {
int insertBatch(List<InvoiceRecord> cils);
List<BillDetailDto> queryBillWithRevenueConf(
@Param("billType") String billType,
@Param("customer") String customer,
@Param("billNumber") String billNumber,
@Param("revenueCofId") Long revenueCofId,
@Param("billContent") String billContent,
@Param("department") String department,
@Param("billTaxRat") BigDecimal billTaxRat,
@Param("billDate") String billDate,
@Param("projectId") String projectId,
@Param("period") Integer period,
@Param("queryDate") String queryDate);
List<String> queryBillTypeGroupBy(@Param("projectId") String projectId,
@Param("period") Integer period);
}
\ No newline at end of file
package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/**
*
......@@ -354,6 +355,17 @@ public class InvoiceRecord extends BaseEntity implements Serializable {
*/
private Date updateTime;
/**
* Database Column Remarks:
* 收入类型id
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column invoice_record.revenue_cof_id
*
* @mbg.generated
*/
private Long revenueCofId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table invoice_record
......@@ -1106,6 +1118,30 @@ public class InvoiceRecord extends BaseEntity implements Serializable {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column invoice_record.revenue_cof_id
*
* @return the value of invoice_record.revenue_cof_id
*
* @mbg.generated
*/
public Long getRevenueCofId() {
return revenueCofId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column invoice_record.revenue_cof_id
*
* @param revenueCofId the value for invoice_record.revenue_cof_id
*
* @mbg.generated
*/
public void setRevenueCofId(Long revenueCofId) {
this.revenueCofId = revenueCofId;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table invoice_record
......@@ -1149,6 +1185,7 @@ public class InvoiceRecord extends BaseEntity implements Serializable {
sb.append(", remarks=").append(remarks);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", revenueCofId=").append(revenueCofId);
sb.append("]");
return sb.toString();
}
......
......@@ -2225,6 +2225,66 @@ public class InvoiceRecordExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andRevenueCofIdIsNull() {
addCriterion("revenue_cof_id is null");
return (Criteria) this;
}
public Criteria andRevenueCofIdIsNotNull() {
addCriterion("revenue_cof_id is not null");
return (Criteria) this;
}
public Criteria andRevenueCofIdEqualTo(Long value) {
addCriterion("revenue_cof_id =", value, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdNotEqualTo(Long value) {
addCriterion("revenue_cof_id <>", value, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdGreaterThan(Long value) {
addCriterion("revenue_cof_id >", value, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdGreaterThanOrEqualTo(Long value) {
addCriterion("revenue_cof_id >=", value, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdLessThan(Long value) {
addCriterion("revenue_cof_id <", value, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdLessThanOrEqualTo(Long value) {
addCriterion("revenue_cof_id <=", value, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdIn(List<Long> values) {
addCriterion("revenue_cof_id in", values, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdNotIn(List<Long> values) {
addCriterion("revenue_cof_id not in", values, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdBetween(Long value1, Long value2) {
addCriterion("revenue_cof_id between", value1, value2, "revenueCofId");
return (Criteria) this;
}
public Criteria andRevenueCofIdNotBetween(Long value1, Long value2) {
addCriterion("revenue_cof_id not between", value1, value2, "revenueCofId");
return (Criteria) this;
}
}
/**
......
......@@ -92,7 +92,8 @@
credit_amount as creditAmount,
beginning_balance as beginningBalance,
adjust_account as adjustAccount,
ending_balance as endingBalance
ending_balance as endingBalance,
project_id as projectId
<if test="sql != null and sql != '' ">
${sql}
</if>
......
......@@ -37,6 +37,7 @@
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="revenue_cof_id" jdbcType="BIGINT" property="revenueCofId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -114,7 +115,7 @@
oa_application_num, contract_no, contract_amount, department, application_date, billing_date,
billing_month, invoice_code, invoice_num, invoices_amount, customer_company_tax_num,
contract_source_system, tax_rate, tax_amount, invoice_status, remarks, create_time,
update_time
update_time, revenue_cof_id
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.InvoiceRecordExample" resultMap="BaseResultMap">
<!--
......@@ -177,7 +178,7 @@
invoice_num, invoices_amount, customer_company_tax_num,
contract_source_system, tax_rate, tax_amount,
invoice_status, remarks, create_time,
update_time)
update_time, revenue_cof_id)
values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{tmsPeriod,jdbcType=INTEGER}, #{period,jdbcType=INTEGER}, #{seqNo,jdbcType=INTEGER},
#{source,jdbcType=VARCHAR}, #{billingBody,jdbcType=VARCHAR}, #{customerCompanyName,jdbcType=VARCHAR},
......@@ -188,7 +189,7 @@
#{invoiceNum,jdbcType=VARCHAR}, #{invoicesAmount,jdbcType=INTEGER}, #{customerCompanyTaxNum,jdbcType=VARCHAR},
#{contractSourceSystem,jdbcType=VARCHAR}, #{taxRate,jdbcType=DECIMAL}, #{taxAmount,jdbcType=DECIMAL},
#{invoiceStatus,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
#{updateTime,jdbcType=TIMESTAMP}, #{revenueCofId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.InvoiceRecord">
<!--
......@@ -290,6 +291,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="revenueCofId != null">
revenue_cof_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -385,6 +389,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="revenueCofId != null">
#{revenueCofId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.InvoiceRecordExample" resultType="java.lang.Long">
......@@ -497,6 +504,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.revenueCofId != null">
revenue_cof_id = #{record.revenueCofId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -538,7 +548,8 @@
invoice_status = #{record.invoiceStatus,jdbcType=VARCHAR},
remarks = #{record.remarks,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
revenue_cof_id = #{record.revenueCofId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -640,6 +651,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="revenueCofId != null">
revenue_cof_id = #{revenueCofId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -678,7 +692,8 @@
invoice_status = #{invoiceStatus,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
revenue_cof_id = #{revenueCofId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.InvoiceRecordExample" resultMap="BaseResultMap">
......
......@@ -65,6 +65,6 @@
and period = #{period}
group by bill_type;
</select>
</select>
</mapper>
\ No newline at end of file
......@@ -165,4 +165,69 @@
</foreach>;
SELECT 1 FROM DUAL;
</insert>
<select id="queryBillWithRevenueConf" resultType="pwc.taxtech.atms.dpo.BillDetailDto">
select detail.*
from (select bd.id as id,
bd.billing_body as subject,
bd.customer_company_name as customer,
bd.invoice_type as billType,
bd.billing_content as billContent,
bd.invoice_amount as billAmount,
bd.tax_rate as billTaxRat,
bd.tax_amount as billTaxAmount,
bd.oa_application_num as OANo,
bd.department as department,
bd.billing_date as billDate,
bd.invoice_code as billCode,
bd.invoice_num as billNumber,
rc.id as revenueCofId,
rc.name as revenueConfName,
case
when rc.id is null then 1
<![CDATA[WHEN rc.id IS NOT NULL and (rc.start_date > #{queryDate} or rc.end_date < #{queryDate}) then 1]]>
<![CDATA[WHEN rc.id IS NOT NULL and rc.start_date <= #{queryDate} and rc.end_date >= #{queryDate} THEN 2]]>
end as emptyCode
from invoice_record as bd
left join revenue_config as rc on rc.org_id = bd.organization_id and rc.id = bd.revenue_cof_id
where bd.project_id = #{projectId}
and bd.period = #{period}
<if test="billType != null and billType != ''">
and bd.invoice_type = #{billType}
</if>
<if test="customer != null and customer != ''">
and bd.customer_company_name like concat('%',#{customer},'%')
</if>
<if test="billNumber != null and billNumber != ''">
and bd.invoice_num like concat('%',#{billNumber},'%')
</if>
<if test="revenueCofId != null">
and bd.revenue_cof_id = #{revenueCofId}
</if>
<if test="billContent != null and billContent != ''">
and bd.billing_content like concat('%',#{billContent},'%')
</if>
<if test="department != null and department != ''">
and bd.department like concat('%',#{department},'%')
</if>
<if test="billTaxRat != null">
and bd.tax_rate = #{billTaxRat}
</if>
<if test="billDate != null and billDate != ''">
and bd.billing_date = #{billDate}
</if>
) as detail
order by detail.emptyCode,detail.billDate desc
</select>
<select id="queryBillTypeGroupBy" resultType="java.lang.String">
select invoice_type
from invoice_record
where project_id = #{projectId}
and period = #{period}
group by invoice_type;
</select>
</mapper>
\ No newline at end of file
......@@ -86,9 +86,11 @@
}
};
var loadSheet = function (templateId) {
var loadSheet = function (templateId, update) {
var prokjectId = vatSessionService.project.id;
var period = 0;
setData();
return templateService.getPeriodTemplateJson(templateId,period,prokjectId).then(function (reportSpread) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
......@@ -98,7 +100,7 @@
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
initSpreadExcel(reportSpread, update).then(function (spread) {
return locateCell(spread, true);
});
}
......@@ -107,7 +109,7 @@
});
};
var initSpreadExcel = function (reportSpread) {
var initSpreadExcel = function (reportSpread, update) {
var spread = new GC.Spread.Sheets.Workbook(getSpreadControlElement());
spread.suspendPaint();
......@@ -233,11 +235,67 @@
// spread.isPaintSuspended(false);
scope.spread = spread;
scope.hasLoadSpread = true;
if(update){
updateData();
}else
{
scope.hasLoadSpread = true;
}
return $q.when(spread);
};
var updateData = function(){
setData();
var sheet = getSpreadControl().sheets[0];
sheet.suspendPaint();
var cells = [];
var reportDataSources = _.chain(scope.reportSource)
.pluck('dataSourceList')
.flatten(true).value();
angular.forEach(scope.reportSource, function (x) {
// 比较刷新前后报表中的值的变化
// 优先将单元格转换成数值比较,如果不能则转换为字符串比较
var cell = sheet.getCell(x.rowIndex, x.columnIndex);
var newVal = 100;//cell.value();
newVal = PWC.tryParseStringToNum(newVal);
if (_.isBoolean(newVal)) {
newVal = newVal.toString();
}
else if (_.isNumber(newVal) && !isNaN(newVal)) {
newVal = newVal.toFixed(4);
}
if(x.keyinData){
sheet.setValue(x.rowIndex, x.columnIndex, x.keyinData);
}
var oldVal = x.value;
oldVal = PWC.tryParseStringToNum(oldVal);
if (_.isBoolean(oldVal)) {
oldVal = oldVal.toString();
}
else if (_.isNumber(oldVal) && !isNaN(oldVal)) {
oldVal = oldVal.toFixed(4);
}
if (newVal !== oldVal) {
cells.push({id: x.cellID, oldVal: oldVal, newVal: newVal});
x.value = newVal;
x.isDirty = true;
var dirtyDataSources = _.filter(reportDataSources, {
cellDataID: x.cellID,
name: 'ReportDataSource'
});
angular.forEach(dirtyDataSources, function (ds) {
newVal = PWC.tryParseStringToNum(newVal);
ds.amount = newVal;
});
sheet.setTag(x.rowIndex, x.columnIndex, JSON.stringify(x));
}
sheet.resumePaint();
});
}
var setEditable = function (spread, isReadOnly, ifSuspend) {
//todo:注册之后这里去掉注释
......@@ -595,54 +653,7 @@
// 更新数据源后,通过调用该方法计算所有当前sheet单元格,并通过比较原数据列表与spreadJS计算的新值列表,获取保存时需要修改库中Value的单元格信息列表
var updateCells = function () {
setData();
var sheet = getSpreadControl().sheets[0];
var cells = [];
var reportDataSources = _.chain(scope.reportSource)
.pluck('dataSourceList')
.flatten(true).value();
angular.forEach(scope.reportSource, function (x) {
// 比较刷新前后报表中的值的变化
// 优先将单元格转换成数值比较,如果不能则转换为字符串比较
var cell = sheet.getCell(x.rowIndex, x.columnIndex);
var newVal = cell.value();
newVal = PWC.tryParseStringToNum(newVal);
if (_.isBoolean(newVal)) {
newVal = newVal.toString();
}
else if (_.isNumber(newVal) && !isNaN(newVal)) {
newVal = newVal.toFixed(4);
}
if(x.keyinData){
sheet.setValue(x.rowIndex, x.columnIndex, x.keyinData);
}
var oldVal = x.value;
oldVal = PWC.tryParseStringToNum(oldVal);
if (_.isBoolean(oldVal)) {
oldVal = oldVal.toString();
}
else if (_.isNumber(oldVal) && !isNaN(oldVal)) {
oldVal = oldVal.toFixed(4);
}
if (newVal !== oldVal) {
cells.push({id: x.cellID, oldVal: oldVal, newVal: newVal});
x.value = newVal;
x.isDirty = true;
var dirtyDataSources = _.filter(reportDataSources, {
cellDataID: x.cellID,
name: 'ReportDataSource'
});
angular.forEach(dirtyDataSources, function (ds) {
newVal = PWC.tryParseStringToNum(newVal);
ds.amount = newVal;
});
sheet.setTag(x.rowIndex, x.columnIndex, JSON.stringify(x));
}
});
loadSheet(scope.templateId);
loadSheet(scope.templateId, true);
return cells;
};
......
......@@ -1602,7 +1602,7 @@
// 前端保存数据
return citReportService.addCellManualData($scope.handInputModel, logDto).then(function (manualData) {
var obj = manualData.data.data;
obj.dataSourceType = manualData.dataSourceType;
obj.dataSourceType = manualData.dataSourceType ;
$scope.updateCellByManualChange(obj);
return $q.when();
});
......
......@@ -4,6 +4,7 @@
vatSessionService, stdAccountService, vatCommonService, formulaService, KeyValueConfigService, modelConfigurationService, $timeout, cellCommentService, modifiedReportCellService, commonWebService) {
var _ra = null;
var priorities = ["Low", "Normal", "Urgent", "High"];
var entityInit = function () {
//初始化值
$scope.entry = {
......@@ -31,7 +32,8 @@
mode: "standard"
},
selection: {
mode: "multiple"
mode: "multiple",
deferred: true
},
sorting: {
mode: 'single'
......@@ -76,6 +78,10 @@
showBorders: true,
showRowLines: true,
showColumnLines: true,
filterRow: {
visible: true
},
selectionFilter: ["Task_Status", "=", "Completed"]
};
//设置数据源表格的列
......
......@@ -234,7 +234,7 @@
$scope.detail.dataGridSourceBind.forEach(function (e, index) {
if (e.adjustAccount != undefined && e.adjustAccount != null) {
updateAdjustDto.push({
"id": e.id,
"id": $scope.detail.entryLogIdById,
"adjustAccount": Number(e.adjustAccount)
});
}
......@@ -1616,8 +1616,7 @@
$scope.detail.entryIndex = e.dataIndex;
$scope.detail.entryLogIdByCode = e.data.accountCode;
$scope.detail.entryLogIdById = e.data.id;
$scope.relObj.entryLogIdByCode = e.data.accountCode;
cellCommentService.loadEntryListDataList(e.data.accountCode).success(function (res) {
cellCommentService.loadEntryListDataList(e.data.accountCode, e.data.projectId).success(function (res) {
$scope.relObj.account = e.data.accountCode;
if (res.resultMsg == "success") {
$scope.relObj.entryDataSource = commonWebService._index(res.data);
......
......@@ -14,8 +14,8 @@ webservices.factory('cellCommentService', ['$http', 'apiConfig', function ($http
getCellInformation: function (data) {
return $http.get('/CellComment/getCellInformation?sql=' + data.relSql, apiConfig.createVat());
},
loadEntryListDataList: function (code) {
return $http.get('/CellComment/loadEntryListDataList?code=' + code, apiConfig.createVat());
loadEntryListDataList: function (code, projectId) {
return $http.get('/CellComment/loadEntryListDataList?code=' + code + "&projectId=" + projectId, apiConfig.createVat());
},
updateAdjust : function (data) {
return $http.post('/CellComment/updateAdjust', JSON.stringify(data), apiConfig.createVat({contentType: 'application/json;charset=UTF-8'}));
......
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