Merge remote-tracking branch 'origin/master'
# Conflicts: # yudao-server/src/main/resources/application.yaml
This commit is contained in:
commit
a7830b521f
@ -77,5 +77,11 @@ public class BaseConstants {
|
||||
public static final String GENERAL_NO = "0";
|
||||
/**1是*/
|
||||
public static final String GENERAL_YES = "1";
|
||||
/**会员充值*/
|
||||
public static final String ORDER_HYCZ = "1";
|
||||
/**维修服务*/
|
||||
public static final String ORDER_WXFW = "2";
|
||||
/**订单店铺名称*/
|
||||
public static final String ORDER_TENANT_NAME = "蓝安集团";
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.custom.service.CustomerActiveService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActivePageReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActiveRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainPageReqVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 用户参与活动记录")
|
||||
@ -72,4 +75,19 @@ public class CustomerActiveController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author PQZ
|
||||
* @date 16:12 2024/9/23
|
||||
* @param pageReqVO ActiveMainPageReqVO实体
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage<?>>
|
||||
**/
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "可参与营销活动")
|
||||
@PreAuthorize("@ss.hasPermission('member:active-main:query')")
|
||||
public CommonResult<List<?>> getActiveMainPage(ActiveMainPageReqVO pageReqVO) {
|
||||
return success(customerActiveService.isJoinActive(pageReqVO));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerActive;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerBalanceService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActiveRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceSaveReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -25,6 +28,22 @@ public class CustomerBalanceController {
|
||||
@Resource
|
||||
private CustomerBalanceService customerBalanceService;
|
||||
|
||||
// /**
|
||||
// * 更新用户余额信息(充值完成的回调)
|
||||
// * @author PQZ
|
||||
// * @date 21:42 2024/9/23
|
||||
// * @param createReqVO CustomerBalanceSaveReqVO
|
||||
// * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
// **/
|
||||
// @PostMapping("/saveBalance")
|
||||
// @Operation(summary = "创建用户积分(余额)")
|
||||
// @PreAuthorize("@ss.hasPermission('base:customer-balance:create')")
|
||||
// public CommonResult<Boolean> saveBalance(@RequestBody CustomerBalanceSaveReqVO createReqVO) {
|
||||
// customerBalanceService.saveBalance(createReqVO.getCusId(),createReqVO.getOrderId(),createReqVO.getActiveId());
|
||||
// return success(true);
|
||||
// }
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户积分(余额)")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-balance:create')")
|
||||
@ -40,4 +59,6 @@ public class CustomerBalanceController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -29,32 +29,33 @@ public class CustomerCouponController {
|
||||
@Resource
|
||||
private CustomerCouponService customerCouponService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户卡券")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:create')")
|
||||
public CommonResult<String> createCustomerCoupon(@Valid @RequestBody CustomerCouponSaveReqVO createReqVO) {
|
||||
return success(customerCouponService.createCustomerCoupon(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户卡券")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:update')")
|
||||
public CommonResult<Boolean> updateCustomerCoupon(@Valid @RequestBody CustomerCouponSaveReqVO updateReqVO) {
|
||||
customerCouponService.updateCustomerCoupon(updateReqVO);
|
||||
/**
|
||||
* 核销用户卡券
|
||||
*
|
||||
* @param saveReqVO CustomerCouponSaveReqVO实体
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
* @author PQZ
|
||||
* @date 15:58 2024/9/23
|
||||
**/
|
||||
@PostMapping("/couponVerification")
|
||||
@Operation(summary = "核销用户卡券")
|
||||
public CommonResult<Boolean> createCustomerCoupon(@Valid @RequestBody CustomerCouponSaveReqVO saveReqVO) {
|
||||
customerCouponService.couponVerification(saveReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户卡券
|
||||
*
|
||||
* @param id 用户卡券id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
* @author PQZ
|
||||
* @date 23:01 2024/9/20
|
||||
* @param id TODO
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
**/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户卡券")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:delete')")
|
||||
public CommonResult<Boolean> deleteCustomerCoupon(@RequestParam("id") String id) {
|
||||
customerCouponService.deleteCustomerCoupon(id);
|
||||
return success(true);
|
||||
@ -62,26 +63,18 @@ public class CustomerCouponController {
|
||||
|
||||
/**
|
||||
* 获取卡券信息及当前消费记录
|
||||
* @author PQZ
|
||||
* @date 22:56 2024/9/20
|
||||
*
|
||||
* @param id 用户卡券id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO>
|
||||
* @author PQZ
|
||||
* @date 22:56 2024/9/20
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户卡券")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:query')")
|
||||
public CommonResult<CustomerCouponRespVO> getCustomerCoupon(@RequestParam("id") String id) {
|
||||
return success(customerCouponService.getCustomerCoupon(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户卡券分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:query')")
|
||||
public CommonResult<PageResult<CustomerCouponRespVO>> getCustomerCouponPage(@Valid CustomerCouponPageReqVO pageReqVO) {
|
||||
PageResult<CustomerCoupon> pageResult = customerCouponService.getCustomerCouponPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CustomerCouponRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
@ -17,8 +22,11 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
@ -121,7 +129,6 @@ public class CustomerMainController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得客户管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-main:query')")
|
||||
public CommonResult<CustomerMainRespVO> getCustomerMain(@RequestParam("id") String id) {
|
||||
return success(customerMainService.getCustomerById(id));
|
||||
}
|
||||
@ -171,4 +178,27 @@ public class CustomerMainController {
|
||||
busiLabelService.saveBusiLable(saveReqVO.getId(), TABLE_BASE_CUSTOMER_MAIN, saveReqVO.getLabelList());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序客户注册
|
||||
* cusName,phoneNumber,birthday,sex,inviter
|
||||
*/
|
||||
@PostMapping("/addUniUser")
|
||||
public CommonResult<Boolean> addUniUser(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
|
||||
if(!saveReqVO.getCode().isEmpty()){
|
||||
String code = saveReqVO.getCode();
|
||||
JSONObject jsonObj = new JSONObject();
|
||||
String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code="
|
||||
+code+"&grant_type=authorization_code";
|
||||
String response = HttpRequest.get(url).execute().body();
|
||||
JSONObject json = JSONUtil.parseObj(response);
|
||||
if (json.containsKey("access_token") && json.containsKey("openid")) {
|
||||
String accessToken = json.getStr("access_token");
|
||||
String openid = json.getStr("openid");
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -4,9 +4,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerActive;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActivePageReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户参与活动记录 Service 接口
|
||||
@ -42,6 +45,8 @@ public interface CustomerActiveService extends IService<CustomerActive> {
|
||||
*/
|
||||
CustomerActive getCustomerActive(String id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获得用户参与活动记录分页
|
||||
*
|
||||
@ -50,4 +55,14 @@ public interface CustomerActiveService extends IService<CustomerActive> {
|
||||
*/
|
||||
PageResult<CustomerActive> getCustomerActivePage(CustomerActivePageReqVO pageReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 可参与营销活动
|
||||
* @author PQZ
|
||||
* @date 16:18 2024/9/23
|
||||
* @param pageReqVO ActiveMainPageReqVO 实体
|
||||
* @return java.util.List<cn.iocoder.yudao.module.member.vo.ActiveMainRespVO>
|
||||
**/
|
||||
List<ActiveMainRespVO> isJoinActive(ActiveMainPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.custom.service;
|
||||
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerBalance;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceSaveReqVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -21,6 +22,15 @@ public interface CustomerBalanceService extends IService<CustomerBalance> {
|
||||
*/
|
||||
String createCustomerBalance(@Valid CustomerBalanceSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户余额信息(充值完成的回调)
|
||||
*
|
||||
* @param orderInfo 订单信息
|
||||
* @author PQZ
|
||||
* @date 22:10 2024/9/23
|
||||
**/
|
||||
void balanceCallback(RepairOrderInfo orderInfo);
|
||||
|
||||
/**
|
||||
* 更新用户积分(余额)
|
||||
*
|
||||
@ -30,10 +40,11 @@ public interface CustomerBalanceService extends IService<CustomerBalance> {
|
||||
|
||||
/**
|
||||
* 根据用户id更新用户余额表
|
||||
* @author PQZ
|
||||
* @date 11:56 2024/9/21
|
||||
*
|
||||
* @param balance CustomerBalance
|
||||
* @return void
|
||||
* @author PQZ
|
||||
* @date 11:56 2024/9/21
|
||||
**/
|
||||
void updateByCusId(CustomerBalance balance);
|
||||
|
||||
|
@ -17,20 +17,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface CustomerCouponService extends IService<CustomerCoupon> {
|
||||
|
||||
/**
|
||||
* 创建用户卡券
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createCustomerCoupon(@Valid CustomerCouponSaveReqVO createReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 更新用户卡券
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateCustomerCoupon(@Valid CustomerCouponSaveReqVO updateReqVO);
|
||||
* 卡券核销
|
||||
* @author PQZ
|
||||
* @date 15:37 2024/9/23
|
||||
* @param saveReqVO CustomerCouponSaveReqVO实体
|
||||
**/
|
||||
void couponVerification(CustomerCouponSaveReqVO saveReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户卡券
|
||||
@ -49,13 +44,7 @@ public interface CustomerCouponService extends IService<CustomerCoupon> {
|
||||
CustomerCouponRespVO getCustomerCoupon(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 获得用户卡券分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户卡券分页
|
||||
*/
|
||||
PageResult<CustomerCoupon> getCustomerCouponPage(CustomerCouponPageReqVO pageReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户id获取卡券信息
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.custom.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.custom.entity.*;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CustomerActiveMapper;
|
||||
import cn.iocoder.yudao.module.custom.service.*;
|
||||
@ -13,15 +14,21 @@ import cn.iocoder.yudao.module.member.entity.ActiveRule;
|
||||
import cn.iocoder.yudao.module.member.entity.MemberCoupon;
|
||||
import cn.iocoder.yudao.module.member.service.ActiveMainService;
|
||||
import cn.iocoder.yudao.module.member.service.MemberCouponService;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainRespVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mzt.logapi.service.IFunctionService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@ -54,7 +61,8 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
@Resource
|
||||
private CustomerCouponService customerCouponService;
|
||||
@Resource
|
||||
private CustomerBalanceService balanceService;
|
||||
@Lazy
|
||||
private RepairOrderInfoService repairOrderInfoService;
|
||||
|
||||
|
||||
|
||||
@ -115,16 +123,34 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
if (null == active.getRuleList() || active.getRuleList().isEmpty()) {
|
||||
throw exception(CUSTOMER_ACTIVE_NO_RULE);
|
||||
}
|
||||
List<ActiveRule> ruleList = active.getRuleList();
|
||||
// List<ActiveRule> ruleList = active.getRuleList();
|
||||
//转换余额信息
|
||||
balance = transBalance(customer,saveReqVO.getTopUpAmount(),ruleList);
|
||||
// balance = transBalance(customer, saveReqVO.getTopUpAmount(), ruleList);
|
||||
//记录日志
|
||||
CustomerBalanceChange change = changeService.initChange(customer.getId(),
|
||||
customer.getUserId(), null, BALANCE_CHANGE_TYPE_CZ, BALANCE_CHANGE_MAIN_YE,
|
||||
null, balance.getNowChange(), balance.getBalance(), "参加" + active.getName() + "活动");
|
||||
changeList.add(change);
|
||||
null, saveReqVO.getTopUpAmount(), new BigDecimal(0), "参加" + active.getName() + "活动充值" + saveReqVO.getTopUpAmount() + "元");
|
||||
changeService.save(change);
|
||||
RepairOrderInfo orderInfo = new RepairOrderInfo();
|
||||
orderInfo.setOrderNo(System.currentTimeMillis() + Math.abs(change.getId().hashCode() % 1000) + "");
|
||||
orderInfo.setGoodsId(change.getId());
|
||||
orderInfo.setActiveId(active.getId());
|
||||
orderInfo.setGoodsTitle(active.getName());
|
||||
orderInfo.setTenantName(ORDER_TENANT_NAME);
|
||||
orderInfo.setGoodsType(ORDER_HYCZ);
|
||||
orderInfo.setUserId(customer.getUserId());
|
||||
orderInfo.setCusId(customer.getId());
|
||||
orderInfo.setCusName(customer.getCusName());
|
||||
orderInfo.setCusPhone(customer.getPhoneNumber());
|
||||
orderInfo.setGoodsPrice(saveReqVO.getTopUpAmount());
|
||||
orderInfo.setPayMoney(saveReqVO.getTopUpAmount());
|
||||
orderInfo.setOrderTime(LocalDateTime.now());
|
||||
orderInfo.setIsOnline("01");
|
||||
orderInfo.setOrderStatus("0");
|
||||
orderInfo.setPayType(saveReqVO.getAccountType());
|
||||
repairOrderInfoService.save(orderInfo);
|
||||
//保存余额信息
|
||||
balanceService.updateByCusId(balance);
|
||||
// balanceService.updateByCusId(balance);
|
||||
}
|
||||
|
||||
/*4、保存参与活动信息*/
|
||||
@ -207,17 +233,20 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
result.setCusId(customer.getId());
|
||||
result.setUserId(customer.getUserId());
|
||||
List<ActiveRule> sortList = ruleList.stream().sorted(Comparator.comparing(ActiveRule::getRechAmount).reversed()).collect(Collectors.toList());
|
||||
BigDecimal nowChange = amount;
|
||||
for (ActiveRule item : sortList) {
|
||||
//如果规则匹配
|
||||
if (amount.compareTo(item.getRechAmount()) >= 0) {
|
||||
BigDecimal nowChange = amount.add(item.getGiveAmount());
|
||||
nowChange = amount.add(item.getGiveAmount());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//余额
|
||||
result.setBalance(customer.getBalance().add(nowChange));
|
||||
//累计充值金额
|
||||
result.setAllBalance(customer.getBalance().add(nowChange));
|
||||
//本次变动金额
|
||||
result.setNowChange(nowChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -239,4 +268,29 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可参与营销活动
|
||||
*
|
||||
* @param pageReqVO ActiveMainPageReqVO 实体
|
||||
* @return java.util.List<cn.iocoder.yudao.module.member.vo.ActiveMainRespVO>
|
||||
* @author PQZ
|
||||
* @date 16:18 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public List<ActiveMainRespVO> isJoinActive(ActiveMainPageReqVO pageReqVO) {
|
||||
LambdaQueryWrapper<CustomerActive> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0).eq(CustomerActive::getCusId, pageReqVO.getCusId());
|
||||
List<CustomerActive> myList = list(lambdaQueryWrapper);
|
||||
//活动id集合
|
||||
List<String> activeIds = myList.stream().map(CustomerActive::getActiveId).distinct().collect(Collectors.toList());
|
||||
List<ActiveMainRespVO> list = activeMainService.listActive(pageReqVO);
|
||||
//排除已参与的
|
||||
list.forEach(item -> {
|
||||
if (activeIds.contains(item.getId())) {
|
||||
item.setIsJoin(GENERAL_YES);
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
@ -5,14 +5,30 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerBalance;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CustomerBalanceMapper;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerBalanceService;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceSaveReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.member.entity.ActiveRule;
|
||||
import cn.iocoder.yudao.module.member.service.ActiveMainService;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainRespVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.GENERAL_YES;
|
||||
|
||||
/**
|
||||
* 用户积分(余额) Service 实现类
|
||||
@ -25,6 +41,12 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
|
||||
|
||||
@Resource
|
||||
private CustomerBalanceMapper customerBalanceMapper;
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private ActiveMainService activeMainService;
|
||||
|
||||
|
||||
@Override
|
||||
public String createCustomerBalance(CustomerBalanceSaveReqVO createReqVO) {
|
||||
@ -35,6 +57,63 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
|
||||
return customerBalance.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户余额信息(充值完成的回调)
|
||||
*
|
||||
* @param orderInfo 用户订单信息
|
||||
* @author PQZ
|
||||
* @date 21:04 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void balanceCallback(RepairOrderInfo orderInfo) {
|
||||
//查询当前登录用户信息
|
||||
CustomerMainRespVO customer = customerMainService.getCustomerById(orderInfo.getCusId());
|
||||
CustomerBalance balance;
|
||||
if (null != orderInfo.getActiveId()) {
|
||||
//获取当前活动信息
|
||||
ActiveMainRespVO active = activeMainService.getActiveMain(orderInfo.getActiveId(), true);
|
||||
balance = transBalance(customer, orderInfo.getPayMoney(), active.getRuleList());
|
||||
} else {
|
||||
balance = transBalance(customer, orderInfo.getPayMoney(), null);
|
||||
}
|
||||
updateByCusId(balance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换余额
|
||||
*
|
||||
* @param customer 用户信息
|
||||
* @param amount 实际充值金额
|
||||
* @param ruleList 规则
|
||||
* @return cn.iocoder.yudao.module.custom.entity.CustomerBalance
|
||||
* @author PQZ
|
||||
* @date 11:30 2024/9/21
|
||||
**/
|
||||
CustomerBalance transBalance(CustomerMainRespVO customer, BigDecimal amount, List<ActiveRule> ruleList) {
|
||||
CustomerBalance result = new CustomerBalance();
|
||||
result.setCusId(customer.getId());
|
||||
result.setUserId(customer.getUserId());
|
||||
BigDecimal nowChange = amount;
|
||||
if (null != ruleList && !ruleList.isEmpty()) {
|
||||
List<ActiveRule> sortList = ruleList.stream().sorted(Comparator.comparing(ActiveRule::getRechAmount).reversed()).collect(Collectors.toList());
|
||||
for (ActiveRule item : sortList) {
|
||||
//如果规则匹配
|
||||
if (amount.compareTo(item.getRechAmount()) >= 0) {
|
||||
nowChange = amount.add(item.getGiveAmount());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//余额
|
||||
result.setBalance(customer.getBalance().add(nowChange));
|
||||
//累计充值金额
|
||||
result.setAllBalance(customer.getBalance().add(nowChange));
|
||||
//本次变动金额
|
||||
result.setNowChange(nowChange);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCustomerBalance(CustomerBalanceSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
@ -53,7 +132,7 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
|
||||
@Override
|
||||
public void updateByCusId(CustomerBalance balance) {
|
||||
LambdaQueryWrapper<CustomerBalance> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CustomerBalance::getCusId,balance.getCusId()).eq(BaseDO::getDeleted,'0');
|
||||
lambdaQueryWrapper.eq(CustomerBalance::getCusId, balance.getCusId()).eq(BaseDO::getDeleted, '0');
|
||||
remove(lambdaQueryWrapper);
|
||||
this.save(balance);
|
||||
}
|
||||
|
@ -12,11 +12,15 @@ import cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
|
||||
/**
|
||||
* 用户卡券 Service 实现类
|
||||
*
|
||||
@ -31,20 +35,37 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
|
||||
@Resource
|
||||
private CustomerBalanceChangeService changeService;
|
||||
|
||||
@Override
|
||||
public String createCustomerCoupon(CustomerCouponSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CustomerCoupon customerCoupon = BeanUtils.toBean(createReqVO, CustomerCoupon.class);
|
||||
customerCouponMapper.insert(customerCoupon);
|
||||
// 返回
|
||||
return customerCoupon.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡券核销
|
||||
*
|
||||
* @param saveReqVO CustomerCouponSaveReqVO实体
|
||||
* @author PQZ
|
||||
* @date 15:37 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public void updateCustomerCoupon(CustomerCouponSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
CustomerCoupon updateObj = BeanUtils.toBean(updateReqVO, CustomerCoupon.class);
|
||||
customerCouponMapper.updateById(updateObj);
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void couponVerification(CustomerCouponSaveReqVO saveReqVO) {
|
||||
CustomerCoupon customerCoupon = getById(saveReqVO.getId());
|
||||
//核销后剩余
|
||||
BigDecimal newBalance = customerCoupon.getBalance().subtract(customerCoupon.getUnitPrice());
|
||||
customerCoupon.setBalance(newBalance);
|
||||
if (newBalance.compareTo(BigDecimal.ZERO) == 0) {
|
||||
customerCoupon.setIsValid(GENERAL_NO);
|
||||
}
|
||||
//保存核销后的卡券
|
||||
saveOrUpdate(customerCoupon);
|
||||
//保存核销记录
|
||||
changeService.saveChange(saveReqVO.getCusId(),
|
||||
saveReqVO.getUserId(),
|
||||
saveReqVO.getCouponId(),
|
||||
BALANCE_CHANGE_TYPE_KQHX,
|
||||
BALANCE_CHANGE_MAIN_KQ,
|
||||
saveReqVO.getOutRule(),
|
||||
saveReqVO.getUnitPrice(),
|
||||
newBalance,
|
||||
"核销" + saveReqVO.getCouponName() + saveReqVO.getUnitPrice() + "次/元,核销后剩余" + newBalance + "次/元"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,25 +77,21 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
|
||||
|
||||
/**
|
||||
* 获取用户卡券信息及卡券变动信息
|
||||
* @author PQZ
|
||||
* @date 22:51 2024/9/20
|
||||
*
|
||||
* @param id 用户卡券id
|
||||
* @return cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO
|
||||
* @author PQZ
|
||||
* @date 22:51 2024/9/20
|
||||
**/
|
||||
@Override
|
||||
public CustomerCouponRespVO getCustomerCoupon(String id) {
|
||||
CustomerCoupon coupon = getById(id);
|
||||
CustomerCouponRespVO result = BeanUtils.toBean(coupon,CustomerCouponRespVO.class);
|
||||
List<CustomerBalanceChange> changeList = changeService.getCouponChange(coupon.getCusId(),coupon.getCouponId());
|
||||
CustomerCouponRespVO result = BeanUtils.toBean(coupon, CustomerCouponRespVO.class);
|
||||
List<CustomerBalanceChange> changeList = changeService.getCouponChange(coupon.getCusId(), coupon.getCouponId());
|
||||
result.setChangeList(changeList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CustomerCoupon> getCustomerCouponPage(CustomerCouponPageReqVO pageReqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id获取卡券信息
|
||||
*
|
||||
|
@ -14,6 +14,8 @@ import javax.validation.constraints.*;
|
||||
public class CustomerActiveSaveReqVO extends CustomerActive {
|
||||
/**充值金额*/
|
||||
private BigDecimal topUpAmount;
|
||||
/**充值金额*/
|
||||
private String accountType;
|
||||
/**选中的优惠券*/
|
||||
private List<MemberCoupon> selectCoupon;
|
||||
}
|
@ -11,5 +11,6 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class CustomerBalanceSaveReqVO extends CustomerBalance {
|
||||
|
||||
private String orderId;
|
||||
|
||||
}
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.custom.vo;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCoupon;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
@ -10,6 +12,35 @@ import java.math.BigDecimal;
|
||||
@Schema(description = "管理后台 - 用户卡券新增/修改 Request VO")
|
||||
@Data
|
||||
public class CustomerCouponSaveReqVO extends CustomerCoupon {
|
||||
|
||||
/**本次核销次数*/
|
||||
private BigDecimal changeBalance;
|
||||
/**
|
||||
* 卡券名称
|
||||
*/
|
||||
private String couponName;
|
||||
/**
|
||||
* 卡券类型(保养卡、服务券、礼包券)
|
||||
*/
|
||||
private String couponType;
|
||||
/**
|
||||
* 适用车型(数据字典)
|
||||
*/
|
||||
private String carModel;
|
||||
/**
|
||||
* 开始有效期
|
||||
*/
|
||||
private LocalDateTime beginTime;
|
||||
/**
|
||||
* 结束有效期
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
/**
|
||||
* 效果图片
|
||||
*/
|
||||
private String image;
|
||||
/**
|
||||
* 来源活动名称
|
||||
*/
|
||||
private String activeName;
|
||||
|
||||
}
|
@ -19,4 +19,8 @@ public class CustomerMainSaveReqVO extends CustomerMain {
|
||||
/**标签信息*/
|
||||
List<BusiLabel> labelList;
|
||||
|
||||
/**
|
||||
* Code
|
||||
*/
|
||||
private String Code;
|
||||
}
|
@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 营销活动")
|
||||
@ -114,5 +116,4 @@ public class ActiveMainController {
|
||||
return success(activeMainService.queryListPage(pageReqVO, page));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 营销活动 Mapper
|
||||
*
|
||||
@ -29,4 +31,14 @@ public interface ActiveMainMapper extends BaseMapper<ActiveMain> {
|
||||
* @date 14:10 2024/9/19
|
||||
**/
|
||||
IPage<ActiveMainRespVO> selectListPage(@Param("entity") ActiveMainPageReqVO entity, Page<ActiveMainRespVO> page);
|
||||
|
||||
/**
|
||||
* 不分页查询可参与的活动规则
|
||||
*
|
||||
* @param entity ActiveMainPageReqVO实体
|
||||
* @return java.util.List<cn.iocoder.yudao.module.member.vo.ActiveMainRespVO>
|
||||
* @author PQZ
|
||||
* @date 16:10 2024/9/23
|
||||
**/
|
||||
List<ActiveMainRespVO> listActiveMain(@Param("entity") ActiveMainPageReqVO entity);
|
||||
}
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 营销活动 Service 接口
|
||||
@ -55,4 +56,15 @@ public interface ActiveMainService extends IService<ActiveMain> {
|
||||
**/
|
||||
IPage<ActiveMainRespVO> queryListPage(ActiveMainPageReqVO pageReqVO, Page<ActiveMainRespVO> page);
|
||||
|
||||
|
||||
/**
|
||||
* 不分页查询可参与的活动规则
|
||||
*
|
||||
* @param pageReqVO ActiveMainPageReqVO实体
|
||||
* @return java.util.List<cn.iocoder.yudao.module.member.vo.ActiveMainRespVO>
|
||||
* @author PQZ
|
||||
* @date 16:11 2024/9/23
|
||||
**/
|
||||
List<ActiveMainRespVO> listActive(ActiveMainPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ public interface MemberCouponService extends IService<MemberCoupon> {
|
||||
/**
|
||||
* 保存基础卡券信息
|
||||
*
|
||||
* @param saveReqVO TODO
|
||||
* @param saveReqVO MemberCouponSaveReqVO实体
|
||||
* @return void
|
||||
* @author PQZ
|
||||
* @date 14:22 2024/9/19
|
||||
|
@ -39,6 +39,7 @@ public class ActiveMainServiceImpl extends ServiceImpl<ActiveMainMapper, ActiveM
|
||||
private ActiveRuleCouponService activeRuleCouponService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存营销活动
|
||||
*
|
||||
@ -108,5 +109,18 @@ public class ActiveMainServiceImpl extends ServiceImpl<ActiveMainMapper, ActiveM
|
||||
return activeMainMapper.selectListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不分页查询可参与的活动规则
|
||||
*
|
||||
* @param pageReqVO ActiveMainPageReqVO实体
|
||||
* @return java.util.List<cn.iocoder.yudao.module.member.vo.ActiveMainRespVO>
|
||||
* @author PQZ
|
||||
* @date 16:11 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public List<ActiveMainRespVO> listActive(ActiveMainPageReqVO pageReqVO) {
|
||||
return activeMainMapper.listActiveMain(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,4 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
public class ActiveMainPageReqVO extends ActiveMain {
|
||||
/**用于判断是否查询当前时间段可参与的活动*/
|
||||
private String isNow;
|
||||
/**当前客户id*/
|
||||
private String cusId;
|
||||
}
|
@ -18,5 +18,7 @@ public class ActiveMainRespVO extends ActiveMain {
|
||||
private List<MemberCoupon> couponList;
|
||||
/**活动关联规则*/
|
||||
private List<ActiveRule> ruleList;
|
||||
/**当前活动当前用户是否已参与*/
|
||||
private String isJoin;
|
||||
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package cn.iocoder.yudao.module.project.controller.admin;
|
||||
package cn.iocoder.yudao.module.order.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.project.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -49,6 +49,21 @@ public class RepairOrderInfoController {
|
||||
return success(BeanUtils.toBean(orderInfo, RepairOrderInfoRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新订单信息
|
||||
*
|
||||
* @param saveReqVO 订单信息
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新车辆信息")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-main:update')")
|
||||
public CommonResult<Boolean> updateCarMain(@RequestBody RepairOrderInfoSaveReqVO saveReqVO) {
|
||||
repairOrderInfoService.rechargeCallback(saveReqVO.getOrderNo());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询订单内容
|
||||
*
|
@ -1,18 +1,13 @@
|
||||
package cn.iocoder.yudao.module.project.entity;
|
||||
package cn.iocoder.yudao.module.order.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 维修模块 订单 DO
|
||||
@ -52,7 +47,7 @@ public class RepairOrderInfo extends TenantBaseDO {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
private Long userId;
|
||||
/**
|
||||
* 客户id
|
||||
*/
|
||||
@ -80,11 +75,11 @@ public class RepairOrderInfo extends TenantBaseDO {
|
||||
/**
|
||||
* 会员优惠金额
|
||||
*/
|
||||
private Long reduceMoney;
|
||||
private BigDecimal reduceMoney;
|
||||
/**
|
||||
* 使用会员储值卡的金额
|
||||
*/
|
||||
private Long balance;
|
||||
private BigDecimal balance;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@ -157,6 +152,14 @@ public class RepairOrderInfo extends TenantBaseDO {
|
||||
* 创建人所在部门
|
||||
*/
|
||||
private Integer deptId;
|
||||
/**
|
||||
* 创建人所在部门
|
||||
*/
|
||||
private String tenantName;
|
||||
/**
|
||||
* 活动id
|
||||
*/
|
||||
private String activeId;
|
||||
|
||||
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
package cn.iocoder.yudao.module.project.mapper;
|
||||
package cn.iocoder.yudao.module.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -29,4 +27,12 @@ public interface RepairOrderInfoMapper extends BaseMapper<RepairOrderInfo> {
|
||||
IPage<RepairOrderInfoRespVO> queryListPage(@Param("entity") RepairOrderInfoPageReqVO entity, Page<RepairOrderInfoRespVO> page);
|
||||
|
||||
|
||||
/**
|
||||
* 订单分页查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:35 2024/9/23
|
||||
* @param respVO 查询对象
|
||||
**/
|
||||
IPage<RepairOrderInfoRespVO> getOrderPageByStatus(@Param("map") RepairOrderInfoRespVO respVO, Page<RepairOrderInfo> page);
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package cn.iocoder.yudao.module.order.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 维修模块 订单 Service 接口
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface RepairOrderInfoService extends IService<RepairOrderInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 保存订单信息
|
||||
*
|
||||
* @param saveReqVO TODO
|
||||
* @author PQZ
|
||||
* @date 14:57 2024/9/23
|
||||
**/
|
||||
void saveOrderInfo(RepairOrderInfoSaveReqVO saveReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 充值完成回调接口
|
||||
* @author PQZ
|
||||
* @date 22:19 2024/9/23
|
||||
* @param orderNo 订单编号
|
||||
**/
|
||||
void rechargeCallback(String orderNo);
|
||||
|
||||
/**
|
||||
* 删除维修模块 订单
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteOrderInfo(String id);
|
||||
|
||||
/**
|
||||
* 获得维修模块 订单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 维修模块 订单
|
||||
*/
|
||||
RepairOrderInfo getOrderInfo(String id);
|
||||
|
||||
/**
|
||||
* 根据订单编号查询订单数据
|
||||
* @author PQZ
|
||||
* @date 22:12 2024/9/23
|
||||
* @param orderNo 订单编号
|
||||
* @return cn.iocoder.yudao.module.order.entity.RepairOrderInfo
|
||||
**/
|
||||
RepairOrderInfo getOrderByOrderNo(String orderNo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
*
|
||||
* @param pageReqVO RepairOrderInfoPageReqVO实体
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
|
||||
* @author PQZ
|
||||
* @date 14:36 2024/9/23
|
||||
**/
|
||||
IPage<RepairOrderInfoRespVO> queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page<RepairOrderInfoRespVO> page);
|
||||
|
||||
/**
|
||||
* 订单分页查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:35 2024/9/23
|
||||
* @param respVO 查询对象
|
||||
**/
|
||||
IPage<RepairOrderInfoRespVO> getOrderPageByStatus(RepairOrderInfoRespVO respVO, Page<RepairOrderInfo> page);
|
||||
|
||||
/**
|
||||
* 查询订单详情(包括工单)
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:43 2024/9/23
|
||||
* @param id 订单ID
|
||||
**/
|
||||
RepairOrderInfoRespVO getOrderById(String id);
|
||||
|
||||
/**
|
||||
* 评价订单
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:50 2024/9/23
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
void appraiseOrder(RepairOrderInfoRespVO respVO);
|
||||
/**
|
||||
* 支付吊起接口
|
||||
* @param orderId 订单主键
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> payTransactions(String orderId);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,208 @@
|
||||
package cn.iocoder.yudao.module.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerBalanceService;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoMapper;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import cn.iocoder.yudao.util.WechatPayRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.GENERAL_YES;
|
||||
import static cn.iocoder.yudao.common.BaseConstants.ORDER_HYCZ;
|
||||
|
||||
/**
|
||||
* 维修模块 订单 Service 实现类
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMapper, RepairOrderInfo> implements RepairOrderInfoService {
|
||||
|
||||
@Resource
|
||||
private RepairOrderInfoMapper repairOrderInfoMapper;
|
||||
@Resource
|
||||
@Lazy
|
||||
private CustomerBalanceService balanceService;
|
||||
|
||||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
@Resource
|
||||
private WechatPayRequest wechatPayRequest;
|
||||
|
||||
/**
|
||||
* 保存订单信息
|
||||
*
|
||||
* @param saveReqVO RepairOrderInfoSaveReqVO实体
|
||||
* @author PQZ
|
||||
* @date 14:57 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public void saveOrderInfo(RepairOrderInfoSaveReqVO saveReqVO) {
|
||||
RepairOrderInfo save = BeanUtils.toBean(saveReqVO, RepairOrderInfo.class);
|
||||
saveOrUpdate(save);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值完成回调接口
|
||||
*
|
||||
* @param orderNo 订单编号
|
||||
* @author PQZ
|
||||
* @date 22:19 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public void rechargeCallback(String orderNo) {
|
||||
//通过订单编号查询订单
|
||||
RepairOrderInfo orderInfo = getOrderByOrderNo(orderNo);
|
||||
if (ORDER_HYCZ.equals(orderInfo.getGoodsType())){
|
||||
//会员充值回调
|
||||
balanceService.balanceCallback(orderInfo);
|
||||
} else {
|
||||
// TODO: 2024/9/24 维修服务回调
|
||||
}
|
||||
orderInfo.setOrderStatus(GENERAL_YES);
|
||||
orderInfo.setPayTime(LocalDateTime.now());
|
||||
updateById(orderInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrderInfo(String id) {
|
||||
// 删除
|
||||
repairOrderInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RepairOrderInfo getOrderInfo(String id) {
|
||||
return repairOrderInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单编号查询订单数据
|
||||
*
|
||||
* @param orderNo 订单编号
|
||||
* @return cn.iocoder.yudao.module.order.entity.RepairOrderInfo
|
||||
* @author PQZ
|
||||
* @date 22:12 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public RepairOrderInfo getOrderByOrderNo(String orderNo) {
|
||||
LambdaQueryWrapper<RepairOrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RepairOrderInfo::getOrderNo,orderNo).eq(BaseDO::getDeleted,'0');
|
||||
return getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
*
|
||||
* @param pageReqVO RepairOrderInfoPageReqVO实体
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
|
||||
* @author PQZ
|
||||
* @date 14:36 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public IPage<RepairOrderInfoRespVO> queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page<RepairOrderInfoRespVO> page) {
|
||||
return repairOrderInfoMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单分页查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:35 2024/9/23
|
||||
* @param respVO 查询对象
|
||||
**/
|
||||
@Override
|
||||
public IPage<RepairOrderInfoRespVO> getOrderPageByStatus(RepairOrderInfoRespVO respVO, Page<RepairOrderInfo> page){
|
||||
return baseMapper.getOrderPageByStatus(respVO, page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单详情(包括工单)
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:43 2024/9/23
|
||||
* @param id 订单ID
|
||||
**/
|
||||
@Override
|
||||
public RepairOrderInfoRespVO getOrderById(String id){
|
||||
// 查订单信息
|
||||
RepairOrderInfo repairOrderInfo = baseMapper.selectById(id);
|
||||
return BeanUtils.toBean(repairOrderInfo, RepairOrderInfoRespVO.class);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 评价订单
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:50 2024/9/23
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
public void appraiseOrder(RepairOrderInfoRespVO respVO){
|
||||
// 没有评价内容就给默认评价内容
|
||||
if (ObjectUtil.isEmpty(respVO.getCommentDesc())){
|
||||
respVO.setCommentDesc("没有填写文本");
|
||||
}
|
||||
// 没有评分就给默认评分
|
||||
if (ObjectUtil.isEmpty(respVO.getCommentStar())){
|
||||
respVO.setCommentStar(5);
|
||||
}
|
||||
respVO.setCommentTime(LocalDateTime.now());
|
||||
baseMapper.updateById(respVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付吊起接口
|
||||
* @param orderId 订单主键
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> payTransactions(String orderId){
|
||||
RepairOrderInfo orderInfo = this.getById(orderId);
|
||||
// 统一参数封装
|
||||
Map<String, Object> params = new HashMap<>(8);
|
||||
params.put("appid", wechatPayConfig.getAppId());
|
||||
params.put("mchid", wechatPayConfig.getMchId());
|
||||
params.put("description", orderInfo.getPayRemark());
|
||||
params.put("out_trade_no", orderInfo.getOrderNo());
|
||||
params.put("notify_url", wechatPayConfig.getRepairNotifyUrl());
|
||||
Map<String, Object> amountMap = new HashMap<>(4);
|
||||
// 金额单位为分
|
||||
amountMap.put("total", orderInfo.getPayMoney().multiply(BigDecimal.valueOf(100L)).intValue());
|
||||
//人民币
|
||||
amountMap.put("currency", "CNY");
|
||||
params.put("amount", amountMap);
|
||||
String paramsStr = JSON.toJSONString(params);
|
||||
String resStr = wechatPayRequest.wechatHttpPost("https://api.mch.weixin.qq.com/v3/pay/transactions/native",paramsStr);
|
||||
return JSONObject.parseObject(resStr, new TypeReference<Map<String, Object>>(){});
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.project.vo;
|
||||
package cn.iocoder.yudao.module.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 维修模块 订单 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RepairOrderInfoRespVO extends RepairOrderInfo {
|
||||
|
||||
/** 订单状态(工单的状态) */
|
||||
private String status;
|
||||
|
||||
|
||||
//订单描述
|
||||
private String description;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 维修模块 订单新增/修改 Request VO")
|
||||
@Data
|
||||
public class RepairOrderInfoSaveReqVO extends RepairOrderInfo {
|
||||
|
||||
|
||||
}
|
@ -58,7 +58,10 @@ public class WechatPayConfig {
|
||||
* 退款回调地址
|
||||
*/
|
||||
private String refundNotifyUrl="https://www.nuoyunr.com/jdcJc/notify/refundNotify";
|
||||
|
||||
/**
|
||||
* 汽修通知回调地址
|
||||
*/
|
||||
private String repairNotifyUrl="https://www.nuoyunr.com/admin-api/repairPayApi/payNotify";
|
||||
/**
|
||||
* API 证书中的 key.pem
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@
|
||||
<if test="map.type != null and map.type != ''">
|
||||
and dbt.type = #{map.type}
|
||||
</if>
|
||||
<if test="map.tenantId != null and map.tenantId != ''">
|
||||
<if test="map.corpId != null and map.corpId != ''">
|
||||
and dbt.corp_id = #{map.corpId}
|
||||
</if>
|
||||
</select>
|
||||
|
@ -28,5 +28,6 @@
|
||||
WHERE
|
||||
bcc.cus_id = #{cusId}
|
||||
AND bcc.deleted = 0
|
||||
AND bcc.is_valid = 1
|
||||
</select>
|
||||
</mapper>
|
@ -29,4 +29,23 @@
|
||||
</where>
|
||||
ORDER BY dam.create_time DESC
|
||||
</select>
|
||||
<select id="listActiveMain" resultType="cn.iocoder.yudao.module.member.vo.ActiveMainRespVO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
dl_active_main dam
|
||||
<where>
|
||||
dam.deleted = 0
|
||||
<if test="entity.isNow != null and entity.isNow == 1">
|
||||
AND begin_time <= NOW()
|
||||
AND end_time >= NOW()
|
||||
</if>
|
||||
<if test="entity.name != null and entity.name != ''">
|
||||
and dam.name like concat('%', #{entity.name}, '%')
|
||||
</if>
|
||||
<if test="entity.type != null and entity.type != ''">
|
||||
and dam.type like concat('%', #{entity.type}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.project.mapper.RepairOrderInfoMapper">
|
||||
<mapper namespace="cn.iocoder.yudao.module.order.vo.RepairOrderInfoMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
@ -9,7 +9,7 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO">
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO">
|
||||
SELECT
|
||||
roi.*
|
||||
FROM
|
||||
@ -20,7 +20,7 @@
|
||||
and roi.order_no like concat('%', #{entity.orderNo}, '%')
|
||||
</if>
|
||||
<if test="entity.goodsTitle != null and entity.goodsTitle != ''">
|
||||
and roi.goods_totle like concat('%', #{entity.goodsTitle}, '%')
|
||||
and roi.goods_title like concat('%', #{entity.goodsTitle}, '%')
|
||||
</if>
|
||||
<if test="entity.goodsType != null and entity.goodsType != ''">
|
||||
and roi.goods_type = #{entity.goodsType}
|
||||
@ -31,6 +31,30 @@
|
||||
<if test="entity.orderStatus != null and entity.orderStatus != ''">
|
||||
and roi.order_status = #{entity.orderStatus}
|
||||
</if>
|
||||
<if test="entity.payType != null and entity.payType != ''">
|
||||
and roi.pay_type = #{entity.payType}
|
||||
</if>
|
||||
</where>
|
||||
order by roi.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getOrderPageByStatus" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO">
|
||||
select roi.*,drt.tickets_work_status as status from repair_order_info roi left join dl_repair_tickets drt on
|
||||
roi.goods_id = drt.id
|
||||
where roi.deleted = '0'
|
||||
<if test="map.userId != null and map.userId != ''">
|
||||
and roi.user_id = #{map.userId}
|
||||
</if>
|
||||
<if test="map.status != null and map.status != ''">
|
||||
<choose>
|
||||
<when test="map.status != '00'">
|
||||
drt.tickets_work_status = #{map.status}
|
||||
</when>
|
||||
<when test="map.status == '00'">
|
||||
roi.comment_time is null
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
order by roi.create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.app.apy;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "用户端 - 维修模块 订单模块")
|
||||
@RestController
|
||||
@RequestMapping("/userClient/order")
|
||||
@Validated
|
||||
public class ClientOrderApi {
|
||||
@Resource
|
||||
private RepairOrderInfoService repairOrderInfoService;
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "订单分页查询")
|
||||
@TenantIgnore
|
||||
public CommonResult<?> getOrderPage(RepairOrderInfoRespVO respVO,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
|
||||
// 当前登录用户的id
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
respVO.setUserId(loginUserId);
|
||||
Page<RepairOrderInfo> page = new Page<>(pageNo, pageSize);
|
||||
return success(repairOrderInfoService.getOrderPageByStatus(respVO, page));
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.app.apy;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.util.WechatPayConfig;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 维修模块 支付模块")
|
||||
@RestController
|
||||
@RequestMapping("/userClient/pay")
|
||||
@Validated
|
||||
public class RepairPayApi {
|
||||
@Resource
|
||||
private RepairOrderInfoService repairOrderInfoService;
|
||||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
/**
|
||||
* 支付吊起接口
|
||||
* @param orderId 订单主键
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/toPay")
|
||||
@TenantIgnore
|
||||
public CommonResult<Map<String, Object>> payTransactions(String orderId){
|
||||
Map<String, Object> res = repairOrderInfoService.payTransactions(orderId);
|
||||
return success(res);
|
||||
}
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
@PostMapping("/payNotify")
|
||||
public Map<String, String> payNotify(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String key = wechatPayConfig.getApiV3Key();
|
||||
String json = jsonObject.toString();
|
||||
String associated_data = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.associated_data");
|
||||
String ciphertext = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.ciphertext");
|
||||
String nonce = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.nonce");
|
||||
String decryptData = new AesUtil(key.getBytes(StandardCharsets.UTF_8)).decryptToString(associated_data.getBytes(StandardCharsets.UTF_8), nonce.getBytes(StandardCharsets.UTF_8), ciphertext);
|
||||
//验签成功
|
||||
JSONObject decryptDataObj = JSONObject.parseObject(decryptData, JSONObject.class);
|
||||
if(lock.tryLock()) {
|
||||
try {
|
||||
String orderNo = decryptDataObj.get("out_trade_no").toString();
|
||||
repairOrderInfoService.rechargeCallback(orderNo);
|
||||
} catch (Exception ignored){
|
||||
|
||||
} finally{
|
||||
//要主动释放锁
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}catch (Exception ignored){
|
||||
|
||||
}
|
||||
|
||||
Map<String, String> res = new HashMap<>();
|
||||
res.put("code", "SUCCESS");
|
||||
res.put("message", "成功");
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.app.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.app.service.UniShopConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/userClient/uniShopConfig")
|
||||
public class UniShopConfigController {
|
||||
|
||||
@Autowired
|
||||
UniShopConfigService uniShopConfigService;
|
||||
|
||||
@GetMapping("/getRepairTel")
|
||||
public CommonResult<String> getRepairTel() {
|
||||
return CommonResult.success(uniShopConfigService.getRepairTel());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.app.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UniShopConfigMapper {
|
||||
|
||||
public String getRepairTel();
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.app.order.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 维修订单API
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:20 2024/9/23
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/api/repair/order")
|
||||
public class RepairOrderAPI {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairOrderInfoService repairOrderInfoService;
|
||||
|
||||
/**
|
||||
* 订单分页查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:35 2024/9/23
|
||||
* @param respVO 查询对象
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "订单分页查询")
|
||||
public CommonResult<?> getOrderPageByStatus(RepairOrderInfoRespVO respVO,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
|
||||
Page<RepairOrderInfo> page = new Page<>(pageNo, pageSize);
|
||||
return success(repairOrderInfoService.getOrderPageByStatus(respVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单详情(包括工单)
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:43 2024/9/23
|
||||
* @param id 订单ID
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询订单详情")
|
||||
public CommonResult<?> getOrderById(@RequestParam(value = "id") String id){
|
||||
return success(repairOrderInfoService.getOrderById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 评价订单
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:50 2024/9/23
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@PostMapping("/appraise")
|
||||
@Operation(summary = "评价订单")
|
||||
public CommonResult<?> appraiseOrder(@RequestBody RepairOrderInfoRespVO respVO){
|
||||
repairOrderInfoService.appraiseOrder(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package cn.iocoder.yudao.module.app.service;
|
||||
|
||||
public interface UniShopConfigService {
|
||||
|
||||
public String getRepairTel();
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.app.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.app.mapper.UniShopConfigMapper;
|
||||
import cn.iocoder.yudao.module.app.service.UniShopConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UniShopConfigServiceImpl implements UniShopConfigService {
|
||||
|
||||
|
||||
@Autowired
|
||||
UniShopConfigMapper uniShopConfigMapper;
|
||||
@Override
|
||||
public String getRepairTel() {
|
||||
return uniShopConfigMapper.getRepairTel();
|
||||
}
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package cn.iocoder.yudao.module.app.tickets.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -28,38 +27,6 @@ public class TicketsAPI {
|
||||
@Resource
|
||||
private DlRepairTicketsService dlRepairTicketsService;
|
||||
|
||||
/**
|
||||
* 维修工单表 评价
|
||||
*
|
||||
* @author 小李
|
||||
* @date 10:54 2024/9/23
|
||||
* @param repairTicketsRespVO 对象
|
||||
**/
|
||||
@PostMapping("/appraise")
|
||||
@Operation(summary = "维修工单表 评价")
|
||||
public CommonResult<?> setAppraise(@RequestBody DlRepairTicketsRespVO repairTicketsRespVO){
|
||||
dlRepairTicketsService.setAppraise(repairTicketsRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单表 按用户的id查
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:37 2024/9/23
|
||||
* @param repairTicketsReqVO 查询对象
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "维修工单表 按用户的id查")
|
||||
public CommonResult<?> getTicketsPageById(DlRepairTicketsReqVO repairTicketsReqVO,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
|
||||
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
|
||||
return success(dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单表 查看一个工单的详细信息
|
||||
*
|
||||
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.project.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 维修模块 支付模块")
|
||||
@RestController
|
||||
@RequestMapping("/admin-api/pay")
|
||||
@Validated
|
||||
public class RepairPayController {
|
||||
@Resource
|
||||
private RepairOrderInfoService repairOrderInfoService;
|
||||
|
||||
/**
|
||||
* 支付吊起接口
|
||||
* @param orderId 订单主键
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/toPay")
|
||||
public CommonResult<Map<String, Object>> payTransactions(String orderId){
|
||||
Map<String, Object> res = repairOrderInfoService.payTransactions(orderId);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package cn.iocoder.yudao.module.project.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 维修模块 订单 Service 接口
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface RepairOrderInfoService extends IService<RepairOrderInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 保存订单信息
|
||||
*
|
||||
* @param saveReqVO TODO
|
||||
* @author PQZ
|
||||
* @date 14:57 2024/9/23
|
||||
**/
|
||||
void saveOrderInfo(RepairOrderInfoSaveReqVO saveReqVO);
|
||||
|
||||
/**
|
||||
* 删除维修模块 订单
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteOrderInfo(String id);
|
||||
|
||||
/**
|
||||
* 获得维修模块 订单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 维修模块 订单
|
||||
*/
|
||||
RepairOrderInfo getOrderInfo(String id);
|
||||
|
||||
/**
|
||||
* 获得维修模块 订单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 维修模块 订单分页
|
||||
*/
|
||||
PageResult<RepairOrderInfo> getOrderInfoPage(RepairOrderInfoPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
*
|
||||
* @param pageReqVO RepairOrderInfoPageReqVO实体
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
|
||||
* @author PQZ
|
||||
* @date 14:36 2024/9/23
|
||||
**/
|
||||
IPage<RepairOrderInfoRespVO> queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page<RepairOrderInfoRespVO> page);
|
||||
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package cn.iocoder.yudao.module.project.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.project.mapper.RepairOrderInfoMapper;
|
||||
import cn.iocoder.yudao.module.project.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 维修模块 订单 Service 实现类
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMapper, RepairOrderInfo> implements RepairOrderInfoService {
|
||||
|
||||
@Resource
|
||||
private RepairOrderInfoMapper repairOrderInfoMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 保存订单信息
|
||||
*
|
||||
* @param saveReqVO RepairOrderInfoSaveReqVO实体
|
||||
* @author PQZ
|
||||
* @date 14:57 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public void saveOrderInfo(RepairOrderInfoSaveReqVO saveReqVO) {
|
||||
RepairOrderInfo save = BeanUtils.toBean(saveReqVO, RepairOrderInfo.class);
|
||||
saveOrUpdate(save);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrderInfo(String id) {
|
||||
// 删除
|
||||
repairOrderInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RepairOrderInfo getOrderInfo(String id) {
|
||||
return repairOrderInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RepairOrderInfo> getOrderInfoPage(RepairOrderInfoPageReqVO pageReqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
*
|
||||
* @param pageReqVO RepairOrderInfoPageReqVO实体
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
|
||||
* @author PQZ
|
||||
* @date 14:36 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public IPage<RepairOrderInfoRespVO> queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page<RepairOrderInfoRespVO> page) {
|
||||
return repairOrderInfoMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.project.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 维修模块 订单 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RepairOrderInfoRespVO extends RepairOrderInfo {
|
||||
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.yudao.module.project.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 维修模块 订单新增/修改 Request VO")
|
||||
@Data
|
||||
public class RepairOrderInfoSaveReqVO extends RepairOrderInfo {
|
||||
|
||||
|
||||
}
|
@ -175,13 +175,4 @@ public class DlRepairTickets extends TenantBaseDO {
|
||||
|
||||
/** 工单进行状态 */
|
||||
private String ticketsWorkStatus;
|
||||
|
||||
/** 评价 */
|
||||
private String appraise;
|
||||
|
||||
/** 是否已评价 */
|
||||
private String isAppraise;
|
||||
|
||||
/** 评分 */
|
||||
private Integer appraiseScope;
|
||||
}
|
||||
|
@ -59,13 +59,4 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param repairTicketsRespVO 工单
|
||||
**/
|
||||
void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO);
|
||||
|
||||
/**
|
||||
* 维修工单表 评价
|
||||
*
|
||||
* @author 小李
|
||||
* @date 10:54 2024/9/23
|
||||
* @param repairTicketsRespVO 对象
|
||||
**/
|
||||
void setAppraise(DlRepairTicketsRespVO repairTicketsRespVO);
|
||||
}
|
||||
|
@ -5,6 +5,10 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.other.entity.DlRepairOther;
|
||||
import cn.iocoder.yudao.module.other.service.DlRepairOtherService;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
@ -13,6 +17,8 @@ import cn.iocoder.yudao.module.project.service.RepairProjectService;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper;
|
||||
@ -26,15 +32,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.ORDER_TENANT_NAME;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
@ -62,6 +69,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@Resource
|
||||
private DlRepairOtherService otherService;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairOrderInfoService repairOrderInfoService;
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
*
|
||||
@ -104,6 +121,34 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
item.setTicketId(ticketsRespVO.getId());
|
||||
});
|
||||
titemService.saveBatch(itemList);
|
||||
|
||||
// 创建订单
|
||||
RepairOrderInfoSaveReqVO repairOrderInfo = new RepairOrderInfoSaveReqVO();
|
||||
// 订单号采用时间戳+工单ID和hash值取余后取3位
|
||||
repairOrderInfo.setOrderNo(System.currentTimeMillis() + Math.abs(ticketsRespVO.getId().hashCode() % 1000) + "");
|
||||
repairOrderInfo.setGoodsId(ticketsRespVO.getId());
|
||||
repairOrderInfo.setTenantName(ORDER_TENANT_NAME);
|
||||
DictDataRespDTO repairType = dictDataApi.getDictData("repair_type", ticketsRespVO.getRepairType());
|
||||
if (ObjectUtil.isNotEmpty(repairType)) {
|
||||
repairOrderInfo.setGoodsTitle(repairType.getLabel());
|
||||
} else {
|
||||
repairOrderInfo.setGoodsTitle("维修费用");
|
||||
}
|
||||
repairOrderInfo.setGoodsType("2");
|
||||
CustomerMainRespVO customerById = customerMainService.getCustomerById(ticketsRespVO.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(customerById)) {
|
||||
repairOrderInfo.setUserId(customerById.getUserId());
|
||||
} else {
|
||||
repairOrderInfo.setUserId(0L);
|
||||
}
|
||||
repairOrderInfo.setCusId(customerById.getId());
|
||||
repairOrderInfo.setCusName(customerById.getCusName());
|
||||
repairOrderInfo.setCusPhone(customerById.getPhoneNumber());
|
||||
repairOrderInfo.setGoodsPrice(ticketsRespVO.getTotalPrice());
|
||||
repairOrderInfo.setOrderTime(ticketsRespVO.getCreateTime());
|
||||
repairOrderInfo.setOrderStatus("0");
|
||||
repairOrderInfo.setDeptId(Integer.parseInt(deptId + ""));
|
||||
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,12 +166,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/**
|
||||
* 获得一个工单的详细信息
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @author 小李
|
||||
* @date 16:05 2024/9/21
|
||||
* @param id 工单ID
|
||||
**/
|
||||
@Override
|
||||
public DlRepairTicketsRespVO getTicketsById(String id){
|
||||
public DlRepairTicketsRespVO getTicketsById(String id) {
|
||||
// 查工单主表
|
||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||
@ -135,7 +180,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
List<DlRepairTitemReqVO> items = itemList.stream().map(item -> BeanUtil.toBean(item, DlRepairTitemReqVO.class)).collect(Collectors.toList());
|
||||
// 取项目
|
||||
List<DlRepairTitemReqVO> projects = items.stream().filter(item -> item.getItemType().equals("01")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(projects)){
|
||||
if (CollectionUtil.isNotEmpty(projects)) {
|
||||
Set<String> ids = projects.stream().map(DlRepairTitemReqVO::getProjectId).collect(Collectors.toSet());
|
||||
List<RepairProject> repairProjects = projectService.listByIds(ids);
|
||||
items.forEach(item -> repairProjects.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setProject));
|
||||
@ -143,14 +188,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
// 取配件
|
||||
List<DlRepairTitemReqVO> wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(wares)){
|
||||
if (CollectionUtil.isNotEmpty(wares)) {
|
||||
Set<String> ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet());
|
||||
List<RepairWares> repairWares = waresService.listByIds(ids);
|
||||
items.forEach(item -> repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare));
|
||||
}
|
||||
// 取附加
|
||||
List<DlRepairTitemReqVO> others = items.stream().filter(item -> item.getItemType().equals("03")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(others)){
|
||||
if (CollectionUtil.isNotEmpty(others)) {
|
||||
Set<String> ids = others.stream().map(DlRepairTitemReqVO::getOtherId).collect(Collectors.toSet());
|
||||
List<DlRepairOther> dlRepairOthers = otherService.listByIds(ids);
|
||||
items.forEach(item -> dlRepairOthers.stream().filter(i -> i.getId().equals(item.getOtherId())).findFirst().ifPresent(item::setOther));
|
||||
@ -162,45 +207,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/**
|
||||
* 维修工单表 作废
|
||||
*
|
||||
* @param repairTicketsReqVO 工单对象
|
||||
* @author 小李
|
||||
* @date 19:46 2024/9/22
|
||||
* @param repairTicketsReqVO 工单对象
|
||||
**/
|
||||
@Override
|
||||
public void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO){
|
||||
public void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO) {
|
||||
baseMapper.updateById(repairTicketsReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单表 结算
|
||||
*
|
||||
* @param repairTicketsRespVO 工单
|
||||
* @author 小李
|
||||
* @date 8:50 2024/9/23
|
||||
* @param repairTicketsRespVO 工单
|
||||
**/
|
||||
@Override
|
||||
public void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO){
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单表 评价
|
||||
*
|
||||
* @author 小李
|
||||
* @date 10:54 2024/9/23
|
||||
* @param repairTicketsRespVO 对象
|
||||
**/
|
||||
@Override
|
||||
public void setAppraise(DlRepairTicketsRespVO repairTicketsRespVO){
|
||||
// 如果用户什么评价也没输入,给个默认评价
|
||||
if (ObjectUtil.isEmpty(repairTicketsRespVO.getAppraise())){
|
||||
repairTicketsRespVO.setIsAppraise("未输入评价内容");
|
||||
}
|
||||
// 如果用户没选择评分,给个默认评分(理论讲前端直接给,以防万一)
|
||||
if (ObjectUtil.isEmpty(repairTicketsRespVO.getAppraiseScope())){
|
||||
repairTicketsRespVO.setAppraiseScope(5);
|
||||
}
|
||||
repairTicketsRespVO.setIsAppraise("1");
|
||||
public void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO) {
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.app.mapper.UniShopConfigMapper">
|
||||
|
||||
|
||||
<select id="getRepairTel" resultType="string">
|
||||
SELECT repair_tel FROM shop_config LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
@ -42,8 +42,6 @@
|
||||
<result property="profit" column="profit" />
|
||||
<result property="partStatus" column="part_status" />
|
||||
<result property="ticketsWorkStatus" column="tickets_work_status" />
|
||||
<result property="appraise" column="appraise" />
|
||||
<result property="appraiseScope" column="appraise_scope" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
@ -83,9 +81,7 @@
|
||||
cost,
|
||||
profit,
|
||||
part_status,
|
||||
tickets_work_status,
|
||||
appraise,
|
||||
appraise_scope
|
||||
tickets_work_status
|
||||
from dl_repair_tickets drt
|
||||
where drt.deleted = '0'
|
||||
</sql>
|
||||
@ -123,9 +119,6 @@
|
||||
<if test="map.userId != null and map.userId != ''">
|
||||
and drt.user_id = #{map.userId}
|
||||
</if>
|
||||
<if test="map.isAppraise != null and map.isAppraise != ''">
|
||||
and drt.is_appraise = #{map.isAppraise}
|
||||
</if>
|
||||
<if test="map.ticketsWorkStatus != null and map.ticketsWorkStatus != ''">
|
||||
and drt.tickets_work_status = #{map.ticketsWorkStatus}
|
||||
</if>
|
||||
|
@ -212,11 +212,19 @@ public class SysLoginController {
|
||||
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
|
||||
authLoginReqVO.setUsername(loginBody.getUsername());
|
||||
authLoginReqVO.setPassword(loginBody.getPassword());
|
||||
|
||||
AuthLoginRespVO login = loginService.login(authLoginReqVO);
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("accessToken",login.getAccessToken());
|
||||
map.put("expiresTime",login.getExpiresTime());
|
||||
map.put("refreshToken",login.getRefreshToken());
|
||||
map.put("userId",login.getUserId());
|
||||
if(org.apache.commons.lang3.StringUtils.isEmpty(user.getMobile())){
|
||||
// 借用此字段设置需要填写手机号标志 为1时弹出验证手机号页面
|
||||
authLoginReqVO.setSocialState("1");
|
||||
map.put("needMobile","1");
|
||||
}else{
|
||||
map.put("needMobile","0");
|
||||
}
|
||||
return success(loginService.login(authLoginReqVO));
|
||||
return success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,6 +145,7 @@ public class YudaoWebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET,"/admin-api/shop/region/**").permitAll()
|
||||
// 微信支付接口
|
||||
.antMatchers("/admin-api/notify/**").permitAll()
|
||||
.antMatchers("/userClient/pay/**").permitAll()
|
||||
.antMatchers("/admin-api/websocket/**").permitAll()
|
||||
// 小程序首页
|
||||
.antMatchers("/admin-api/system/notice/listWx","/admin-api/system/swiper/listWx","/admin-api/system/shopconfig/listWx").permitAll()
|
||||
|
@ -67,7 +67,6 @@ flowable:
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
@ -279,7 +278,7 @@ yudao:
|
||||
- /admin-api/rescue/loginJcApp
|
||||
- /admin-api/system/tenant/getListByWebsite
|
||||
- /admin-api/websocket/**
|
||||
- /admin-api/system/dict-data/type
|
||||
- /userClient/pay/**
|
||||
ignore-tables:
|
||||
- system_tenant
|
||||
- system_tenant_package
|
||||
|
Loading…
Reference in New Issue
Block a user