this is 4.2 update
This commit is contained in:
parent
3caad83a67
commit
cbdb0bd965
|
@ -1,28 +1,30 @@
|
|||
package com.cultural.heritage.controller.address;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cultural.heritage.common.BaseResponse;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.address.AddressAddRequest;
|
||||
import com.cultural.heritage.model.dto.address.AddressUpdateRequest;
|
||||
import com.cultural.heritage.model.entity.Address;
|
||||
import com.cultural.heritage.model.entity.User;
|
||||
import com.cultural.heritage.service.address.AddressService;
|
||||
import com.cultural.heritage.service.common.CommonService;
|
||||
import com.cultural.heritage.service.user.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
@ -41,6 +43,10 @@ public class AddressController {
|
|||
private UserService userService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加地址信息
|
||||
* @param addressAddRequest 地址添加请求体
|
||||
|
@ -48,20 +54,23 @@ public class AddressController {
|
|||
*/
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "小程序端用户添加地址信息", description = "参数:地址添加请求体,权限:所有人,方法名:addAddress")
|
||||
public BaseResponse<Boolean> addAddress(@RequestBody AddressAddRequest addressAddRequest, HttpServletRequest request) {
|
||||
public BaseResponse<Long> addAddress(@RequestBody AddressAddRequest addressAddRequest, HttpServletRequest request) {
|
||||
if (addressAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
Long userId = loginUser.getId();
|
||||
Address address = new Address();
|
||||
BeanUtils.copyProperties(addressAddRequest, address);
|
||||
Address address = commonService.copyProperties(addressAddRequest, Address.class);
|
||||
address.setUserId(userId);
|
||||
// 处理之前的默认地址
|
||||
if (address.getIsDefault() == 1) {
|
||||
LambdaUpdateWrapper<Address> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(Address::getUserId, userId).eq(Address::getIsDefault, 1).set(Address::getIsDefault, 0);
|
||||
addressService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
addressService.validAddress(address, false);
|
||||
addressService.verifyIsDefault(address);
|
||||
boolean result = addressService.save(address);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
addressService.save(address);
|
||||
return ResultUtils.success(address.getId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,8 +88,7 @@ public class AddressController {
|
|||
}
|
||||
userService.getLoginUser(request);
|
||||
Long id = deleteRequest.getId();
|
||||
boolean result = addressService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
addressService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -100,13 +108,16 @@ public class AddressController {
|
|||
}
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
Long userId = loginUser.getId();
|
||||
Address address = new Address();
|
||||
BeanUtils.copyProperties(addressUpdateRequest, address);
|
||||
Address address = commonService.copyProperties(addressUpdateRequest, Address.class);
|
||||
address.setUserId(userId);
|
||||
// 处理之前的默认地址
|
||||
if (address.getIsDefault() == 1) {
|
||||
LambdaUpdateWrapper<Address> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(Address::getUserId, userId).eq(Address::getIsDefault, 1).set(Address::getIsDefault, 0);
|
||||
addressService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
addressService.validAddress(address, true);
|
||||
addressService.verifyIsDefault(address);
|
||||
boolean result = addressService.updateById(address);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
addressService.updateById(address);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -122,8 +133,11 @@ public class AddressController {
|
|||
public BaseResponse<List<Address>> listAddress(HttpServletRequest request) {
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
Long userId = loginUser.getId();
|
||||
List<Address> list = addressService.getUserAddressById(userId);
|
||||
return ResultUtils.success(list);
|
||||
LambdaQueryWrapper<Address> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Address::getUserId, userId);
|
||||
List<Address> addressList = addressService.list(queryWrapper);
|
||||
Collections.reverse(addressList);
|
||||
return ResultUtils.success(addressList);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
package com.cultural.heritage.controller.address;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cultural.heritage.common.BaseResponse;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.contacts.ContactsAddRequest;
|
||||
import com.cultural.heritage.model.dto.contacts.ContactsUpdateRequest;
|
||||
import com.cultural.heritage.model.entity.Contacts;
|
||||
import com.cultural.heritage.model.entity.User;
|
||||
import com.cultural.heritage.service.address.ContactsService;
|
||||
import com.cultural.heritage.service.common.CommonService;
|
||||
import com.cultural.heritage.service.user.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
@ -40,6 +42,10 @@ public class ContactsController {
|
|||
private UserService userService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加联系人
|
||||
* @param contactsAddRequest 联系人添加请求体
|
||||
|
@ -47,20 +53,23 @@ public class ContactsController {
|
|||
*/
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "小程序端用户添加联系人信息", description = "参数:联系人添加请求体,权限:所有人,方法名:addContacts")
|
||||
public BaseResponse<Boolean> addContacts(@RequestBody ContactsAddRequest contactsAddRequest, HttpServletRequest request) {
|
||||
public BaseResponse<Long> addContacts(@RequestBody ContactsAddRequest contactsAddRequest, HttpServletRequest request) {
|
||||
if (contactsAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
Long userId = loginUser.getId();
|
||||
Contacts contacts = new Contacts();
|
||||
BeanUtils.copyProperties(contactsAddRequest, contacts);
|
||||
Contacts contacts = commonService.copyProperties(contactsAddRequest, Contacts.class);
|
||||
contacts.setUserId(userId);
|
||||
// 处理之前的默认联系人
|
||||
if (contacts.getIsDefault() == 1) {
|
||||
LambdaUpdateWrapper<Contacts> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(Contacts::getUserId, userId).eq(Contacts::getIsDefault, 1).set(Contacts::getIsDefault, 0);
|
||||
contactsService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
contactsService.validContacts(contacts, false);
|
||||
contactsService.verifyIsDefault(contacts);
|
||||
boolean result = contactsService.save(contacts);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
contactsService.save(contacts);
|
||||
return ResultUtils.success(contacts.getId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,13 +87,16 @@ public class ContactsController {
|
|||
}
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
Long userId = loginUser.getId();
|
||||
Contacts contacts = new Contacts();
|
||||
BeanUtils.copyProperties(contactsUpdateRequest, contacts);
|
||||
Contacts contacts = commonService.copyProperties(contactsUpdateRequest, Contacts.class);
|
||||
contacts.setUserId(userId);
|
||||
// 处理之前的默认联系人
|
||||
if (contacts.getIsDefault() == 1) {
|
||||
LambdaUpdateWrapper<Contacts> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(Contacts::getUserId, userId).eq(Contacts::getIsDefault, 1).set(Contacts::getIsDefault, 0);
|
||||
contactsService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
contactsService.validContacts(contacts, true);
|
||||
contactsService.verifyIsDefault(contacts);
|
||||
boolean result = contactsService.updateById(contacts);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
contactsService.updateById(contacts);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -104,8 +116,7 @@ public class ContactsController {
|
|||
}
|
||||
userService.getLoginUser(request);
|
||||
Long id = contactsDeleteRequest.getId();
|
||||
boolean result = contactsService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
contactsService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -120,8 +131,11 @@ public class ContactsController {
|
|||
public BaseResponse<List<Contacts>> listUserContacts(HttpServletRequest request) {
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
Long userId = loginUser.getId();
|
||||
List<Contacts> list = contactsService.getUserContactsById(userId);
|
||||
return ResultUtils.success(list);
|
||||
LambdaQueryWrapper<Contacts> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Contacts::getId, userId);
|
||||
List<Contacts> contactsList = contactsService.list(queryWrapper);
|
||||
Collections.reverse(contactsList);
|
||||
return ResultUtils.success(contactsList);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -71,11 +71,9 @@ public class BookingDateController {
|
|||
QueryWrapper<BookingTime> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("bookingDateId", id);
|
||||
bookingTimeService.remove(queryWrapper);
|
||||
// ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "预约时间点删除失败");
|
||||
|
||||
// 删除这个预约日期
|
||||
boolean success = bookingDateService.removeById(id);
|
||||
ThrowUtils.throwIf(!success, ErrorCode.OPERATION_ERROR, "预约日期删除失败");
|
||||
bookingDateService.removeById(id);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
@ -96,9 +94,7 @@ public class BookingDateController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = commonRequest.getId();
|
||||
boolean remove = bookingTimeService.removeById(id);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "预约时间删除失败");
|
||||
|
||||
bookingTimeService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -123,9 +119,7 @@ public class BookingDateController {
|
|||
UpdateWrapper<BookingDate> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("isAvailable", status);
|
||||
boolean update = bookingDateService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "预约日期状态修改失败");
|
||||
|
||||
bookingDateService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -140,7 +134,6 @@ public class BookingDateController {
|
|||
*/
|
||||
@PostMapping("/add/time")
|
||||
@Operation(summary = "Web端管理员添加预约时间段", description = "参数:预约时间段添加请求体,权限:管理员(admin, boss),方法名:addAppointmentDate")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Long> addTimePeriod(@RequestBody BookingTimeSingleAddRequest bookingTimeSingleAddRequest) {
|
||||
if (bookingTimeSingleAddRequest == null || StringUtils.isBlank(bookingTimeSingleAddRequest.getTimePoint())) {
|
||||
|
@ -148,9 +141,7 @@ public class BookingDateController {
|
|||
}
|
||||
BookingTime bookingTime = new BookingTime();
|
||||
BeanUtils.copyProperties(bookingTimeSingleAddRequest, bookingTime);
|
||||
boolean save = bookingTimeService.save(bookingTime);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "预约时间段添加失败");
|
||||
|
||||
bookingTimeService.save(bookingTime);
|
||||
return ResultUtils.success(bookingTime.getId());
|
||||
}
|
||||
|
||||
|
@ -174,8 +165,7 @@ public class BookingDateController {
|
|||
// 添加当前商品的预约日期
|
||||
BookingDate bookingDate = new BookingDate();
|
||||
BeanUtils.copyProperties(bookingDateSingleAddRequest, bookingDate);
|
||||
boolean save = bookingDateService.save(bookingDate);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "预约日期添加失败");
|
||||
bookingDateService.save(bookingDate);
|
||||
|
||||
// 添加当前预约日期的预约时间段
|
||||
Long bookingDateId = bookingDate.getId();
|
||||
|
@ -186,9 +176,7 @@ public class BookingDateController {
|
|||
bookingTime.setBookingDateId(bookingDateId);
|
||||
return bookingTime;
|
||||
}).toList();
|
||||
boolean result = bookingTimeService.saveBatch(bookingTimes);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "批量添加预约时间失败");
|
||||
|
||||
bookingTimeService.saveBatch(bookingTimes);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -226,8 +214,7 @@ public class BookingDateController {
|
|||
bookingTimes.addAll(bookingTimeList);
|
||||
}
|
||||
|
||||
boolean result = bookingTimeService.saveBatch(bookingTimes);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "预约时间批量添加失败");
|
||||
bookingTimeService.saveBatch(bookingTimes);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.cultural.heritage.common.ErrorCode;
|
|||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.CommonStringRequest;
|
||||
import com.cultural.heritage.model.dto.photoCategory.PhotoCategoryAddRequest;
|
||||
|
@ -30,6 +29,7 @@ import jakarta.annotation.Resource;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -83,8 +83,7 @@ public class PhotoCategoryController {
|
|||
BeanUtils.copyProperties(photoCategoryAddRequest, photoCategory);
|
||||
// 校验
|
||||
photoCategoryService.validPhotoCategory(photoCategory, false);
|
||||
boolean save = photoCategoryService.save(photoCategory);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "写真类别添加失败");
|
||||
photoCategoryService.save(photoCategory);
|
||||
return ResultUtils.success(photoCategory.getId());
|
||||
}
|
||||
|
||||
|
@ -97,6 +96,7 @@ public class PhotoCategoryController {
|
|||
*/
|
||||
@PostMapping("/update")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "Web端管理员更新写真类别", description = "参数:写真类别更新请求体,权限:管理员(admin, boss),方法名:updatePhotoCategory")
|
||||
public BaseResponse<Boolean> updatePhotoCategory(@RequestBody PhotoCategoryUpdateRequest photoCategoryUpdateRequest) {
|
||||
if (photoCategoryUpdateRequest == null || photoCategoryUpdateRequest.getId() <= 0) {
|
||||
|
@ -118,10 +118,7 @@ public class PhotoCategoryController {
|
|||
BeanUtils.copyProperties(photoCategoryUpdateRequest, photoCategory);
|
||||
// 校验
|
||||
photoCategoryService.validPhotoCategory(photoCategory, true);
|
||||
|
||||
boolean result = photoCategoryService.updateById(photoCategory);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "写真类别名称更新失败");
|
||||
|
||||
photoCategoryService.updateById(photoCategory);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -133,6 +130,7 @@ public class PhotoCategoryController {
|
|||
*/
|
||||
@PostMapping("/delete")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "Web端管理员删除写真类别", description = "参数:写真类别id,权限:管理员(admin, boss),方法名:deletePhotoCategory")
|
||||
public BaseResponse<Boolean> deletePhotoCategory(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
|
@ -148,19 +146,12 @@ public class PhotoCategoryController {
|
|||
List<BookingTime> bookingTimeList = commonService.findByFieldInTargetField(bookingDateList, bookingTimeService, BookingDate::getId, "bookingDateId");
|
||||
// 批量删除预约时间
|
||||
bookingTimeService.removeBatchByIds(bookingTimeList);
|
||||
// ThrowUtils.throwIf(!removeTime, ErrorCode.OPERATION_ERROR, "预约时间删除失败");
|
||||
|
||||
// 批量删除预约日期
|
||||
bookingDateService.removeBatchByIds(bookingDateList);
|
||||
// ThrowUtils.throwIf(!removeDate, ErrorCode.OPERATION_ERROR, "预约日期批量删除失败");
|
||||
|
||||
// 删除该类别下所有写真产品
|
||||
photoProductsService.removeBatchByIds(photoProductsList);
|
||||
// ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "写真产品批量删除失败");
|
||||
|
||||
// 删除写真类别
|
||||
boolean result = photoCategoryService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "写真类别删除失败");
|
||||
photoCategoryService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -196,7 +187,6 @@ public class PhotoCategoryController {
|
|||
List<PhotoCategory> photoCategoryList = commonService.findByFieldInTargetField(photoProductsList, photoCategoryService, PhotoProducts::getCategoryName, "name");
|
||||
// 获取写真产品类别VO列表
|
||||
List<PhotoCategoryVO> photoCategoryVOList = commonService.convertList(photoCategoryList, PhotoCategoryVO.class);
|
||||
|
||||
return ResultUtils.success(photoCategoryVOList);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -49,7 +49,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/photoProducts")
|
||||
|
@ -83,10 +82,6 @@ public class PhotoProductsController {
|
|||
|
||||
|
||||
|
||||
@Resource
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员添加写真产品
|
||||
* @param photoProductsAddRequest 写真产品添加请求体
|
||||
|
@ -94,6 +89,7 @@ public class PhotoProductsController {
|
|||
*/
|
||||
@PostMapping("/add")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "Web端管理员添加写真产品", description = "参数:写真产品添加请求体,权限:管理员(admin, boss),方法名:addPhotoProducts")
|
||||
public BaseResponse<Long> addPhotoProducts(@RequestBody PhotoProductsAddRequest photoProductsAddRequest) {
|
||||
if (photoProductsAddRequest == null) {
|
||||
|
@ -135,9 +131,7 @@ public class PhotoProductsController {
|
|||
}).toList();
|
||||
bookingTimes.addAll(bookingTimeList);
|
||||
}
|
||||
boolean save = bookingTimeService.saveBatch(bookingTimes);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "写真产品预约时间添加失败");
|
||||
|
||||
bookingTimeService.saveBatch(bookingTimes);
|
||||
return ResultUtils.success(photoProducts.getId());
|
||||
}
|
||||
|
||||
|
@ -160,8 +154,7 @@ public class PhotoProductsController {
|
|||
BeanUtils.copyProperties(photoProductsUpdateRequest, photoProducts);
|
||||
// 校验
|
||||
photoProductsService.validPhotoProducts(photoProducts, true);
|
||||
boolean result = photoProductsService.updateById(photoProducts);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "写真产品更新失败");
|
||||
photoProductsService.updateById(photoProducts);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -175,6 +168,7 @@ public class PhotoProductsController {
|
|||
*/
|
||||
@PostMapping("/delete")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "Web管理员删除写真产品", description = "参数:写真产品id,权限:管理员(admin, boss),方法名:deletePhotoProducts")
|
||||
public BaseResponse<Boolean> deletePhotoProducts(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
|
@ -187,13 +181,10 @@ public class PhotoProductsController {
|
|||
List<BookingTime> bookingTimeList = commonService.findByFieldInTargetField(bookingDateList, bookingTimeService, BookingDate::getId, "bookingDateId");
|
||||
// 删除写真产品下的预约时间
|
||||
bookingTimeService.removeBatchByIds(bookingTimeList);
|
||||
// ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "预约时间批量删除失败");
|
||||
// 删除写真产品下的预约日期
|
||||
bookingDateService.removeBatchByIds(bookingDateList);
|
||||
// ThrowUtils.throwIf(!success, ErrorCode.OPERATION_ERROR, "预约日期批量删除失败");
|
||||
// 删除写真产品
|
||||
boolean result = photoProductsService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "写真产品删除失败");
|
||||
photoProductsService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -207,6 +198,7 @@ public class PhotoProductsController {
|
|||
*/
|
||||
@PostMapping("/delBatch")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "Web管理员批量删除写真产品", description = "参数:写真产品id列表,权限:管理员(admin, boss),方法名:deletePhotoProducts")
|
||||
public BaseResponse<Boolean> delBatchPhotoProducts(@RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
if (commonBatchRequest == null || CollectionUtils.isEmpty(commonBatchRequest.getIdList())) {
|
||||
|
@ -219,13 +211,10 @@ public class PhotoProductsController {
|
|||
List<BookingTime> bookingTimeList = commonService.findByFieldInTargetField(bookingDateList, bookingTimeService, BookingDate::getId, "bookingDateId");
|
||||
// 删除写真产品下的预约时间
|
||||
bookingTimeService.removeBatchByIds(bookingTimeList);
|
||||
// ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "预约时间批量删除失败");
|
||||
// 删除写真产品下的预约日期
|
||||
bookingDateService.removeBatchByIds(bookingDateList);
|
||||
// ThrowUtils.throwIf(!success, ErrorCode.OPERATION_ERROR, "预约日期批量删除失败");
|
||||
// 批量删除写真产品
|
||||
boolean result = photoProductsService.removeBatchByIds(idList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "写真产品批量删除失败");
|
||||
photoProductsService.removeBatchByIds(idList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -468,8 +457,7 @@ public class PhotoProductsController {
|
|||
UpdateWrapper<PhotoProducts> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("isShelves", status);
|
||||
boolean update = photoProductsService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "上架状态更新失败");
|
||||
photoProductsService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -501,53 +489,53 @@ public class PhotoProductsController {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员保存特殊写真产品指向的id
|
||||
* @return 是否保存成功
|
||||
*/
|
||||
@PostMapping("/special/save")
|
||||
@Operation(summary = "Web端管理员保存特殊写真产品指向的id", description = "参数:无,权限:管理员(admin, boss),方法名:saveSpecialPhotoProductById")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> saveSpecialPhotoProductById(@RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
if (commonBatchRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
List<Long> idList = commonBatchRequest.getIdList();
|
||||
redisTemplate.opsForValue().set("photoProductIds", idList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端(小程序端)管理员查询特殊写真产品指向的id
|
||||
* @return 写真产品id列表
|
||||
*/
|
||||
@PostMapping("/special/get")
|
||||
@Operation(summary = "Web端管理员(小程序端)查询特殊写真产品指向的id", description = "参数:写真产品id列表,权限:管理员(admin, boss),方法名:getSpecialPhotoProductIds")
|
||||
public BaseResponse<List<Long>> getSpecialPhotoProductIds () {
|
||||
|
||||
Object valueObj = redisTemplate.opsForValue().get("photoProductIds");
|
||||
List<Long> newIds = new ArrayList<>();
|
||||
if (valueObj != null) {
|
||||
List<Long> ids = ((List<?>) valueObj).stream()
|
||||
.map(obj -> ((Number) obj).longValue())
|
||||
.collect(Collectors.toList());
|
||||
for (Long id: ids) {
|
||||
PhotoProducts photoProducts = photoProductsService.getById(id);
|
||||
if (photoProducts == null || photoProducts.getIsShelves() == 0) {
|
||||
newIds.add(0L);
|
||||
} else {
|
||||
newIds.add(id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newIds = Arrays.asList(0L, 0L);
|
||||
}
|
||||
redisTemplate.opsForValue().set("photoProductIds", newIds);
|
||||
return ResultUtils.success(newIds);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * Web端管理员保存特殊写真产品指向的id
|
||||
// * @return 是否保存成功
|
||||
// */
|
||||
// @PostMapping("/special/save")
|
||||
// @Operation(summary = "Web端管理员保存特殊写真产品指向的id", description = "参数:无,权限:管理员(admin, boss),方法名:saveSpecialPhotoProductById")
|
||||
// @AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// public BaseResponse<Boolean> saveSpecialPhotoProductById(@RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
// if (commonBatchRequest == null) {
|
||||
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
// }
|
||||
// List<Long> idList = commonBatchRequest.getIdList();
|
||||
// redisTemplate.opsForValue().set("photoProductIds", idList);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Web端(小程序端)管理员查询特殊写真产品指向的id
|
||||
// * @return 写真产品id列表
|
||||
// */
|
||||
// @PostMapping("/special/get")
|
||||
// @Operation(summary = "Web端管理员(小程序端)查询特殊写真产品指向的id", description = "参数:写真产品id列表,权限:管理员(admin, boss),方法名:getSpecialPhotoProductIds")
|
||||
// public BaseResponse<List<Long>> getSpecialPhotoProductIds () {
|
||||
//
|
||||
// Object valueObj = redisTemplate.opsForValue().get("photoProductIds");
|
||||
// List<Long> newIds = new ArrayList<>();
|
||||
// if (valueObj != null) {
|
||||
// List<Long> ids = ((List<?>) valueObj).stream()
|
||||
// .map(obj -> ((Number) obj).longValue())
|
||||
// .collect(Collectors.toList());
|
||||
// for (Long id: ids) {
|
||||
// PhotoProducts photoProducts = photoProductsService.getById(id);
|
||||
// if (photoProducts == null || photoProducts.getIsShelves() == 0) {
|
||||
// newIds.add(0L);
|
||||
// } else {
|
||||
// newIds.add(id);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// newIds = Arrays.asList(0L, 0L);
|
||||
// }
|
||||
// redisTemplate.opsForValue().set("photoProductIds", newIds);
|
||||
// return ResultUtils.success(newIds);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.cultural.heritage.common.ErrorCode;
|
|||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.clotheCategory.ClothesCategoryAddRequest;
|
||||
import com.cultural.heritage.model.dto.clotheCategory.ClothesCategoryUpdateRequest;
|
||||
|
@ -69,8 +68,7 @@ public class ClothesCategoryController {
|
|||
ClothesCategory clothesCategory = commonService.copyProperties(clothesCategoryAddRequest, ClothesCategory.class);
|
||||
// 校验
|
||||
clothesCategoryService.validClothesCategory(clothesCategory, false);
|
||||
boolean save = clothesCategoryService.save(clothesCategory);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "服装类别添加失败");
|
||||
clothesCategoryService.save(clothesCategory);
|
||||
return ResultUtils.success(clothesCategory.getId());
|
||||
}
|
||||
|
||||
|
@ -91,10 +89,7 @@ public class ClothesCategoryController {
|
|||
ClothesCategory clothesCategory = commonService.copyProperties(clothesCategoryUpdateRequest, ClothesCategory.class);
|
||||
// 校验
|
||||
clothesCategoryService.validClothesCategory(clothesCategory, true);
|
||||
|
||||
boolean result = clothesCategoryService.updateById(clothesCategory);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装类别名称更新失败");
|
||||
|
||||
clothesCategoryService.updateById(clothesCategory);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -119,11 +114,8 @@ public class ClothesCategoryController {
|
|||
|
||||
// 删除该类别下的所有服装
|
||||
clothesService.remove(queryWrapper);
|
||||
|
||||
// 删除服装类别
|
||||
boolean result = clothesCategoryService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装类别删除失败");
|
||||
|
||||
clothesCategoryService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ public class ClothesController {
|
|||
Clothes clothes = commonService.copyProperties(clothesAddRequest, Clothes.class);
|
||||
// 校验
|
||||
clothesService.validClothes(clothes, false);
|
||||
boolean save = clothesService.save(clothes);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "服装租赁产品添加失败");
|
||||
clothesService.save(clothes);
|
||||
|
||||
// 缓存商品详情到 Redis
|
||||
String clothesCacheKey = CLOTHES_KEY + clothes.getId();
|
||||
|
@ -100,9 +99,7 @@ public class ClothesController {
|
|||
// 更新服装租赁产品
|
||||
Clothes clothes = commonService.copyProperties(clothesUpdateRequest, Clothes.class);
|
||||
clothesService.validClothes(clothes, true);
|
||||
|
||||
boolean result = clothesService.updateById(clothes);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装租赁产品更新失败");
|
||||
clothesService.updateById(clothes);
|
||||
|
||||
// 清除 Redis 缓存
|
||||
String cacheKey = CLOTHES_KEY + clothes.getId();
|
||||
|
@ -124,8 +121,7 @@ public class ClothesController {
|
|||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
boolean result = clothesService.removeById(commonRequest.getId());
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服装租赁产品删除失败");
|
||||
clothesService.removeById(commonRequest.getId());
|
||||
|
||||
// 删除缓存中的相应数据
|
||||
String cacheKey = CLOTHES_KEY + commonRequest.getId();
|
||||
|
@ -168,7 +164,6 @@ public class ClothesController {
|
|||
// 如果缓存命中,直接返回
|
||||
if (clothes != null) {
|
||||
clothesVO = commonService.copyProperties(clothes, ClothesVO.class);
|
||||
System.out.println("走缓存");
|
||||
return ResultUtils.success(clothesVO);
|
||||
}
|
||||
Clothes clothesInfo = clothesService.getClothesInfoById(id);
|
||||
|
@ -195,7 +190,6 @@ public class ClothesController {
|
|||
// 如果缓存命中,直接返回
|
||||
if (clothes != null) {
|
||||
clothesLabelVO = commonService.copyProperties(clothes, ClothesLabelVO.class);
|
||||
System.out.println("走缓存");
|
||||
return ResultUtils.success(clothesLabelVO);
|
||||
}
|
||||
Clothes clothesInfo = clothesService.getClothesInfoById(id);
|
||||
|
@ -290,9 +284,7 @@ public class ClothesController {
|
|||
UpdateWrapper<Clothes> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("isShelves", status);
|
||||
boolean update = clothesService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "上架状态更新失败");
|
||||
|
||||
clothesService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,12 +94,8 @@ public class AppointmentDateController {
|
|||
QueryWrapper<TimePeriod> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("appointmentDateId", id);
|
||||
timePeriodService.remove(queryWrapper);
|
||||
// ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "预约时间段删除失败");
|
||||
|
||||
// 删除这个预约日期
|
||||
boolean success = appointmentDateService.removeById(id);
|
||||
ThrowUtils.throwIf(!success, ErrorCode.OPERATION_ERROR, "预约日期删除失败");
|
||||
|
||||
appointmentDateService.removeById(id);
|
||||
// 删除服务类商品待处理记录
|
||||
QueryWrapper<PendingServiceGood> goodQueryWrapper = new QueryWrapper<>();
|
||||
goodQueryWrapper.eq("appointmentDateId", id);
|
||||
|
@ -110,8 +106,7 @@ public class AppointmentDateController {
|
|||
map.put(pendingServiceOrder.getPendingId(), 1);
|
||||
}
|
||||
pendingServiceGoodList = pendingServiceGoodList.stream().filter(pendingServiceGood -> map.get(pendingServiceGood.getId()) == null).toList();
|
||||
boolean result = pendingServiceGoodService.removeBatchByIds(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录删除失败");
|
||||
pendingServiceGoodService.removeBatchByIds(pendingServiceGoodList);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
|
||||
|
@ -134,9 +129,7 @@ public class AppointmentDateController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = commonRequest.getId();
|
||||
boolean remove = timePeriodService.removeById(id);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "预约时间段删除失败");
|
||||
|
||||
timePeriodService.removeById(id);
|
||||
// 删除服务类商品待处理记录
|
||||
QueryWrapper<PendingServiceGood> goodQueryWrapper = new QueryWrapper<>();
|
||||
goodQueryWrapper.eq("timePeriodId", id);
|
||||
|
@ -148,10 +141,7 @@ public class AppointmentDateController {
|
|||
QueryWrapper<PendingServiceOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("pendingId", pendingId);
|
||||
long count = pendingServiceOrderService.count(queryWrapper);
|
||||
if (count == 0) {
|
||||
boolean result = pendingServiceGoodService.remove(goodQueryWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录删除失败");
|
||||
}
|
||||
if (count == 0) pendingServiceGoodService.remove(goodQueryWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -164,6 +154,7 @@ public class AppointmentDateController {
|
|||
*/
|
||||
@PostMapping("/update/status")
|
||||
@Operation(summary = "Web端管理员根据id修改预约日期的状态", description = "参数:预约日期id,权限:管理员(admin, boss),方法名:updateTimePeriodStatusById")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> updateTimePeriodStatusById(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
|
@ -176,14 +167,11 @@ public class AppointmentDateController {
|
|||
UpdateWrapper<AppointmentDate> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("isAvailable", status);
|
||||
boolean update = appointmentDateService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "预约日期状态修改失败");
|
||||
|
||||
appointmentDateService.update(updateWrapper);
|
||||
// 批量更新服务类商品待处理记录
|
||||
UpdateWrapper<PendingServiceGood> goodUpdateWrapper = new UpdateWrapper<>();
|
||||
goodUpdateWrapper.eq("appointmentDateId", id).set("isAvailable", status);
|
||||
boolean result = pendingServiceGoodService.update(goodUpdateWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录批量更新失败");
|
||||
pendingServiceGoodService.update(goodUpdateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -197,6 +185,7 @@ public class AppointmentDateController {
|
|||
*/
|
||||
@PostMapping("/update/time")
|
||||
@Operation(summary = "Web端管理员根据id修改预约时间段的人数", description = "参数:预约日期id,权限:管理员(admin, boss),方法名:updateTimePeriodPersonNumberById")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> updateTimePeriodPersonNumberById(@RequestBody TimePeriodSingleUpdateRequest timePeriodSingleUpdateRequest) {
|
||||
if (timePeriodSingleUpdateRequest == null || timePeriodSingleUpdateRequest.getId() <= 0) {
|
||||
|
@ -210,18 +199,13 @@ public class AppointmentDateController {
|
|||
BeanUtils.copyProperties(timePeriodSingleUpdateRequest, timePeriod);
|
||||
timePeriod.setId(time.getId());
|
||||
timePeriod.setTimeSlot(time.getTimeSlot());
|
||||
|
||||
boolean update = timePeriodService.updateById(timePeriod);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "预约时间段人数修改失败");
|
||||
|
||||
timePeriodService.updateById(timePeriod);
|
||||
// 更新服务类商品待处理记录
|
||||
UpdateWrapper<PendingServiceGood> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("timePeriodId", id);
|
||||
updateWrapper.set("minNumber", timePeriodSingleUpdateRequest.getMinNumber());
|
||||
updateWrapper.set("maxNumber", timePeriodSingleUpdateRequest.getMaxNumber());
|
||||
boolean result = pendingServiceGoodService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录更新失败");
|
||||
|
||||
pendingServiceGoodService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -241,9 +225,7 @@ public class AppointmentDateController {
|
|||
}
|
||||
TimePeriod timePeriod = new TimePeriod();
|
||||
BeanUtils.copyProperties(timePeriodSingleAddRequest, timePeriod);
|
||||
boolean save = timePeriodService.save(timePeriod);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "预约时间段添加失败");
|
||||
|
||||
timePeriodService.save(timePeriod);
|
||||
// 添加服务类商品待处理记录
|
||||
PendingServiceGood pendingServiceGood = new PendingServiceGood();
|
||||
BeanUtils.copyProperties(timePeriodSingleAddRequest, pendingServiceGood);
|
||||
|
@ -262,10 +244,7 @@ public class AppointmentDateController {
|
|||
pendingServiceGood.setTimePeriodId(timePeriod.getId());
|
||||
pendingServiceGood.setReservationDate(appointmentDate.getSpecificDate());
|
||||
pendingServiceGood.setIsAvailable(appointmentDate.getIsAvailable());
|
||||
|
||||
boolean result = pendingServiceGoodService.save(pendingServiceGood);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录添加失败");
|
||||
|
||||
pendingServiceGoodService.save(pendingServiceGood);
|
||||
return ResultUtils.success(timePeriod.getId());
|
||||
}
|
||||
|
||||
|
@ -287,9 +266,7 @@ public class AppointmentDateController {
|
|||
// 添加当前商品的预约日期
|
||||
AppointmentDate appointmentDate = new AppointmentDate();
|
||||
BeanUtils.copyProperties(appointmentDateSingleAddRequest, appointmentDate);
|
||||
boolean save = appointmentDateService.save(appointmentDate);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "预约日期添加失败");
|
||||
|
||||
appointmentDateService.save(appointmentDate);
|
||||
// 添加当前预约日期的预约时间段
|
||||
Long appointmentDateId = appointmentDate.getId();
|
||||
List<TimePeriodAddRequest> timePeriodAddRequestList = appointmentDateSingleAddRequest.getTimePeriodAddRequestList();
|
||||
|
@ -299,8 +276,7 @@ public class AppointmentDateController {
|
|||
timePeriod.setAppointmentDateId(appointmentDateId);
|
||||
return timePeriod;
|
||||
}).toList();
|
||||
boolean result = timePeriodService.saveBatch(timePeriodList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "批量添加预约时间段失败");
|
||||
timePeriodService.saveBatch(timePeriodList);
|
||||
|
||||
// 批量添加服务类商品待处理记录
|
||||
Long goodId = appointmentDate.getGoodId();
|
||||
|
@ -333,9 +309,7 @@ public class AppointmentDateController {
|
|||
|
||||
pendingServiceGoodList.add(pendingServiceGood);
|
||||
}
|
||||
boolean saveBatch = pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!saveBatch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录批量添加失败");
|
||||
|
||||
pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -361,8 +335,7 @@ public class AppointmentDateController {
|
|||
|
||||
// 批量添加当前商品的预约日期
|
||||
List<AppointmentDate> appointmentDateList = commonService.convertList(appointmentDateSingleAddRequestList, AppointmentDate.class);
|
||||
boolean save = appointmentDateService.saveBatch(appointmentDateList);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "预约日期批量添加失败");
|
||||
appointmentDateService.saveBatch(appointmentDateList);
|
||||
|
||||
// 批量添加当前预约日期的预约时间段
|
||||
List<TimePeriod> timePeriods = new ArrayList<>();
|
||||
|
@ -377,8 +350,7 @@ public class AppointmentDateController {
|
|||
}).toList();
|
||||
timePeriods.addAll(timePeriodList);
|
||||
}
|
||||
boolean result = timePeriodService.saveBatch(timePeriods);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "批量添加预约时间段失败");
|
||||
timePeriodService.saveBatch(timePeriods);
|
||||
|
||||
// 批量插入服务类商品待处理记录
|
||||
List<AppointmentDateTimePeriodVO> appointmentDateTimePeriodVOList = appointmentDateService.queryAppointmentDateDetailById(good.getId());
|
||||
|
@ -393,10 +365,7 @@ public class AppointmentDateController {
|
|||
pendingServiceGood.setAppointmentDateId(appointmentDateTimePeriodVO.getId());
|
||||
pendingServiceGoodList.add(pendingServiceGood);
|
||||
}
|
||||
boolean batch = pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!batch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录批量插入失败");
|
||||
|
||||
|
||||
pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.cultural.heritage.common.BaseResponse;
|
|||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonBatchRequest;
|
||||
import com.cultural.heritage.model.dto.cartService.CartExperienceAddRequest;
|
||||
import com.cultural.heritage.model.dto.cartService.CartExperienceUpdateRequest;
|
||||
|
@ -145,8 +144,7 @@ public class CartExperienceController {
|
|||
cartExperience.setTimeSlot(timeSlot);
|
||||
}
|
||||
|
||||
boolean result = cartExperienceService.updateBatchById(cartExperienceList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "购物车信息更新失败");
|
||||
cartExperienceService.updateBatchById(cartExperienceList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -165,8 +163,7 @@ public class CartExperienceController {
|
|||
}
|
||||
userService.getLoginUser(request);
|
||||
List<Long> idList = commonBatchRequest.getIdList();
|
||||
boolean result = cartExperienceService.removeBatchByIds(idList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
cartExperienceService.removeBatchByIds(idList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.cultural.heritage.common.BaseResponse;
|
|||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonBatchRequest;
|
||||
import com.cultural.heritage.model.dto.cart.CartRecordAddRequest;
|
||||
import com.cultural.heritage.model.dto.cart.CartRecordUpdateRequest;
|
||||
|
@ -115,9 +114,7 @@ public class CartRecordController {
|
|||
BigDecimal price = priceMap.get(goodId);
|
||||
cartRecord.setSubtotal(price.multiply(BigDecimal.valueOf(quantity)));
|
||||
}
|
||||
|
||||
boolean result = cartRecordService.updateBatchById(cartRecordList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
cartRecordService.updateBatchById(cartRecordList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -136,8 +133,7 @@ public class CartRecordController {
|
|||
}
|
||||
userService.getLoginUser(request);
|
||||
List<Long> idList = commonBatchRequest.getIdList();
|
||||
boolean result = cartRecordService.removeBatchByIds(idList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
cartRecordService.removeBatchByIds(idList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.cultural.heritage.common.ErrorCode;
|
|||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonBatchRequest;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.category.CategoryAddRequest;
|
||||
|
@ -27,6 +26,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -75,8 +75,7 @@ public class CategoryController {
|
|||
Category category = new Category();
|
||||
BeanUtils.copyProperties(categoryAddRequest, category);
|
||||
categoryService.validCategory(category, true);
|
||||
boolean save = categoryService.save(category);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR);
|
||||
categoryService.save(category);
|
||||
return ResultUtils.success(true, "类别插入成功");
|
||||
}
|
||||
|
||||
|
@ -88,6 +87,7 @@ public class CategoryController {
|
|||
*/
|
||||
@PostMapping("/delete")
|
||||
@Operation(summary = "Web端管理员删除商品类别", description = "参数:类别删除请求体,权限:管理员(admin, boss),方法名:deleteCategory")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> deleteCategory(@RequestBody CommonRequest deleteCategoryRequest) {
|
||||
if (deleteCategoryRequest == null || deleteCategoryRequest.getId() <= 0) {
|
||||
|
@ -99,14 +99,9 @@ public class CategoryController {
|
|||
|
||||
String typeName = category.getTypeName();
|
||||
List<Good> goodList = commonService.findByFieldEqTargetField("type", typeName, goodService);
|
||||
|
||||
goodService.removeBatchByIds(goodList);
|
||||
// ThrowUtils.throwIf(!isSuccess, ErrorCode.OPERATION_ERROR, "商品批量删除失败");
|
||||
|
||||
// 删除当前类别
|
||||
boolean result = categoryService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "类别删除失败");
|
||||
|
||||
categoryService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -118,6 +113,7 @@ public class CategoryController {
|
|||
*/
|
||||
@PostMapping("/delBatch")
|
||||
@Operation(summary = "Web端管理员批量删除商品类别", description = "参数:类别删除请求体,权限:管理员(admin, boss),方法名:deleteCategory")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> delBatchCategory(@RequestBody CommonBatchRequest commonDelBatchRequest) {
|
||||
if (commonDelBatchRequest == null || CollectionUtils.isEmpty(commonDelBatchRequest.getIdList())) {
|
||||
|
@ -130,12 +126,8 @@ public class CategoryController {
|
|||
|
||||
// 批量删除商品
|
||||
goodService.removeBatchByIds(goodList);
|
||||
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "商品批量删除失败");
|
||||
|
||||
// 批量删除当前类别
|
||||
boolean remove = categoryService.removeBatchByIds(categoryList);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "类别批量删除失败");
|
||||
|
||||
categoryService.removeBatchByIds(categoryList);
|
||||
return ResultUtils.success(true, "批量删除类别成功");
|
||||
}
|
||||
|
||||
|
@ -149,6 +141,7 @@ public class CategoryController {
|
|||
*/
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "Web端管理员更新商品类别", description = "参数:类别更新请求体,权限:管理员(admin, boss),方法名:updateCategory")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> updateCategory(@RequestBody CategoryUpdateRequest categoryUpdateRequest) {
|
||||
if (categoryUpdateRequest == null || categoryUpdateRequest.getId() <= 0) {
|
||||
|
@ -168,14 +161,11 @@ public class CategoryController {
|
|||
Category category = new Category();
|
||||
BeanUtils.copyProperties(categoryUpdateRequest, category);
|
||||
categoryService.validCategory(category, false);
|
||||
boolean result = categoryService.updateById(category);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "商品类别更新失败");
|
||||
|
||||
categoryService.updateById(category);
|
||||
// 修改原有类别下所有商品的类名
|
||||
UpdateWrapper<Good> goodUpdateWrapper = new UpdateWrapper<>();
|
||||
goodUpdateWrapper.eq("type", originTypeName).set("type", targetTypeName);
|
||||
goodService.update(goodUpdateWrapper);
|
||||
// ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "商品类名更新失败");
|
||||
return ResultUtils.success(true, "类别更新成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -95,9 +95,7 @@ public class CouponController {
|
|||
}
|
||||
// 校验
|
||||
couponService.validCoupon(coupon, false);
|
||||
boolean result = couponService.save(coupon);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "优惠券添加失败");
|
||||
|
||||
couponService.save(coupon);
|
||||
// 向消息队列中发送优惠券创建的消息
|
||||
couponService.sendCouponCreateMessage(coupon);
|
||||
|
||||
|
@ -131,15 +129,11 @@ public class CouponController {
|
|||
} else {
|
||||
coupon.setStatus("可用");
|
||||
}
|
||||
|
||||
// 校验
|
||||
couponService.validCoupon(coupon, true);
|
||||
boolean result = couponService.saveOrUpdate(coupon);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "优惠券更新失败");
|
||||
|
||||
couponService.saveOrUpdate(coupon);
|
||||
// 向消息队列中发送优惠券创建的消息
|
||||
couponService.sendCouponCreateMessage(coupon);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -158,8 +152,7 @@ public class CouponController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = couponDeleteRequest.getId();
|
||||
boolean result = couponService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "优惠券删除失败");
|
||||
couponService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -178,8 +171,7 @@ public class CouponController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数为null或数组为空");
|
||||
}
|
||||
List<Long> idList = commonBatchRequest.getIdList();
|
||||
boolean result = couponService.removeBatchByIds(idList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "优惠券批量删除失败");
|
||||
couponService.removeBatchByIds(idList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -208,15 +200,14 @@ public class CouponController {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户积分兑换优惠券
|
||||
* @param commonRequest 兑换记录添加请求体
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/exchange")
|
||||
@Operation(summary = "小程序端用户积分兑换优惠券", description = "参数:兑换记录添加请求体,权限:所有人,方法名:pointsExchangeCoupon")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "小程序端用户积分兑换优惠券", description = "参数:兑换记录添加请求体,权限:所有人,方法名:pointsExchangeCoupon")
|
||||
public BaseResponse<Boolean> pointsExchangeCoupon(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
// 获取当前用户信息
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
|
@ -238,17 +229,12 @@ public class CouponController {
|
|||
UserCoupon userCoupon = new UserCoupon();
|
||||
userCoupon.setUserId(userId);
|
||||
userCoupon.setCouponVO(couponVO);
|
||||
boolean save = userCouponService.save(userCoupon);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "兑换记录插入失败");
|
||||
|
||||
userCouponService.save(userCoupon);
|
||||
// 向消息队列中发送用户优惠券创建的消息
|
||||
couponService.sendUserCouponCreateMessage(userCoupon, coupon);
|
||||
|
||||
// 更新用户积分
|
||||
loginUser.setPoints(loginUser.getPoints() - requirePoints);
|
||||
boolean isSuccess = userService.updateById(loginUser);
|
||||
ThrowUtils.throwIf(!isSuccess, ErrorCode.OPERATION_ERROR, "更新用户积分信息失败");
|
||||
|
||||
userService.updateById(loginUser);
|
||||
return ResultUtils.success(true, "兑换成功");
|
||||
}
|
||||
|
||||
|
@ -256,6 +242,7 @@ public class CouponController {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据状态查看优惠券
|
||||
* @param commonStringRequest 优惠券状态
|
||||
|
@ -340,8 +327,7 @@ public class CouponController {
|
|||
UpdateWrapper<Coupon> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("isShelves", status);
|
||||
boolean update = couponService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "上架状态更新失败");
|
||||
couponService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,8 +175,7 @@ public class GoodController {
|
|||
good.setFestivalName(good.getFestivalName() + ";" + url);
|
||||
// 校验
|
||||
goodService.validGood(good, false);
|
||||
boolean save = goodService.save(good);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR);
|
||||
goodService.save(good);
|
||||
return ResultUtils.success(true, "商品插入成功");
|
||||
}
|
||||
|
||||
|
@ -189,8 +188,8 @@ public class GoodController {
|
|||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("/add/service")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "Web端管理员添加服务类商品", description = "参数:服务类商品添加请求体,权限:管理员(admin, boss),方法名:addServiceGood")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> addServiceGood(@RequestBody ServiceGoodAddRequest serviceGoodAddRequest) {
|
||||
if (serviceGoodAddRequest == null) {
|
||||
|
@ -205,8 +204,7 @@ public class GoodController {
|
|||
good.setFestivalName("无");
|
||||
// 校验
|
||||
goodService.validGood(good, false);
|
||||
boolean save = goodService.save(good);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR);
|
||||
goodService.save(good);
|
||||
|
||||
// 添加当前商品的预约日期
|
||||
List<AppointmentDateAddRequest> appointmentDateAddRequestList = serviceGoodAddRequest.getAppointmentDateAddRequestList();
|
||||
|
@ -218,8 +216,7 @@ public class GoodController {
|
|||
appointmentDateService.validAppointmentDate(appointmentDate, false);
|
||||
return appointmentDate;
|
||||
}).toList();
|
||||
boolean isSaveBatch = appointmentDateService.saveBatch(appointmentDateList);
|
||||
ThrowUtils.throwIf(!isSaveBatch, ErrorCode.OPERATION_ERROR);
|
||||
appointmentDateService.saveBatch(appointmentDateList);
|
||||
|
||||
// 添加当前商品的预约时间段
|
||||
List<TimePeriod> timePeriods = new ArrayList<>();
|
||||
|
@ -238,8 +235,7 @@ public class GoodController {
|
|||
}).toList();
|
||||
timePeriods.addAll(timePeriodList);
|
||||
}
|
||||
boolean result = timePeriodService.saveBatch(timePeriods);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
timePeriodService.saveBatch(timePeriods);
|
||||
|
||||
// 批量插入服务类商品待处理记录
|
||||
List<AppointmentDateTimePeriodVO> appointmentDateTimePeriodVOList = appointmentDateService.queryAppointmentDateDetailById(good.getId());
|
||||
|
@ -254,9 +250,7 @@ public class GoodController {
|
|||
pendingServiceGood.setAppointmentDateId(appointmentDateTimePeriodVO.getId());
|
||||
pendingServiceGoodList.add(pendingServiceGood);
|
||||
}
|
||||
boolean batch = pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!batch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录批量插入失败");
|
||||
|
||||
pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -275,8 +269,7 @@ public class GoodController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = deleteRequest.getId();
|
||||
boolean result = goodService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
goodService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -289,8 +282,8 @@ public class GoodController {
|
|||
*/
|
||||
@PostMapping("/delete/service")
|
||||
@Operation(summary = "Web端管理员删除服务类商品", description = "参数: 商品删除请求体,权限:管理员(admin, boss),方法名:deleteServiceGood")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> deleteServiceGood(@RequestBody CommonRequest deleteRequest) {
|
||||
if (deleteRequest == null || deleteRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
|
@ -298,17 +291,14 @@ public class GoodController {
|
|||
Long id = deleteRequest.getId();
|
||||
// 获取预约日期列表
|
||||
List<AppointmentDate> appointmentDateList = commonService.findByFieldEqTargetField("goodId", id, appointmentDateService);
|
||||
|
||||
// 获取预约时间段列表
|
||||
List<TimePeriod> timePeriodList = commonService.findByFieldInTargetField(appointmentDateList, timePeriodService, AppointmentDate::getId, "appointmentDateId");
|
||||
|
||||
// 删除预约时间段表中与该商品关联的记录
|
||||
timePeriodService.removeBatchByIds(timePeriodList);
|
||||
// 删除预约日期表中与该商品关联的记录
|
||||
appointmentDateService.removeBatchByIds(appointmentDateList);
|
||||
// 删除商品表中的服务类商品
|
||||
boolean result = goodService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品删除失败");
|
||||
goodService.removeById(id);
|
||||
|
||||
// 删除服务类商品待处理记录
|
||||
QueryWrapper<PendingServiceGood> queryWrapper = new QueryWrapper<>();
|
||||
|
@ -321,8 +311,7 @@ public class GoodController {
|
|||
map.put(pendingServiceOrder.getPendingId(), 1);
|
||||
}
|
||||
pendingServiceGoodList = pendingServiceGoodList.stream().filter(pendingServiceGood -> map.get(pendingServiceGood.getId()) == null).toList();
|
||||
boolean removeBatch = pendingServiceGoodService.removeBatchByIds(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!removeBatch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录删除失败");
|
||||
pendingServiceGoodService.removeBatchByIds(pendingServiceGoodList);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
|
||||
|
@ -337,8 +326,8 @@ public class GoodController {
|
|||
*/
|
||||
@PostMapping("/delBatch/service")
|
||||
@Operation(summary = "Web端用户批量删除服务类商品", description = "服务类商品id列表,权限:管理员(admin, boss),方法名:delBatchServiceGoods")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> delBatchServiceGoods(@RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
if (commonBatchRequest == null || CollectionUtils.isEmpty(commonBatchRequest.getIdList())) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
|
@ -353,8 +342,7 @@ public class GoodController {
|
|||
// 删除预约日期表中与该商品关联的记录
|
||||
appointmentDateService.removeBatchByIds(appointmentDateList);
|
||||
// 删除商品表中的服务类商品
|
||||
boolean result = goodService.removeBatchByIds(ids);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品删除失败");
|
||||
goodService.removeBatchByIds(ids);
|
||||
|
||||
// 批量删除服务类商品待处理记录
|
||||
QueryWrapper<PendingServiceGood> goodQueryWrapper = new QueryWrapper<>();
|
||||
|
@ -366,9 +354,7 @@ public class GoodController {
|
|||
map.put(pendingServiceOrder.getPendingId(), 1);
|
||||
}
|
||||
pendingServiceGoodList = pendingServiceGoodList.stream().filter(pendingServiceGood -> map.get(pendingServiceGood.getId()) == null).toList();
|
||||
boolean removeBatch = pendingServiceGoodService.removeBatchByIds(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!removeBatch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录删除失败");
|
||||
|
||||
pendingServiceGoodService.removeBatchByIds(pendingServiceGoodList);
|
||||
return ResultUtils.success(true);
|
||||
|
||||
}
|
||||
|
@ -382,6 +368,7 @@ public class GoodController {
|
|||
*/
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "Web端管理员更新常规类商品", description = "参数:商品更新请求体,权限:管理员(admin, boss),方法名:updateGoods")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> updateGoods(@RequestBody GoodUpdateRequest goodUpdateRequest) {
|
||||
if (goodUpdateRequest == null || goodUpdateRequest.getId() <= 0) {
|
||||
|
@ -400,8 +387,7 @@ public class GoodController {
|
|||
}
|
||||
// 校验
|
||||
goodService.validGood(good, true);
|
||||
boolean result = goodService.updateById(good);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "实体类商品更新失败");
|
||||
goodService.updateById(good);
|
||||
// 如果更新了商品的价格,就需要更新购物车中的小计
|
||||
Long id = good.getId();
|
||||
BigDecimal targetPrice = good.getPrice();
|
||||
|
@ -411,8 +397,7 @@ public class GoodController {
|
|||
List<CartRecord> cartRecords = commonService.findByFieldEqTargetField("goodId", id, cartRecordService);
|
||||
if (!cartRecords.isEmpty()) {
|
||||
List<CartRecord> cartRecordList = goodService.updateCartGoodPrice(id, targetPrice);
|
||||
boolean update = cartRecordService.updateBatchById(cartRecordList);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
|
||||
cartRecordService.updateBatchById(cartRecordList);
|
||||
}
|
||||
}
|
||||
return ResultUtils.success(true);
|
||||
|
@ -462,8 +447,7 @@ public class GoodController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
List<Long> idList = commonDelBatchRequest.getIdList();
|
||||
boolean result = goodService.removeBatchByIds(idList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
goodService.removeBatchByIds(idList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -810,9 +794,7 @@ public class GoodController {
|
|||
good.setFestivalName("无");
|
||||
// 校验
|
||||
goodService.validGood(good, true);
|
||||
boolean result = goodService.updateById(good);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品信息更新失败");
|
||||
|
||||
goodService.updateById(good);
|
||||
// 删除当前商品关联的所有日期和时间段
|
||||
CommonRequest commonRequest = new CommonRequest();
|
||||
commonRequest.setId(good.getId());
|
||||
|
@ -836,16 +818,13 @@ public class GoodController {
|
|||
// 获取预约时间段列表
|
||||
List<TimePeriod> timePeriodList = commonService.findByFieldInTargetField(appointmentDateList, timePeriodService, AppointmentDate::getId, "appointmentDateId");
|
||||
// 删除预约时间段表中与该商品关联的记录
|
||||
boolean remove = timePeriodService.removeBatchByIds(timePeriodList);
|
||||
// ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "服务类商品预约时间段删除失败");
|
||||
timePeriodService.removeBatchByIds(timePeriodList);
|
||||
// 删除预约日期表中与该商品关联的记录
|
||||
boolean isSuccess = appointmentDateService.removeBatchByIds(appointmentDateList);
|
||||
// ThrowUtils.throwIf(!isSuccess, ErrorCode.OPERATION_ERROR, "服务类商品预约日期删除失败");
|
||||
appointmentDateService.removeBatchByIds(appointmentDateList);
|
||||
// 删除服务类商品待处理记录
|
||||
QueryWrapper<PendingServiceGood> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("goodId", id);
|
||||
boolean removeBatch = pendingServiceGoodService.remove(queryWrapper);
|
||||
ThrowUtils.throwIf(!removeBatch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录删除失败");
|
||||
pendingServiceGoodService.remove(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
|
@ -861,8 +840,7 @@ public class GoodController {
|
|||
appointmentDateService.validAppointmentDate(appointmentDate, false);
|
||||
return appointmentDate;
|
||||
}).toList();
|
||||
boolean isSaveBatch = appointmentDateService.saveBatch(appointmentDateList);
|
||||
ThrowUtils.throwIf(!isSaveBatch, ErrorCode.OPERATION_ERROR);
|
||||
appointmentDateService.saveBatch(appointmentDateList);
|
||||
|
||||
// 添加当前商品的预约时间段
|
||||
List<TimePeriod> timePeriods = new ArrayList<>();
|
||||
|
@ -881,8 +859,7 @@ public class GoodController {
|
|||
}).toList();
|
||||
timePeriods.addAll(timePeriodList);
|
||||
}
|
||||
boolean result = timePeriodService.saveBatch(timePeriods);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
timePeriodService.saveBatch(timePeriods);
|
||||
|
||||
// 批量插入服务类商品待处理记录
|
||||
List<AppointmentDateTimePeriodVO> appointmentDateTimePeriodVOList = appointmentDateService.queryAppointmentDateDetailById(good.getId());
|
||||
|
@ -897,8 +874,7 @@ public class GoodController {
|
|||
pendingServiceGood.setAppointmentDateId(appointmentDateTimePeriodVO.getId());
|
||||
pendingServiceGoodList.add(pendingServiceGood);
|
||||
}
|
||||
boolean batch = pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
ThrowUtils.throwIf(!batch, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录批量插入失败");
|
||||
pendingServiceGoodService.saveBatch(pendingServiceGoodList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -923,8 +899,7 @@ public class GoodController {
|
|||
UpdateWrapper<Good> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("isShelves", status);
|
||||
boolean update = goodService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "上架状态更新失败");
|
||||
goodService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -957,8 +932,7 @@ public class GoodController {
|
|||
good.setFestivalName("无");
|
||||
// 校验
|
||||
goodService.validGood(good, true);
|
||||
boolean result = goodService.updateById(good);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品信息更新失败");
|
||||
goodService.updateById(good);
|
||||
|
||||
// 如果更新了商品的价格,就需要更新购物车中的小计
|
||||
Long id = good.getId();
|
||||
|
@ -969,8 +943,7 @@ public class GoodController {
|
|||
if (!cartExperiences.isEmpty()) {
|
||||
// 更新购物车中的小计
|
||||
List<CartExperience> cartExperienceList = goodService.updateCartExperienceGoodPrice(id, targetPrice);
|
||||
boolean update = cartExperienceService.updateBatchById(cartExperienceList);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "购物车商品价格更新失败");
|
||||
cartExperienceService.updateBatchById(cartExperienceList);
|
||||
}
|
||||
}
|
||||
return ResultUtils.success(true);
|
||||
|
@ -995,7 +968,6 @@ public class GoodController {
|
|||
ThrowUtils.throwIf(good == null, ErrorCode.NOT_FOUND_ERROR, "商品不存在");
|
||||
ServiceGoodCardVO serviceGoodVO = new ServiceGoodCardVO();
|
||||
BeanUtils.copyProperties(good, serviceGoodVO);
|
||||
|
||||
return ResultUtils.success(serviceGoodVO);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,7 @@ public class AdvanceOrderController {
|
|||
advanceOrder.setOrderStatus(OrderStatusConstant.PENDING_PAYMENT);
|
||||
// 校验
|
||||
advanceOrderService.validAdvanceOrder(advanceOrder);
|
||||
boolean result = advanceOrderService.save(advanceOrder);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单创建失败");
|
||||
advanceOrderService.save(advanceOrder);
|
||||
// 向消息队列中发送订单创建的消息
|
||||
advanceOrderService.sendAdvanceOrderMessage(advanceOrder.getId());
|
||||
return ResultUtils.success(advanceOrder.getId());
|
||||
|
@ -175,9 +174,7 @@ public class AdvanceOrderController {
|
|||
ThrowUtils.throwIf(advanceOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
ThrowUtils.throwIf(!advanceOrder.getOrderStatus().equals(OrderStatusConstant.PENDING_PAYMENT), ErrorCode.SYSTEM_ERROR, "订单状态错误");
|
||||
advanceOrder.setOrderStatus(OrderStatusConstant.TRANSACTION_CLOSED);
|
||||
boolean update = advanceOrderService.updateById(advanceOrder);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态更新失败");
|
||||
|
||||
advanceOrderService.updateById(advanceOrder);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -201,7 +198,6 @@ public class AdvanceOrderController {
|
|||
AdvanceOrder advanceOrder = advanceOrderService.getById(id);
|
||||
ThrowUtils.throwIf(advanceOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
AdvanceOrderVO advanceOrderVO = commonService.copyProperties(advanceOrder, AdvanceOrderVO.class);
|
||||
|
||||
return ResultUtils.success(advanceOrderVO);
|
||||
}
|
||||
|
||||
|
@ -276,8 +272,7 @@ public class AdvanceOrderController {
|
|||
Long id = commonRequest.getId();
|
||||
AdvanceOrder advanceOrder = advanceOrderService.getById(id);
|
||||
ThrowUtils.throwIf(advanceOrder == null || !advanceOrder.getOrderStatus().equals(OrderStatusConstant.TRANSACTION_CLOSED), ErrorCode.OPERATION_ERROR, "订单不存在或状态错误");
|
||||
boolean result = advanceOrderService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单删除失败");
|
||||
advanceOrderService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -372,8 +367,7 @@ public class AdvanceOrderController {
|
|||
UpdateWrapper<AdvanceOrder> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("orderStatus", orderStatus);
|
||||
boolean result = advanceOrderService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单状态不存在或订单状态更新失败");
|
||||
advanceOrderService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ public class ClothesRentOrderController {
|
|||
clothesRentOrderService.validClothesRentOrder(clothesRentOrderAddRequest);
|
||||
// 获取服装信息
|
||||
Long clothesId = clothesRentOrderAddRequest.getClothesId();
|
||||
// 校验当前服装是否已被租赁
|
||||
clothesRentOrderService.validIsBeenRented(clothesId);
|
||||
Clothes clothes = clothesService.getById(clothesId);
|
||||
ThrowUtils.throwIf(clothes == null || clothes.getIsShelves() == 0, ErrorCode.OPERATION_ERROR, "服装已被下架或者不存在");
|
||||
ClothesSnapshot clothesSnapshot = commonService.copyProperties(clothes, ClothesSnapshot.class);
|
||||
|
@ -116,8 +118,7 @@ public class ClothesRentOrderController {
|
|||
clothesRentOrder.setRentDays(rentDays);
|
||||
clothesRentOrder.setTotalAmount(totalAmount);
|
||||
|
||||
boolean save = clothesRentOrderService.save(clothesRentOrder);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "订单创建失败");
|
||||
clothesRentOrderService.save(clothesRentOrder);
|
||||
clothesRentOrderService.sendClothesRentOrderMessage(clothesRentOrder.getId());
|
||||
|
||||
return ResultUtils.success(clothesRentOrder.getId());
|
||||
|
@ -146,8 +147,7 @@ public class ClothesRentOrderController {
|
|||
ThrowUtils.throwIf(!clothesRentOrder.getOrderStatus().equals(OrderStatusConstant.PENDING_PAYMENT), ErrorCode.SYSTEM_ERROR, "订单状态错误");
|
||||
UpdateWrapper<ClothesRentOrder> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id).set("orderStatus", OrderStatusConstant.TRANSACTION_CLOSED);
|
||||
boolean update = clothesRentOrderService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态更新失败");
|
||||
clothesRentOrderService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -238,8 +238,7 @@ public class ClothesRentOrderController {
|
|||
Long id = commonRequest.getId();
|
||||
ClothesRentOrder clothesRentOrder = clothesRentOrderService.getById(id);
|
||||
ThrowUtils.throwIf(clothesRentOrder == null || !clothesRentOrder.getOrderStatus().equals(OrderStatusConstant.TRANSACTION_CLOSED), ErrorCode.OPERATION_ERROR, "订单不存在或状态错误");
|
||||
boolean result = clothesRentOrderService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单删除失败");
|
||||
clothesRentOrderService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ import java.util.Map;
|
|||
@RequestMapping("/order")
|
||||
@Slf4j
|
||||
@Tag(name = "订单管理模块")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OrderController {
|
||||
|
||||
@Resource
|
||||
|
@ -332,8 +331,7 @@ public class OrderController {
|
|||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("trackingNumber", trackingNumber);
|
||||
updateWrapper.set("orderStatus", OrderStatusConstant.PENDING_DELIVERY);
|
||||
boolean result = orderService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单状态不存在或订单状态更新失败");
|
||||
orderService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -370,6 +368,7 @@ public class OrderController {
|
|||
*/
|
||||
@PostMapping ("/cancel/id")
|
||||
@Operation(summary = "小程序端用户取消服务类商品订单", description = "参数:订单id,权限:所有人,方法名:cancelOrderById")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> cancelOrderById(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
|
@ -380,8 +379,7 @@ public class OrderController {
|
|||
ThrowUtils.throwIf(order == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
ThrowUtils.throwIf(!order.getOrderStatus().equals(OrderStatusConstant.PENDING_PAYMENT), ErrorCode.SYSTEM_ERROR, "订单状态错误");
|
||||
order.setOrderStatus(OrderStatusConstant.TRANSACTION_CLOSED);
|
||||
boolean update = orderService.updateById(order);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态更新失败");
|
||||
orderService.updateById(order);
|
||||
|
||||
// 恢复商品库存
|
||||
List<OrderItems> orderItemsList = commonService.findByFieldEqTargetField("orderId", id, orderItemService);
|
||||
|
@ -410,9 +408,7 @@ public class OrderController {
|
|||
Integer inventory = good.getInventory();
|
||||
good.setInventory(quantity + inventory);
|
||||
}
|
||||
boolean updateBatch = goodService.updateBatchById(goodList);
|
||||
ThrowUtils.throwIf(!updateBatch, ErrorCode.SYSTEM_ERROR, "商品库存恢复失败");
|
||||
|
||||
goodService.updateBatchById(goodList);
|
||||
// 如果使用了优惠券,则退还优惠券
|
||||
CouponSnapshot couponSnapshot = order.getCouponSnapshot();
|
||||
if (couponSnapshot != null) {
|
||||
|
@ -421,8 +417,7 @@ public class OrderController {
|
|||
ThrowUtils.throwIf(userCoupon == null, ErrorCode.OPERATION_ERROR, "优惠券不存在");
|
||||
// 更新优惠券状态
|
||||
userCoupon.setIsUsed(0);
|
||||
boolean result = userCouponService.updateById(userCoupon);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "优惠券状态更新失败");
|
||||
userCouponService.updateById(userCoupon);
|
||||
}
|
||||
|
||||
return ResultUtils.success(true);
|
||||
|
@ -448,8 +443,7 @@ public class OrderController {
|
|||
ThrowUtils.throwIf(order == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
ThrowUtils.throwIf(!order.getOrderStatus().equals(OrderStatusConstant.TRANSACTION_CLOSED), ErrorCode.SYSTEM_ERROR, "订单状态错误");
|
||||
|
||||
boolean remove = orderService.removeById(id);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR, "订单删除失败");
|
||||
orderService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -464,6 +458,7 @@ public class OrderController {
|
|||
*/
|
||||
@PostMapping ("/cancel/service/id")
|
||||
@Operation(summary = "小程序端用户取消服务类商品订单", description = "参数:订单id,权限:所有人,方法名:cancelOrderById")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> cancelServiceOrderById(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
|
@ -474,17 +469,14 @@ public class OrderController {
|
|||
ThrowUtils.throwIf(order == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
ThrowUtils.throwIf(!order.getOrderStatus().equals(OrderStatusConstant.PENDING_PAYMENT), ErrorCode.SYSTEM_ERROR, "订单状态错误");
|
||||
order.setOrderStatus(OrderStatusConstant.TRANSACTION_CLOSED);
|
||||
boolean update = orderService.updateById(order);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态更新失败");
|
||||
orderService.updateById(order);
|
||||
|
||||
// 更新服务类商品待处理订单记录
|
||||
List<PendingServiceOrder> pendingServiceOrderList = commonService.findByFieldEqTargetField("orderNumber", order.getOrderNumber(), pendingServiceOrderService);
|
||||
for (PendingServiceOrder pendingServiceOrder : pendingServiceOrderList) {
|
||||
pendingServiceOrder.setOrderItemStatus(order.getOrderStatus());
|
||||
}
|
||||
boolean updateResult = pendingServiceOrderService.updateBatchById(pendingServiceOrderList);
|
||||
ThrowUtils.throwIf(!updateResult, ErrorCode.OPERATION_ERROR, "服务类商品待处理订单记录更新失败");
|
||||
|
||||
pendingServiceOrderService.updateBatchById(pendingServiceOrderList);
|
||||
|
||||
// 如果使用了优惠券,则退还优惠券
|
||||
CouponSnapshot couponSnapshot = order.getCouponSnapshot();
|
||||
|
@ -494,8 +486,7 @@ public class OrderController {
|
|||
ThrowUtils.throwIf(userCoupon == null, ErrorCode.OPERATION_ERROR, "优惠券不存在");
|
||||
// 更新优惠券状态
|
||||
userCoupon.setIsUsed(0);
|
||||
boolean result = userCouponService.updateById(userCoupon);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "优惠券状态更新失败");
|
||||
userCouponService.updateById(userCoupon);
|
||||
}
|
||||
|
||||
return ResultUtils.success(true);
|
||||
|
@ -522,8 +513,7 @@ public class OrderController {
|
|||
UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", id);
|
||||
updateWrapper.set("orderStatus", orderStatus);
|
||||
boolean result = orderService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单状态不存在或订单状态更新失败");
|
||||
orderService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import jakarta.annotation.Resource;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -44,7 +43,6 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/pending")
|
||||
@Slf4j
|
||||
@Tag(name = "待处理商品管理模块")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PendingServiceGoodController {
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -26,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/refund")
|
||||
@Slf4j
|
||||
@Tag(name = "退款管理模块")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RefundRecordController {
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.cultural.heritage.common.ErrorCode;
|
|||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.CommonStringRequest;
|
||||
import com.cultural.heritage.model.dto.banner.BannerAddRequest;
|
||||
|
@ -62,8 +61,7 @@ public class BannerController {
|
|||
Banner banner = new Banner();
|
||||
BeanUtils.copyProperties(bannerAddRequest, banner);
|
||||
bannerService.validBanner(banner, false);
|
||||
boolean result = bannerService.save(banner);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "轮播图添加失败");
|
||||
bannerService.save(banner);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -82,8 +80,7 @@ public class BannerController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = commonRequest.getId();
|
||||
boolean result = bannerService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "轮播图删除失败");
|
||||
bannerService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -105,8 +102,7 @@ public class BannerController {
|
|||
Banner banner = new Banner();
|
||||
BeanUtils.copyProperties(bannerUpdateRequest, banner);
|
||||
bannerService.validBanner(banner, true);
|
||||
boolean result = bannerService.updateById(banner);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "轮播图更新失败");
|
||||
bannerService.updateById(banner);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.cultural.heritage.common.ResultUtils;
|
|||
import com.cultural.heritage.config.WxOpenConfig;
|
||||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.user.*;
|
||||
import com.cultural.heritage.model.entity.User;
|
||||
|
@ -181,8 +180,7 @@ public class UserController {
|
|||
User user = new User();
|
||||
BeanUtils.copyProperties(userUpdateMyRequest, user);
|
||||
user.setId(loginUser.getId());
|
||||
boolean result = userService.updateById(user);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "用户信息更新失败");
|
||||
userService.updateById(user);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -228,8 +226,7 @@ public class UserController {
|
|||
String encryptPassword = DigestUtils.md5DigestAsHex((SALT + user.getUserPassword()).getBytes());
|
||||
user.setUserPassword(encryptPassword);
|
||||
userService.validUser(user, false);
|
||||
boolean save = userService.save(user);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "用户添加失败");
|
||||
userService.save(user);
|
||||
return ResultUtils.success(user, "添加用户成功");
|
||||
}
|
||||
|
||||
|
@ -246,8 +243,7 @@ public class UserController {
|
|||
if (deleteRequest == null || deleteRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
boolean result = userService.removeById(deleteRequest.getId());
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
userService.removeById(deleteRequest.getId());
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -282,8 +278,7 @@ public class UserController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "无法修改为boss权限");
|
||||
}
|
||||
userService.validUser(user, true);
|
||||
boolean result = userService.updateById(user);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
userService.updateById(user);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.cultural.heritage.common.ErrorCode;
|
|||
import com.cultural.heritage.common.ResultUtils;
|
||||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.article.OfficialAccountArticleAddRequest;
|
||||
import com.cultural.heritage.model.dto.article.OfficialAccountArticleQueryRequest;
|
||||
|
@ -70,8 +69,7 @@ public class WeChatController {
|
|||
OfficialAccountArticle officialAccountArticle = new OfficialAccountArticle();
|
||||
BeanUtils.copyProperties(officialAccountArticleAddRequest, officialAccountArticle);
|
||||
weChatOfficialAccountService.validArticle(officialAccountArticle, false);
|
||||
boolean result = weChatOfficialAccountService.save(officialAccountArticle);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "文章添加失败");
|
||||
weChatOfficialAccountService.save(officialAccountArticle);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -90,8 +88,7 @@ public class WeChatController {
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = deleteRequest.getId();
|
||||
boolean result = weChatOfficialAccountService.removeById(id);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "文章删除失败");
|
||||
weChatOfficialAccountService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -113,8 +110,7 @@ public class WeChatController {
|
|||
OfficialAccountArticle officialAccountArticle = new OfficialAccountArticle();
|
||||
BeanUtils.copyProperties(officialAccountArticleUpdateRequest, officialAccountArticle);
|
||||
weChatOfficialAccountService.validArticle(officialAccountArticle, true);
|
||||
boolean result = weChatOfficialAccountService.updateById(officialAccountArticle);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "文章更新失败");
|
||||
weChatOfficialAccountService.updateById(officialAccountArticle);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class WeChatLogisticsController {
|
|||
public BaseResponse<WxAccessToken> getAccessToken() {
|
||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||
if (accessToken == null) {
|
||||
weChatLogisticsService.getAccessToken();
|
||||
weChatLogisticsService.getStableAccessToken();
|
||||
accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||
}
|
||||
WxAccessToken wxAccessToken = WxAccessToken.builder()
|
||||
|
|
|
@ -99,7 +99,6 @@ public class WeChatPayController {
|
|||
*/
|
||||
@Hidden
|
||||
@PostMapping("/payment/callback")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "JSAPI 下单回调(商品类)", description = "参数:订单id, 权限:所有人, 方法名:callbackPayment")
|
||||
public synchronized BaseResponse<Boolean> callbackPayment(HttpServletRequest request) throws IOException {
|
||||
// 获取下单信息
|
||||
|
@ -142,7 +141,6 @@ public class WeChatPayController {
|
|||
*/
|
||||
@Hidden
|
||||
@PostMapping("/payment/photo/callback")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "JSAPI 下单回调(写真预约类)", description = "参数:订单id, 权限:所有人, 方法名:callbackPhotoProductsPayment")
|
||||
public synchronized BaseResponse<Boolean> callbackPhotoProductsPayment(HttpServletRequest request) throws IOException {
|
||||
// 获取下单信息
|
||||
|
@ -340,7 +338,6 @@ public class WeChatPayController {
|
|||
*/
|
||||
@Hidden
|
||||
@PostMapping("/payment/clothesRent/callback")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "JSAPI 下单回调(服装租赁)", description = "参数:订单id, 权限:所有人, 方法名:callbackClothesRentPayment")
|
||||
public synchronized BaseResponse<Boolean> callbackClothesRentPayment(HttpServletRequest request) throws IOException {
|
||||
// 获取下单信息
|
||||
|
@ -395,8 +392,6 @@ public class WeChatPayController {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 发送订阅消息
|
||||
// */
|
||||
|
|
|
@ -3,20 +3,7 @@ package com.cultural.heritage.service.address;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cultural.heritage.model.entity.Address;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AddressService extends IService<Address> {
|
||||
/**
|
||||
* 校验是否添加或更新了默认地址
|
||||
*/
|
||||
void verifyIsDefault(Address address);
|
||||
|
||||
|
||||
/**
|
||||
* 根据userId获取用户地址
|
||||
*/
|
||||
List<Address> getUserAddressById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户提交的地址信息
|
||||
|
|
|
@ -3,20 +3,7 @@ package com.cultural.heritage.service.address;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cultural.heritage.model.entity.Contacts;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ContactsService extends IService<Contacts> {
|
||||
/**
|
||||
* 校验是否添加或更新了默认联系人
|
||||
*/
|
||||
void verifyIsDefault(Contacts contacts);
|
||||
|
||||
|
||||
/**
|
||||
* 根据userId获取用户联系人
|
||||
*/
|
||||
List<Contacts> getUserContactsById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户提交的地址信息
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.cultural.heritage.service.address.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.AddressMapper;
|
||||
import com.cultural.heritage.model.entity.Address;
|
||||
import com.cultural.heritage.service.address.AddressService;
|
||||
|
@ -12,37 +10,10 @@ import com.cultural.heritage.utils.RegexUtils;
|
|||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {
|
||||
|
||||
@Override
|
||||
public void verifyIsDefault(Address address) {
|
||||
Integer isDefault = address.getIsDefault();
|
||||
Long userId = address.getUserId();
|
||||
List<Address> list = this.getUserAddressById(userId);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return ;
|
||||
}
|
||||
if (isDefault == 1) {
|
||||
list.forEach(item -> item.setIsDefault(0));
|
||||
}
|
||||
boolean result = this.updateBatchById(list);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Address> getUserAddressById(Long userId) {
|
||||
QueryWrapper<Address> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("userId", userId);
|
||||
List<Address> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户提交的地址信息
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.cultural.heritage.service.address.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.ContactsMapper;
|
||||
import com.cultural.heritage.model.entity.Contacts;
|
||||
import com.cultural.heritage.service.address.ContactsService;
|
||||
|
@ -12,38 +10,11 @@ import com.cultural.heritage.utils.RegexUtils;
|
|||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> implements ContactsService {
|
||||
|
||||
|
||||
@Override
|
||||
public void verifyIsDefault(Contacts contacts) {
|
||||
Integer isDefault = contacts.getIsDefault();
|
||||
Long userId = contacts.getUserId();
|
||||
List<Contacts> list = this.getUserContactsById(userId);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return ;
|
||||
}
|
||||
if (isDefault == 1) {
|
||||
list.forEach(item -> item.setIsDefault(0));
|
||||
}
|
||||
boolean result = this.updateBatchById(list);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Contacts> getUserContactsById(Long userId) {
|
||||
QueryWrapper<Contacts> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("userId", userId);
|
||||
List<Contacts> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户提交的地址信息
|
||||
*/
|
||||
|
|
|
@ -9,51 +9,6 @@ import java.util.function.Function;
|
|||
|
||||
public interface CommonService {
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 从源集合中提取 ID 列表,并根据这些 ID 查询目标集合的数据。
|
||||
// * @param sourceList 源集合(List<T>),包含需要提取 ID 的元素
|
||||
// * @param genericService 执行查询的 Service(IService<R>)
|
||||
// * @param getId 提取源集合中每个元素的 ID 的函数
|
||||
// * @param <T> 源集合中元素的类型
|
||||
// * @param <R> 目标集合中元素的类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// <T, R> List<R> findByMyIdInOtherIds(List<T> sourceList, IService<R> genericService, Function<T, Long> getId);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 该方法接收一个 List<Long> 类型的 ID 列表,利用传入的服务接口和目标字段名,构造查询条件并执行查询。
|
||||
// * @param idList ID 列表(List<Long>)
|
||||
// * @param service 执行查询的 Service
|
||||
// * @param targetField 目标字段名
|
||||
// * @param <T> 查询结果实体类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// <T> List<T> findByMyFieldValueInOtherIds(List<Long> idList, IService<T> service, String targetField);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 从第一个集合中提取某个属性值,并用这些值作为查询条件去查询第二个集合的数据。
|
||||
// * @param sourceList 原始集合(源数据)
|
||||
// * @param service 要执行查询的 Service
|
||||
// * @param sourceField 在原始集合中提取的字段名
|
||||
// * @param targetField 在目标集合中的查询字段名
|
||||
// * @param <T> 目标查询实体类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// <T> List<T> findByMyFieldValueInOtherFieldValues(List<?> sourceList, IService<T> service, String sourceField, String targetField);
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,116 +15,6 @@ import java.util.stream.Collectors;
|
|||
public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 从源集合中提取 ID 列表,并根据这些 ID 查询目标集合的数据。
|
||||
// * @param sourceList 源集合(List<T>),包含需要提取 ID 的元素
|
||||
// * @param genericService 执行查询的 Service(IService<R>)
|
||||
// * @param getId 提取源集合中每个元素的 ID 的函数
|
||||
// * @param <T> 源集合中元素的类型
|
||||
// * @param <R> 目标集合中元素的类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// @Override
|
||||
// public <T, R> List<R> findByMyIdInOtherIds(List<T> sourceList, IService<R> genericService, Function<T, Long> getId) {
|
||||
// // 提取ID
|
||||
// List<Long> ids = sourceList.stream()
|
||||
// .map(getId) // 提取每个元素的ID
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// if (ids.isEmpty()) {
|
||||
// return List.of(); // 返回空集合
|
||||
// }
|
||||
// // 构造查询条件
|
||||
// QueryWrapper<R> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.in("id", ids);
|
||||
//
|
||||
// // 返回查询结果
|
||||
// return genericService.list(queryWrapper);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 该方法接收一个 List<Long> 类型的 ID 列表,利用传入的服务接口和目标字段名,构造查询条件并执行查询。
|
||||
// * @param idList ID 列表(List<Long>)
|
||||
// * @param service 执行查询的 Service
|
||||
// * @param targetField 目标字段名
|
||||
// * @param <T> 查询结果实体类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// public <T> List<T> findByMyFieldValueInOtherIds(List<Long> idList, IService<T> service, String targetField) {
|
||||
// // 如果 idList 为空或为 null,直接返回空集合
|
||||
// if (idList.isEmpty()) {
|
||||
// return List.of(); // 返回空集合
|
||||
// }
|
||||
//
|
||||
// // 创建 QueryWrapper 对象,用于构建查询条件
|
||||
// QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
//
|
||||
// // 使用 in 方法,构造根据 targetField 字段值查询的条件
|
||||
// queryWrapper.in(targetField, idList); // 将传入的 ID 列表作为查询条件
|
||||
//
|
||||
// // 调用 service 的 list 方法,执行查询并返回结果
|
||||
// return service.list(queryWrapper); // 返回查询结果
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 从第一个集合中提取某个属性值,并用这些值作为查询条件去查询第二个集合的数据。
|
||||
// * @param sourceList 原始集合(源数据)
|
||||
// * @param service 要执行查询的 Service
|
||||
// * @param sourceField 在原始集合中提取的字段名
|
||||
// * @param targetField 在目标集合中的查询字段名
|
||||
// * @param <T> 目标查询实体类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// @Override
|
||||
// public <T> List<T> findByMyFieldValueInOtherFieldValues(List<?> sourceList, IService<T> service, String sourceField, String targetField) {
|
||||
// // 使用反射获取源集合中对应字段的值
|
||||
// List<Object> fieldValues = sourceList.stream()
|
||||
// .map(item -> getFieldValue(item, sourceField)) // 获取字段值
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 如果 fieldValues 为空,直接返回空集合
|
||||
// if (fieldValues.isEmpty()) {
|
||||
// return List.of(); // 返回空集合
|
||||
// }
|
||||
// // 创建查询条件
|
||||
// QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.in(targetField, fieldValues); // 根据字段值进行查询
|
||||
//
|
||||
// return service.list(queryWrapper); // 执行查询并返回结果
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 使用反射获取对象的字段值
|
||||
// * @param object 对象
|
||||
// * @param fieldName 字段名
|
||||
// * @return 字段的值
|
||||
// */
|
||||
// private Object getFieldValue(Object object, String fieldName) {
|
||||
// try {
|
||||
// Field field = object.getClass().getDeclaredField(fieldName);
|
||||
// field.setAccessible(true);
|
||||
// return field.get(object);
|
||||
// } catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
// throw new RuntimeException("字段获取失败", e);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 从源集合中提取指定属性并作为查询条件查询目标集合
|
||||
* @param sourceList 源集合(List<T>),包含需要提取属性的元素
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
package com.cultural.heritage.service.good;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cultural.heritage.model.entity.Category;
|
||||
import com.cultural.heritage.model.entity.Good;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface CategoryService extends IService<Category> {
|
||||
|
||||
/**
|
||||
* 获取类别名列表
|
||||
*/
|
||||
|
||||
List<String> getTypeNameList();
|
||||
|
||||
/**
|
||||
* 根据id获取类别
|
||||
*/
|
||||
|
@ -26,10 +16,4 @@ public interface CategoryService extends IService<Category> {
|
|||
*/
|
||||
void validCategory(Category category, boolean add);
|
||||
|
||||
/**
|
||||
* 根据类别id获取商品删除的条件
|
||||
*/
|
||||
QueryWrapper<Good> getDeleteQueryWrapper(Long id);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -85,8 +85,7 @@ public class CartExperienceServiceImpl extends ServiceImpl<CartExperienceMapper,
|
|||
// 如果购物车中已存在该商品, 就叠加数量
|
||||
cartExperience.setQuantity(originQuantity + addQuantity);
|
||||
cartExperience.setSubtotal(good.getPrice().multiply(BigDecimal.valueOf(cartExperience.getQuantity())));
|
||||
boolean result = this.updateById(cartExperience);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "更新购物车商品数量失败");
|
||||
this.updateById(cartExperience);
|
||||
} else {
|
||||
// 校验当前服务类商品的预约情况
|
||||
goodService.checkServiceGoodBookingDetailIsProperly(goodId, reservationDate, timeSlot, addQuantity);
|
||||
|
@ -98,8 +97,7 @@ public class CartExperienceServiceImpl extends ServiceImpl<CartExperienceMapper,
|
|||
cartExperienceRecord.setSubtotal(good.getPrice().multiply(BigDecimal.valueOf(cartExperienceRecord.getQuantity())));
|
||||
// 校验
|
||||
this.validCart(cartExperienceRecord, false);
|
||||
boolean result = this.save(cartExperienceRecord);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
this.save(cartExperienceRecord);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.CartRecordMapper;
|
||||
import com.cultural.heritage.model.dto.cart.CartOrderItemAddRequest;
|
||||
import com.cultural.heritage.model.dto.cart.CartRecordAddRequest;
|
||||
|
@ -68,8 +67,7 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
// 如果购物车中已存在该商品, 就叠加数量
|
||||
cartRecord.setQuantity(currentQuantity);
|
||||
cartRecord.setSubtotal(good.getPrice().multiply(BigDecimal.valueOf(currentQuantity)));
|
||||
boolean result = this.updateById(cartRecord);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "更新购物车商品数量失败");
|
||||
this.updateById(cartRecord);
|
||||
} else {
|
||||
// 判断数量是否超出库存
|
||||
Integer currentQuantity = cartRecordAddRequest.getQuantity();
|
||||
|
@ -81,8 +79,7 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
cartGood.setSubtotal(good.getPrice().multiply(BigDecimal.valueOf(cartGood.getQuantity())));
|
||||
// 校验
|
||||
this.validCart(cartGood, false);
|
||||
boolean result = this.save(cartGood);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
this.save(cartGood);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,32 +7,13 @@ import com.cultural.heritage.exception.BusinessException;
|
|||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.CategoryMapper;
|
||||
import com.cultural.heritage.model.entity.Category;
|
||||
import com.cultural.heritage.model.entity.Good;
|
||||
import com.cultural.heritage.service.good.CategoryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
|
||||
|
||||
/**
|
||||
* 获取类别名列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getTypeNameList() {
|
||||
List<Category> list = this.list();
|
||||
List<String> collect = list.stream().map(Category::getTypeName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategoryById(Long id) {
|
||||
QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
|
||||
|
@ -70,16 +51,4 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据类别id获取商品删除的条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<Good> getDeleteQueryWrapper(Long id) {
|
||||
Category category = this.getById(id);
|
||||
String typeName = category.getTypeName();
|
||||
QueryWrapper<Good> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("type", typeName);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,4 +33,10 @@ public interface ClothesRentOrderService extends IService<ClothesRentOrder> {
|
|||
* 向消息队列中发送服装租赁倒计时的消息
|
||||
*/
|
||||
void sendClothesRentPeriodMessage(Long id, Integer days);
|
||||
|
||||
|
||||
/**
|
||||
* 校验当前服装是否被租赁
|
||||
*/
|
||||
void validIsBeenRented(Long clothesId);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.constant.CommonConstant;
|
||||
import com.cultural.heritage.constant.MqConstant;
|
||||
import com.cultural.heritage.constant.OrderStatusConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.ClothesRentOrderMapper;
|
||||
import com.cultural.heritage.model.dto.clothesRentOrder.ClothesRentOrderAddRequest;
|
||||
|
@ -106,4 +108,21 @@ public class ClothesRentOrderServiceImpl extends ServiceImpl<ClothesRentOrderMap
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验当前服装是否被租赁
|
||||
*/
|
||||
@Override
|
||||
public void validIsBeenRented(Long clothesId) {
|
||||
QueryWrapper<ClothesRentOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in(OrderStatusConstant.PENDING_SHIPMENT, OrderStatusConstant.PENDING_DELIVERY);
|
||||
List<ClothesRentOrder> clothesRentOrderList = this.list(queryWrapper);
|
||||
for (ClothesRentOrder clothesRentOrder : clothesRentOrderList) {
|
||||
Long clothesSnapshotId = clothesRentOrder.getClothesSnapshot().getId();
|
||||
if (clothesSnapshotId.equals(clothesId)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "该服装已被租赁");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -257,8 +257,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
order.setOrderStatus(OrderStatusConstant.PENDING_PAYMENT);
|
||||
// 校验订单
|
||||
this.validOrder(order);
|
||||
boolean result = this.save(order);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单生成失败");
|
||||
this.save(order);
|
||||
// 创建订单明细
|
||||
Long id = order.getId();
|
||||
List<OrderItemAddRequest> orderItemList = orderAddRequest.getOrderItemList();
|
||||
|
@ -268,9 +267,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
orderItems.setOrderId(id);
|
||||
return orderItems;
|
||||
}).toList();
|
||||
boolean save = orderItemService.saveBatch(newOrderItemsList);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "订单明细生成失败");
|
||||
|
||||
orderItemService.saveBatch(newOrderItemsList);
|
||||
if (isGeneral) {
|
||||
// 扣减商品库存
|
||||
List<OrderItemMainInfoAddRequest> orderItemMainInfoAddRequestList = orderMainInfoAddRequest.getOrderItemMainInfoAddRequestList();
|
||||
|
@ -282,14 +279,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
|
||||
// 清空购物车
|
||||
if (isCartOrder) {
|
||||
if (isGeneral) {
|
||||
boolean removeGeneral = cartRecordService.removeBatchByIds(cartIds);
|
||||
ThrowUtils.throwIf(!removeGeneral, ErrorCode.OPERATION_ERROR, "清空常规类购物车失败");
|
||||
} else {
|
||||
boolean removeService = cartExperienceService.removeBatchByIds(cartIds);
|
||||
ThrowUtils.throwIf(!removeService, ErrorCode.OPERATION_ERROR, "清空服务类购物车失败");
|
||||
}
|
||||
|
||||
if (isGeneral) cartRecordService.removeBatchByIds(cartIds);
|
||||
else cartExperienceService.removeBatchByIds(cartIds);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
@ -328,8 +319,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
pendingServiceOrderList.add(pendingServiceOrder);
|
||||
}
|
||||
|
||||
boolean saveBatch = pendingServiceOrderService.saveBatch(pendingServiceOrderList);
|
||||
ThrowUtils.throwIf(!saveBatch, ErrorCode.OPERATION_ERROR, "服务类订单待处理记录批量生成失败");
|
||||
pendingServiceOrderService.saveBatch(pendingServiceOrderList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,8 +349,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
Integer inventory = map.get(good.getId());
|
||||
good.setInventory(good.getInventory() - inventory);
|
||||
}
|
||||
boolean update = goodService.updateBatchById(goodList);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "商品库存更新失败");
|
||||
goodService.updateBatchById(goodList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,8 +399,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
conditionAmount = userCoupon.getCouponVO().getConditionAmount();
|
||||
// 更新优惠券状态
|
||||
userCoupon.setIsUsed(1);
|
||||
boolean update = userCouponService.updateById(userCoupon);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "优惠券状态更新失败");
|
||||
userCouponService.updateById(userCoupon);
|
||||
}
|
||||
Integer quantity = orderItemMainInfoAddRequest.getQuantity();
|
||||
Long goodId = orderItemMainInfoAddRequest.getGoodId();
|
||||
|
@ -502,8 +490,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
totalAmount = totalAmount.subtract(conditionAmount);
|
||||
// 更新优惠券状态
|
||||
userCoupon.setIsUsed(1);
|
||||
boolean update = userCouponService.updateById(userCoupon);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "优惠券状态更新失败");
|
||||
userCouponService.updateById(userCoupon);
|
||||
}
|
||||
// 填充订单主要信息请求体金额
|
||||
orderMainInfoAddRequest.setTotalAmount(totalAmount);
|
||||
|
@ -576,8 +563,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
totalAmount = totalAmount.subtract(conditionAmount);
|
||||
// 更新优惠券状态
|
||||
userCoupon.setIsUsed(1);
|
||||
boolean update = userCouponService.updateById(userCoupon);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "优惠券状态更新失败");
|
||||
userCouponService.updateById(userCoupon);
|
||||
}
|
||||
// 填充订单主要信息请求体金额
|
||||
orderMainInfoAddRequest.setTotalAmount(totalAmount);
|
||||
|
|
|
@ -189,8 +189,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
user.setUserRole("user");
|
||||
user.setPoints(10000);
|
||||
user.setUserAvatar(UserConstant.USER_DEFAULT_AVATAR);
|
||||
boolean result = this.save(user);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "登录失败");
|
||||
this.save(user);
|
||||
// 记住用户的登录态
|
||||
}
|
||||
request.getSession().setAttribute(USER_LOGIN_STATE, user);
|
||||
|
@ -210,8 +209,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
} else {
|
||||
user.setPoints(Math.max(user.getPoints() - points, 0));
|
||||
}
|
||||
boolean update = this.updateById(user);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "积分更新失败");
|
||||
this.updateById(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 玄德
|
||||
* @author 陈新知
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
|
@ -536,8 +536,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
// 更新服务类订单待处理记录
|
||||
UpdateWrapper<PendingServiceOrder> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("orderItemId", orderItemId).set("orderItemStatus", OrderStatusConstant.PAYMENT_REFUNDED);
|
||||
boolean update = pendingServiceOrderService.update(updateWrapper);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "服务类订单待处理记录状态更新失败");
|
||||
pendingServiceOrderService.update(updateWrapper);
|
||||
// 如果退款的是订单中最后一个订单明细,则修改订单状态
|
||||
QueryWrapper<RefundRecord> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("outTradeNo", orderNumber);
|
||||
|
@ -550,8 +549,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
UpdateWrapper<Order> orderUpdateWrapper = new UpdateWrapper<>();
|
||||
if (refundCount == orderItemCount) {
|
||||
orderUpdateWrapper.eq("id", order.getId()).set("orderStatus", OrderStatusConstant.PAYMENT_REFUNDED);
|
||||
boolean result = orderService.update(orderUpdateWrapper);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "订单状态更新失败");
|
||||
orderService.update(orderUpdateWrapper);
|
||||
}
|
||||
} else {
|
||||
// 恢复商品库存
|
||||
|
@ -561,7 +559,6 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
ThrowUtils.throwIf(good == null, ErrorCode.OPERATION_ERROR, "当前商品不存在");
|
||||
good.setInventory(good.getInventory() + orderItems.getQuantity());
|
||||
goodService.updateById(good);
|
||||
// ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "商品库存恢复失败");
|
||||
}
|
||||
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||
return true;
|
||||
|
@ -790,8 +787,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
for (PendingServiceOrder pendingServiceOrder : pendingServiceOrderList) {
|
||||
pendingServiceOrder.setOrderItemStatus(orderStatus);
|
||||
}
|
||||
boolean result = pendingServiceOrderService.updateBatchById(pendingServiceOrderList);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类订单待处理记录批量更新失败");
|
||||
pendingServiceOrderService.updateBatchById(pendingServiceOrderList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -845,9 +841,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
refundRecord.setOutTradeNo(refundNotification.getOutTradeNo());
|
||||
refundRecord.setOutRefundNo(refundNotification.getOutRefundNo());
|
||||
refundRecord.setRefundAmount(BigDecimal.valueOf(refundNotification.getAmount().getRefund()).movePointLeft(2));
|
||||
|
||||
boolean save = refundRecordService.save(refundRecord);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "退款记录生成失败");
|
||||
refundRecordService.save(refundRecord);
|
||||
}
|
||||
|
||||
|
||||
|
@ -860,9 +854,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
refundRecord.setOutTradeNo(outTradeNo);
|
||||
refundRecord.setOutRefundNo(outRefundNo);
|
||||
refundRecord.setRefundAmount(refundAmount.movePointLeft(2));
|
||||
|
||||
boolean save = refundRecordService.save(refundRecord);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "退款记录生成失败");
|
||||
refundRecordService.save(refundRecord);
|
||||
}
|
||||
|
||||
|
||||
|
@ -875,8 +867,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
private void modifyOrderStatus(Order order, String orderStatus) {
|
||||
order.setOrderStatus(orderStatus);
|
||||
order.setUpdateTime(DateUtil.date());
|
||||
boolean update = orderService.updateById(order);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态修改失败");
|
||||
orderService.updateById(order);
|
||||
}
|
||||
|
||||
|
||||
|
@ -886,8 +877,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
private void modifyAdvanceOrderStatus(AdvanceOrder advanceOrder, String orderStatus) {
|
||||
advanceOrder.setOrderStatus(orderStatus);
|
||||
advanceOrder.setUpdateTime(DateUtil.date());
|
||||
boolean update = advanceOrderService.updateById(advanceOrder);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态修改失败");
|
||||
advanceOrderService.updateById(advanceOrder);
|
||||
}
|
||||
|
||||
|
||||
|
@ -898,8 +888,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
private void modifyClothesRentStatus(ClothesRentOrder clothesRentOrder, String orderStatus) {
|
||||
clothesRentOrder.setOrderStatus(orderStatus);
|
||||
clothesRentOrder.setUpdateTime(DateUtil.date());
|
||||
boolean update = clothesRentOrderService.updateById(clothesRentOrder);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "订单状态修改失败");
|
||||
clothesRentOrderService.updateById(clothesRentOrder);
|
||||
}
|
||||
|
||||
|
||||
|
@ -951,7 +940,6 @@ public class WeChatServiceImpl implements WeChatService {
|
|||
good.setUpdateTime(DateUtil.date());
|
||||
}
|
||||
goodService.updateBatchById(goodList);
|
||||
// ThrowUtils.throwIf(!updateBatch, ErrorCode.SYSTEM_ERROR, "商品库存恢复失败");
|
||||
}
|
||||
|
||||
|
||||
|
|
101
src/main/resources/application-dev.yml
Normal file
101
src/main/resources/application-dev.yml
Normal file
|
@ -0,0 +1,101 @@
|
|||
spring:
|
||||
datasource:
|
||||
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://123.249.108.160:3306/feiyi-sc?serverTimezone=Asia/Shanghai
|
||||
username: feiyi-sc
|
||||
password: 123456asd
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
rabbitmq:
|
||||
host: 123.249.108.160
|
||||
port: 5672
|
||||
username: chenxinzhi
|
||||
password: yuanteng
|
||||
virtual-host: vhost
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 123.249.108.160
|
||||
database: 0
|
||||
password: yuanteng
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
|
||||
server:
|
||||
port: 9092
|
||||
|
||||
servlet:
|
||||
context-path: /api
|
||||
# cookie 30 天过期
|
||||
session:
|
||||
cookie:
|
||||
max-age: 2592000
|
||||
timeout: 720h
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: isDelete #全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1 #逻辑已删除值(默认为1)
|
||||
logic-not-delete-value: 0 #逻辑未删除值(默认为0)
|
||||
type-handlers-package: com.cultural.heritage.handler
|
||||
|
||||
|
||||
hwyun:
|
||||
obs:
|
||||
accessKey: TEA5FAYCZDUSCEJP8NKX
|
||||
securityKey: djX3WNrYjRDmp5v7rOXfa25e9CHj8OXKRzQJp6Ec
|
||||
endPoint: obs.cn-north-4.myhuaweicloud.com
|
||||
bucketName: carbon2
|
||||
|
||||
|
||||
|
||||
wx:
|
||||
mini:
|
||||
appId: wx61b63e27bddf4ea2
|
||||
appSecret: 5ef9e1f17acd8180afe2d80199fd466e
|
||||
official:
|
||||
appId: wx5d04ca2de0e628a8
|
||||
appSecret: 495af5bc4df1b86ffcfc21bb12daea76
|
||||
pay:
|
||||
#应用id(小程序id)
|
||||
appId: wx61b63e27bddf4ea2
|
||||
#商户号
|
||||
merchantId: 1700326544
|
||||
#商户API私钥
|
||||
privateKeyPath: apiclient_key.pem
|
||||
#商户证书序列号
|
||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
#商户APIv3密钥
|
||||
apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#通知地址
|
||||
notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
||||
|
||||
#微信服务器地址
|
||||
domain: https://api.mch.weixin.qq.com
|
||||
|
||||
|
||||
knife4j:
|
||||
enable: true
|
105
src/main/resources/application-prod.yml
Normal file
105
src/main/resources/application-prod.yml
Normal file
|
@ -0,0 +1,105 @@
|
|||
spring:
|
||||
datasource:
|
||||
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://123.249.108.160:3306/feiyi-sc?serverTimezone=Asia/Shanghai
|
||||
username: feiyi-sc
|
||||
password: 123456asd
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
rabbitmq:
|
||||
host: 123.249.108.160
|
||||
port: 5672
|
||||
username: chenxinzhi
|
||||
password: yuanteng
|
||||
virtual-host: vhost
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 123.249.108.160
|
||||
database: 0
|
||||
password: yuanteng
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
|
||||
server:
|
||||
port: 8888
|
||||
ssl:
|
||||
key-store: classpath:carboner.cn.jks
|
||||
key-store-password: 6gsn1hke4m4f7
|
||||
key-store-type: JKS
|
||||
|
||||
servlet:
|
||||
context-path: /api
|
||||
# cookie 30 天过期
|
||||
session:
|
||||
cookie:
|
||||
max-age: 2592000
|
||||
timeout: 720h
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: isDelete #全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1 #逻辑已删除值(默认为1)
|
||||
logic-not-delete-value: 0 #逻辑未删除值(默认为0)
|
||||
type-handlers-package: com.cultural.heritage.handler
|
||||
|
||||
|
||||
hwyun:
|
||||
obs:
|
||||
accessKey: TEA5FAYCZDUSCEJP8NKX
|
||||
securityKey: djX3WNrYjRDmp5v7rOXfa25e9CHj8OXKRzQJp6Ec
|
||||
endPoint: obs.cn-north-4.myhuaweicloud.com
|
||||
bucketName: carbon2
|
||||
|
||||
|
||||
|
||||
wx:
|
||||
mini:
|
||||
appId: wx61b63e27bddf4ea2
|
||||
appSecret: 5ef9e1f17acd8180afe2d80199fd466e
|
||||
official:
|
||||
appId: wx5d04ca2de0e628a8
|
||||
appSecret: 495af5bc4df1b86ffcfc21bb12daea76
|
||||
pay:
|
||||
#应用id(小程序id)
|
||||
appId: wx61b63e27bddf4ea2
|
||||
#商户号
|
||||
merchantId: 1700326544
|
||||
#商户API私钥
|
||||
privateKeyPath: apiclient_key.pem
|
||||
#商户证书序列号
|
||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
#商户APIv3密钥
|
||||
apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#通知地址
|
||||
notifyUrl: https://www.carboner.cn:8888
|
||||
|
||||
#微信服务器地址
|
||||
domain: https://api.mch.weixin.qq.com
|
||||
|
||||
|
||||
knife4j:
|
||||
enable: false
|
109
src/main/resources/application-test.yml
Normal file
109
src/main/resources/application-test.yml
Normal file
|
@ -0,0 +1,109 @@
|
|||
spring:
|
||||
datasource:
|
||||
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://123.249.108.160:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
username: feiyi
|
||||
password: 123456asd
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
|
||||
|
||||
rabbitmq:
|
||||
host: 154.8.193.216
|
||||
port: 5672
|
||||
username: admin
|
||||
password: cksys6509
|
||||
virtual-host: vhost
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 123.249.108.160
|
||||
database: 0
|
||||
password: yuanteng
|
||||
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
|
||||
server:
|
||||
port: 9093
|
||||
|
||||
|
||||
servlet:
|
||||
context-path: /api
|
||||
# cookie 30 天过期
|
||||
session:
|
||||
cookie:
|
||||
max-age: 2592000
|
||||
timeout: 720h
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: isDelete #全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1 #逻辑已删除值(默认为1)
|
||||
logic-not-delete-value: 0 #逻辑未删除值(默认为0)
|
||||
type-handlers-package: com.cultural.heritage.handler
|
||||
|
||||
|
||||
hwyun:
|
||||
obs:
|
||||
accessKey: TEA5FAYCZDUSCEJP8NKX
|
||||
securityKey: djX3WNrYjRDmp5v7rOXfa25e9CHj8OXKRzQJp6Ec
|
||||
endPoint: obs.cn-north-4.myhuaweicloud.com
|
||||
bucketName: carbon2
|
||||
|
||||
|
||||
|
||||
|
||||
wx:
|
||||
mini:
|
||||
appId: wx61b63e27bddf4ea2
|
||||
appSecret: 5ef9e1f17acd8180afe2d80199fd466e
|
||||
official:
|
||||
appId: wx5d04ca2de0e628a8
|
||||
appSecret: 495af5bc4df1b86ffcfc21bb12daea76
|
||||
pay:
|
||||
#应用id(小程序id)
|
||||
appId: wx61b63e27bddf4ea2
|
||||
#商户号
|
||||
merchantId: 1700326544
|
||||
#商户API私钥
|
||||
privateKeyPath: apiclient_key.pem
|
||||
#商户证书序列号
|
||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
#商户APIv3密钥
|
||||
apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#通知地址
|
||||
notifyUrl: http://154.8.193.216:9093
|
||||
|
||||
#微信服务器地址
|
||||
domain: https://api.mch.weixin.qq.com
|
||||
|
||||
|
||||
knife4j:
|
||||
enable: true
|
|
@ -1,183 +1,6 @@
|
|||
spring:
|
||||
datasource:
|
||||
# 生产环境
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://154.8.193.216:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
# username: feiyi
|
||||
# password: 123456asd
|
||||
# hikari:
|
||||
# maximum-pool-size: 20
|
||||
# max-lifetime: 120000
|
||||
|
||||
|
||||
# 开发环境
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://123.249.108.160:3306/feiyi-sc?serverTimezone=Asia/Shanghai
|
||||
username: feiyi-sc
|
||||
password: 123456asd
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
# 测试环境
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://123.249.108.160:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
# username: feiyi
|
||||
# password: 123456asd
|
||||
# hikari:
|
||||
# maximum-pool-size: 20
|
||||
# max-lifetime: 120000
|
||||
profiles:
|
||||
active: test
|
||||
|
||||
|
||||
|
||||
# 新环境
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://1.94.237.210:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
# username: root
|
||||
# password: Cxzyt331
|
||||
# hikari:
|
||||
# maximum-pool-size: 20
|
||||
# max-lifetime: 120000
|
||||
|
||||
|
||||
|
||||
|
||||
# 生产环境
|
||||
rabbitmq:
|
||||
host: 123.249.108.160
|
||||
port: 5672
|
||||
username: chenxinzhi
|
||||
password: yuanteng
|
||||
virtual-host: vhost
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
|
||||
|
||||
# 测试环境
|
||||
# rabbitmq:
|
||||
# host: 154.8.193.216
|
||||
# port: 5672
|
||||
# username: admin
|
||||
# password: cksys6509
|
||||
# virtual-host: vhost
|
||||
# listener:
|
||||
# simple:
|
||||
# prefetch: 1
|
||||
|
||||
|
||||
# 新环境
|
||||
# rabbitmq:
|
||||
# host: 1.94.237.210
|
||||
# port: 5672
|
||||
# username: admin
|
||||
# password: Cxzyt331
|
||||
# virtual-host: vhost
|
||||
# listener:
|
||||
# simple:
|
||||
# prefetch: 1
|
||||
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
|
||||
|
||||
# 开发环境
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 123.249.108.160
|
||||
database: 0
|
||||
password: yuanteng
|
||||
|
||||
|
||||
|
||||
# 开发环境
|
||||
# data:
|
||||
# redis:
|
||||
# port: 6379
|
||||
# host: 1.94.237.210
|
||||
# database: 0
|
||||
# password: Cxzyt331
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
|
||||
server:
|
||||
# port: 9093
|
||||
port: 8888
|
||||
ssl:
|
||||
key-store: classpath:carboner.cn.jks
|
||||
key-store-password: 6gsn1hke4m4f7
|
||||
key-store-type: JKS
|
||||
|
||||
servlet:
|
||||
context-path: /api
|
||||
# cookie 30 天过期
|
||||
session:
|
||||
cookie:
|
||||
max-age: 2592000
|
||||
timeout: 720h
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: isDelete #全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1 #逻辑已删除值(默认为1)
|
||||
logic-not-delete-value: 0 #逻辑未删除值(默认为0)
|
||||
type-handlers-package: com.cultural.heritage.handler
|
||||
|
||||
|
||||
hwyun:
|
||||
obs:
|
||||
accessKey: TEA5FAYCZDUSCEJP8NKX
|
||||
securityKey: djX3WNrYjRDmp5v7rOXfa25e9CHj8OXKRzQJp6Ec
|
||||
endPoint: obs.cn-north-4.myhuaweicloud.com
|
||||
bucketName: carbon2
|
||||
|
||||
|
||||
|
||||
|
||||
wx:
|
||||
mini:
|
||||
appId: wx61b63e27bddf4ea2
|
||||
appSecret: 5ef9e1f17acd8180afe2d80199fd466e
|
||||
official:
|
||||
appId: wx5d04ca2de0e628a8
|
||||
appSecret: 495af5bc4df1b86ffcfc21bb12daea76
|
||||
pay:
|
||||
#应用id(小程序id)
|
||||
appId: wx61b63e27bddf4ea2
|
||||
#商户号
|
||||
merchantId: 1700326544
|
||||
#商户API私钥
|
||||
privateKeyPath: apiclient_key.pem
|
||||
#商户证书序列号
|
||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
#商户APIv3密钥
|
||||
apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#通知地址
|
||||
# notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
||||
# notifyUrl: http://123.249.108.160:8888
|
||||
# notifyUrl: http://154.8.193.216:9092
|
||||
# notifyUrl: http://154.8.193.216:9093
|
||||
notifyUrl: https://www.carboner.cn:8888
|
||||
|
||||
#微信服务器地址
|
||||
domain: https://api.mch.weixin.qq.com
|
||||
|
||||
|
||||
knife4j:
|
||||
enable: true
|
183
src/main/resources/temp.yml
Normal file
183
src/main/resources/temp.yml
Normal file
|
@ -0,0 +1,183 @@
|
|||
#spring:
|
||||
# datasource:
|
||||
# # 生产环境
|
||||
# # driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# # url: jdbc:mysql://154.8.193.216:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
# # username: feiyi
|
||||
# # password: 123456asd
|
||||
# # hikari:
|
||||
# # maximum-pool-size: 20
|
||||
# # max-lifetime: 120000
|
||||
#
|
||||
#
|
||||
# # 开发环境
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://123.249.108.160:3306/feiyi-sc?serverTimezone=Asia/Shanghai
|
||||
# username: feiyi-sc
|
||||
# password: 123456asd
|
||||
# hikari:
|
||||
# maximum-pool-size: 20
|
||||
# max-lifetime: 120000
|
||||
#
|
||||
#
|
||||
# # 测试环境
|
||||
# # driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# # url: jdbc:mysql://123.249.108.160:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
# # username: feiyi
|
||||
# # password: 123456asd
|
||||
# # hikari:
|
||||
# # maximum-pool-size: 20
|
||||
# # max-lifetime: 120000
|
||||
#
|
||||
#
|
||||
#
|
||||
# # 新环境
|
||||
# # driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# # url: jdbc:mysql://1.94.237.210:3306/feiyi?serverTimezone=Asia/Shanghai
|
||||
# # username: root
|
||||
# # password: Cxzyt331
|
||||
# # hikari:
|
||||
# # maximum-pool-size: 20
|
||||
# # max-lifetime: 120000
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# # 生产环境
|
||||
# rabbitmq:
|
||||
# host: 123.249.108.160
|
||||
# port: 5672
|
||||
# username: chenxinzhi
|
||||
# password: yuanteng
|
||||
# virtual-host: vhost
|
||||
# listener:
|
||||
# simple:
|
||||
# prefetch: 1
|
||||
#
|
||||
#
|
||||
# # 测试环境
|
||||
# # rabbitmq:
|
||||
# # host: 154.8.193.216
|
||||
# # port: 5672
|
||||
# # username: admin
|
||||
# # password: cksys6509
|
||||
# # virtual-host: vhost
|
||||
# # listener:
|
||||
# # simple:
|
||||
# # prefetch: 1
|
||||
#
|
||||
#
|
||||
# # 新环境
|
||||
# # rabbitmq:
|
||||
# # host: 1.94.237.210
|
||||
# # port: 5672
|
||||
# # username: admin
|
||||
# # password: Cxzyt331
|
||||
# # virtual-host: vhost
|
||||
# # listener:
|
||||
# # simple:
|
||||
# # prefetch: 1
|
||||
#
|
||||
#
|
||||
#
|
||||
# servlet:
|
||||
# multipart:
|
||||
# max-file-size: 20MB
|
||||
# max-request-size: 20MB
|
||||
#
|
||||
#
|
||||
# # 开发环境
|
||||
# data:
|
||||
# redis:
|
||||
# port: 6379
|
||||
# host: 123.249.108.160
|
||||
# database: 0
|
||||
# password: yuanteng
|
||||
#
|
||||
#
|
||||
#
|
||||
## 开发环境
|
||||
## data:
|
||||
## redis:
|
||||
## port: 6379
|
||||
## host: 1.94.237.210
|
||||
## database: 0
|
||||
## password: Cxzyt331
|
||||
#
|
||||
#
|
||||
#
|
||||
#springdoc:
|
||||
# default-flat-param-object: true
|
||||
#
|
||||
#
|
||||
#server:
|
||||
# # port: 9093
|
||||
# port: 8888
|
||||
# ssl:
|
||||
# key-store: classpath:carboner.cn.jks
|
||||
# key-store-password: 6gsn1hke4m4f7
|
||||
# key-store-type: JKS
|
||||
#
|
||||
# servlet:
|
||||
# context-path: /api
|
||||
# # cookie 30 天过期
|
||||
# session:
|
||||
# cookie:
|
||||
# max-age: 2592000
|
||||
# timeout: 720h
|
||||
#
|
||||
#mybatis-plus:
|
||||
# mapper-locations: classpath:mapper/*.xml
|
||||
# configuration:
|
||||
# map-underscore-to-camel-case: false
|
||||
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# global-config:
|
||||
# db-config:
|
||||
# logic-delete-field: isDelete #全局逻辑删除的实体字段名
|
||||
# logic-delete-value: 1 #逻辑已删除值(默认为1)
|
||||
# logic-not-delete-value: 0 #逻辑未删除值(默认为0)
|
||||
# type-handlers-package: com.cultural.heritage.handler
|
||||
#
|
||||
#
|
||||
#hwyun:
|
||||
# obs:
|
||||
# accessKey: TEA5FAYCZDUSCEJP8NKX
|
||||
# securityKey: djX3WNrYjRDmp5v7rOXfa25e9CHj8OXKRzQJp6Ec
|
||||
# endPoint: obs.cn-north-4.myhuaweicloud.com
|
||||
# bucketName: carbon2
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#wx:
|
||||
# mini:
|
||||
# appId: wx61b63e27bddf4ea2
|
||||
# appSecret: 5ef9e1f17acd8180afe2d80199fd466e
|
||||
# official:
|
||||
# appId: wx5d04ca2de0e628a8
|
||||
# appSecret: 495af5bc4df1b86ffcfc21bb12daea76
|
||||
# pay:
|
||||
# #应用id(小程序id)
|
||||
# appId: wx61b63e27bddf4ea2
|
||||
# #商户号
|
||||
# merchantId: 1700326544
|
||||
# #商户API私钥
|
||||
# privateKeyPath: apiclient_key.pem
|
||||
# #商户证书序列号
|
||||
# merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
# #商户APIv3密钥
|
||||
# apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
# #通知地址
|
||||
# # notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
||||
# # notifyUrl: http://123.249.108.160:8888
|
||||
# # notifyUrl: http://154.8.193.216:9092
|
||||
# # notifyUrl: http://154.8.193.216:9093
|
||||
# notifyUrl: https://www.carboner.cn:8888
|
||||
#
|
||||
# #微信服务器地址
|
||||
# domain: https://api.mch.weixin.qq.com
|
||||
#
|
||||
#
|
||||
#knife4j:
|
||||
# enable: true
|
Loading…
Reference in New Issue
Block a user