Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.inventory</groupId>
<artifactId>inventory-api</artifactId>
<version>3.4.0</version>
<version>3.5.0</version>
<packaging>war</packaging>
<name>Inventory-API</name>
<description>Inventory Page</description>
Expand Down Expand Up @@ -111,11 +111,11 @@
<artifactId>jersey-media-multipart</artifactId>
<version>2.0-m11</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
</dependency>
</dependency> -->

Check warning on line 118 in pom.xml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDnCDJ0w-VaziVl1&open=AZrjtDnCDJ0w-VaziVl1&pullRequest=108
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down Expand Up @@ -215,14 +215,26 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<!-- <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</exclusions> -->
<!-- <version>2.5.5</version> Use the latest stable version -->

Check warning on line 224 in pom.xml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDnCDJ0w-VaziVl2&open=AZrjtDnCDJ0w-VaziVl2&pullRequest=108
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>


<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
ItemStockEntryReport report = InputMapper.gson().fromJson(request, ItemStockEntryReport.class);
String res = crmReportService.getShortExpiryReport(report);
response.setResponse(res);
logger.info("getShortExpiryReport response " + response.toString());
logger.info("Short Expiry Report response:" + response.toString());

Check warning on line 214 in src/main/java/com/iemr/inventory/controller/report/CRMReportController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDiKDJ0w-VaziVls&open=AZrjtDiKDJ0w-VaziVls&pullRequest=108

