feat(transaction): 微信商户新增APPID功能
- 添加微信商户新增APPID请求和响应对象- 实现微信商户新增APPID接口调用 - 更新商品信息相关代码,增加删除标志字段- 优化品牌、商品分类、SKU等实体类结构 -调整商品信息查询逻辑,增加租户信息判断
This commit is contained in:
parent
765efb0cd5
commit
1a859a9337
@ -32,7 +32,7 @@ public class AppProductController {
|
||||
|
||||
@Tag(name ="获取商品信息详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") Long id) {
|
||||
public R<ProductVO> getInfo(@PathVariable("id") Long id) {
|
||||
return R.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,9 @@ import com.wzj.soopin.goods.domain.vo.ProductVO;
|
||||
import org.dromara.common.web.core.IBusiness;
|
||||
|
||||
public interface IProductBusiness extends IBusiness<ProductVO, ProductBo> {
|
||||
|
||||
ProductVO info(Long id);
|
||||
|
||||
boolean audit(Long id, Integer authFlag, String reasons);
|
||||
boolean publish(Long id, Integer publishStatus);
|
||||
/**
|
||||
|
@ -14,7 +14,6 @@ import com.wzj.soopin.goods.service.ProductService;
|
||||
import com.wzj.soopin.goods.service.SkuService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BusinessImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -41,15 +40,25 @@ public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductCon
|
||||
return productService.getList(bo, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品信息
|
||||
*
|
||||
* @param id 商品信息主键
|
||||
* @return 商品信息
|
||||
*/
|
||||
@Override
|
||||
public ProductVO info(Long id) {
|
||||
return productService.selectById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean save(ProductBo bo) {
|
||||
|
||||
Product product = converter.toPo(bo);
|
||||
product.setType(1);
|
||||
product.setSales("0");
|
||||
product.setTenantId(TenantHelper.getTenantId());
|
||||
productService.saveOrUpdate(product);
|
||||
boolean result = productService.saveOrUpdate(product);
|
||||
//清理掉旧的SKU
|
||||
skuService.remove(new LambdaQueryWrapper<Sku>().eq(Sku::getProductId, product.getId()));
|
||||
// 2. 保存SKU列表
|
||||
@ -62,10 +71,10 @@ public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductCon
|
||||
return sku;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
skuService.saveBatch(skus);
|
||||
result = skuService.saveBatch(skus);
|
||||
}
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,11 +4,10 @@ package com.wzj.soopin.goods.controller;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wzj.soopin.goods.business.IProductBusiness;
|
||||
import com.wzj.soopin.goods.convert.ProductConvert;
|
||||
import com.wzj.soopin.goods.domain.bo.ProductBo;
|
||||
import com.wzj.soopin.goods.domain.entity.Product;
|
||||
import com.wzj.soopin.goods.domain.vo.ProductVO;
|
||||
import com.wzj.soopin.goods.service.ProductService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
@ -25,7 +24,7 @@ import java.util.List;
|
||||
* @author zcc
|
||||
* @date 2022-11-28
|
||||
*/
|
||||
@Tag(name ="商品信息接口列表")
|
||||
@Tag(name ="商品")
|
||||
@RestController
|
||||
@RequestMapping("/pms/product")
|
||||
@RequiredArgsConstructor
|
||||
@ -33,14 +32,14 @@ public class ProductController extends BaseController {
|
||||
|
||||
private final IProductBusiness business;
|
||||
|
||||
@Tag(name ="查询商品信息列表")
|
||||
@Operation(summary = "查询商品信息列表")
|
||||
@PostMapping("list")
|
||||
public R<IPage<ProductVO>> list(@RequestBody ProductBo bo) {
|
||||
return R.ok(business.page(bo));
|
||||
}
|
||||
|
||||
|
||||
@Tag(name ="导出商品信息列表")
|
||||
@Operation(summary = "导出商品信息列表")
|
||||
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("export")
|
||||
public R<String> export(ProductBo query) {
|
||||
@ -49,20 +48,20 @@ public class ProductController extends BaseController {
|
||||
return R.ok(util.writeExcel(list, "商品信息数据"));
|
||||
}
|
||||
|
||||
@Tag(name ="获取商品信息详细信息")
|
||||
@Operation(summary = "获取商品信息详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") Long id) {
|
||||
public R<ProductVO> getInfo(@PathVariable("id") Long id) {
|
||||
return R.ok(business.info(id));
|
||||
}
|
||||
|
||||
@Tag(name ="新增商品信息")
|
||||
@Operation(summary = "新增商品信息")
|
||||
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public R add(@RequestBody ProductBo bo) {
|
||||
return R.ok(business.save(bo));
|
||||
}
|
||||
|
||||
@Tag(name ="修改商品信息")
|
||||
@Operation
|
||||
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public R edit(@RequestBody ProductBo bo) {
|
||||
@ -70,7 +69,7 @@ public class ProductController extends BaseController {
|
||||
return R.ok(business.save(bo));
|
||||
}
|
||||
|
||||
@Tag(name = "删除商品信息")
|
||||
@Operation(summary = "删除商品信息")
|
||||
@Log(title = "商品信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public R remove(@PathVariable Long id) {
|
||||
@ -78,7 +77,7 @@ public class ProductController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Tag(name ="审核商品")
|
||||
@Operation(summary = "审核商品")
|
||||
@Log(title = "审核商品", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/audit")
|
||||
public R audit( @RequestParam Long id,
|
||||
@ -87,14 +86,14 @@ public class ProductController extends BaseController {
|
||||
return R.ok(business.audit(id,authFlag,reasons));
|
||||
}
|
||||
|
||||
@Tag(name ="上下架商品")
|
||||
@Operation(summary = "上下架商品")
|
||||
@Log(title = "上下架商品", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/publish")
|
||||
public R publish( @RequestParam Long id,
|
||||
@RequestParam Integer publishStatus) {
|
||||
return R.ok(business.publish(id,publishStatus));
|
||||
}
|
||||
@Tag(name ="查询商品信息列表")
|
||||
@Operation(summary = "查询商品信息列表")
|
||||
@PostMapping("/recommend")
|
||||
public R<IPage<ProductVO>> recommend(@RequestBody Page<Product> page) {
|
||||
return R.ok(business.getRecommendPage(page));
|
||||
|
@ -1,8 +1,12 @@
|
||||
package com.wzj.soopin.goods.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.dromara.common.core.domain.model.BaseAudit;
|
||||
import org.dromara.common.excel.annotation.Excel;
|
||||
|
||||
@ -35,4 +39,10 @@ public class Brand extends BaseAudit {
|
||||
@Schema(description = "品牌logo")
|
||||
@Excel(name = "品牌logo")
|
||||
private String logo;
|
||||
|
||||
@Schema(description = "删除标志(0代表存在,1代表删除)")
|
||||
@Excel(name = "删除标志(0代表存在,1代表删除)")
|
||||
@TableLogic(value ="0", delval = "1")
|
||||
@TableField(value ="del_flag",fill = FieldFill.INSERT, jdbcType = JdbcType.CHAR)
|
||||
private String delFlag;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.dromara.common.core.domain.model.BaseAudit;
|
||||
import org.dromara.common.excel.annotation.Excel;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
@ -115,5 +114,5 @@ public class Product extends BaseEntity {
|
||||
@Excel(name = "删除标志(0代表存在,1代表删除)")
|
||||
@TableLogic(value ="0", delval = "1")
|
||||
@TableField(value ="del_flag",fill = FieldFill.INSERT, jdbcType = JdbcType.CHAR)
|
||||
private Integer delFlag;
|
||||
private String delFlag;
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package com.wzj.soopin.goods.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.dromara.common.core.domain.model.BaseAudit;
|
||||
import org.dromara.common.excel.annotation.Excel;
|
||||
|
||||
@ -43,4 +47,10 @@ public class ProductCategory extends BaseAudit {
|
||||
@Schema(description = "图标")
|
||||
@Excel(name = "图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "删除标志(0代表存在,1代表删除)")
|
||||
@Excel(name = "删除标志(0代表存在,1代表删除)")
|
||||
@TableLogic(value ="0", delval = "1")
|
||||
@TableField(value ="del_flag",fill = FieldFill.INSERT, jdbcType = JdbcType.CHAR)
|
||||
private String delFlag;
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.wzj.soopin.goods.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.dromara.common.core.domain.model.BaseAudit;
|
||||
import org.dromara.common.excel.annotation.Excel;
|
||||
|
||||
@ -51,4 +55,10 @@ public class Sku extends BaseAudit {
|
||||
@Schema(description = "租户id")
|
||||
@Excel(name = "租户id")
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "删除标志(0代表存在,1代表删除)")
|
||||
@Excel(name = "删除标志(0代表存在,1代表删除)")
|
||||
@TableLogic(value ="0", delval = "1")
|
||||
@TableField(value ="del_flag",fill = FieldFill.INSERT, jdbcType = JdbcType.CHAR)
|
||||
private String delFlag;
|
||||
}
|
||||
|
@ -136,5 +136,8 @@ public class ProductVO extends BaseAudit {
|
||||
@Schema(description = "店铺名称")
|
||||
private String storeName;
|
||||
|
||||
@Schema(description = "是否可下单")
|
||||
private boolean canOrder;
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,19 +3,11 @@ package com.wzj.soopin.goods.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wzj.soopin.goods.domain.entity.Brand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 品牌管理Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface BrandMapper extends BaseMapper<Brand> {
|
||||
/**
|
||||
* 查询品牌管理列表
|
||||
*
|
||||
* @param brand 品牌管理
|
||||
* @return 品牌管理集合
|
||||
*/
|
||||
List<Brand> selectByEntity(Brand brand);
|
||||
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {
|
||||
/**
|
||||
* 查询商品分类列表
|
||||
*
|
||||
* @param productCategory 商品分类
|
||||
* @return 商品分类集合
|
||||
*/
|
||||
List<ProductCategory> selectByEntity(ProductCategory productCategory);
|
||||
|
||||
/**
|
||||
* 查询所有子分类
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.wzj.soopin.goods.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -10,8 +9,6 @@ import com.wzj.soopin.goods.domain.vo.ProductVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -23,13 +20,6 @@ import java.util.Map;
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductMapper extends BaseMapper<Product> {
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*
|
||||
* @param product 商品信息
|
||||
* @return 商品信息集合
|
||||
*/
|
||||
List<Product> selectByEntity(Product product);
|
||||
|
||||
|
||||
Page<ProductVO> getlist(@Param("page") Page<Product> page, @Param("query") ProductBo query);
|
||||
|
@ -20,13 +20,6 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SkuMapper extends BaseMapper<Sku> {
|
||||
/**
|
||||
* 查询sku信息列表
|
||||
*
|
||||
* @param sku sku信息
|
||||
* @return sku信息集合
|
||||
*/
|
||||
List<Sku> selectByEntity(Sku sku);
|
||||
|
||||
int updateStockById(@Param("skuId")Long skuId, @Param("optDate")LocalDateTime optDate, @Param("quantity")Integer quantity);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.wzj.soopin.goods.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -10,18 +11,15 @@ import com.wzj.soopin.goods.domain.entity.ProductCategory;
|
||||
import com.wzj.soopin.goods.domain.vo.ProductVO;
|
||||
import com.wzj.soopin.goods.mapper.ProductCategoryMapper;
|
||||
import com.wzj.soopin.goods.mapper.ProductMapper;
|
||||
import com.wzj.soopin.goods.mapper.SkuMapper;
|
||||
import com.wzj.soopin.goods.service.ProductService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.system.mapper.SysDeptMapper;
|
||||
import org.dromara.system.mapper.SysTenantMapper;
|
||||
import org.dromara.system.mapper.SysUserTenantMapper;
|
||||
import org.dromara.system.domain.vo.SysTenantVo;
|
||||
import org.dromara.system.service.ISysTenantService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品信息Service业务层处理
|
||||
@ -37,10 +35,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
|
||||
private final ProductMapper productMapper;
|
||||
private final ProductCategoryMapper productCategoryMapper;
|
||||
private final SkuMapper skuMapper;
|
||||
private final SysTenantMapper sysTenantMapper;
|
||||
private final SysDeptMapper sysDeptMapper;
|
||||
private final SysUserTenantMapper sysUserTenantMapper;
|
||||
private final ISysTenantService sysTenantService;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ProductVO> getList(ProductBo query, Page<Product> page) {
|
||||
@ -66,7 +62,10 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
*/
|
||||
@Override
|
||||
public ProductVO selectById(Long id) {
|
||||
return TenantHelper.ignore(() -> productMapper.selectProductWithSkus(id));
|
||||
ProductVO productVO = TenantHelper.ignore(() -> productMapper.selectProductWithSkus(id));
|
||||
SysTenantVo sysTenantVo = sysTenantService.queryByTenantId(productVO.getTenantId());
|
||||
productVO.setCanOrder(StrUtil.isNotBlank(sysTenantVo.getMchtCode()));
|
||||
return productVO;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?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.wzj.soopin.goods.mapper.BrandMapper">
|
||||
|
||||
<resultMap type="Brand" id="BrandResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="showStatus" column="show_status"/>
|
||||
<result property="logo" column="logo"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBrandVo">
|
||||
select id, name, sort, show_status, logo, create_by, create_time, update_by, update_time from pms_brand
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="Brand" resultMap="BrandResult">
|
||||
<include refid="selectBrandVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="sort != null "> and sort = #{sort}</if>
|
||||
<if test="showStatus != null "> and show_status = #{showStatus}</if>
|
||||
<if test="logo != null and logo != ''"> and logo = #{logo}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -4,37 +4,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wzj.soopin.goods.mapper.ProductCategoryMapper">
|
||||
|
||||
<resultMap type="ProductCategory" id="ProductCategoryResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="level" column="level"/>
|
||||
<result property="showStatus" column="show_status"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="icon" column="icon"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectProductCategoryVo">
|
||||
select id, parent_id, name, level, show_status, sort, icon, create_by, create_time, update_by, update_time from pms_product_category
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="ProductCategory" resultMap="ProductCategoryResult">
|
||||
<include refid="selectProductCategoryVo"/>
|
||||
<where>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="level != null "> and level = #{level}</if>
|
||||
<if test="showStatus != null "> and show_status = #{showStatus}</if>
|
||||
<if test="sort != null "> and sort = #{sort}</if>
|
||||
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -4,58 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wzj.soopin.goods.mapper.ProductMapper">
|
||||
|
||||
<resultMap type="Product" id="ProductResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="brandId" column="brand_id"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
<result property="outProductId" column="out_product_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="pic" column="pic"/>
|
||||
<result property="albumPics" column="album_pics"/>
|
||||
<result property="publishStatus" column="publish_status"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="weight" column="weight"/>
|
||||
<result property="detailHtml" column="detail_html"/>
|
||||
<result property="detailMobileHtml" column="detail_mobile_html"/>
|
||||
<result property="brandName" column="brand_name"/>
|
||||
<result property="productCategoryName" column="product_category_name"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectProductVo">
|
||||
select id, brand_id, category_id, out_product_id, name, pic, album_pics, publish_status, sort, price, unit, weight, detail_html, detail_mobile_html, brand_name, product_category_name, create_by, create_time, update_by, update_time from pms_product
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="Product" resultMap="ProductResult">
|
||||
<include refid="selectProductVo"/>
|
||||
<where>
|
||||
<if test="brandId != null "> and brand_id = #{brandId}</if>
|
||||
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||
<if test="outProductId != null and outProductId != ''"> and out_product_id = #{outProductId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="pic != null and pic != ''"> and pic = #{pic}</if>
|
||||
<if test="albumPics != null and albumPics != ''"> and album_pics = #{albumPics}</if>
|
||||
<if test="publishStatus != null "> and publish_status = #{publishStatus}</if>
|
||||
<if test="sort != null "> and sort = #{sort}</if>
|
||||
<if test="price != null "> and price = #{price}</if>
|
||||
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
|
||||
<if test="weight != null "> and weight = #{weight}</if>
|
||||
<if test="detailHtml != null and detailHtml != ''"> and detail_html = #{detailHtml}</if>
|
||||
<if test="detailMobileHtml != null and detailMobileHtml != ''"> and detail_mobile_html = #{detailMobileHtml}</if>
|
||||
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
|
||||
<if test="productCategoryName != null and productCategoryName != ''"> and product_category_name like concat('%', #{productCategoryName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getlist" resultMap="ProductWithSkusResultMap">
|
||||
SELECT
|
||||
p.*,
|
||||
@ -96,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="query.categoryId != null">
|
||||
AND p.category_id = #{query.categoryId}
|
||||
</if>
|
||||
and p.del_flag = '0' and s.del_flag = '0'
|
||||
</where>
|
||||
|
||||
ORDER BY
|
||||
@ -124,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
pms_sku s ON p.id = s.product_id
|
||||
WHERE
|
||||
p.id = #{id}
|
||||
and p.del_flag = '0'
|
||||
and s.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="getProduct" resultType="com.wzj.soopin.goods.domain.vo.ProductVO">
|
||||
|
@ -5,26 +5,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!--suppress MybatisPlusMapperXmlInspection -->
|
||||
<mapper namespace="com.wzj.soopin.goods.mapper.SkuMapper">
|
||||
|
||||
<resultMap type="Sku" id="SkuResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="productId" column="product_id"/>
|
||||
<result property="outSkuId" column="out_sku_id"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="pic" column="pic"/>
|
||||
<result property="spData" column="sp_data"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSkuVo">
|
||||
select id, product_id, out_sku_id, price, pic, sp_data, create_by, create_time, update_by, update_time from pms_sku
|
||||
</sql>
|
||||
<update id="updateStockById">
|
||||
update
|
||||
pms_sku
|
||||
@ -34,17 +14,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{skuId}
|
||||
</update>
|
||||
|
||||
<select id="selectByEntity" parameterType="Sku" resultMap="SkuResult">
|
||||
<include refid="selectSkuVo"/>
|
||||
<where>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
<if test="outSkuId != null and outSkuId != ''"> and out_sku_id = #{outSkuId}</if>
|
||||
<if test="price != null "> and price = #{price}</if>
|
||||
<if test="pic != null and pic != ''"> and pic = #{pic}</if>
|
||||
<if test="spData != null and spData != ''"> and sp_data = #{spData}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getlist" resultType="com.wzj.soopin.goods.domain.vo.SkuVO">
|
||||
SELECT
|
||||
s.id,
|
||||
|
@ -181,5 +181,8 @@ public class SysTenantVo implements Serializable {
|
||||
@Schema(description = "所属代理商")
|
||||
private String agencyTenantId;
|
||||
|
||||
@Schema(description = "易生分配的商户编码")
|
||||
private String mchtCode;
|
||||
|
||||
|
||||
}
|
||||
|
@ -110,4 +110,16 @@ public interface SysTenantMapper extends BaseMapperPlus<SysTenant, SysTenantVo>
|
||||
SysTenant queryByDeptId(@Param("deptId") Long deptId);
|
||||
|
||||
IPage<SysReferenceVO> getReferenceList(@Param("page")Page<Object> page, @Param("query") SysReferenceBo query);
|
||||
|
||||
@Select("SELECT " +
|
||||
" st.*, " +
|
||||
" ste.mcht_code " +
|
||||
"FROM " +
|
||||
" sys_tenant st " +
|
||||
" LEFT JOIN sys_tenant_extend ste ON st.tenant_id = ste.tenant_id " +
|
||||
"WHERE " +
|
||||
" st.tenant_id = #{tenantId} " +
|
||||
" AND st.del_flag = 0 " +
|
||||
" LIMIT 1")
|
||||
SysTenantVo getTenantInfoByTenantId(@Param("tenantId") String tenantId);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
@Cacheable(cacheNames = CacheNames.SYS_TENANT, key = "#tenantId")
|
||||
@Override
|
||||
public SysTenantVo queryByTenantId(String tenantId) {
|
||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysTenant>().eq(SysTenant::getTenantId, tenantId).last("LIMIT 1"));
|
||||
return baseMapper.getTenantInfoByTenantId(tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,6 +11,7 @@ import com.wzj.soopin.transaction.domain.bo.easypay.separate.apply.resp.Separate
|
||||
import com.wzj.soopin.transaction.domain.vo.EasypayTransResultVO;
|
||||
import com.wzj.soopin.transaction.domain.vo.EasypayPrePayVO;
|
||||
import com.wzj.soopin.transaction.service.IEasypayService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
@ -29,6 +30,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 易生支付
|
||||
*/
|
||||
@Tag(name = "易生支付")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/trans/easypay")
|
||||
@ -135,4 +137,17 @@ public class TransEasypayController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信商户新增APPID
|
||||
*
|
||||
* @param subMchtCode 微信子商户号
|
||||
*/
|
||||
@PostMapping("/addSubAppidConfig")
|
||||
@SaIgnore
|
||||
public R addSubAppidConfig(@RequestParam("subMchtCode") String subMchtCode) throws IOException {
|
||||
easypayService.addSubAppidConfig(subMchtCode);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.wzj.soopin.transaction.domain.bo.easypay.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 微信商户新增APPID请求体
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class AddSubAppidConfigReqBody {
|
||||
/**
|
||||
* 易生商户号
|
||||
*/
|
||||
private String mchtCode;
|
||||
/**
|
||||
* subAppid,绑定特约商户或渠道公众号、小程序、APP支付等对应的APPID,支持多个绑定,使用 , 隔开
|
||||
*/
|
||||
private String subAppId;
|
||||
/**
|
||||
* 微信子商户号
|
||||
*/
|
||||
private String subMchtCode;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.wzj.soopin.transaction.domain.bo.easypay.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 微信商户新增APPID响应体
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class AddSubAppidConfigRespBody {
|
||||
/**
|
||||
* 返回码
|
||||
*/
|
||||
private String retCode;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String retMsg;
|
||||
|
||||
}
|
@ -81,6 +81,12 @@ public interface IEasypayService {
|
||||
*/
|
||||
boolean separateRefund(SeparateRefundBO separateRefundBO);
|
||||
|
||||
/**
|
||||
* 微信商户新增APPID
|
||||
* @param subMchtCode
|
||||
*/
|
||||
void addSubAppidConfig(String subMchtCode);
|
||||
|
||||
/**
|
||||
* 获取易生账户
|
||||
* @param memberId
|
||||
|
@ -29,6 +29,8 @@ import com.wzj.soopin.transaction.config.EasypayConfig;
|
||||
import com.wzj.soopin.transaction.config.WechatMiniProgramConfig;
|
||||
import com.wzj.soopin.transaction.domain.bo.*;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.*;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.config.AddSubAppidConfigReqBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.config.AddSubAppidConfigRespBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.merchant.add.*;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.merchant.binding.MerchantBindingReqBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.merchant.pictureUpload.MerchantPicUploadReqBody;
|
||||
@ -43,6 +45,7 @@ import com.wzj.soopin.transaction.domain.bo.easypay.separate.apply.resp.Separate
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.separate.apply.resp.SeparateRespOrderInfo;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.separate.query.req.SeparateQueryReqBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.separate.query.resp.SeparateQueryRespBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.separate.refund.req.SeparateRefundReqBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.separate.refund.resp.SeparateRefundRespBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.trade.jsapi.req.*;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.trade.jsapi.resp.JsApiRespBody;
|
||||
@ -51,12 +54,13 @@ import com.wzj.soopin.transaction.domain.bo.easypay.trade.jsapi.resp.WxJsApiResp
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.trade.query.req.TradeQueryReqBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.trade.query.resp.TradeQueryRespBody;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.trade.query.resp.TradeQueryRespOrderInfo;
|
||||
import com.wzj.soopin.transaction.domain.bo.easypay.separate.refund.req.SeparateRefundReqBody;
|
||||
import com.wzj.soopin.transaction.domain.entity.WxAuthResponse;
|
||||
import com.wzj.soopin.transaction.domain.po.Divide;
|
||||
import com.wzj.soopin.transaction.domain.po.DivideDetail;
|
||||
import com.wzj.soopin.transaction.domain.po.PayOrder;
|
||||
import com.wzj.soopin.transaction.domain.vo.*;
|
||||
import com.wzj.soopin.transaction.domain.vo.EasypayAccountVO;
|
||||
import com.wzj.soopin.transaction.domain.vo.EasypayPrePayVO;
|
||||
import com.wzj.soopin.transaction.domain.vo.EasypayTransResultVO;
|
||||
import com.wzj.soopin.transaction.enums.DivideStatus;
|
||||
import com.wzj.soopin.transaction.enums.TransState;
|
||||
import com.wzj.soopin.transaction.enums.easypay.*;
|
||||
@ -1039,6 +1043,48 @@ public class EasypayServiceImpl implements IEasypayService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addSubAppidConfig(String subMchtCode) {
|
||||
EasyPayRequestHeader reqHeader = generateEasyPayRequestHeader();
|
||||
AddSubAppidConfigReqBody addSubAppidConfigReqBody = AddSubAppidConfigReqBody.builder()
|
||||
.mchtCode(easypayConfig.getMchtCode())
|
||||
.subMchtCode(subMchtCode)
|
||||
.subAppId(wechatMiniProgramConfig.getAppId())
|
||||
.build();
|
||||
String reqSign = getSignStr(reqHeader, addSubAppidConfigReqBody);
|
||||
EasyPayRequest easyRequest = EasyPayRequest.builder()
|
||||
.reqHeader(reqHeader)
|
||||
.reqBody(addSubAppidConfigReqBody)
|
||||
.reqSign(reqSign)
|
||||
.build();
|
||||
log.debug("调用易生[微信商户新增APPID]接口请求:{}", JSONObject.toJSONString(easyRequest));
|
||||
String url = StrBuilder.create(easypayConfig.getApiPathPrefix()).append("/merchant/channel/wx/addSubAppidConfig").toString();
|
||||
String body = HttpRequest.post(url)
|
||||
.timeout(3000)
|
||||
.body(JSON.toJSONString(easyRequest))
|
||||
.execute()
|
||||
.body();
|
||||
log.debug("调用易生[微信商户新增APPID]接口响应:{}", body);
|
||||
EasyPayResponse easyPayResponse = JSONObject.parseObject(body, EasyPayResponse.class);
|
||||
if (StrUtil.equals(RSP_HEADER_OK, easyPayResponse.getRspHeader().getRspCode())) {
|
||||
verify(easyPayResponse.getRspHeader(), easyPayResponse.getRspBody(), easyPayResponse.getRspSign());
|
||||
AddSubAppidConfigRespBody respBody = JSON.parseObject(JSONObject.toJSONString(easyPayResponse.getRspBody()), AddSubAppidConfigRespBody.class);
|
||||
if (StrUtil.equals(RSP_BODY_RESP_OK, respBody.getRetCode())) {
|
||||
log.info("易生[微信商户新增APPID]成功:{}", respBody.getRetMsg());
|
||||
} else {
|
||||
log.error("易生[微信商户新增APPID]失败:{}", respBody.getRetMsg());
|
||||
throw new ServiceException("易生[微信商户新增APPID]失败:" + respBody.getRetMsg());
|
||||
}
|
||||
} else {
|
||||
log.error("易生[微信商户新增APPID]通讯失败:{}", easyPayResponse.getRspHeader().getRspInfo());
|
||||
throw new ServiceException("易生[微信商户新增APPID]通讯失败:" + easyPayResponse.getRspHeader().getRspInfo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public EasypayAccountVO getEasypayAccount(Long memberId) {
|
||||
return EasypayAccountVO.builder().balance(new BigDecimal(1000)).build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user