Commit 3ab39e95 authored by eddie.woo's avatar eddie.woo

modify

parent 4310c448
...@@ -381,6 +381,38 @@ ...@@ -381,6 +381,38 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/lib/soap-client-1.0.jar</systemPath> <systemPath>${basedir}/lib/soap-client-1.0.jar</systemPath>
</dependency> </dependency>
<!--CXF-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-wsdl</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-databinding-jaxb</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.2.6</version>
</dependency>
<!--CXF END-->
</dependencies> </dependencies>
<profiles> <profiles>
......
...@@ -50,12 +50,21 @@ public class AtmsExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -50,12 +50,21 @@ public class AtmsExceptionHandler extends ResponseEntityExceptionHandler {
} }
@ExceptionHandler(value = Throwable.class) @ExceptionHandler(value = Throwable.class)
public ApiResultDto handle(HttpServletResponse response) { public void handle(Throwable throwable, HttpServletResponse response) {
return ApiResultDto.fail("error."); throwable.printStackTrace();
//noinspection Duplicates
try {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=UTF-8");
response.getWriter().write(JSON.toJSONString(ApiResultDto.fail(throwable.getMessage())));
} catch (IOException e) {
logger.error("customHandle error.", e);
}
} }
@ExceptionHandler(value = ServiceException.class) @ExceptionHandler(value = ServiceException.class)
public void customHandle(pwc.taxtech.atms.common.ServiceException exception, HttpServletResponse response) { public void customHandle(pwc.taxtech.atms.common.ServiceException exception, HttpServletResponse response) {
//noinspection Duplicates
try { try {
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=UTF-8"); response.setContentType("application/json; charset=UTF-8");
......
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSON; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dpo.PagingDto; import pwc.taxtech.atms.dpo.PagingDto;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.PagingResultDto; import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto; import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam; import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
import pwc.taxtech.atms.service.impl.DataImportService; import pwc.taxtech.atms.service.impl.DataImportService;
import pwc.taxtech.atms.service.impl.LgGlBalanceService;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
...@@ -17,6 +21,8 @@ public class DataImportController extends BaseController { ...@@ -17,6 +21,8 @@ public class DataImportController extends BaseController {
@Resource @Resource
private DataImportService dataImportService; private DataImportService dataImportService;
@Resource
private LgGlBalanceService lgGlBalanceService;
@PostMapping("GetBalanceDataForDisplay") @PostMapping("GetBalanceDataForDisplay")
public PagingResultDto<TrialBalanceDto> getBalanceDataForDisplay(@RequestBody TrialBalanceParam param) { public PagingResultDto<TrialBalanceDto> getBalanceDataForDisplay(@RequestBody TrialBalanceParam param) {
...@@ -29,7 +35,13 @@ public class DataImportController extends BaseController { ...@@ -29,7 +35,13 @@ public class DataImportController extends BaseController {
resultDto.setPageInfo(pagingDto); resultDto.setPageInfo(pagingDto);
resultDto.setList(list); resultDto.setList(list);
resultDto.setCalculateData(dataImportService.calculateData(list)); resultDto.setCalculateData(dataImportService.calculateData(list));
// 直接返回对象,jackson解析不全 return resultDto;
}
@PostMapping("queryGlBalance")
public ApiResultDto queryGlBalance(@RequestBody TrialBalanceParam param) {
ApiResultDto resultDto = new ApiResultDto();
lgGlBalanceService.queryGlBalance(param.getOrgId(), param.getFromPeriod(), param.getToPeriod());
return resultDto; return resultDto;
} }
} }
...@@ -10,14 +10,18 @@ import org.apache.commons.lang3.StringUtils; ...@@ -10,14 +10,18 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.ServiceException; import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.common.config.SystemConfig; import pwc.taxtech.atms.common.config.SystemConfig;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dao.EnterpriseAccountMapper; import pwc.taxtech.atms.dao.EnterpriseAccountMapper;
import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper; import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.vat.dao.GlBalanceMapper; import pwc.taxtech.atms.vat.dao.GlBalanceMapper;
import pwc.taxtech.atms.vat.entity.GlBalance; import pwc.taxtech.atms.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample; import pwc.taxtech.atms.vat.entity.GlBalanceExample;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -31,6 +35,8 @@ public class LgGlBalanceService extends BaseService { ...@@ -31,6 +35,8 @@ public class LgGlBalanceService extends BaseService {
private EnterpriseAccountSetOrgMapper setOrgMapper; private EnterpriseAccountSetOrgMapper setOrgMapper;
@Resource @Resource
private GlBalanceMapper glBalanceMapper; private GlBalanceMapper glBalanceMapper;
@Resource
private OrganizationMapper organizationMapper;
/** /**
* 科目余额数据同步 * 科目余额数据同步
...@@ -82,4 +88,34 @@ public class LgGlBalanceService extends BaseService { ...@@ -82,4 +88,34 @@ public class LgGlBalanceService extends BaseService {
} }
} }
/**
* 科目余额数据同步
*
* @param orgId String
* @param period YYYY-MM
* @throws ServiceException ex
*/
public void queryGlBalance(String orgId, String period) throws ServiceException {
Organization org = organizationMapper.selectByPrimaryKey(orgId);
if (null == org) {
return;
}
queryGlBalance(org, period);
}
/**
* @param orgId String
* @param fromPeriod Integer
* @param toPeriod Integer
* @throws ServiceException ex
*/
public void queryGlBalance(String orgId, Integer fromPeriod, Integer toPeriod) throws ServiceException {
Calendar calendar = Calendar.getInstance();
for (int i = fromPeriod; i <= toPeriod; i++) {
calendar.set(Calendar.MONTH, i - 1);
SimpleDateFormat dateFormat = new SimpleDateFormat(Constant.DateFormat.YEAR_MONTH);
queryGlBalance(orgId, dateFormat.format(calendar.getTime()));
}
}
} }
...@@ -2,16 +2,29 @@ package pwc.taxtech.atms.common; ...@@ -2,16 +2,29 @@ package pwc.taxtech.atms.common;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
import org.junit.Test; import org.junit.Test;
import pwc.taxtech.atms.CommonIT; import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.entity.StandardAccount; import pwc.taxtech.atms.entity.StandardAccount;
import pwc.taxtech.atms.invoice.InputInvoiceDetailMapper;
import pwc.taxtech.atms.invoice.InputInvoiceMapper;
import pwc.taxtech.atms.vat.entity.InputInvoice;
import pwc.taxtech.atms.vat.entity.InputInvoiceDetail;
import pwc.taxtech.atms.vat.entity.InputInvoiceExample;
import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Optional;
public class DataInitTest extends CommonIT { public class DataInitTest extends CommonIT {
@Resource
private InputInvoiceMapper inputInvoiceMapper;
@Resource
private InputInvoiceDetailMapper inputInvoiceDetailMapper;
@Test @Test
public void initStandardAccount() { public void initStandardAccount() {
...@@ -73,7 +86,115 @@ public class DataInitTest extends CommonIT { ...@@ -73,7 +86,115 @@ public class DataInitTest extends CommonIT {
} }
} }
@Test
public void initInput() throws Exception {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_进项主表_绿能_201809.xls"));
Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
try {
for (int c = 0; c <= sheet.getRow(r).getLastCellNum(); c++) {
Cell cell = sheet.getRow(r).getCell(c);
if (null != cell) {
cell.setCellType(CellType.STRING);
}
}
InputInvoice invoice = new InputInvoice();
invoice.setID(CommonUtils.getUUID());
invoice.setFPDM(sheet.getRow(r).getCell(1).getStringCellValue());
invoice.setFPHM(sheet.getRow(r).getCell(2).getStringCellValue());
invoice.setKPRQ(sheet.getRow(r).getCell(3).getStringCellValue());
invoice.setGFSH(sheet.getRow(r).getCell(4).getStringCellValue());
invoice.setGFMC(sheet.getRow(r).getCell(5).getStringCellValue());
invoice.setXFSH(sheet.getRow(r).getCell(8).getStringCellValue());
invoice.setXFMC(sheet.getRow(r).getCell(9).getStringCellValue());
invoice.setFPLX(sheet.getRow(r).getCell(13).getStringCellValue());
invoice.setHJJE(sheet.getRow(r).getCell(16).getStringCellValue());
invoice.setHJSE(sheet.getRow(r).getCell(17).getStringCellValue());
invoice.setJSHJ(sheet.getRow(r).getCell(18).getStringCellValue());
invoice.setFPZT(sheet.getRow(r).getCell(27).getStringCellValue());
invoice.setCYZT(sheet.getRow(r).getCell(28).getStringCellValue());
invoice.setRZZT(sheet.getRow(r).getCell(29).getStringCellValue());
invoice.setRZSQ(sheet.getRow(r).getCell(30).getStringCellValue());
invoice.setRZSJ(sheet.getRow(r).getCell(31).getStringCellValue());
invoice.setRZJG(sheet.getRow(r).getCell(32).getStringCellValue());
invoice.setCJSJ(sheet.getRow(r).getCell(34).getStringCellValue());
invoice.setLRRQ(sheet.getRow(r).getCell(38).getStringCellValue());
inputInvoiceMapper.insertSelective(invoice);
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println("end");
}
@Test
public void initInputDetail() throws Exception {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_进项明细_绿能_201809.xls"));
Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
try {
for (int c = 0; c <= sheet.getRow(r).getLastCellNum(); c++) {
Cell cell = sheet.getRow(r).getCell(c);
if (null != cell) {
cell.setCellType(CellType.STRING);
}
}
InputInvoiceDetail detail = new InputInvoiceDetail();
detail.setID(CommonUtils.getUUID());
detail.setFPDM(sheet.getRow(r).getCell(1).getStringCellValue());
detail.setFPHM(sheet.getRow(r).getCell(2).getStringCellValue());
detail.setSPMC(sheet.getRow(r).getCell(3).getStringCellValue());
detail.setDW(sheet.getRow(r).getCell(5).getStringCellValue());
detail.setDJ(sheet.getRow(r).getCell(6).getStringCellValue());
detail.setSPSL(sheet.getRow(r).getCell(7).getStringCellValue());
detail.setJE(sheet.getRow(r).getCell(8).getStringCellValue());
detail.setSLV(String.valueOf(Math.round(Double.valueOf(sheet.getRow(r).getCell(9).getStringCellValue()))));
detail.setSE(sheet.getRow(r).getCell(10).getStringCellValue());
// InputInvoiceExample example = new InputInvoiceExample();
// example.createCriteria().andFPDMEqualTo(detail.getFPDM()).andFPHMEqualTo(detail.getFPHM());
// Optional<InputInvoice> invoiceOptional = inputInvoiceMapper.selectByExample(example).stream().findFirst();
// if (!invoiceOptional.isPresent()) {
// continue;
// }
// detail.setFPID();
inputInvoiceDetailMapper.insertSelective(detail);
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println("end");
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(CommonUtils.getUUID()); System.out.println(CommonUtils.getUUID());
try {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入/导入模板_进项明细_乐叶_201807.xls"));
Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
for (int c = 0; c <= sheet.getRow(r).getLastCellNum(); c++) {
Cell cell = sheet.getRow(r).getCell(c);
if (null != cell) {
cell.setCellType(CellType.STRING);
}
}
InputInvoiceDetail detail = new InputInvoiceDetail();
detail.setID(CommonUtils.getUUID());
detail.setFPDM(sheet.getRow(r).getCell(1).getStringCellValue());
detail.setFPHM(sheet.getRow(r).getCell(2).getStringCellValue());
detail.setSPMC(sheet.getRow(r).getCell(3).getStringCellValue());
detail.setDW(sheet.getRow(r).getCell(5).getStringCellValue());
detail.setDJ(sheet.getRow(r).getCell(6).getStringCellValue());
detail.setSPSL(sheet.getRow(r).getCell(7).getStringCellValue());
detail.setJE(sheet.getRow(r).getCell(8).getStringCellValue());
detail.setSLV(String.valueOf(Math.round(Double.valueOf(sheet.getRow(r).getCell(9).getStringCellValue()))));
detail.setSE(sheet.getRow(r).getCell(10).getStringCellValue());
}
sheet.getFirstRowNum();
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidFormatException e) {
e.printStackTrace();
}
} }
} }
...@@ -124,7 +124,14 @@ ...@@ -124,7 +124,14 @@
$scope.isToPrint = true; $scope.isToPrint = true;
$scope.getDataFromDatabase($scope.currentCategory.selected.id, $scope.filterData.periodFrom, $scope.filterData.periodTo, $scope.filterDataCriteria, true); $scope.getDataFromDatabase($scope.currentCategory.selected.id, $scope.filterData.periodFrom, $scope.filterData.periodTo, $scope.filterDataCriteria, true);
} };
$scope.queryGlBalance = function () {
vatImportService.queryGlBalance($scope.filterData.periodFrom, $scope.filterData.periodTo, vatSessionService.project.organizationID)
.success(function (res) {
});
};
// function to get data from Backend // function to get data from Backend
$scope.getDataFromDatabase = function (category, from, to, criteria, isExportOnly) { $scope.getDataFromDatabase = function (category, from, to, criteria, isExportOnly) {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<!--<button id="btnDataFilter" class="hidden" ng-click="doDataFilter('')">Open Filter</button> <!--<button id="btnDataFilter" class="hidden" ng-click="doDataFilter('')">Open Filter</button>
<button id="btnResetDataFilter" class="hidden" ng-click="doDataFilterReset()">Reset Filter</button>--> <button id="btnResetDataFilter" class="hidden" ng-click="doDataFilterReset()">Reset Filter</button>-->
<span class="cursorPointer margin-right10" ng-click="doExport('GL','xlsx')"><i class="fa fa-file-excel-o" aria-hidden="true"></i> <span translate="ExportBtn"></span></span> <span class="cursorPointer margin-right10" ng-click="doExport('GL','xlsx')"><i class="fa fa-file-excel-o" aria-hidden="true"></i> <span translate="ExportBtn"></span></span>
<span class="cursorPointer margin-right10" ng-click="queryGlBalance()"><i class="fa fa-file-excel-o" aria-hidden="true"></i> <span>数据同步</span></span>
</div> </div>
</div> </div>
......
...@@ -249,6 +249,14 @@ ...@@ -249,6 +249,14 @@
// return $http.get('/DataImport/GetBalanceDataForDisplay?category=' + category + '&fromPeriod=' + fromPeriod + '&toPeriod=' + toPeriod + '&criteria=' + criteria, apiConfig.createVat()); // return $http.get('/DataImport/GetBalanceDataForDisplay?category=' + category + '&fromPeriod=' + fromPeriod + '&toPeriod=' + toPeriod + '&criteria=' + criteria, apiConfig.createVat());
}, },
queryGlBalance: function (fromPeriod, toPeriod, orgId) {
return $http.post('/DataImport/queryGlBalance', {
fromPeriod: fromPeriod,
toPeriod: toPeriod,
orgId: orgId
}, apiConfig.createVat());
},
updateACustomPrice: function (customId, invoiceAmount) { updateACustomPrice: function (customId, invoiceAmount) {
return $http.get('/CustomsInvoice/UpdateACustomPrice?customId=' + customId + '&invoiceAmount=' + invoiceAmount, apiConfig.createVat()); return $http.get('/CustomsInvoice/UpdateACustomPrice?customId=' + customId + '&invoiceAmount=' + invoiceAmount, apiConfig.createVat());
}, },
......
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