修改 不传生日报错的问题

This commit is contained in:
gong
2025-12-22 17:01:06 +08:00
parent e8855faf3d
commit 566db778a6

View File

@@ -39,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
@@ -172,10 +173,10 @@ public class AShopUserServiceImpl implements AShopUserService {
shopUser.setUserId(userInfo.getId());
shopUser.setMainShopId(shopInfoService.getMainIdByShopId(shopId));
shopUser.setJoinTime(shopUser.getIsVip() != null && shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null);
if (StrUtil.isBlank(shopUserAddDTO.getBirthDay())) {
try {
DateUtil.parse(shopUserAddDTO.getBirthDay(), "yyyy-MM-dd");
} catch (Exception e) {
shopUser.setBirthDay(null);
} else {
shopUser.setBirthDay(shopUserAddDTO.getBirthDay());
}
return shopUserService.save(shopUser);
}