123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- package cn.fastfun.util;
- import cn.fastfun.service.entity.Product;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- public class ResolveUtil {
- // 对SN进行切片
- public static Map<String,String> splitImei(String imei){
- Map<String,String> snMap = new HashMap<>();
- snMap.put("产品类型代码",imei.substring(0,1));
- snMap.put("pack制造商代码",imei.substring(1,3));
- snMap.put("电芯厂家代码",imei.substring(3,5));
- snMap.put("化学体系代码",imei.substring(5,6));
- snMap.put("电池平台代码",imei.substring(6,7));
- snMap.put("容量代码",imei.substring(7,9));
- snMap.put("产品扩展代码",imei.substring(9,10));
- snMap.put("生产日期代码",imei.substring(10,14));
- snMap.put("序列号代码",imei.substring(14,17));
- return snMap;
- }
- // // 将输入的产品规格代码拆分成三个项
- // public static List<Product> resolveProductSpecification(Product product){
- //
- // String[] SnTypeDescList = product.getSnTypeDesc().split(" ");
- // List<Product> productSpecification = new ArrayList<>();
- //
- // String chemicalSystemCode = product.getSnTypeCode().substring(0,1);
- // String chemicalSystemDesc = SnTypeDescList[0];
- // String batteryPlatformCode = product.getSnTypeCode().substring(1,2);
- // String batteryPlatformDesc = SnTypeDescList[1];
- // String capacityCode = product.getSnTypeCode().substring(2,4);
- // String capacityDesc = SnTypeDescList[2];
- //
- // Product chemicalSystem = new Product();
- // chemicalSystem.setSnType("化学体系");
- // chemicalSystem.setSnTypeCode(chemicalSystemCode);
- // chemicalSystem.setSnTypeDesc(chemicalSystemDesc);
- // chemicalSystem.setOperator(product.getOperator());
- // productSpecification.add(chemicalSystem);
- //
- // Product batteryPlatform = new Product();
- // batteryPlatform.setSnType("电池平台");
- // batteryPlatform.setSnTypeCode(batteryPlatformCode);
- // batteryPlatform.setSnTypeDesc(batteryPlatformDesc);
- // batteryPlatform.setOperator(product.getOperator());
- // productSpecification.add(batteryPlatform);
- //
- // Product capacity = new Product();
- // capacity.setSnType("容量");
- // capacity.setSnTypeCode(capacityCode);
- // capacity.setSnTypeDesc(capacityDesc);
- // capacity.setOperator(product.getOperator());
- // productSpecification.add(capacity);
- //
- // return productSpecification;
- // }
- // 对SN中的日期进行解释
- public static String resolveDate(String productionDate){
- String year = "20" + productionDate.substring(0,2) + "年";
- String month = productionDate.substring(2,3);
- switch (month){
- case "A":
- month = "10月";
- case "B":
- month = "11月";
- case "C":
- month = "12月";
- default:
- month = month + "月";
- }
- String day = productionDate.substring(3,4);
- switch (day){
- case "A":
- day = "10日";
- break;
- case "B":
- day = "11日";
- break;
- case "C":
- day = "12日";
- break;
- case "D":
- day = "13日";
- break;
- case "E":
- day = "14日";
- break;
- case "F":
- day = "15日";
- break;
- case "G":
- day = "16日";
- break;
- case "H":
- day = "17日";
- break;
- case "J":
- day = "18日";
- break;
- case "K":
- day = "19日";
- break;
- case "L":
- day = "20日";
- break;
- case "M":
- day = "21日";
- break;
- case "N":
- day = "22日";
- break;
- case "P":
- day = "23日";
- break;
- case "Q":
- day = "24日";
- break;
- case "R":
- day = "25日";
- break;
- case "S":
- day = "26日";
- break;
- case "T":
- day = "27日";
- break;
- case "U":
- day = "28日";
- break;
- case "V":
- day = "29日";
- break;
- case "W":
- day = "30日";
- break;
- case "X":
- day = "31日";
- break;
- default:
- day = day + "日";
- }
- return year + month + day;
- }
- }
|