Check warning on line 214 in src/main/java/com/iemr/inventory/controller/report/CRMReportController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Invoke method(s) only conditionally. Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDiKDJ0w-VaziVlr&open=AZrjtDiKDJ0w-VaziVlr&pullRequest=108
} catch (Exception e) {
logger.error(e.getMessage());
response.setError(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public interface InventoryReportMapper {
@Mappings({ @Mapping(target = "facilityName", expression = "java(entryReport.getFacilityName())"),
@Mapping(target = "itemName", expression = "java(entryReport.getItemName())"),
@Mapping(target = "itemCategory", expression = "java(entryReport.getItemCategoryName())"),
@Mapping(target = "strength", expression = "java(entryReport.getStrength())"),
@Mapping(target = "batchNo", expression = "java(entryReport.getBatchNo())"),
@Mapping(target = "unitCostPrice", expression = "java(entryReport.getUnitCostPrice())"),
@Mapping(target = "expiryDate", expression = "java(entryReport.getExpiryDate())"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

private String itemCategory;

private String strength;

private String batchNo;

private Double unitCostPrice;
Expand All @@ -52,12 +54,13 @@

}

public ExpiryReport(String facilityName, String itemName, String itemCategory, String batchNo, Double unitCostPrice,
public ExpiryReport(String facilityName, String itemName, String itemCategory, String Strength, String batchNo, Double unitCostPrice,

Check warning on line 57 in src/main/java/com/iemr/inventory/model/report/ExpiryReport.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDmpDJ0w-VaziVlz&open=AZrjtDmpDJ0w-VaziVlz&pullRequest=108

Check warning on line 57 in src/main/java/com/iemr/inventory/model/report/ExpiryReport.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Constructor has 8 parameters, which is greater than 7 authorized.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDmpDJ0w-VaziVl0&open=AZrjtDmpDJ0w-VaziVl0&pullRequest=108
Date expiryDate, Integer quantityInHand) {

this.facilityName = facilityName;
this.itemName = itemName;
this.itemCategory = itemCategory;
this.strength = Strength;
this.batchNo = batchNo;
this.unitCostPrice = unitCostPrice;
this.expiryDate = expiryDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ List<Object[]> getDailyStockDetailReportByFacilityID(@Param("startDate") Date st
List<Object[]> getDailyStockSummaryReportByFacilityID(@Param("startDate") Date startDate,
@Param("endDate") Date endDate, @Param("facilityID") Integer facilityID);

@Query(value="Select distinct FacilityName, ItemName, ItemCategoryName, BatchNo, UnitCostPrice, ExpiryDate, QuantityInHand from db_reporting.fact_itemstockentry "
@Query(value="Select distinct FacilityName, ItemName, ItemCategoryName, Strength, BatchNo, UnitCostPrice, ExpiryDate, QuantityInHand from db_reporting.fact_itemstockentry "
+ "where ExpiryDate >= :startDate and ExpiryDate <= adddate(:startDate,AlertBeforeDays) and Deleted=false order by ExpiryDate asc",nativeQuery=true)
List<Object[]> getShortExpiryReport(@Param("startDate") Date startDate);

@Query(value="Select distinct FacilityName, ItemName, ItemCategoryName, BatchNo, UnitCostPrice, ExpiryDate, QuantityInHand from db_reporting.fact_itemstockentry "
@Query(value="Select distinct FacilityName, ItemName, ItemCategoryName, Strength, BatchNo, UnitCostPrice, ExpiryDate, QuantityInHand from db_reporting.fact_itemstockentry "
+ "where ExpiryDate >= :startDate and ExpiryDate <= adddate(:startDate,AlertBeforeDays) and FacilityID = :facilityID and Deleted=false order by ExpiryDate asc",nativeQuery=true)
List<Object[]> getShortExpiryReportByFacilityID(@Param("startDate") Date startDate,
@Param("facilityID") Integer facilityID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -57,6 +59,8 @@
@Autowired(required=false)
InventoryReportMapper mapper;

private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());

@Override
public String getInwardStockReport(ItemStockEntryReport entryReport) {

Expand Down Expand Up @@ -98,9 +102,10 @@
object[1] != null ? object[1].toString() : null,
object[2] != null ? object[2].toString() : null,
object[3] != null ? object[3].toString() : null,
object[4] != null ? Double.valueOf(object[4].toString()) : null,
(Date) (object[5] != null ? object[5] : null),
(Integer) (object[6] != null ? object[6] : null));
object[4] != null ? object[4].toString() : null,
object[5] != null ? Double.valueOf(object[5].toString()) : null,
(Date) (object[6] != null ? object[6] : null),
(Integer) (object[7] != null ? object[7] : null));

report.setSlNo(slNo++);
reportList.add(report);
Expand Down Expand Up @@ -618,6 +623,10 @@
list = itemStockReportRepo.getShortExpiryReport(startExpiry);
}

logger.info("Short Expiry Report Start Date: " + startExpiry + " End Date: " + endExpiry);

Check warning on line 626 in src/main/java/com/iemr/inventory/service/report/CRMReportServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDkhDJ0w-VaziVlt&open=AZrjtDkhDJ0w-VaziVlt&pullRequest=108

Check warning on line 626 in src/main/java/com/iemr/inventory/service/report/CRMReportServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDkhDJ0w-VaziVlv&open=AZrjtDkhDJ0w-VaziVlv&pullRequest=108

logger.info("Short Expiry Report List Size: " + list.size());

Check warning on line 628 in src/main/java/com/iemr/inventory/service/report/CRMReportServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDkhDJ0w-VaziVlw&open=AZrjtDkhDJ0w-VaziVlw&pullRequest=108

Check warning on line 628 in src/main/java/com/iemr/inventory/service/report/CRMReportServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Invoke method(s) only conditionally. Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDkhDJ0w-VaziVlu&open=AZrjtDkhDJ0w-VaziVlu&pullRequest=108

Long slNo = 1L;

for (Object[] object : list) {
Expand All @@ -627,9 +636,10 @@
object[1] != null ? object[1].toString() : null,
object[2] != null ? object[2].toString() : null,
object[3] != null ? object[3].toString() : null,
object[4] != null ? ((BigDecimal) object[4]).doubleValue() : null,
(Date) (object[5] != null ? object[5] : null),
(Integer) (object[6] != null ? object[6] : null));
object[4] != null ? object[4].toString() : null,
object[5] != null ? ((BigDecimal) object[5]).doubleValue() : null,
(Date) (object[6] != null ? object[6] : null),
(Integer) (object[7] != null ? object[7] : null));

report.setSlNo(slNo++);
reportList.add(report);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,13 @@
throws InventoryException {

List<AllocateItemMap> allocateItemMapList = new ArrayList<AllocateItemMap>();

logger.info("ItemStockExitList Size:" + itemStockExitList.size());

Check warning on line 151 in src/main/java/com/iemr/inventory/service/stockEntry/StockEntryServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDlsDJ0w-VaziVly&open=AZrjtDlsDJ0w-VaziVly&pullRequest=108

Check warning on line 151 in src/main/java/com/iemr/inventory/service/stockEntry/StockEntryServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Invoke method(s) only conditionally. Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Inventory-API&issues=AZrjtDlsDJ0w-VaziVlx&open=AZrjtDlsDJ0w-VaziVlx&pullRequest=108
for (ItemStockExit itemStockExit : itemStockExitList) {
AllocateItemMap allocateItemMap = new AllocateItemMap();
List<ItemStockEntry> itemStockList = new ArrayList<ItemStockEntry>();

ItemMaster item = itemService.getItemMasterCatByID(itemStockExit.getItemID());


System.out.println("Test Item: " + item.toString());
System.out.println("Test item category: "+ item.getItemCategory());
System.out.println("Test item issuetype: "+ item.getItemCategory().getIssueType());
System.out.println("Test facilityID: "+ item.getFacilityID());
System.out.println("Test itemStockExit: "+ itemStockExit.toString());
System.out.println("Test itemStockExit.getDuration(): "+ itemStockExit.getDuration());


allocateItemMap.setFacilityID(item.getFacilityID());
allocateItemMap.setItemID(item.getItemID());
allocateItemMap.setItemName(item.getItemName());
Expand Down
Loading