Skip to content

Commit

Permalink
Merge pull request #2 from nguyenthanhptiter11/release-candidate-3.0-…
Browse files Browse the repository at this point in the history
…duong

Import deliverable file zip
  • Loading branch information
duongnguyen1996 authored Jul 16, 2020
2 parents 88fdca6 + bab68a1 commit 53ca81f
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ public Response importDeliverables(
Locale locale, User user, ServiceContext serviceContext,
Attachment file) {

// System.out.println("================POST===========================");
System.out.println("================POST===========================" + file);
JSONObject result = JSONFactoryUtil.createJSONObject();

BackendAuth auth = new BackendAuthImpl();
Expand All @@ -740,15 +740,18 @@ public Response importDeliverables(
// HttpURLConnection.HTTP_UNAUTHORIZED).entity(
// "User not permission process!").build();
}
// long groupId =
// GetterUtil.getLong(header.getHeaderString(Field.GROUP_ID));
// long userId = user.getUserId();
long groupId =
GetterUtil.getLong(header.getHeaderString(Field.GROUP_ID));
long userId = user.getUserId();
long companyId = user.getCompanyId();
String userName = user.getFullName();

// List<Deliverable> deliverables =
// DeliverableUtils.readWorkBooksDeliverabe(
// file, userId, groupId, serviceContext);
//
// result.put(ConstantUtils.TOTAL, deliverables.size());
JSONArray deliverables =
DeliverableUtils.readZipDeliverabe(file, userId, groupId, companyId, userName, serviceContext);
int size = 0;

result.put(ConstantUtils.TOTAL, deliverables.length());
result.put(ConstantUtils.API_JSON_COUNT, size);

return Response.status(HttpURLConnection.HTTP_OK).entity(
JSONFactoryUtil.looseSerialize(result)).build();
Expand Down Expand Up @@ -823,8 +826,7 @@ public Response importDeliverables2(
String userName = user.getFullName();

DataHandler dataHandle = file.getDataHandler();
JSONArray deliverables = DeliverableUtils.readExcelDeliverable(
dataHandle.getInputStream());
JSONArray deliverables = DeliverableUtils.readExcelDeliverable(dataHandle.getInputStream());

int size = 0;
for (int i = 0; i < deliverables.length(); i++) {
Expand Down
Loading

0 comments on commit 53ca81f

Please sign in to comment.