商家入驻,方法优化, fix bug
This commit is contained in:
parent
a22ec2ebf7
commit
11d8c4e934
@ -67,6 +67,22 @@ public class DateTimeUtils {
|
||||
|
||||
// 快速判断格式并解析
|
||||
try {
|
||||
// 处理连字符格式(yyyy-MM-dd 或 yyyy-M-d)
|
||||
if (dateStr.contains("-")) {
|
||||
if (length == 10 && dateStr.charAt(4) == '-' && dateStr.charAt(7) == '-') {
|
||||
// 标准格式 yyyy-MM-dd
|
||||
return LocalDate.parse(dateStr, DateTimeFormatter.ISO_LOCAL_DATE).toString();
|
||||
} else if (length >= 8 && length < 10 && dateStr.charAt(4) == '-' && countOccurrences(dateStr, '-') == 2) {
|
||||
// 宽松格式 yyyy-M-d
|
||||
return LocalDate.parse(dateStr,
|
||||
new DateTimeFormatterBuilder()
|
||||
.appendPattern("yyyy-M-d")
|
||||
.parseDefaulting(ChronoField.MONTH_OF_YEAR, 1)
|
||||
.parseDefaulting(ChronoField.DAY_OF_MONTH, 1)
|
||||
.toFormatter()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
// 中文格式(yyyy年MM月dd日 或 yyyy年M月d日)
|
||||
if (dateStr.contains("年")) {
|
||||
if (length >= 10) {
|
||||
@ -89,7 +105,7 @@ public class DateTimeUtils {
|
||||
} else if (dateStr.contains("/")) {
|
||||
separator = '/';
|
||||
} else {
|
||||
return DEFAULT_FUTURE_DATE; // 无效格式
|
||||
return dateStr; // 无效格式
|
||||
}
|
||||
|
||||
// 判断年份位数
|
||||
@ -133,15 +149,33 @@ public class DateTimeUtils {
|
||||
}
|
||||
} catch (DateTimeException e) {
|
||||
// 解析失败,返回默认值
|
||||
return DEFAULT_FUTURE_DATE;
|
||||
return dateStr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算字符串中某个字符的出现次数
|
||||
*/
|
||||
private static int countOccurrences(String str, char c) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
if (str.charAt(i) == c) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(convertLklDate("2025.01.02")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2021-02-19")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2021-2-3")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2025/1/2")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2025/01/02")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2025.1.2")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2025.01.02")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2025年1月2日")); // 2025-01-02
|
||||
System.out.println(convertLklDate("2025年01月02日")); // 2025-01-02
|
||||
System.out.println(convertLklDate("25.1.2")); // 2025-01-02
|
||||
System.out.println(convertLklDate("25.01.02")); // 2025-01-02
|
||||
System.out.println(convertLklDate("长期")); // 9999-12-31
|
||||
|
||||
@ -25,8 +25,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "拉卡拉相关接口 - 前端控制器")
|
||||
@RestController
|
||||
@ -45,17 +43,17 @@ public class LakalaController extends BaseControllerImpl {
|
||||
@ApiOperation(value = "测试案例", notes = "测试案例")
|
||||
@RequestMapping(value = "/testcase", method = RequestMethod.POST)
|
||||
public Object testcase(@RequestBody JSONObject paramsJSON) {
|
||||
// return lakalaPayService.applyLedgerMerEc(paramsJSON.getStr("mchMobile"));
|
||||
return lakalaPayService.applyLedgerMerEc(paramsJSON.getStr("mchMobile"));
|
||||
// return lakalaPayService.LedgerMerEcDownload(975790666910121984L);
|
||||
|
||||
// return geTuiPushService.pushMessageToSingleByCid("f9da7081a7951cff6d7f1d4e2d2f270b", "", "从 shop 发消息", "none", "");
|
||||
|
||||
// return "";
|
||||
|
||||
List<String> tags = new ArrayList<>();
|
||||
// tags.add("纯净水");
|
||||
// tags.add("放心");
|
||||
return libraryProductService.matchLibraryProducts(paramsJSON.getStr("barcode"), paramsJSON.getStr("productName"), tags);
|
||||
//
|
||||
// List<String> tags = new ArrayList<>();
|
||||
//// tags.add("纯净水");
|
||||
//// tags.add("放心");
|
||||
// return libraryProductService.matchLibraryProducts(paramsJSON.getStr("barcode"), paramsJSON.getStr("productName"), tags);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -550,7 +550,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
|
||||
// 发短信给商家,及时签署合同 SMS_488465246
|
||||
// 商家您好,您的入驻申请已收到。请尽快登录小发同城商家 APP 完成合同签署,签署时效为 24 小时,望知晓。
|
||||
shopMessageTemplateService.aliyunSmsSend(mchMobile, "SMS_488465246", null);//SMS_479760276
|
||||
shopMessageTemplateService.aliyunSmsSend(mchMobile, "SMS_489795044", null);//SMS_479760276
|
||||
|
||||
return Pair.of(true, "商家入网申请电子合同成功");
|
||||
}
|
||||
|
||||
@ -478,7 +478,6 @@ public class LklTkServiceImpl {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSONObject SHOP_OUTSIDE_IMG = updatePhoto(shopMchEntry.getFront_facade_image(), "SHOP_OUTSIDE_IMG", false);
|
||||
if (SHOP_OUTSIDE_IMG != null) {
|
||||
attachments.put(SHOP_OUTSIDE_IMG); // 门店门面图片
|
||||
@ -528,7 +527,7 @@ public class LklTkServiceImpl {
|
||||
Boolean success = shopMchEntryService.updateMerchEntryLklMerCupNo(mchMobile, CommonConstant.Disable2, lklMerInnerNo, lklMerInnerNo, formData.toString(), respBody.toString());
|
||||
if (!success) {
|
||||
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_LKL_NOPASS, "请求进件成功,但更新商户号失败!");
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_LKL_NOPASS, "进件成功,但更新商户号失败!");
|
||||
|
||||
return Pair.of(false, "请求进件成功,但更新商户号失败!");
|
||||
}
|
||||
|
||||
@ -336,11 +336,6 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
if (StrUtil.isNotBlank(record.getIndividual_id_number()) && !StringUtils.validateIDCard(record.getIndividual_id_number())) {
|
||||
return CommonResult.failed("个人身份证号码有误!");
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getIndividual_id_number()) && !PhoneNumberUtils.checkPhoneNumber(record.getIndividual_id_number())) {
|
||||
return CommonResult.failed("个人手机号码有误!");
|
||||
}
|
||||
|
||||
} else {
|
||||
// 企业
|
||||
// if (StrUtil.isBlank(record.getBiz_license_number()) || StrUtil.isBlank(record.getBiz_license_image())) {
|
||||
@ -394,7 +389,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
|
||||
// 转换拉卡拉的日期格式 yyyy-MM-dd
|
||||
record = convLklDateFormat(record);
|
||||
|
||||
|
||||
if (!updateById(record)) {
|
||||
return CommonResult.failed("重新申请入驻提交失败!");
|
||||
}
|
||||
@ -430,7 +425,6 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
record.setLkl_ec_name("");
|
||||
record.setLkl_ec_no("");
|
||||
record.setLkl_ec_result_url("");
|
||||
record.setApproval_invalid_col("[]");
|
||||
record.setHas_ec_signed(CommonConstant.Disable2);
|
||||
|
||||
return record;
|
||||
@ -652,6 +646,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
|
||||
record.setApproval_status(approvalStatus);
|
||||
record.setApproval_remark(approvalRemark);
|
||||
record.setApproval_invalid_col(approvalInvalidCol);
|
||||
record.setSplit_ratio(splitRatio);
|
||||
record.setUpdated_by(userId);
|
||||
// // 构建更新参数
|
||||
|
||||
Loading…
Reference in New Issue
Block a user