Commit 8c20d107 authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo' into 'dev'

Dev neo

See merge request root/atms!87
parents a7706553 ead4192b
...@@ -36,7 +36,7 @@ public class JournalEntryImportController { ...@@ -36,7 +36,7 @@ public class JournalEntryImportController {
return ResponseEntity.ok(journalEntryDataImportService.getValidationInfoList(type, period)); return ResponseEntity.ok(journalEntryDataImportService.getValidationInfoList(type, period));
} }
@RequestMapping(value = "/importJournalEntry", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "importJournalEntry", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity ImportJournalEntryData(@RequestBody ImportVoucherDto importParam) { public ResponseEntity ImportJournalEntryData(@RequestBody ImportVoucherDto importParam) {
journalEntryDataImportService.ImportJournalEntryData(importParam.VoucherList, importParam.ImportType, journalEntryDataImportService.ImportJournalEntryData(importParam.VoucherList, importParam.ImportType,
identityService.getIdentityUser().getID()); identityService.getIdentityUser().getID());
......
package pwc.taxtech.atms.dto.vatdto; package pwc.taxtech.atms.dto.vatdto;
import org.thymeleaf.util.StringUtils;
import pwc.taxtech.atms.vat.entity.Voucher;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -396,4 +399,30 @@ public class VoucherDto { ...@@ -396,4 +399,30 @@ public class VoucherDto {
public void setAuditCount(int auditCount) { public void setAuditCount(int auditCount) {
this.auditCount = auditCount; this.auditCount = auditCount;
} }
public VoucherDto extractFromVoucher(Voucher v) {
setVoucherID(v.getVoucherID());
setvID(v.getVID());
setDate(v.getDate());
setGroup(v.getGroup());
setPeriod(v.getPeriod());
setCustomerCode(v.getCustomerCode());
setCustomerName(v.getCustomerName());
setSummary(v.getSummary());
setAcctCode(v.getAcctCode());
setDebit(v.getDebit());
setCredit(v.getCredit());
setAttach(v.getAttach());
if (v.getItemID() != null)
setItemID(Long.parseLong(v.getItemID()));
setCreatedTime(v.getCreateTime());
setOriginalPeriod(v.getOriginalPeriod());
setStatus(v.getStatus());
setStdCode(v.getStdCode());
setMappingReason(v.getMappingReason());
if (!StringUtils.isEmpty(v.getMappingReason()))
setMappingUser(Integer.valueOf(v.getMappingUser()));
setMappingTime(v.getMappingTime());
return this;
}
} }
...@@ -43,7 +43,6 @@ public interface JournalEntryImportMapper extends MyVatMapper { ...@@ -43,7 +43,6 @@ public interface JournalEntryImportMapper extends MyVatMapper {
"WHERE " + "WHERE " +
" 1 = 1 " + " 1 = 1 " +
" AND `ImportType` = #{importType} AND `Period` = #{period} " + " AND `ImportType` = #{importType} AND `Period` = #{period} " +
" ORDER BY `Period`,`Group`,`VID`,`ItemID`" +
" LIMIT #{start},#{size}" + " LIMIT #{start},#{size}" +
"</script>") "</script>")
List<Voucher> pageQuery(@Param("importType") int code, @Param("period") int periodId, @Param("start") int start , List<Voucher> pageQuery(@Param("importType") int code, @Param("period") int periodId, @Param("start") int start ,
...@@ -61,14 +60,13 @@ public interface JournalEntryImportMapper extends MyVatMapper { ...@@ -61,14 +60,13 @@ public interface JournalEntryImportMapper extends MyVatMapper {
Integer pageQueryCount(@Param("importType") int code, @Param("period") int periodId); Integer pageQueryCount(@Param("importType") int code, @Param("period") int periodId);
@Select("<script>" + @Select("<script>" +
"SELECT " + " SELECT " +
" COUNT(1) " + " count(1) " +
"FROM " + "FROM " +
" Voucher " + " (SELECT DISTINCT " +
"WHERE " + " VID , `Group`, Period " +
" 1 = 1" + " FROM " +
" AND `ImportType` = #{importType} AND `Period` = #{period}" + " Voucher WHERE `ImportType` = #{importType} AND `Period` = #{period}) as temp" +
" GROUP BY `VID` ,`Group`,`Period`" +
"</script>") "</script>")
Integer pageVIDCount(@Param("importType") int code, @Param("period") int periodId); Integer pageVIDCount(@Param("importType") int code, @Param("period") int periodId);
} }
...@@ -282,15 +282,7 @@ public class FinanceDataImportServiceImpl { ...@@ -282,15 +282,7 @@ public class FinanceDataImportServiceImpl {
List<VoucherDto> dtos = new ArrayList<>(vouchers.size()); List<VoucherDto> dtos = new ArrayList<>(vouchers.size());
vouchers.forEach(m -> { vouchers.forEach(m -> {
VoucherDto dto = new VoucherDto(); dtos.add(new VoucherDto().extractFromVoucher(m));
try {
FieldsMapper.map(m, dto);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
dtos.add(dto);
}); });
return dtos; return dtos;
......
...@@ -60,7 +60,7 @@ public class JournalEntryImportServiceImpl { ...@@ -60,7 +60,7 @@ public class JournalEntryImportServiceImpl {
qResult.setCalculateData(new VoucherDto()); qResult.setCalculateData(new VoucherDto());
List<Voucher> pageResultList = journalEntryImportMapper.pageQuery(VatImportType.JournalEntry.getCode(), List<Voucher> pageResultList = journalEntryImportMapper.pageQuery(VatImportType.JournalEntry.getCode(),
queryJeDto.getPeriodId(), queryJeDto.getPageInfo().getPageIndex() * queryJeDto.getPageInfo().getPageSize(), queryJeDto.getPeriodId(), (queryJeDto.getPageInfo().getPageIndex()-1) * queryJeDto.getPageInfo().getPageSize(),
queryJeDto.getPageInfo().getPageSize()); queryJeDto.getPageInfo().getPageSize());
Integer pageCount = journalEntryImportMapper.pageQueryCount(VatImportType.JournalEntry.getCode(), Integer pageCount = journalEntryImportMapper.pageQueryCount(VatImportType.JournalEntry.getCode(),
...@@ -92,16 +92,7 @@ public class JournalEntryImportServiceImpl { ...@@ -92,16 +92,7 @@ public class JournalEntryImportServiceImpl {
for (Voucher voucher : pageResultList) { for (Voucher voucher : pageResultList) {
if (voucher.getMonthID() == null && MonthID == 1) voucher.setMonthID(0); if (voucher.getMonthID() == null && MonthID == 1) voucher.setMonthID(0);
if (voucher.getSummary() == null && Summary == 1) voucher.setSummary(""); if (voucher.getSummary() == null && Summary == 1) voucher.setSummary("");
qResult.getList().add(new VoucherDto().extractFromVoucher(voucher));
VoucherDto voucherDto = new VoucherDto();
try {
FieldsMapper.map(voucher, voucherDto);
} catch (ClassNotFoundException e) {//TODO replace exception filter (neo)
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
qResult.getList().add(voucherDto);
} }
return qResult; return qResult;
......
...@@ -691,7 +691,7 @@ ...@@ -691,7 +691,7 @@
}) + ')' + $translate.instant('JournalJFJE') + $translate.instant('NumOverLengthMsg') + '<br />'; }) + ')' + $translate.instant('JournalJFJE') + $translate.instant('NumOverLengthMsg') + '<br />';
numOutRangeCheckCount++; numOutRangeCheckCount++;
} else { } else {
m.Debit = PWC.round(m.Debit, 2); // m.Debit = PWC.round(m.Debit, 2);//todo:skip round to ben open future (neo)
} }
//如果在规定的数值范围外,则提示错误 //如果在规定的数值范围外,则提示错误
if (parseFloat(m.Credit) < constant.startNum || parseFloat(m.Credit) > constant.endNum) { if (parseFloat(m.Credit) < constant.startNum || parseFloat(m.Credit) > constant.endNum) {
...@@ -700,7 +700,7 @@ ...@@ -700,7 +700,7 @@
}) + ')' + $translate.instant('JournalDFJE') + $translate.instant('NumOverLengthMsg') + '<br />'; }) + ')' + $translate.instant('JournalDFJE') + $translate.instant('NumOverLengthMsg') + '<br />';
numOutRangeCheckCount++; numOutRangeCheckCount++;
} else { } else {
m.Credit = PWC.round(m.Credit, 2); // m.Credit = PWC.round(m.Credit, 2);//todo:skip round to ben open future (neo)
} }
} }
...@@ -949,7 +949,7 @@ ...@@ -949,7 +949,7 @@
//前台数据验证 //前台数据验证
// FrontEndValidJournalEntryData(inputJournalEntryList);todo : to be open futrue (neo) FrontEndValidJournalEntryData(inputJournalEntryList);
if ($scope.errorMsgMap.length > 0) { if ($scope.errorMsgMap.length > 0) {
$('#errorListModal').modal('show'); $('#errorListModal').modal('show');
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
var date = new Date(); var date = new Date();
var month = date.getMonth(); var month = date.getMonth();
var projectyear = date.getFullYear(); var projectyear = date.getFullYear();
var cacheName = 'atms-vat-cache';
var propList = ['month', 'year', 'project', 'projects', 'dataChanged', 'logUser', 'userPermission', 'queryDto'];
if (month <= 0) { if (month <= 0) {
month = 1; month = 1;
} }
...@@ -23,6 +26,15 @@ ...@@ -23,6 +26,15 @@
checkedOrgs: {}, checkedOrgs: {},
}; };
var cacheObj = {
month: month,
userPermission: {},
project: { year: 2017 },
projects: [],
dataChanged: false
};
//重置项目月份
var reset = function () { var reset = function () {
var date = new Date(); var date = new Date();
var m = date.getMonth(); var m = date.getMonth();
...@@ -32,50 +44,216 @@ ...@@ -32,50 +44,216 @@
this.month = m; this.month = m;
setProperty("month", m); setProperty("month", m);
}; };
var temp = localStorageService.get(cacheName);
if (temp) {
cacheObj = temp;
} else {
localStorageService.set(cacheName, cacheObj);
};
//设置属性值
var setProperty = function (propertyName, propertyValue) {
cacheObj[propertyName] = propertyValue;
localStorageService.set(cacheName, cacheObj);
};
//获取属性值
var getProperty = function (propertyName) {
return cacheObj[propertyName];
};
// 更新project内属性
var updateObjectProperty = function (objectName, propertyPath, propertyValue) {
var obj = cacheObj[objectName];
if (!_.isEmpty(obj)) {
var propertyArr = propertyPath.split('.');
for (var i = 0; i < propertyArr.length - 1; i++) {
if (!_.isEmpty(obj)) {
obj = obj[propertyArr[i]];
}
}
if (!_.isEmpty(obj)) {
obj[propertyArr[propertyArr.length - 1]] = propertyValue;
}
}
localStorageService.set(cacheName, cacheObj);
};
// 跳转到admin或者outputinvoice management 需要清空所选择的project,不然会影响权限
var clearSelectProject = function () {
var tempProject = { year: 2017 };
setProperty('project', tempProject);
};
var result = {};
var defineProp = function (propertyName) {
Object.defineProperty(result, propertyName, {
get: function () {
var getValue = getProperty(propertyName);
var year = new Date().getFullYear();
var month = new Date().getMonth();
switch (propertyName) {
case "year":
return getValue || year;
case "month":
return getValue || month - 1;
case "project":
return getValue || { year: year };
case "projects":
return getValue || [];
case "dataChanged":
return getValue || false;
case "logUser":
return getValue || logUser;
case "userPermission":
return getValue || {};
case "queryDto":
return getValue || queryDto;
}
},
set: function (val) {
setProperty(propertyName, val);
},
});
};
propList.forEach(function (propName) {
defineProp(propName);
});
result.reset = reset;
result.setProperty = setProperty;
result.getProperty = getProperty;
result.updateObjectProperty = updateObjectProperty;
result.clearSelectProject = clearSelectProject;
return result;
}]);
webservices.factory('citSessionService', ['$log', 'localStorageService', 'enums', function ($log, localStorageService, enums) {
'use strict';
$log.debug('citSessionService.ctor()...');
var date = new Date();
var month = constant.WholeYearPeriod;
var projectyear = 2017;
var cacheName = 'atms-cit-cache';
var propList = ['month', 'year', 'project', 'projects', 'dataChanged', 'logUser', 'userPermission', 'queryDto'];
var logUser = {
ID: "66933E7B-DA75-4B2E-B7D6-AB65DCA20D50",
UserName: "Admin",
};
var queryDto = {
searchKeyword: '',
fieldId: '',
filedName: 'orgName',
checkedOrgs: {},
};
var cacheObj = { var cacheObj = {
month: month, month: month,
userPermission: {}, userPermission: {},
project: { year: 2017 }, project: { year: projectyear },
projects: [], projects: [],
dataChanged: false dataChanged: false
}; };
var temp = localStorageService.get('atms-cache');
var temp = localStorageService.get(cacheName);
if (temp) { if (temp) {
cacheObj = temp; cacheObj = temp;
} else { } else {
localStorageService.set('atms-cache', cacheObj); localStorageService.set(cacheName, cacheObj);
} };
//设置属性值
var setProperty = function (propertyName, propertyValue) { var setProperty = function (propertyName, propertyValue) {
cacheObj[propertyName] = propertyValue
//$cookieStore.put('atms-cache', JSON.stringify(apiTokenObj));
localStorageService.set('atms-cache', cacheObj);
}
cacheObj[propertyName] = propertyValue;
localStorageService.set(cacheName, cacheObj);
};
//获取属性值
var getProperty = function (propertyName) { var getProperty = function (propertyName) {
//console.log($cookieStore.get('atms-cache'));
return cacheObj[propertyName]; return cacheObj[propertyName];
};
// 更新project内属性
var updateObjectProperty = function (objectName, propertyPath, propertyValue) {
var obj = cacheObj[objectName];
if (obj) {
var propertyArr = propertyPath.split('.');
for (var i = 0; i < propertyArr.length - 1; i++) {
if (!_.isEmpty(obj)) {
obj = obj[propertyArr[i]];
}
}
obj[propertyArr[propertyArr.length - 1]] = propertyValue;
} }
// 跳转到admin或者outputinvoice management 需要清空所选择的project,不然会影响权限 localStorageService.set(cacheName, cacheObj);
};
//跳转到admin或者outputinvoice management 需要清空所选择的project,不然会影响权限
var clearSelectProject = function () { var clearSelectProject = function () {
var tempProject = { year: 2017 }; var tempProject = { year: projectyear };
setProperty('project', tempProject); setProperty('project', tempProject);
}; };
return { var result = {};
month: month,
year: projectyear, var defineProp = function (propertyName) {
project: { year: 2017 }, Object.defineProperty(result, propertyName, {
projects: [], get: function () {
dataChanged: false,
logUser: logUser, var getValue = getProperty(propertyName);
reset: reset, var year = new Date().getFullYear();
userPermission: userPermission,
queryDto: queryDto, switch (propertyName) {
setProperty: setProperty, case "year":
getProperty: getProperty, return getValue || year;
clearSelectProject: clearSelectProject, case "month":
return getValue || enums.wholeYearPeriod.import;
case "project":
return getValue || { year: year };
case "projects":
return getValue || [];
case "dataChanged":
return getValue || false;
case "logUser":
return getValue || logUser;
case "userPermission":
return getValue || {};
case "queryDto":
return getValue || queryDto;
} }
},
set: function (val) {
setProperty(propertyName, val);
},
});
};
propList.forEach(function (propName) {
defineProp(propName);
});
result.setProperty = setProperty;
result.getProperty = getProperty;
result.updateObjectProperty = updateObjectProperty;
result.clearSelectProject = clearSelectProject;
return result;
}]); }]);
\ No newline at end of file
webservices.factory('vatSessionService', ['$log', 'localStorageService', function ($log, localStorageService) {
'use strict';
$log.debug('vatSessionService.ctor()...');
var date = new Date();
var month = date.getMonth();
var projectyear = date.getFullYear();
if (month <= 0) {
month = 1;
}
var logUser =
{
ID: "66933E7B-DA75-4B2E-B7D6-AB65DCA20D50",
UserName: "Admin",
};
var userPermission = {};
var queryDto = {
searchKeyword: '',
fieldId: '',
filedName: 'orgName',
checkedOrgs: {},
};
var reset = function () {
var date = new Date();
var m = date.getMonth();
if (m <= 0) {
m = 1;
}
this.month = m;
setProperty("month", m);
};
var cacheObj = {
month: month,
userPermission: {},
project: { year: 2017 },
projects: [],
dataChanged: false
};
var temp = localStorageService.get('tesla-cache');
if (temp) {
cacheObj = temp;
} else {
localStorageService.set('tesla-cache', cacheObj);
}
var setProperty = function (propertyName, propertyValue) {
cacheObj[propertyName] = propertyValue;
//$cookieStore.put('tesla-cache', JSON.stringify(apiTokenObj));
localStorageService.set('tesla-cache', cacheObj);
};
var getProperty = function (propertyName) {
//console.log($cookieStore.get('tesla-cache'));
return cacheObj[propertyName];
};
// 跳转到admin或者outputinvoice management 需要清空所选择的project,不然会影响权限
var clearSelectProject = function () {
var tempProject = { year: 2017 };
setProperty('project', tempProject);
};
return {
month: month,
year: projectyear,
project: { year: 2017 },
projects: [],
dataChanged: false,
logUser: logUser,
reset: reset,
userPermission: userPermission,
queryDto: queryDto,
setProperty: setProperty,
getProperty: getProperty,
clearSelectProject: clearSelectProject
}
}]);
\ No newline at end of file
This diff is collapsed.
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