mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -13,9 +13,7 @@ import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
||||
@@ -641,4 +639,25 @@ public class PileService {
|
||||
String orderCode = orderLogic.startPersonalPileCharging(dto);
|
||||
return orderCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成桩密钥
|
||||
* @return
|
||||
*/
|
||||
public String generatePileSecret() {
|
||||
// 获取 年月日 日期
|
||||
String dateStr = DateUtils.dateTimeNow(DateUtils.YYYYMMDD);
|
||||
// System.out.println("dateStr:" + dateStr);
|
||||
int dateInt = Integer.parseInt(dateStr);
|
||||
// 将年月日加上 160829
|
||||
String data = String.valueOf(dateInt + 160829);
|
||||
byte[] bytes = BytesUtil.str2Bcd(data);
|
||||
// crc16加密
|
||||
String crc = String.format("%04x", CRC16Util.calcCrc16(bytes));
|
||||
// System.out.println(crc);
|
||||
// 将16进制转成10进制
|
||||
int i = Integer.parseInt(crc, 16);
|
||||
// System.out.println(i);
|
||||
return String.valueOf(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,4 +233,21 @@ public class PileBasicInfoController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据当前日期生成桩密钥
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getPileSecretStr")
|
||||
public RestApiResponse<?> getPileSecretStr() {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = pileService.generatePileSecret();
|
||||
response = new RestApiResponse<>(result);
|
||||
}catch (Exception e) {
|
||||
logger.error("生成桩密钥 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("生成桩密钥 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user