搬家相关

20230922-ljl-fixBug
qiushengjie 1 year ago
parent f155db090c
commit 81efd17aef

@ -56,9 +56,7 @@ public class MoveCollectTaskDetailServiceImpl implements MoveCollectTaskDetailSe
@Override
public MoveCollectTaskDetail getMoveCollectTaskDetail(long shopId, long moveCollectTaskDetailId) {
// TODO
//return $this->db->queryFirstRow("SELECT * FROM move_collect_task_detail WHERE move_collect_task_detail_id = %i AND shop_id = %i", $detailId, $shopId);
return null;
return moveCollectTaskDetailMapper.selectByPrimaryKey(moveCollectTaskDetailId);
}
@Override

@ -1,6 +1,7 @@
package com.ms.api.tool;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -470,6 +471,86 @@ public class CommonTool {
}
/**
*
* @param number
* @param decimals
* @return
*/
public static double numFormat(double number, int decimals) {
StringBuilder pattern = new StringBuilder("#.");
for (int i = 0; i < decimals; i++) {
pattern.append("#");
}
DecimalFormat decimalFormat = new DecimalFormat(pattern.toString());
String formattedString = decimalFormat.format(number);
return Double.parseDouble(formattedString);
}
/**
* 0
* @param price
* @return
*/
public static String[] splitAndTrim(String price) {
String trimmedPrice;
while (price.endsWith("0")) {
trimmedPrice = price.substring(0, price.length() - 1);
price = trimmedPrice;
}
return price.split("\\.");
}
/**
* 21
* @param str
* @return
*/
public static int countStrLen(String str) {
int length = 0;
for (char c : str.toCharArray()) {
if (Character.UnicodeScript.of(c) == Character.UnicodeScript.HAN) {
length += 2;
} else {
length += 1;
}
}
return length;
}
/**
* 21
* @param str
* @param len
* @return
*/
public static String substringByLen(String str, int len) {
int length = 0;
StringBuilder result = new StringBuilder();
for (char c : str.toCharArray()) {
if (Character.UnicodeScript.of(c) == Character.UnicodeScript.HAN) {
if (length + 2 > len) {
break;
}
length += 2;
} else {
if (length + 1 > len) {
break;
}
length += 1;
}
result.append(c);
}
return result.toString();
}
public static void main(String[] args) {
System.out.println(splitWithComma("6921394317136631525|6921399584322230185|6921393247513351270|6921412710844995353"));

Loading…
Cancel
Save