Compare commits
18 Commits
2ea473cc71
...
f4e61343da
Author | SHA1 | Date |
---|---|---|
|
f4e61343da | |
|
f4084ddbd2 | |
|
b2c95c67ed | |
|
c7f1992eb5 | |
|
30eb6bd1d9 | |
|
14e1e278b6 | |
|
c64db627a0 | |
|
102d1b4ba1 | |
|
4bdd939bb4 | |
|
5959d05bdb | |
|
d42906fd45 | |
|
bbce433af9 | |
|
d3a2436898 | |
|
12b87ec426 | |
|
045ebce1b3 | |
|
5a9df58a31 | |
|
ef4f81db8a | |
|
5f10ea17ed |
|
@ -89,4 +89,12 @@ public class MyApi {
|
|||
* 重要路径
|
||||
*/
|
||||
private String apiRouter;
|
||||
/**
|
||||
* 允许试用次数
|
||||
*/
|
||||
private Integer userCount;
|
||||
/**
|
||||
* 是否被购买
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,18 @@ public class Product extends BaseEntity {
|
|||
*/
|
||||
private String requestMethod;
|
||||
|
||||
/**
|
||||
* 允许试用次数
|
||||
*/
|
||||
private Integer userCount;
|
||||
/**
|
||||
* 是否被购买
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
public static Product addProductList(ProductAddReq productAddReq){
|
||||
return Product.builder()
|
||||
.productId(null)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package com.muyu.cloud.market.domin;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.market.domin
|
||||
* @Project:cloud-market
|
||||
* @name:UserProductCount
|
||||
* @Date:2024/9/3 10:12
|
||||
*/
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "user_product_count",autoResultMap = true)
|
||||
public class UserProductCount {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "test_id",type = IdType.AUTO)
|
||||
private Integer testId;
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
private long userId;
|
||||
/**
|
||||
* 产品Id
|
||||
*/
|
||||
private Integer productId;
|
||||
/**
|
||||
* 测试次数
|
||||
*/
|
||||
private Integer testCount;
|
||||
|
||||
public Integer getTestId() {
|
||||
return testId;
|
||||
}
|
||||
|
||||
public void setTestId(Integer testId) {
|
||||
this.testId = testId;
|
||||
}
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getTestCount() {
|
||||
return testCount;
|
||||
}
|
||||
|
||||
public void setTestCount(Integer testCount) {
|
||||
this.testCount = testCount;
|
||||
}
|
||||
}
|
|
@ -65,6 +65,14 @@ public class ProductListResp {
|
|||
* 重要路径
|
||||
*/
|
||||
private String apiRouter;
|
||||
/**
|
||||
* 允许试用次数
|
||||
*/
|
||||
private Integer userCount;
|
||||
/**
|
||||
* 是否被购买
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人",defaultValue = "muyu",type = "String")
|
||||
private String createBy;
|
||||
|
@ -94,6 +102,8 @@ public class ProductListResp {
|
|||
.returnFormat(product.getReturnFormat())
|
||||
.requestMethod(product.getRequestMethod())
|
||||
.apiRouter(product.getApiRouter())
|
||||
.remark(product.getRemark())
|
||||
.userCount(product.getUserCount())
|
||||
.createBy(product.getCreateBy())
|
||||
.createTime(product.getCreateTime())
|
||||
.build();
|
||||
|
|
|
@ -64,7 +64,7 @@ public class AliPayController {
|
|||
System.out.println("买家付款时间: " + params.get("gmt_payment"));
|
||||
System.out.println("买家付款金额: " + params.get("buyer_pay_amount"));
|
||||
// 更新订单未已支付
|
||||
ordersMapper.updateState(tradeNo, "已支付", gmtPayment, alipayTradeNo);
|
||||
// ordersMapper.updateByordersState1()
|
||||
}
|
||||
}
|
||||
return "success";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package com.muyu.cloud.market.controller;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.market.service.CompanyService;
|
||||
|
@ -81,4 +82,7 @@ public class CompanyController {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.cloud.market.controller;
|
||||
|
||||
import com.alibaba.nacos.api.naming.pojo.healthcheck.impl.Http;
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.cloud.market.domin.Orders;
|
||||
|
@ -104,7 +105,6 @@ public class OrdersController {
|
|||
return orderShowService.delByOrderId(ordersId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回显
|
||||
* 根据id查内容
|
||||
|
@ -118,14 +118,62 @@ public class OrdersController {
|
|||
}
|
||||
|
||||
//导出
|
||||
@RequestMapping("/getOutAll")
|
||||
public void getOutAll(@Validated @RequestBody HttpServletResponse response){
|
||||
@GetMapping("/getOutAll")
|
||||
@Operation(summary = "导出")
|
||||
public void gatOutAll(HttpServletResponse response){
|
||||
//创建工具类对象
|
||||
ExcelUtil<Orders> excelUtil =new ExcelUtil<>(Orders.class);
|
||||
//去数据库查询要导出来的数据
|
||||
List<Orders> outAll = orderShowService.getOutAll();
|
||||
|
||||
excelUtil.exportExcel(response,outAll ,"订单信息表");
|
||||
}
|
||||
|
||||
//选中导出
|
||||
@GetMapping("/getseleOut")
|
||||
@Operation(summary = "选中导出")
|
||||
public void selectOut (HttpServletResponse response,Integer[] ids){
|
||||
//创建
|
||||
ExcelUtil<Orders> excelUtil = new ExcelUtil<>(Orders.class);
|
||||
//去数据库查询要导出来的数据
|
||||
List<Orders> list = orderShowService.getOutAll();
|
||||
//调用工具类导出的方法
|
||||
excelUtil.exportExcel(response,list,"订单信息表");
|
||||
List<Orders> list = orderShowService.getseleOut(ids);
|
||||
|
||||
excelUtil.exportExcel(response,list,"订单信息选中导出");
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单修改支付状态1已付款后,更改该商品的销量
|
||||
* (0待支付,1已付款,2未付款,3.售后(申请退款) 4.已退款)
|
||||
*/
|
||||
//订单修改支付状
|
||||
@GetMapping("/updateByordersState1")
|
||||
@Operation(summary = "订单修改支付状态=1,更改该商品的销量", description = "根据orderid修改数据库字段支付状态为1,根据productId修改数据库销量")
|
||||
Result updateByordersState1ANDproductSales(@RequestParam("ordersId")Integer ordersId,@RequestParam("productId")Integer productId){
|
||||
return orderShowService.updateByordersState1ANDproductSales(ordersId, productId);
|
||||
}
|
||||
|
||||
@PostMapping("/updateByordersState2/{ordersId}")
|
||||
@Operation(summary = "订单修改支付状态=2", description = "根据orderid修改数据库字段支付状态为2")
|
||||
Result updateByordersState2(@Validated @PathVariable("ordersId") Integer ordersId) {
|
||||
try {
|
||||
return orderShowService.updateByordersState2(ordersId);
|
||||
} catch (Exception e) {
|
||||
return Result.error("更新订单状态失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//3.售后(申请退款)
|
||||
@PostMapping("/updateByordersState3/{ordersId}")
|
||||
@Operation(summary = "订单修改支付状态=3", description = "根据orderid修改数据库字段支付状态为3")
|
||||
Result updateByordersState3( @PathVariable("ordersId")Integer ordersId){
|
||||
return orderShowService.updateByordersState3(ordersId);
|
||||
}
|
||||
// 4.已退款
|
||||
@PostMapping("/updateByordersState4/{ordersId}")
|
||||
@Operation(summary = "订单修改支付状态=4", description = "根据orderid修改数据库字段支付状态为4")
|
||||
Result updateByordersState4(@Validated @PathVariable("ordersId")Integer ordersId){
|
||||
return orderShowService.updateByordersState4(ordersId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,6 +124,42 @@ public class ProductApiController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/ifbuy")
|
||||
@Operation(summary = "是否购买",description = "判断是否已经购买")
|
||||
public Result ifbuy(@Validated @RequestBody Product product){
|
||||
String selectremark = productApiService.selectremark(product);
|
||||
if (selectremark.equals("否")){
|
||||
return Result.error("尊敬的客户,由于您没有对此产品进行购买,我们会给您提供两次的测试机会,若您想要多次使用本产品,请先购买!");
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/reducetestcount")
|
||||
@Operation(summary = "测试次数-1",description = "测试次数-1")
|
||||
public void reducetestcount(@Validated @RequestBody Product product){
|
||||
Integer reducetestcount = productApiService.reducetestcount(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断测试次数
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/iftest")
|
||||
@Operation(summary = "判断测试次数是否<=0",description = "判断测试次数是否<=0")
|
||||
public Result iftest(@Validated @RequestBody Product product){
|
||||
Integer iftest = productApiService.iftest(product);
|
||||
return Result.success(iftest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package com.muyu.cloud.market.controller;
|
||||
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.UserProductCount;
|
||||
import com.muyu.cloud.market.service.ProducttestService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.market.controller
|
||||
* @Project:cloud-market
|
||||
* @name:ProducttestController
|
||||
* @Date:2024/9/3 10:16
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/producttest")
|
||||
@Tag(name = "产品测试",description = "产品测试相关操作")
|
||||
public class ProducttestController {
|
||||
@Autowired
|
||||
private ProducttestService producttestService;
|
||||
|
||||
|
||||
/**
|
||||
* 不同用户/方式的测试次数
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findcount")
|
||||
@Operation(summary = "不同用户/方式的测试次数",description = "不同用户/方式的测试次数")
|
||||
public Result findcount(@Validated @RequestBody UserProductCount userProductCount, HttpServletRequest request){
|
||||
UserProductCount findcount = producttestService.findcount(userProductCount, request);
|
||||
return Result.success(findcount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/reducetestcount")
|
||||
@Operation(summary = "测试次数-1",description = "测试次数-1")
|
||||
public void reducetestcount(@Validated @RequestBody UserProductCount userProductCount){
|
||||
Integer reducetestcount = producttestService.reducetestcount(userProductCount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.cloud.market.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.market.domin.Company;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
|
@ -13,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface CompanyMapper extends BaseMapper<Company> {
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.cloud.market.domin.Orders;
|
|||
import com.muyu.cloud.market.domin.req.OrdersAddReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersListReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersUpdReq;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
@ -67,19 +68,36 @@ public interface OrderShowMapper {
|
|||
Orders findAllById (Integer ordersId);
|
||||
|
||||
|
||||
/**
|
||||
* 订单修改支付状态1已付款后,更改该商品的销量
|
||||
* (0待支付,1已付款,2未付款,3.售后(申请退款) 4.已退款)
|
||||
*/
|
||||
//订单修改支付状
|
||||
Integer updateByordersState1(Integer ordersId);
|
||||
//更改该商品的销量
|
||||
Integer updateByproductSales(Integer productId);
|
||||
|
||||
void updateState(String tradeNo, String 已支付, String gmtPayment, String alipayTradeNo);
|
||||
//修改状态为 2未付款
|
||||
Integer updateByordersState2(Integer ordersId);
|
||||
|
||||
/**
|
||||
* 订单修改支付状态后,更改该商品的销量
|
||||
* 申请退款后的操作(审核表)
|
||||
* @param ordersId
|
||||
* @return
|
||||
*/
|
||||
//3.售后(申请退款--涉及到申请退款)
|
||||
Integer updateByordersState3(Integer ordersId);
|
||||
// 4.已退款
|
||||
Integer updateByordersState4(Integer ordersId);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//导出
|
||||
List<Orders> getOutAll();
|
||||
//选中导出
|
||||
List<Orders> getseleOut(@Param("ids") Integer[] ids);
|
||||
//搜索导出
|
||||
List<OrdersListReq> getsearOut(@Param("empName") String empName);
|
||||
List<Orders> getSeleOut(@Param("ids") Integer[] ids);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,22 @@ public interface ProductApiMapper extends BaseMapper<Product> {
|
|||
List<ChosehowpayResp> selectspecification(ChosehowpayResp chosehowpayResp);
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
String selectremark(Product product);
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
Integer reducetestcount(Product product);
|
||||
|
||||
Integer iftest(Product product);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.cloud.market.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.UserProductCount;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.market.mapper
|
||||
* @Project:cloud-market
|
||||
* @name:ProducttestMapper
|
||||
* @Date:2024/9/3 10:20
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProducttestMapper extends BaseMapper<UserProductCount> {
|
||||
|
||||
/**
|
||||
* 不同用户/方式的测试次数
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
UserProductCount findcount(UserProductCount userProductCount);
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
Integer reducetestcount(UserProductCount userProductCount);
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.cloud.market.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.market.domin.Company;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.CompanyListReq;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
@ -28,4 +29,10 @@ public interface CompanyService extends IService<Company> {
|
|||
*/
|
||||
User ifcompanyauthentication();
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.cloud.market.service;
|
|||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.cloud.market.domin.Orders;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.OrdersAddReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersListReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersUpdReq;
|
||||
|
@ -79,5 +80,29 @@ public interface OrderShowService {
|
|||
*/
|
||||
List<Orders> getOutAll();
|
||||
|
||||
List<Orders> getseleOut(Integer[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 获取登陆人信息
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 订单修改支付状态1已付款后,更改该商品的销量
|
||||
* (0待支付,1已付款,2未付款,3.售后(申请退款) 4.已退款)
|
||||
*/
|
||||
//订单修改支付状 //更改该商品的销量
|
||||
Result updateByordersState1ANDproductSales(Integer ordersId,Integer productId);
|
||||
|
||||
|
||||
|
||||
//修改状态为 2未付款
|
||||
Result updateByordersState2(Integer ordersId);
|
||||
//3.售后(申请退款)
|
||||
Result updateByordersState3(Integer ordersId);
|
||||
// 4.已退款
|
||||
Result updateByordersState4(Integer ordersId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -44,4 +44,24 @@ public interface ProductApiService extends IService<Product> {
|
|||
* @return
|
||||
*/
|
||||
List<ChosehowpayResp> selectspecification(ChosehowpayResp chosehowpayResp);
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
String selectremark(Product product);
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
Integer reducetestcount(Product product);
|
||||
|
||||
/*
|
||||
判断测试次数
|
||||
*/
|
||||
Integer iftest(Product product);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cloud.market.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.UserProductCount;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.market.service
|
||||
* @Project:cloud-market
|
||||
* @name:ProducttestService
|
||||
* @Date:2024/9/3 10:19
|
||||
*/
|
||||
public interface ProducttestService extends IService<UserProductCount> {
|
||||
|
||||
/**
|
||||
* 不同用户/方式的测试次数
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
UserProductCount findcount(UserProductCount userProductCount, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
Integer reducetestcount(UserProductCount userProductCount);
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.cloud.market.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.market.domin.Company;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.market.mapper.CompanyMapper;
|
||||
|
@ -91,4 +92,5 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||
User user = userService.getById(userid);
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,16 @@ package com.muyu.cloud.market.service.impl;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.cloud.market.domin.Orders;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.OrdersAddReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersListReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersUpdReq;
|
||||
import com.muyu.cloud.market.mapper.OrderShowMapper;
|
||||
import com.muyu.cloud.market.service.OrderShowService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -18,9 +21,13 @@ import java.util.List;
|
|||
@Service
|
||||
@Log4j2
|
||||
public class OrderShowServiceImpl implements OrderShowService {
|
||||
|
||||
@Resource
|
||||
private OrderShowMapper orderShowMapper;
|
||||
@Autowired
|
||||
private HttpServletResponse response;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
|
@ -123,13 +130,64 @@ public class OrderShowServiceImpl implements OrderShowService {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Orders selectByOrderNo(String ordersNum) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Orders> getOutAll() {
|
||||
return orderShowMapper.getOutAll();
|
||||
}
|
||||
|
||||
public Orders selectByOrderNo(String ordersNum) {
|
||||
return orderShowMapper.selectByordersNum(ordersNum);
|
||||
@Override
|
||||
public List<Orders> getseleOut(Integer[] ids) {
|
||||
return orderShowMapper.getSeleOut(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateByordersState1ANDproductSales(Integer ordersId, Integer productId) {
|
||||
|
||||
Integer updateByordersState1 = orderShowMapper.updateByordersState1(ordersId);
|
||||
|
||||
if(updateByordersState1 > 0){
|
||||
Integer updateByproductSales = orderShowMapper.updateByproductSales(productId);
|
||||
if(updateByproductSales > 0){
|
||||
log.info("订单信息+产品信息",ordersId,productId);
|
||||
Result.success(200,"修改成功");
|
||||
}
|
||||
}
|
||||
return Result.error(402,"修改失败");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result updateByordersState2(Integer ordersId) {
|
||||
Integer updateByordersState2 = orderShowMapper.updateByordersState2(ordersId);
|
||||
if(updateByordersState2 > 0){
|
||||
Result.success(ordersId,"修改成功");
|
||||
}
|
||||
return Result.error(402,"修改失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateByordersState3(Integer ordersId) {
|
||||
Integer updateByordersState3 = orderShowMapper.updateByordersState3(ordersId);
|
||||
if(updateByordersState3 > 0){
|
||||
return Result.success(ordersId,"修改成功");
|
||||
}
|
||||
return Result.error(402,"修改失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateByordersState4(Integer ordersId) {
|
||||
Integer updateByordersState4 = orderShowMapper.updateByordersState4(ordersId);
|
||||
if(updateByordersState4 > 0){
|
||||
return Result.success(ordersId,"修改成功");
|
||||
}
|
||||
return Result.error(402,"修改失败");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -99,4 +99,37 @@ public class ProductApiServiceImpl extends ServiceImpl<ProductApiMapper, Product
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String selectremark(Product product) {
|
||||
return productApiMapper.selectremark(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer reducetestcount(Product product) {
|
||||
Integer reducetestcount = productApiMapper.reducetestcount(product);
|
||||
return reducetestcount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
判断测试次数
|
||||
*/
|
||||
@Override
|
||||
public Integer iftest(Product product) {
|
||||
Integer iftest = productApiMapper.iftest(product);
|
||||
return iftest;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package com.muyu.cloud.market.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.UserProductCount;
|
||||
import com.muyu.cloud.market.mapper.ProducttestMapper;
|
||||
import com.muyu.cloud.market.service.ProducttestService;
|
||||
import com.muyu.common.security.service.TokenService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.market.service.impl
|
||||
* @Project:cloud-market
|
||||
* @name:ProducttestServiceImpl
|
||||
* @Date:2024/9/3 10:19
|
||||
*/
|
||||
@Service
|
||||
public class ProducttestServiceImpl extends ServiceImpl<ProducttestMapper, UserProductCount> implements ProducttestService {
|
||||
@Autowired
|
||||
private ProducttestMapper producttestMapper;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
||||
/**
|
||||
* 不同用户/方式的测试次数
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UserProductCount findcount(UserProductCount userProductCount, HttpServletRequest request) {
|
||||
String token = SecurityUtils.getToken();// 获取当前Token
|
||||
LoginUser loginUser = tokenService.getLoginUser(token); // 获取当前登录用户
|
||||
Long userid = loginUser.getUserid();
|
||||
userProductCount.setUserId(userid);
|
||||
return producttestMapper.findcount(userProductCount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param userProductCount
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer reducetestcount(UserProductCount userProductCount) {
|
||||
String token = SecurityUtils.getToken();// 获取当前Token
|
||||
LoginUser loginUser = tokenService.getLoginUser(token); // 获取当前登录用户
|
||||
Long userid = loginUser.getUserid();
|
||||
userProductCount.setUserId(userid);
|
||||
Integer iftest = producttestMapper.reducetestcount(userProductCount);
|
||||
return iftest;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,8 @@
|
|||
<result property="returnFormat" column="return_format"></result>
|
||||
<result property="requestMethod" column="request_method"></result>
|
||||
<result property="apiRouter" column="api_router"></result>
|
||||
<result property="remark" column="remark"></result>
|
||||
<result property="userCount" column="user_count"></result>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectmyapi">
|
||||
|
@ -37,7 +39,9 @@
|
|||
api_address,
|
||||
return_format,
|
||||
request_method,
|
||||
api_router
|
||||
api_router,
|
||||
remark,
|
||||
user_count
|
||||
FROM
|
||||
myapi
|
||||
LEFT JOIN product ON myapi.product_id = product.product_id
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
ORDER BY orders_launchdate DESC
|
||||
</select>
|
||||
|
||||
<!--添加订单到-->
|
||||
<!--添加订单-->
|
||||
<insert id="addOrdeds">
|
||||
INSERT INTO `orders`
|
||||
(`orders_num`, `orders_product`, `orders_user`, `orders_price`, `orders_specification`, `orders_state`, `orders_launchdate`)
|
||||
|
@ -62,6 +62,7 @@
|
|||
(#{ordersNum}, #{ordersProduct}, #{ordersUser}, #{ordersPrice}, #{ordersSpecification}, 0, NOW());
|
||||
</insert>
|
||||
|
||||
<!--修改订单数据-->
|
||||
<update id="updateOrders">
|
||||
UPDATE `orders` SET `orders`.`orders_product` = #{ordersProduct},
|
||||
`orders`.`orders_price` = #{ordersPrice},
|
||||
|
@ -70,23 +71,53 @@
|
|||
WHERE `orders`.`orders_id` = #{ordersId}
|
||||
</update>
|
||||
|
||||
<!-- 逻辑删除 改变字段状态 -->
|
||||
<!-- 逻辑删除 改变字段状态 为0 不存在 -->
|
||||
<update id="updateByeExist">
|
||||
UPDATE `orders` SET `orders`.`exist` = 0 WHERE `orders`.`orders_id` = #{ordersId}
|
||||
</update>
|
||||
<!-- 逻辑字段 修改字段状态 -->
|
||||
<!-- 逻辑复原 修改字段状态 为1 存在-->
|
||||
<update id="updateByExist">
|
||||
UPDATE `orders` SET `orders`.`exist` = 1 WHERE `orders`.`orders_id` = #{ordersId}
|
||||
</update>
|
||||
|
||||
<update id="updateState"></update>
|
||||
<!-- /**
|
||||
* 订单修改支付状态后,更改该商品的销量
|
||||
* (0待支付,1已付款,2未付款,3.售后(申请退款) 4.已退款)
|
||||
*/-->
|
||||
<update id="updateByordersState1">
|
||||
UPDATE `orders`
|
||||
SET `orders_state` = 1,
|
||||
WHERE `orders_id` = #{ordersId}
|
||||
</update>
|
||||
<update id="updateByproductSales">
|
||||
UPDATE `product`
|
||||
SET `product_sales` = product_sales + 1
|
||||
WHERE `product_id` = #{productId}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<update id="updateByordersState2">
|
||||
UPDATE `orders`
|
||||
SET `orders_state`= 2
|
||||
WHERE `orders_id`= #{ordersId}
|
||||
</update>
|
||||
<update id="updateByordersState3">
|
||||
UPDATE `orders`
|
||||
SET `orders_state`= 3
|
||||
WHERE `orders_id`= #{ordersId}
|
||||
</update>
|
||||
<update id="updateByordersState4">
|
||||
UPDATE `orders`
|
||||
SET `orders_state`= 4
|
||||
WHERE `orders_id`= #{ordersId}
|
||||
</update>
|
||||
|
||||
<!-- 彻底删除(根据orderid删除数据库字段)-->
|
||||
<delete id="delByOrderId">
|
||||
DELETE FROM `orders` WHERE `orders`.`orders_id` = #{ordersId}
|
||||
</delete>
|
||||
|
||||
|
||||
<!--订单回显: 根据ordersId回显数据-->
|
||||
<select id="findAllById" resultMap="goodsResult">
|
||||
<include refid="ordersSql"/>
|
||||
|
@ -95,12 +126,43 @@
|
|||
|
||||
<!-- 普通导出(测试版) -->
|
||||
<select id="getOutAll" resultType="com.muyu.cloud.market.domin.Orders">
|
||||
SELECT orders_id, orders_num, product_name, user_name, orders_price, orders_specification, orders_state, orders_launchdate,
|
||||
SELECT
|
||||
orders_id,
|
||||
orders_num,
|
||||
product_name,
|
||||
user_name,
|
||||
orders_price,
|
||||
orders_specification,
|
||||
orders_state,
|
||||
orders_launchdate
|
||||
FROM `orders`
|
||||
LEFT JOIN `product` ON `orders`.orders_product = `product`.product_id
|
||||
LEFT JOIN `sys_user` ON `orders`.orders_user = `sys_user`.user_id
|
||||
LEFT JOIN `product` ON `orders`.orders_product = `product`.product_id
|
||||
LEFT JOIN `sys_user` ON `orders`.orders_user =`sys_user`.sys_user_id
|
||||
ORDER BY orders_launchdate DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!--选中测试导出-->
|
||||
<select id="getSeleOut" resultType="com.muyu.cloud.market.domin.Orders">
|
||||
SELECT
|
||||
orders_id,
|
||||
orders_num,
|
||||
orders_name,
|
||||
user_name,
|
||||
order_price,
|
||||
orders_specification,
|
||||
orders_state,
|
||||
orders_launchdate
|
||||
FROM `orders`
|
||||
LEFT JOIN `product` ON `orders`.orders_product = `product`.product_id
|
||||
LEFT JOIN `sys_user` ON `orders`.orders_user =`sys_user`.sys_user_id
|
||||
WHERE
|
||||
`orders`.ordersId in (
|
||||
<foreach collection="ids" item="ordersId" separator=",">
|
||||
#{ordersId}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
<mapper namespace="com.muyu.cloud.market.mapper.ProductApiMapper">
|
||||
|
||||
|
||||
<select id="selectspecification" resultType="com.muyu.cloud.market.domin.resp.ChosehowpayResp">
|
||||
select
|
||||
product.product_id,
|
||||
|
@ -17,4 +18,14 @@
|
|||
left join product_specification on middle_specification_product.middle_specification=product_specification.product_specification_id
|
||||
WHERE product.product_id = #{productId}
|
||||
</select>
|
||||
<select id="selectremark" resultType="java.lang.String">
|
||||
SELECT remark from product where product_id=#{productId}
|
||||
</select>
|
||||
<select id="iftest" resultType="java.lang.Integer">
|
||||
SELECT product.user_count from product where product_id =#{productId}
|
||||
</select>
|
||||
|
||||
<update id="reducetestcount">
|
||||
update product set user_count=user_count-1 where product_id=#{productId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?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="com.muyu.cloud.market.mapper.ProducttestMapper">
|
||||
|
||||
<select id="findcount" resultType="com.muyu.cloud.market.domin.UserProductCount">
|
||||
SELECT
|
||||
sys_user.user_id,
|
||||
product.product_id,
|
||||
user_product_count.test_count
|
||||
FROM
|
||||
sys_user
|
||||
LEFT JOIN user_product_count on sys_user.user_id = user_product_count.user_id
|
||||
left join product on user_product_count.product_id=product.product_id
|
||||
<where>
|
||||
and user_product_count.user_id=#{userId}
|
||||
<if test="productId!=null">
|
||||
and user_product_count.product_id=#{productId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="reducetestcount">
|
||||
UPDATE `h6_cloud_server`.`user_product_count`
|
||||
SET `test_count` = `test_count`-1 WHERE `user_id` = #{userId} and `product_id` = #{productId};
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue