ResolveUtil.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. package cn.fastfun.util;
  2. import cn.fastfun.service.entity.Product;
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5. import java.util.List;
  6. import java.util.Map;
  7. public class ResolveUtil {
  8. // 对SN进行切片
  9. public static Map<String,String> splitImei(String imei){
  10. Map<String,String> snMap = new HashMap<>();
  11. snMap.put("产品类型代码",imei.substring(0,1));
  12. snMap.put("pack制造商代码",imei.substring(1,3));
  13. snMap.put("电芯厂家代码",imei.substring(3,5));
  14. snMap.put("化学体系代码",imei.substring(5,6));
  15. snMap.put("电池平台代码",imei.substring(6,7));
  16. snMap.put("容量代码",imei.substring(7,9));
  17. snMap.put("产品扩展代码",imei.substring(9,10));
  18. snMap.put("生产日期代码",imei.substring(10,14));
  19. snMap.put("序列号代码",imei.substring(14,17));
  20. return snMap;
  21. }
  22. // // 将输入的产品规格代码拆分成三个项
  23. // public static List<Product> resolveProductSpecification(Product product){
  24. //
  25. // String[] SnTypeDescList = product.getSnTypeDesc().split(" ");
  26. // List<Product> productSpecification = new ArrayList<>();
  27. //
  28. // String chemicalSystemCode = product.getSnTypeCode().substring(0,1);
  29. // String chemicalSystemDesc = SnTypeDescList[0];
  30. // String batteryPlatformCode = product.getSnTypeCode().substring(1,2);
  31. // String batteryPlatformDesc = SnTypeDescList[1];
  32. // String capacityCode = product.getSnTypeCode().substring(2,4);
  33. // String capacityDesc = SnTypeDescList[2];
  34. //
  35. // Product chemicalSystem = new Product();
  36. // chemicalSystem.setSnType("化学体系");
  37. // chemicalSystem.setSnTypeCode(chemicalSystemCode);
  38. // chemicalSystem.setSnTypeDesc(chemicalSystemDesc);
  39. // chemicalSystem.setOperator(product.getOperator());
  40. // productSpecification.add(chemicalSystem);
  41. //
  42. // Product batteryPlatform = new Product();
  43. // batteryPlatform.setSnType("电池平台");
  44. // batteryPlatform.setSnTypeCode(batteryPlatformCode);
  45. // batteryPlatform.setSnTypeDesc(batteryPlatformDesc);
  46. // batteryPlatform.setOperator(product.getOperator());
  47. // productSpecification.add(batteryPlatform);
  48. //
  49. // Product capacity = new Product();
  50. // capacity.setSnType("容量");
  51. // capacity.setSnTypeCode(capacityCode);
  52. // capacity.setSnTypeDesc(capacityDesc);
  53. // capacity.setOperator(product.getOperator());
  54. // productSpecification.add(capacity);
  55. //
  56. // return productSpecification;
  57. // }
  58. // 对SN中的日期进行解释
  59. public static String resolveDate(String productionDate){
  60. String year = "20" + productionDate.substring(0,2) + "年";
  61. String month = productionDate.substring(2,3);
  62. switch (month){
  63. case "A":
  64. month = "10月";
  65. case "B":
  66. month = "11月";
  67. case "C":
  68. month = "12月";
  69. default:
  70. month = month + "月";
  71. }
  72. String day = productionDate.substring(3,4);
  73. switch (day){
  74. case "A":
  75. day = "10日";
  76. break;
  77. case "B":
  78. day = "11日";
  79. break;
  80. case "C":
  81. day = "12日";
  82. break;
  83. case "D":
  84. day = "13日";
  85. break;
  86. case "E":
  87. day = "14日";
  88. break;
  89. case "F":
  90. day = "15日";
  91. break;
  92. case "G":
  93. day = "16日";
  94. break;
  95. case "H":
  96. day = "17日";
  97. break;
  98. case "J":
  99. day = "18日";
  100. break;
  101. case "K":
  102. day = "19日";
  103. break;
  104. case "L":
  105. day = "20日";
  106. break;
  107. case "M":
  108. day = "21日";
  109. break;
  110. case "N":
  111. day = "22日";
  112. break;
  113. case "P":
  114. day = "23日";
  115. break;
  116. case "Q":
  117. day = "24日";
  118. break;
  119. case "R":
  120. day = "25日";
  121. break;
  122. case "S":
  123. day = "26日";
  124. break;
  125. case "T":
  126. day = "27日";
  127. break;
  128. case "U":
  129. day = "28日";
  130. break;
  131. case "V":
  132. day = "29日";
  133. break;
  134. case "W":
  135. day = "30日";
  136. break;
  137. case "X":
  138. day = "31日";
  139. break;
  140. default:
  141. day = day + "日";
  142. }
  143. return year + month + day;
  144. }
  145. }