PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/UniwareCore/src/main/java/com/uniware/core/vo/ChannelInventoryFormulaVO.java

https://bitbucket.org/piyushgd10/bhumi
Java | 78 lines | 60 code | 18 blank | 0 comment | 0 complexity | ca6254af4d162d45ec56f9b558bfc1cd MD5 | raw file
  1. package com.uniware.core.vo;
  2. import com.google.gson.Gson;
  3. import com.unifier.core.utils.DateUtils;
  4. import com.unifier.core.utils.EncryptionUtils;
  5. import com.unifier.core.utils.StringUtils;
  6. import org.springframework.data.annotation.Id;
  7. import org.springframework.data.mongodb.core.index.Indexed;
  8. import org.springframework.data.mongodb.core.mapping.Document;
  9. import java.util.Date;
  10. @Document(collection = "channelInventoryFormula")
  11. public class ChannelInventoryFormulaVO {
  12. @Id
  13. private String id;
  14. @Indexed(unique = true)
  15. private String code;
  16. @Indexed(unique = true)
  17. private String checksum;
  18. private String formula;
  19. private Date created;
  20. public String getId() {
  21. return id;
  22. }
  23. public void setId(String id) {
  24. this.id = id;
  25. }
  26. public String getCode() {
  27. return code;
  28. }
  29. public void setCode(String code) {
  30. this.code = code;
  31. }
  32. public String getChecksum() {
  33. return checksum;
  34. }
  35. public void setChecksum(String checksum) {
  36. this.checksum = checksum;
  37. }
  38. public String getFormula() {
  39. return formula;
  40. }
  41. public void setFormula(String formula) {
  42. this.formula = formula;
  43. }
  44. public Date getCreated() {
  45. return created;
  46. }
  47. public void setCreated(Date created) {
  48. this.created = created;
  49. }
  50. public static void main(String[] args) {
  51. String checksum = EncryptionUtils.md5Encode(
  52. "#{#inventorySnapshot.inventory - #inventorySnapshot.openSale - #pendency - (#failedOrderInventory?:0) - #inventoryBlockedOnOtherChannels - #inventorySnapshot.pendingInventoryAssessment + #unprocessedOrderInventory}");
  53. ChannelInventoryFormulaVO channelInventoryFormula = new ChannelInventoryFormulaVO();
  54. channelInventoryFormula.setCode(StringUtils.getRandomAlphaNumeric(8));
  55. channelInventoryFormula.setChecksum(checksum);
  56. channelInventoryFormula.setFormula("#{#inventorySnapshot.inventory - #inventorySnapshot.openSale - #pendency - (#failedOrderInventory?:0) - #inventoryBlockedOnOtherChannels - #inventorySnapshot.pendingInventoryAssessment + #unprocessedOrderInventory}");
  57. channelInventoryFormula.setCreated(DateUtils.getCurrentTime());
  58. System.out.println(new Gson().toJson(channelInventoryFormula));
  59. }
  60. }