优化:支付功能(10550)

This commit is contained in:
2025-07-26 12:53:34 +08:00
parent b924d11892
commit 1593e834cc
68 changed files with 1250 additions and 3913 deletions

View File

@@ -0,0 +1,129 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.CmsStatisticsService;
import com.gxwebsoft.cms.entity.CmsStatistics;
import com.gxwebsoft.cms.param.CmsStatisticsParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 站点统计信息表控制器
*
* @author 科技小王子
* @since 2025-07-25 12:32:06
*/
@Api(tags = "站点统计信息表管理")
@RestController
@RequestMapping("/api/cms/cms-statistics")
public class CmsStatisticsController extends BaseController {
@Resource
private CmsStatisticsService cmsStatisticsService;
@PreAuthorize("hasAuthority('cms:cmsStatistics:list')")
@ApiOperation("分页查询站点统计信息表")
@GetMapping("/page")
public ApiResult<PageResult<CmsStatistics>> page(CmsStatisticsParam param) {
// 使用关联查询
return success(cmsStatisticsService.pageRel(param));
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:list')")
@ApiOperation("查询全部站点统计信息表")
@GetMapping()
public ApiResult<List<CmsStatistics>> list(CmsStatisticsParam param) {
// 使用关联查询
return success(cmsStatisticsService.listRel(param));
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:list')")
@ApiOperation("根据id查询站点统计信息表")
@GetMapping("/{id}")
public ApiResult<CmsStatistics> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(cmsStatisticsService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:save')")
@OperationLog
@ApiOperation("添加站点统计信息表")
@PostMapping()
public ApiResult<?> save(@RequestBody CmsStatistics cmsStatistics) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
cmsStatistics.setUserId(loginUser.getUserId());
}
if (cmsStatisticsService.save(cmsStatistics)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:update')")
@OperationLog
@ApiOperation("修改站点统计信息表")
@PutMapping()
public ApiResult<?> update(@RequestBody CmsStatistics cmsStatistics) {
if (cmsStatisticsService.updateById(cmsStatistics)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:remove')")
@OperationLog
@ApiOperation("删除站点统计信息表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (cmsStatisticsService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:save')")
@OperationLog
@ApiOperation("批量添加站点统计信息表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<CmsStatistics> list) {
if (cmsStatisticsService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:update')")
@OperationLog
@ApiOperation("批量修改站点统计信息表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<CmsStatistics> batchParam) {
if (batchParam.update(cmsStatisticsService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:cmsStatistics:remove')")
@OperationLog
@ApiOperation("批量删除站点统计信息表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (cmsStatisticsService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,5 +0,0 @@
package com.gxwebsoft.cms.dto;
public class CmsWebsiteConstants {
public static final String MP_APPID_KEY = "MpApp:";
}

View File

@@ -0,0 +1,124 @@
package com.gxwebsoft.cms.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 站点统计信息表
*
* @author 科技小王子
* @since 2025-07-25 12:32:06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "CmsStatistics对象", description = "站点统计信息表")
public class CmsStatistics implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "站点ID")
private Integer websiteId;
@ApiModelProperty(value = "用户总数")
private Integer userCount;
@ApiModelProperty(value = "订单总数")
private Integer orderCount;
@ApiModelProperty(value = "商品总数")
private Integer productCount;
@ApiModelProperty(value = "总销售额")
private BigDecimal totalSales;
@ApiModelProperty(value = "本月销售额")
private BigDecimal monthSales;
@ApiModelProperty(value = "今日销售额")
private BigDecimal todaySales;
@ApiModelProperty(value = "昨日销售额")
private BigDecimal yesterdaySales;
@ApiModelProperty(value = "本周销售额")
private BigDecimal weekSales;
@ApiModelProperty(value = "本年销售额")
private BigDecimal yearSales;
@ApiModelProperty(value = "今日订单数")
private Integer todayOrders;
@ApiModelProperty(value = "本月订单数")
private Integer monthOrders;
@ApiModelProperty(value = "今日新增用户")
private Integer todayUsers;
@ApiModelProperty(value = "本月新增用户")
private Integer monthUsers;
@ApiModelProperty(value = "今日访问量")
private Integer todayVisits;
@ApiModelProperty(value = "总访问量")
private Integer totalVisits;
@ApiModelProperty(value = "商户总数")
private Integer merchantCount;
@ApiModelProperty(value = "活跃用户数")
private Integer activeUsers;
@ApiModelProperty(value = "转化率(%)")
private BigDecimal conversionRate;
@ApiModelProperty(value = "平均订单金额")
private BigDecimal avgOrderAmount;
@ApiModelProperty(value = "统计日期")
private LocalDate statisticsDate;
@ApiModelProperty(value = "统计类型: 1日统计, 2月统计, 3年统计")
private Integer statisticsType;
@ApiModelProperty(value = "排序号")
private Integer sortNumber;
@ApiModelProperty(value = "操作用户ID")
private Integer userId;
@ApiModelProperty(value = "商户ID")
private Integer merchantId;
@ApiModelProperty(value = "状态: 0禁用, 1启用")
private Boolean status;
@ApiModelProperty(value = "是否删除: 0否, 1是")
@TableLogic
private Boolean deleted;
@ApiModelProperty(value = "租户ID")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.cms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.cms.entity.CmsStatistics;
import com.gxwebsoft.cms.param.CmsStatisticsParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 站点统计信息表Mapper
*
* @author 科技小王子
* @since 2025-07-25 12:32:06
*/
public interface CmsStatisticsMapper extends BaseMapper<CmsStatistics> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<CmsStatistics>
*/
List<CmsStatistics> selectPageRel(@Param("page") IPage<CmsStatistics> page,
@Param("param") CmsStatisticsParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<CmsStatistics> selectListRel(@Param("param") CmsStatisticsParam param);
}

View File

@@ -0,0 +1,120 @@
<?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.gxwebsoft.cms.mapper.CmsStatisticsMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM cms_statistics a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.websiteId != null">
AND a.website_id = #{param.websiteId}
</if>
<if test="param.userCount != null">
AND a.user_count = #{param.userCount}
</if>
<if test="param.orderCount != null">
AND a.order_count = #{param.orderCount}
</if>
<if test="param.productCount != null">
AND a.product_count = #{param.productCount}
</if>
<if test="param.totalSales != null">
AND a.total_sales = #{param.totalSales}
</if>
<if test="param.monthSales != null">
AND a.month_sales = #{param.monthSales}
</if>
<if test="param.todaySales != null">
AND a.today_sales = #{param.todaySales}
</if>
<if test="param.yesterdaySales != null">
AND a.yesterday_sales = #{param.yesterdaySales}
</if>
<if test="param.weekSales != null">
AND a.week_sales = #{param.weekSales}
</if>
<if test="param.yearSales != null">
AND a.year_sales = #{param.yearSales}
</if>
<if test="param.todayOrders != null">
AND a.today_orders = #{param.todayOrders}
</if>
<if test="param.monthOrders != null">
AND a.month_orders = #{param.monthOrders}
</if>
<if test="param.todayUsers != null">
AND a.today_users = #{param.todayUsers}
</if>
<if test="param.monthUsers != null">
AND a.month_users = #{param.monthUsers}
</if>
<if test="param.todayVisits != null">
AND a.today_visits = #{param.todayVisits}
</if>
<if test="param.totalVisits != null">
AND a.total_visits = #{param.totalVisits}
</if>
<if test="param.merchantCount != null">
AND a.merchant_count = #{param.merchantCount}
</if>
<if test="param.activeUsers != null">
AND a.active_users = #{param.activeUsers}
</if>
<if test="param.conversionRate != null">
AND a.conversion_rate = #{param.conversionRate}
</if>
<if test="param.avgOrderAmount != null">
AND a.avg_order_amount = #{param.avgOrderAmount}
</if>
<if test="param.statisticsDate != null">
AND a.statistics_date LIKE CONCAT('%', #{param.statisticsDate}, '%')
</if>
<if test="param.statisticsType != null">
AND a.statistics_type = #{param.statisticsType}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.CmsStatistics">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.CmsStatistics">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -0,0 +1,137 @@
package com.gxwebsoft.cms.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 站点统计信息表查询参数
*
* @author 科技小王子
* @since 2025-07-25 12:32:06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "CmsStatisticsParam对象", description = "站点统计信息表查询参数")
public class CmsStatisticsParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "站点ID")
@QueryField(type = QueryType.EQ)
private Integer websiteId;
@ApiModelProperty(value = "用户总数")
@QueryField(type = QueryType.EQ)
private Integer userCount;
@ApiModelProperty(value = "订单总数")
@QueryField(type = QueryType.EQ)
private Integer orderCount;
@ApiModelProperty(value = "商品总数")
@QueryField(type = QueryType.EQ)
private Integer productCount;
@ApiModelProperty(value = "总销售额")
@QueryField(type = QueryType.EQ)
private BigDecimal totalSales;
@ApiModelProperty(value = "本月销售额")
@QueryField(type = QueryType.EQ)
private BigDecimal monthSales;
@ApiModelProperty(value = "今日销售额")
@QueryField(type = QueryType.EQ)
private BigDecimal todaySales;
@ApiModelProperty(value = "昨日销售额")
@QueryField(type = QueryType.EQ)
private BigDecimal yesterdaySales;
@ApiModelProperty(value = "本周销售额")
@QueryField(type = QueryType.EQ)
private BigDecimal weekSales;
@ApiModelProperty(value = "本年销售额")
@QueryField(type = QueryType.EQ)
private BigDecimal yearSales;
@ApiModelProperty(value = "今日订单数")
@QueryField(type = QueryType.EQ)
private Integer todayOrders;
@ApiModelProperty(value = "本月订单数")
@QueryField(type = QueryType.EQ)
private Integer monthOrders;
@ApiModelProperty(value = "今日新增用户")
@QueryField(type = QueryType.EQ)
private Integer todayUsers;
@ApiModelProperty(value = "本月新增用户")
@QueryField(type = QueryType.EQ)
private Integer monthUsers;
@ApiModelProperty(value = "今日访问量")
@QueryField(type = QueryType.EQ)
private Integer todayVisits;
@ApiModelProperty(value = "总访问量")
@QueryField(type = QueryType.EQ)
private Integer totalVisits;
@ApiModelProperty(value = "商户总数")
@QueryField(type = QueryType.EQ)
private Integer merchantCount;
@ApiModelProperty(value = "活跃用户数")
@QueryField(type = QueryType.EQ)
private Integer activeUsers;
@ApiModelProperty(value = "转化率(%)")
@QueryField(type = QueryType.EQ)
private BigDecimal conversionRate;
@ApiModelProperty(value = "平均订单金额")
@QueryField(type = QueryType.EQ)
private BigDecimal avgOrderAmount;
@ApiModelProperty(value = "统计日期")
private String statisticsDate;
@ApiModelProperty(value = "统计类型: 1日统计, 2月统计, 3年统计")
@QueryField(type = QueryType.EQ)
private Integer statisticsType;
@ApiModelProperty(value = "排序号")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "操作用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "商户ID")
@QueryField(type = QueryType.EQ)
private Long merchantId;
@ApiModelProperty(value = "状态: 0禁用, 1启用")
@QueryField(type = QueryType.EQ)
private Boolean status;
@ApiModelProperty(value = "是否删除: 0否, 1是")
@QueryField(type = QueryType.EQ)
private Boolean deleted;
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.cms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.cms.entity.CmsStatistics;
import com.gxwebsoft.cms.param.CmsStatisticsParam;
import java.util.List;
/**
* 站点统计信息表Service
*
* @author 科技小王子
* @since 2025-07-25 12:32:06
*/
public interface CmsStatisticsService extends IService<CmsStatistics> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<CmsStatistics>
*/
PageResult<CmsStatistics> pageRel(CmsStatisticsParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<CmsStatistics>
*/
List<CmsStatistics> listRel(CmsStatisticsParam param);
/**
* 根据id查询
*
* @param id 自增ID
* @return CmsStatistics
*/
CmsStatistics getByIdRel(Integer id);
}

View File

@@ -0,0 +1,47 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.CmsStatisticsMapper;
import com.gxwebsoft.cms.service.CmsStatisticsService;
import com.gxwebsoft.cms.entity.CmsStatistics;
import com.gxwebsoft.cms.param.CmsStatisticsParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 站点统计信息表Service实现
*
* @author 科技小王子
* @since 2025-07-25 12:32:06
*/
@Service
public class CmsStatisticsServiceImpl extends ServiceImpl<CmsStatisticsMapper, CmsStatistics> implements CmsStatisticsService {
@Override
public PageResult<CmsStatistics> pageRel(CmsStatisticsParam param) {
PageParam<CmsStatistics, CmsStatisticsParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<CmsStatistics> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<CmsStatistics> listRel(CmsStatisticsParam param) {
List<CmsStatistics> list = baseMapper.selectListRel(param);
// 排序
PageParam<CmsStatistics, CmsStatisticsParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public CmsStatistics getByIdRel(Integer id) {
CmsStatisticsParam param = new CmsStatisticsParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -0,0 +1,238 @@
package com.gxwebsoft.common.system.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.core.utils.RequestUtil;
import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.param.PaymentParam;
import com.gxwebsoft.common.system.service.PaymentService;
import com.gxwebsoft.common.system.service.UserBalanceLogService;
import com.gxwebsoft.common.system.service.UserService;
import com.gxwebsoft.shop.entity.ShopOrder;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction;
import com.wechat.pay.java.service.partnerpayments.model.TransactionAmount;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import static com.gxwebsoft.common.core.constants.BalanceConstants.BALANCE_USE;
/**
* 支付方式控制器
*
* @author 科技小王子
* @since 2024-05-11 12:39:11
*/
@Api(tags = "支付")
@RestController
@RequestMapping("/api/system/payment")
public class PaymentController extends BaseController {
@Resource
private PaymentService paymentService;
@Resource
private UserService userService;
@Resource
private UserBalanceLogService userBalanceLogService;
@Resource
private RedisUtil redisUtil;
@Resource
private RequestUtil requestUtil;
@ApiOperation("余额支付接口")
@PostMapping("/balancePay")
public ApiResult<?> balancePay(@RequestBody ShopOrder order) {
System.out.println("使用余额支付 >>> 订单信息 " + order);
// 查询购买者信息
final User buyer = userService.getById(order.getUserId());
if (buyer.getBalance().compareTo(order.getPayPrice()) < 0) {
return fail("余额不足");
}
// 扣除余额
final BigDecimal subtract = buyer.getBalance().subtract(order.getTotalPrice());
// final BigDecimal multiply = subtract.multiply(new BigDecimal(100));
buyer.setBalance(subtract);
final boolean updateUser = userService.updateUser(buyer);
// 记录余额明细
UserBalanceLog userBalanceLog = new UserBalanceLog();
userBalanceLog.setUserId(buyer.getUserId());
userBalanceLog.setScene(BALANCE_USE);
userBalanceLog.setMoney(order.getPayPrice());
BigDecimal balance = buyer.getBalance().add(order.getPayPrice());
userBalanceLog.setBalance(balance);
userBalanceLog.setComments(order.getMerchantName());
userBalanceLog.setTransactionId(UUID.randomUUID().toString());
userBalanceLog.setOrderNo(order.getOrderNo());
final boolean save = userBalanceLogService.save(userBalanceLog);
System.out.println("save = " + save);
// 推送微信官方支付结果(携带租户ID的POST请求)
final Transaction transaction = new Transaction();
transaction.setOutTradeNo(order.getOrderNo());
transaction.setTransactionId(order.getOrderNo());
final TransactionAmount amount = new TransactionAmount();
// 计算金额
BigDecimal decimal = order.getTotalPrice();
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
// 将 BigDecimal 转换为 Integer
Integer money = multiply.intValue();
amount.setTotal(money);
amount.setCurrency("CNY");
transaction.setAmount(amount);
// 获取支付配置信息用于解密
String key = "Payment:0:".concat(order.getTenantId().toString());
System.out.println("key = " + key);
final Payment payment = redisUtil.get(key, Payment.class);
requestUtil.pushBalancePayNotify(transaction, payment);
return success("支付成功",order.getOrderNo());
}
@ApiOperation("选择支付方式")
@GetMapping("/select")
public ApiResult<?> select(PaymentParam param) {
String key = "SelectPayment:".concat(getTenantId().toString());
final String string = redisUtil.get(key);
final List<Payment> paymentList = JSONObject.parseArray(string, Payment.class);
if (!CollectionUtils.isEmpty(paymentList)) {
return success(paymentList);
}
// 使用关联查询
final List<Payment> list = paymentService.list(new LambdaUpdateWrapper<Payment>().eq(Payment::getStatus, true));
if (!CollectionUtils.isEmpty(list)) {
list.forEach(d -> {
d.setApiKey(null);
d.setApiclientCert(null);
d.setApiclientKey(null);
d.setMerchantSerialNumber(null);
});
}
redisUtil.set(key,list,1L, TimeUnit.DAYS);
return success(list);
}
@PreAuthorize("hasAuthority('sys:payment:list')")
@ApiOperation("分页查询支付方式")
@GetMapping("/page")
public ApiResult<PageResult<Payment>> page(PaymentParam param) {
PageParam<Payment, PaymentParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time asc");
return success(paymentService.page(page, page.getWrapper()));
// 使用关联查询
// return success(paymentService.pageRel(param));
}
@PreAuthorize("hasAuthority('sys:payment:list')")
@ApiOperation("查询全部支付方式")
@GetMapping()
public ApiResult<List<Payment>> list(PaymentParam param) {
PageParam<Payment, PaymentParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time asc");
return success(paymentService.list(page.getOrderWrapper()));
// 使用关联查询
//return success(paymentService.listRel(param));
}
@PreAuthorize("hasAuthority('sys:payment:list')")
@ApiOperation("根据id查询支付方式")
@GetMapping("/{id}")
public ApiResult<Payment> get(@PathVariable("id") Integer id) {
return success(paymentService.getById(id));
// 使用关联查询
//return success(paymentService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('sys:payment:save')")
@OperationLog
@ApiOperation("添加支付方式")
@PostMapping()
public ApiResult<?> save(@RequestBody Payment payment) {
if (paymentService.count(new LambdaQueryWrapper<Payment>().eq(Payment::getCode,payment.getCode())) > 0) {
return fail(payment.getName() + "已存在");
}
if (paymentService.save(payment)) {
String key = "Payment:" + payment.getCode() + ":" + getTenantId();
redisUtil.set(key,payment);
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('sys:payment:update')")
@OperationLog
@ApiOperation("修改支付方式")
@PutMapping()
public ApiResult<?> update(@RequestBody Payment payment) {
if (paymentService.updateById(payment)) {
String key = "Payment:" + payment.getCode() + ":" + getTenantId();
redisUtil.set(key,payment);
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('sys:payment:remove')")
@OperationLog
@ApiOperation("删除支付方式")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
final Payment payment = paymentService.getById(id);
System.out.println("payment = " + payment);
String key = "Payment:" + payment.getCode() + ":" + getTenantId();
redisUtil.delete(key);
if (paymentService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('sys:payment:save')")
@OperationLog
@ApiOperation("批量添加支付方式")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Payment> list) {
if (paymentService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('sys:payment:update')")
@OperationLog
@ApiOperation("批量修改支付方式")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Payment> batchParam) {
if (batchParam.update(paymentService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('sys:payment:remove')")
@OperationLog
@ApiOperation("批量删除支付方式")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (paymentService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.common.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.common.system.param.PaymentParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 支付方式Mapper
*
* @author 科技小王子
* @since 2024-05-11 12:39:11
*/
public interface PaymentMapper extends BaseMapper<Payment> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Payment>
*/
List<Payment> selectPageRel(@Param("page") IPage<Payment> page,
@Param("param") PaymentParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Payment> selectListRel(@Param("param") PaymentParam param);
}

View File

@@ -1,51 +1,51 @@
<?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.gxwebsoft.mp.mapper.MpAdMapper">
<mapper namespace="com.gxwebsoft.common.system.mapper.PaymentMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM mp_ad a
FROM sys_payment a
<where>
<if test="param.adId != null">
AND a.ad_id = #{param.adId}
</if>
<if test="param.pageId != null">
AND a.page_id = #{param.pageId}
</if>
<if test="param.adType != null">
AND a.ad_type LIKE CONCAT('%', #{param.adType}, '%')
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.width != null">
AND a.width LIKE CONCAT('%', #{param.width}, '%')
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.height != null">
AND a.height LIKE CONCAT('%', #{param.height}, '%')
<if test="param.code != null">
AND a.code = #{param.code}
</if>
<if test="param.images != null">
AND a.images LIKE CONCAT('%', #{param.images}, '%')
<if test="param.wechatType != null">
AND a.wechat_type = #{param.wechatType}
</if>
<if test="param.colors != null">
AND a.colors LIKE CONCAT('%', #{param.colors}, '%')
<if test="param.appId != null">
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
</if>
<if test="param.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
<if test="param.mchId != null">
AND a.mch_id LIKE CONCAT('%', #{param.mchId}, '%')
</if>
<if test="param.pageName != null">
AND a.page_name LIKE CONCAT('%', #{param.pageName}, '%')
<if test="param.apiKey != null">
AND a.api_key LIKE CONCAT('%', #{param.apiKey}, '%')
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
<if test="param.apiclientCert != null">
AND a.apiclient_cert LIKE CONCAT('%', #{param.apiclientCert}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
<if test="param.apiclientKey != null">
AND a.apiclient_key LIKE CONCAT('%', #{param.apiclientKey}, '%')
</if>
<if test="param.merchantSerialNumber != null">
AND a.merchant_serial_number LIKE CONCAT('%', #{param.merchantSerialNumber}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
@@ -61,20 +61,16 @@
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.mp.entity.MpAd">
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Payment">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.mp.entity.MpAd">
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Payment">
<include refid="selectSql"></include>
</select>

View File

@@ -0,0 +1,77 @@
package com.gxwebsoft.common.system.param;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 支付方式查询参数
*
* @author 科技小王子
* @since 2024-05-11 12:39:11
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "PaymentParam对象", description = "支付方式查询参数")
public class PaymentParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "支付方式")
private String name;
@ApiModelProperty(value = "类型")
@QueryField(type = QueryType.EQ)
private Integer type;
@ApiModelProperty(value = "标识")
@QueryField(type = QueryType.EQ)
private String code;
@ApiModelProperty(value = "微信商户号类型 1普通商户2子商户")
@QueryField(type = QueryType.EQ)
private Integer wechatType;
@ApiModelProperty(value = "应用ID")
private String appId;
@ApiModelProperty(value = "商户号")
private String mchId;
@ApiModelProperty(value = "设置APIv3密钥")
private String apiKey;
@ApiModelProperty(value = "证书文件 (CERT)")
private String apiclientCert;
@ApiModelProperty(value = "证书文件 (KEY)")
private String apiclientKey;
@ApiModelProperty(value = "商户证书序列号")
private String merchantSerialNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "文章排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "状态, 0启用, 1禁用")
@QueryField(type = QueryType.EQ)
private Boolean status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.common.system.param.PaymentParam;
import java.util.List;
/**
* 支付方式Service
*
* @author 科技小王子
* @since 2024-05-11 12:39:11
*/
public interface PaymentService extends IService<Payment> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Payment>
*/
PageResult<Payment> pageRel(PaymentParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Payment>
*/
List<Payment> listRel(PaymentParam param);
/**
* 根据id查询
*
* @param id ID
* @return Payment
*/
Payment getByIdRel(Integer id);
}

View File

@@ -0,0 +1,47 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.common.system.mapper.PaymentMapper;
import com.gxwebsoft.common.system.param.PaymentParam;
import com.gxwebsoft.common.system.service.PaymentService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 支付方式Service实现
*
* @author 科技小王子
* @since 2024-05-11 12:39:11
*/
@Service
public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, Payment> implements PaymentService {
@Override
public PageResult<Payment> pageRel(PaymentParam param) {
PageParam<Payment, PaymentParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc");
List<Payment> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Payment> listRel(PaymentParam param) {
List<Payment> list = baseMapper.selectListRel(param);
// 排序
PageParam<Payment, PaymentParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Payment getByIdRel(Integer id) {
PaymentParam param = new PaymentParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,129 +0,0 @@
package com.gxwebsoft.mp.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.mp.service.MpAdService;
import com.gxwebsoft.mp.entity.MpAd;
import com.gxwebsoft.mp.param.MpAdParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 小程序广告位控制器
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Api(tags = "小程序广告位管理")
@RestController
@RequestMapping("/api/mp/mp-ad")
public class MpAdController extends BaseController {
@Resource
private MpAdService mpAdService;
@PreAuthorize("hasAuthority('mp:mpAd:list')")
@ApiOperation("分页查询小程序广告位")
@GetMapping("/page")
public ApiResult<PageResult<MpAd>> page(MpAdParam param) {
// 使用关联查询
return success(mpAdService.pageRel(param));
}
@PreAuthorize("hasAuthority('mp:mpAd:list')")
@ApiOperation("查询全部小程序广告位")
@GetMapping()
public ApiResult<List<MpAd>> list(MpAdParam param) {
// 使用关联查询
return success(mpAdService.listRel(param));
}
@PreAuthorize("hasAuthority('mp:mpAd:list')")
@ApiOperation("根据id查询小程序广告位")
@GetMapping("/{id}")
public ApiResult<MpAd> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(mpAdService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('mp:mpAd:save')")
@OperationLog
@ApiOperation("添加小程序广告位")
@PostMapping()
public ApiResult<?> save(@RequestBody MpAd mpAd) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
mpAd.setUserId(loginUser.getUserId());
}
if (mpAdService.save(mpAd)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpAd:update')")
@OperationLog
@ApiOperation("修改小程序广告位")
@PutMapping()
public ApiResult<?> update(@RequestBody MpAd mpAd) {
if (mpAdService.updateById(mpAd)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpAd:remove')")
@OperationLog
@ApiOperation("删除小程序广告位")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (mpAdService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('mp:mpAd:save')")
@OperationLog
@ApiOperation("批量添加小程序广告位")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<MpAd> list) {
if (mpAdService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpAd:update')")
@OperationLog
@ApiOperation("批量修改小程序广告位")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpAd> batchParam) {
if (batchParam.update(mpAdService, "ad_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpAd:remove')")
@OperationLog
@ApiOperation("批量删除小程序广告位")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (mpAdService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,213 +0,0 @@
package com.gxwebsoft.mp.controller;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gxwebsoft.common.core.utils.JSONUtil;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.mp.entity.MpWxBody;
import com.gxwebsoft.mp.param.MpWxParam;
import com.gxwebsoft.mp.service.MpService;
import com.gxwebsoft.mp.entity.Mp;
import com.gxwebsoft.mp.param.MpParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
/**
* 小程序控制器
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Api(tags = "小程序管理")
@RestController
@RequestMapping("/api/mp/mp")
public class MpController extends BaseController {
@Resource
private MpService mpService;
@PreAuthorize("hasAuthority('mp:mp:list')")
@ApiOperation("分页查询小程序")
@GetMapping("/page")
public ApiResult<PageResult<Mp>> page(MpParam param) {
// 使用关联查询
return success(mpService.pageRel(param));
}
@PreAuthorize("hasAuthority('mp:mp:list')")
@ApiOperation("查询全部小程序")
@GetMapping()
public ApiResult<List<Mp>> list(MpParam param) {
// 使用关联查询
return success(mpService.listRel(param));
}
@PreAuthorize("hasAuthority('mp:mp:list')")
@ApiOperation("根据id查询小程序")
@GetMapping("/{id}")
public ApiResult<Mp> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(mpService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('mp:mp:save')")
@OperationLog
@ApiOperation("添加小程序")
@PostMapping()
public ApiResult<?> save(@RequestBody Mp mp) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
mp.setUserId(loginUser.getUserId());
getComponentAccessToken();
}
if (mpService.save(mp)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("获取验证票据")
@PostMapping("/component_verify_ticket")
public ApiResult<MpWxBody> component_verify_ticket(MpWxParam param, @RequestBody MpWxBody body, HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("param = " + param);
System.out.println("body = " + body);
System.out.print("success");
return success(body);
// String encodingAesKey = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG";
// String token = "pamtest";
// String timestamp = "1409304348";
// String nonce = "xxxxxx";
// String appId = "wxb11529c136998cb6";
// String replyMsg = "我是中文abcd123";
// String xmlFormat = "<xml><ToUserName><![CDATA[toUser]]></ToUserName><Encrypt><![CDATA[%1$s]]></Encrypt></xml>";
// String afterAesEncrypt = "jn1L23DB+6ELqJ+6bruv21Y6MD7KeIfP82D6gU39rmkgczbWwt5+3bnyg5K55bgVtVzd832WzZGMhkP72vVOfg==";
// String randomStr = "aaaabbbbccccdddd";
//
// String replyMsg2 = "<xml><ToUserName><![CDATA[oia2Tj我是中文jewbmiOUlr6X-1crbLOvLw]]></ToUserName><FromUserName><![CDATA[gh_7f083739789a]]></FromUserName><CreateTime>1407743423</CreateTime><MsgType><![CDATA[video]]></MsgType><Video><MediaId><![CDATA[eYJ1MbwPRJtOvIEabaxHs7TX2D-HV71s79GUxqdUkjm6Gs2Ed1KF3ulAOA9H1xG0]]></MediaId><Title><![CDATA[testCallBackReplyVideo]]></Title><Description><![CDATA[testCallBackReplyVideo]]></Description></Video></xml>";
// String afterAesEncrypt2 = "jn1L23DB+6ELqJ+6bruv23M2GmYfkv0xBh2h+XTBOKVKcgDFHle6gqcZ1cZrk3e1qjPQ1F4RsLWzQRG9udbKWesxlkupqcEcW7ZQweImX9+wLMa0GaUzpkycA8+IamDBxn5loLgZpnS7fVAbExOkK5DYHBmv5tptA9tklE/fTIILHR8HLXa5nQvFb3tYPKAlHF3rtTeayNf0QuM+UW/wM9enGIDIJHF7CLHiDNAYxr+r+OrJCmPQyTy8cVWlu9iSvOHPT/77bZqJucQHQ04sq7KZI27OcqpQNSto2OdHCoTccjggX5Z9Mma0nMJBU+jLKJ38YB1fBIz+vBzsYjrTmFQ44YfeEuZ+xRTQwr92vhA9OxchWVINGC50qE/6lmkwWTwGX9wtQpsJKhP+oS7rvTY8+VdzETdfakjkwQ5/Xka042OlUb1/slTwo4RscuQ+RdxSGvDahxAJ6+EAjLt9d8igHngxIbf6YyqqROxuxqIeIch3CssH/LqRs+iAcILvApYZckqmA7FNERspKA5f8GoJ9sv8xmGvZ9Yrf57cExWtnX8aCMMaBropU/1k+hKP5LVdzbWCG0hGwx/dQudYR/eXp3P0XxjlFiy+9DMlaFExWUZQDajPkdPrEeOwofJb";
// 微信官方要求返回 success 格式
// System.out.println("body = " + body);
// try {
// System.out.println("body = " + body);
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// PrintWriter out = response.getWriter();
// out.print("success");
// }
}
@ApiOperation("获取验证票据")
@PostMapping("/callback")
public String callback(@RequestBody Object body) {
System.out.println("body = " + body);
return "success";
}
public void getComponentAccessToken() {
final HashMap<Object, Object> map = new HashMap<>();
map.put("component_appid", "wx16ee0d4ff88c2f53");
map.put("component_appsecret", "cbc696419219a2bae8458b4a83500d6e");
map.put("component_verify_ticket", "ticket");
final String post = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/component/api_component_token", JSONUtil.toJSONString(map));
System.out.println("post = " + post);
String url = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?component_access_token=";
System.out.println("url = " + url);
String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8);
System.out.println("response = " + response);
final JSONObject jsonObject = JSONObject.parseObject(response);
// 获取成功
if (jsonObject.getString("access_token") != null) {
// this.access_token = jsonObject.getString("access_token");
// this.expires_in = jsonObject.getString("expires_in");
// stringRedisTemplate.opsForValue().set(key,this.access_token,7000, TimeUnit.SECONDS);
// System.out.println("获取access_token成功 = " + this.access_token);
// this.getUserInfo(code,this.access_token);
}
}
@PreAuthorize("hasAuthority('mp:mp:update')")
@OperationLog
@ApiOperation("修改小程序")
@PutMapping()
public ApiResult<?> update(@RequestBody Mp mp) {
if (mpService.updateById(mp)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mp:remove')")
@OperationLog
@ApiOperation("删除小程序")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (mpService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('mp:mp:save')")
@OperationLog
@ApiOperation("批量添加小程序")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Mp> list) {
if (mpService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mp:update')")
@OperationLog
@ApiOperation("批量修改小程序")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Mp> batchParam) {
if (batchParam.update(mpService, "mp_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mp:remove')")
@OperationLog
@ApiOperation("批量删除小程序")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (mpService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,124 +0,0 @@
package com.gxwebsoft.mp.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.mp.service.MpFieldService;
import com.gxwebsoft.mp.entity.MpField;
import com.gxwebsoft.mp.param.MpFieldParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 小程序配置控制器
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Api(tags = "小程序配置管理")
@RestController
@RequestMapping("/api/mp/mp-field")
public class MpFieldController extends BaseController {
@Resource
private MpFieldService mpFieldService;
@PreAuthorize("hasAuthority('mp:mpField:list')")
@ApiOperation("分页查询小程序配置")
@GetMapping("/page")
public ApiResult<PageResult<MpField>> page(MpFieldParam param) {
// 使用关联查询
return success(mpFieldService.pageRel(param));
}
@PreAuthorize("hasAuthority('mp:mpField:list')")
@ApiOperation("查询全部小程序配置")
@GetMapping()
public ApiResult<List<MpField>> list(MpFieldParam param) {
// 使用关联查询
return success(mpFieldService.listRel(param));
}
@PreAuthorize("hasAuthority('mp:mpField:list')")
@ApiOperation("根据id查询小程序配置")
@GetMapping("/{id}")
public ApiResult<MpField> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(mpFieldService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('mp:mpField:save')")
@OperationLog
@ApiOperation("添加小程序配置")
@PostMapping()
public ApiResult<?> save(@RequestBody MpField mpField) {
if (mpFieldService.save(mpField)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpField:update')")
@OperationLog
@ApiOperation("修改小程序配置")
@PutMapping()
public ApiResult<?> update(@RequestBody MpField mpField) {
if (mpFieldService.updateById(mpField)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpField:remove')")
@OperationLog
@ApiOperation("删除小程序配置")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (mpFieldService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('mp:mpField:save')")
@OperationLog
@ApiOperation("批量添加小程序配置")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<MpField> list) {
if (mpFieldService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpField:update')")
@OperationLog
@ApiOperation("批量修改小程序配置")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpField> batchParam) {
if (batchParam.update(mpFieldService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpField:remove')")
@OperationLog
@ApiOperation("批量删除小程序配置")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (mpFieldService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,129 +0,0 @@
package com.gxwebsoft.mp.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.mp.service.MpMenuService;
import com.gxwebsoft.mp.entity.MpMenu;
import com.gxwebsoft.mp.param.MpMenuParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 小程序端菜单控制器
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Api(tags = "小程序端菜单管理")
@RestController
@RequestMapping("/api/mp/mp-menu")
public class MpMenuController extends BaseController {
@Resource
private MpMenuService mpMenuService;
@PreAuthorize("hasAuthority('mp:mpMenu:list')")
@ApiOperation("分页查询小程序端菜单")
@GetMapping("/page")
public ApiResult<PageResult<MpMenu>> page(MpMenuParam param) {
// 使用关联查询
return success(mpMenuService.pageRel(param));
}
@PreAuthorize("hasAuthority('mp:mpMenu:list')")
@ApiOperation("查询全部小程序端菜单")
@GetMapping()
public ApiResult<List<MpMenu>> list(MpMenuParam param) {
// 使用关联查询
return success(mpMenuService.listRel(param));
}
@PreAuthorize("hasAuthority('mp:mpMenu:list')")
@ApiOperation("根据id查询小程序端菜单")
@GetMapping("/{id}")
public ApiResult<MpMenu> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(mpMenuService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('mp:mpMenu:save')")
@OperationLog
@ApiOperation("添加小程序端菜单")
@PostMapping()
public ApiResult<?> save(@RequestBody MpMenu mpMenu) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
mpMenu.setUserId(loginUser.getUserId());
}
if (mpMenuService.save(mpMenu)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpMenu:update')")
@OperationLog
@ApiOperation("修改小程序端菜单")
@PutMapping()
public ApiResult<?> update(@RequestBody MpMenu mpMenu) {
if (mpMenuService.updateById(mpMenu)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpMenu:remove')")
@OperationLog
@ApiOperation("删除小程序端菜单")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (mpMenuService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('mp:mpMenu:save')")
@OperationLog
@ApiOperation("批量添加小程序端菜单")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<MpMenu> list) {
if (mpMenuService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpMenu:update')")
@OperationLog
@ApiOperation("批量修改小程序端菜单")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpMenu> batchParam) {
if (batchParam.update(mpMenuService, "menu_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpMenu:remove')")
@OperationLog
@ApiOperation("批量删除小程序端菜单")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (mpMenuService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,129 +0,0 @@
package com.gxwebsoft.mp.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.mp.service.MpPagesService;
import com.gxwebsoft.mp.entity.MpPages;
import com.gxwebsoft.mp.param.MpPagesParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 小程序页面控制器
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Api(tags = "小程序页面管理")
@RestController
@RequestMapping("/api/mp/mp-pages")
public class MpPagesController extends BaseController {
@Resource
private MpPagesService mpPagesService;
@PreAuthorize("hasAuthority('mp:mpPages:list')")
@ApiOperation("分页查询小程序页面")
@GetMapping("/page")
public ApiResult<PageResult<MpPages>> page(MpPagesParam param) {
// 使用关联查询
return success(mpPagesService.pageRel(param));
}
@PreAuthorize("hasAuthority('mp:mpPages:list')")
@ApiOperation("查询全部小程序页面")
@GetMapping()
public ApiResult<List<MpPages>> list(MpPagesParam param) {
// 使用关联查询
return success(mpPagesService.listRel(param));
}
@PreAuthorize("hasAuthority('mp:mpPages:list')")
@ApiOperation("根据id查询小程序页面")
@GetMapping("/{id}")
public ApiResult<MpPages> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(mpPagesService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('mp:mpPages:save')")
@OperationLog
@ApiOperation("添加小程序页面")
@PostMapping()
public ApiResult<?> save(@RequestBody MpPages mpPages) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
mpPages.setUserId(loginUser.getUserId());
}
if (mpPagesService.save(mpPages)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpPages:update')")
@OperationLog
@ApiOperation("修改小程序页面")
@PutMapping()
public ApiResult<?> update(@RequestBody MpPages mpPages) {
if (mpPagesService.updateById(mpPages)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpPages:remove')")
@OperationLog
@ApiOperation("删除小程序页面")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (mpPagesService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('mp:mpPages:save')")
@OperationLog
@ApiOperation("批量添加小程序页面")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<MpPages> list) {
if (mpPagesService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('mp:mpPages:update')")
@OperationLog
@ApiOperation("批量修改小程序页面")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpPages> batchParam) {
if (batchParam.update(mpPagesService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('mp:mpPages:remove')")
@OperationLog
@ApiOperation("批量删除小程序页面")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (mpPagesService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,98 +0,0 @@
package com.gxwebsoft.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Mp对象", description = "小程序")
public class Mp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "mp_id", type = IdType.AUTO)
private Integer mpId;
@ApiModelProperty(value = "是否主账号")
private Integer type;
@ApiModelProperty(value = "小程序ID")
private String appId;
@ApiModelProperty(value = "小程序密钥")
private String appSecret;
@ApiModelProperty(value = "小程序名称")
private String mpName;
@ApiModelProperty(value = "小程序简称")
private String shortName;
@ApiModelProperty(value = "头像")
private String avatar;
@ApiModelProperty(value = "小程序码")
private String mpQrcode;
@ApiModelProperty(value = "微信认证")
private Integer authentication;
@ApiModelProperty(value = "主体信息")
private String companyName;
@ApiModelProperty(value = "小程序备案")
private String icpNo;
@ApiModelProperty(value = "登录邮箱")
private String email;
@ApiModelProperty(value = "登录密码")
private String password;
@ApiModelProperty(value = "原始ID")
private String ghId;
@ApiModelProperty(value = "入口页面")
private String mainPath;
@ApiModelProperty(value = "过期时间")
private LocalDateTime expirationTime;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "介绍")
private String comments;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@@ -1,79 +0,0 @@
package com.gxwebsoft.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序广告位
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "MpAd对象", description = "小程序广告位")
public class MpAd implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "ad_id", type = IdType.AUTO)
private Integer adId;
@ApiModelProperty(value = "页面ID")
private Integer pageId;
@ApiModelProperty(value = "广告类型")
private String adType;
@ApiModelProperty(value = "广告位名称")
private String name;
@ApiModelProperty(value = "")
private String width;
@ApiModelProperty(value = "")
private String height;
@ApiModelProperty(value = "广告图片")
private String images;
@ApiModelProperty(value = "图标背景色")
private String colors;
@ApiModelProperty(value = "路由/链接地址")
private String path;
@ApiModelProperty(value = "页面名称")
private String pageName;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@@ -1,57 +0,0 @@
package com.gxwebsoft.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序配置
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "MpField对象", description = "小程序配置")
public class MpField implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "类型0文本 1图片 2其他")
private Integer type;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "名称")
private String value;
@ApiModelProperty(value = "页面ID")
private Integer pageId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
}

View File

@@ -1,121 +0,0 @@
package com.gxwebsoft.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序端菜单
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "MpMenu对象", description = "小程序端菜单")
public class MpMenu implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "menu_id", type = IdType.AUTO)
private Integer menuId;
@ApiModelProperty(value = "上级id, 0是顶级")
private Integer parentId;
@ApiModelProperty(value = "菜单名称")
private String title;
@ApiModelProperty(value = "类型 0功能图标 1订单状态图标 2首页导航图标 3 商城导航图标 4管理人员功能图标")
private Integer type;
@ApiModelProperty(value = "是否微信小程序菜单")
private Boolean isMpWeixin;
@ApiModelProperty(value = "菜单路由地址")
private String path;
@ApiModelProperty(value = "菜单组件地址, 目录可为空")
private String component;
@ApiModelProperty(value = "打开位置")
private String target;
@ApiModelProperty(value = "菜单图标")
private String avatar;
@ApiModelProperty(value = "图标颜色")
private String color;
@ApiModelProperty(value = "上传图标")
private String icon;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
private Integer hide;
@ApiModelProperty(value = "位置 0不限 1顶部 2底部")
private Integer position;
@ApiModelProperty(value = "0 第一行 1第二行")
private Integer rows;
@ApiModelProperty(value = "菜单侧栏选中的path")
private String active;
@ApiModelProperty(value = "其它路由元信息")
private String meta;
@ApiModelProperty(value = "绑定的页面")
private Integer pageId;
@ApiModelProperty(value = "绑定的文章分类ID")
private Integer articleCategoryId;
@ApiModelProperty(value = "绑定的文章ID")
private Integer articleId;
@ApiModelProperty(value = "绑定的表单ID")
private Integer formId;
@ApiModelProperty(value = "绑定的书籍标识")
private String bookCode;
@ApiModelProperty(value = "绑定的商品分类ID")
private Integer goodsCategoryId;
@ApiModelProperty(value = "绑定的商品ID")
private Integer goodsId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "是否管理人员可见")
private Integer adminShow;
@ApiModelProperty(value = "设为首页")
private Integer home;
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
}

View File

@@ -1,75 +0,0 @@
package com.gxwebsoft.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序页面
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "MpPages对象", description = "小程序页面")
public class MpPages implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "上级id, 0是顶级")
private Integer parentId;
@ApiModelProperty(value = "页面名称")
private String title;
@ApiModelProperty(value = "页面路径")
private String path;
@ApiModelProperty(value = "设为首页")
private Integer home;
@ApiModelProperty(value = "分包")
private String subpackage;
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "未选中图标(废弃)")
private String iconPath;
@ApiModelProperty(value = "选中的图标(废弃)")
private String selectedIconPath;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
}

View File

@@ -1,45 +0,0 @@
package com.gxwebsoft.mp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* 小程序
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Mp对象", description = "小程序")
public class MpWxBody implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "小程序ID")
private String ToUserName;
@ApiModelProperty(value = "小程序密钥")
private String FromUserName;
@ApiModelProperty(value = "小程序名称")
private String CreateTime;
@ApiModelProperty(value = "小程序简称")
private String MsgType;
@ApiModelProperty(value = "头像")
private String Event;
@ApiModelProperty(value = "小程序码")
private String debug_str;
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.mp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.mp.entity.MpAd;
import com.gxwebsoft.mp.param.MpAdParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序广告位Mapper
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpAdMapper extends BaseMapper<MpAd> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<MpAd>
*/
List<MpAd> selectPageRel(@Param("page") IPage<MpAd> page,
@Param("param") MpAdParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<MpAd> selectListRel(@Param("param") MpAdParam param);
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.mp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.mp.entity.MpField;
import com.gxwebsoft.mp.param.MpFieldParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序配置Mapper
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpFieldMapper extends BaseMapper<MpField> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<MpField>
*/
List<MpField> selectPageRel(@Param("page") IPage<MpField> page,
@Param("param") MpFieldParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<MpField> selectListRel(@Param("param") MpFieldParam param);
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.mp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.mp.entity.Mp;
import com.gxwebsoft.mp.param.MpParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序Mapper
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpMapper extends BaseMapper<Mp> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Mp>
*/
List<Mp> selectPageRel(@Param("page") IPage<Mp> page,
@Param("param") MpParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Mp> selectListRel(@Param("param") MpParam param);
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.mp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.mp.entity.MpMenu;
import com.gxwebsoft.mp.param.MpMenuParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序端菜单Mapper
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpMenuMapper extends BaseMapper<MpMenu> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<MpMenu>
*/
List<MpMenu> selectPageRel(@Param("page") IPage<MpMenu> page,
@Param("param") MpMenuParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<MpMenu> selectListRel(@Param("param") MpMenuParam param);
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.mp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.mp.entity.MpPages;
import com.gxwebsoft.mp.param.MpPagesParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序页面Mapper
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpPagesMapper extends BaseMapper<MpPages> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<MpPages>
*/
List<MpPages> selectPageRel(@Param("page") IPage<MpPages> page,
@Param("param") MpPagesParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<MpPages> selectListRel(@Param("param") MpPagesParam param);
}

View File

@@ -1,60 +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.gxwebsoft.mp.mapper.MpFieldMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM mp_field a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.value != null">
AND a.value LIKE CONCAT('%', #{param.value}, '%')
</if>
<if test="param.pageId != null">
AND a.page_id = #{param.pageId}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.mp.entity.MpField">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.mp.entity.MpField">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -1,99 +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.gxwebsoft.mp.mapper.MpMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM mp a
<where>
<if test="param.mpId != null">
AND a.mp_id = #{param.mpId}
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.appId != null">
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
</if>
<if test="param.appSecret != null">
AND a.app_secret LIKE CONCAT('%', #{param.appSecret}, '%')
</if>
<if test="param.mpName != null">
AND a.mp_name LIKE CONCAT('%', #{param.mpName}, '%')
</if>
<if test="param.shortName != null">
AND a.short_name LIKE CONCAT('%', #{param.shortName}, '%')
</if>
<if test="param.avatar != null">
AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%')
</if>
<if test="param.mpQrcode != null">
AND a.mp_qrcode LIKE CONCAT('%', #{param.mpQrcode}, '%')
</if>
<if test="param.authentication != null">
AND a.authentication = #{param.authentication}
</if>
<if test="param.companyName != null">
AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%')
</if>
<if test="param.icpNo != null">
AND a.icp_no LIKE CONCAT('%', #{param.icpNo}, '%')
</if>
<if test="param.email != null">
AND a.email LIKE CONCAT('%', #{param.email}, '%')
</if>
<if test="param.password != null">
AND a.password LIKE CONCAT('%', #{param.password}, '%')
</if>
<if test="param.ghId != null">
AND a.gh_id LIKE CONCAT('%', #{param.ghId}, '%')
</if>
<if test="param.mainPath != null">
AND a.main_path LIKE CONCAT('%', #{param.mainPath}, '%')
</if>
<if test="param.expirationTime != null">
AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.mp.entity.Mp">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.mp.entity.Mp">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -1,123 +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.gxwebsoft.mp.mapper.MpMenuMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM mp_menu a
<where>
<if test="param.menuId != null">
AND a.menu_id = #{param.menuId}
</if>
<if test="param.parentId != null">
AND a.parent_id = #{param.parentId}
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.isMpWeixin != null">
AND a.is_mp_weixin = #{param.isMpWeixin}
</if>
<if test="param.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
</if>
<if test="param.component != null">
AND a.component LIKE CONCAT('%', #{param.component}, '%')
</if>
<if test="param.target != null">
AND a.target LIKE CONCAT('%', #{param.target}, '%')
</if>
<if test="param.avatar != null">
AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%')
</if>
<if test="param.color != null">
AND a.color LIKE CONCAT('%', #{param.color}, '%')
</if>
<if test="param.icon != null">
AND a.icon LIKE CONCAT('%', #{param.icon}, '%')
</if>
<if test="param.hide != null">
AND a.hide = #{param.hide}
</if>
<if test="param.position != null">
AND a.position = #{param.position}
</if>
<if test="param.rows != null">
AND a.rows = #{param.rows}
</if>
<if test="param.active != null">
AND a.active LIKE CONCAT('%', #{param.active}, '%')
</if>
<if test="param.meta != null">
AND a.meta LIKE CONCAT('%', #{param.meta}, '%')
</if>
<if test="param.pageId != null">
AND a.page_id = #{param.pageId}
</if>
<if test="param.articleCategoryId != null">
AND a.article_category_id = #{param.articleCategoryId}
</if>
<if test="param.articleId != null">
AND a.article_id = #{param.articleId}
</if>
<if test="param.formId != null">
AND a.form_id = #{param.formId}
</if>
<if test="param.bookCode != null">
AND a.book_code LIKE CONCAT('%', #{param.bookCode}, '%')
</if>
<if test="param.goodsCategoryId != null">
AND a.goods_category_id = #{param.goodsCategoryId}
</if>
<if test="param.goodsId != null">
AND a.goods_id = #{param.goodsId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.adminShow != null">
AND a.admin_show = #{param.adminShow}
</if>
<if test="param.home != null">
AND a.home = #{param.home}
</if>
<if test="param.groupName != null">
AND a.group_name LIKE CONCAT('%', #{param.groupName}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.mp.entity.MpMenu">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.mp.entity.MpMenu">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -1,78 +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.gxwebsoft.mp.mapper.MpPagesMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM mp_pages a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.parentId != null">
AND a.parent_id = #{param.parentId}
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
</if>
<if test="param.home != null">
AND a.home = #{param.home}
</if>
<if test="param.subpackage != null">
AND a.subpackage LIKE CONCAT('%', #{param.subpackage}, '%')
</if>
<if test="param.icon != null">
AND a.icon LIKE CONCAT('%', #{param.icon}, '%')
</if>
<if test="param.iconPath != null">
AND a.icon_path LIKE CONCAT('%', #{param.iconPath}, '%')
</if>
<if test="param.selectedIconPath != null">
AND a.selected_icon_path LIKE CONCAT('%', #{param.selectedIconPath}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.mp.entity.MpPages">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.mp.entity.MpPages">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -1,77 +0,0 @@
package com.gxwebsoft.mp.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序广告位查询参数
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "MpAdParam对象", description = "小程序广告位查询参数")
public class MpAdParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer adId;
@ApiModelProperty(value = "页面ID")
@QueryField(type = QueryType.EQ)
private Integer pageId;
@ApiModelProperty(value = "广告类型")
private String adType;
@ApiModelProperty(value = "广告位名称")
private String name;
@ApiModelProperty(value = "")
private String width;
@ApiModelProperty(value = "")
private String height;
@ApiModelProperty(value = "广告图片")
private String images;
@ApiModelProperty(value = "图标背景色")
private String colors;
@ApiModelProperty(value = "路由/链接地址")
private String path;
@ApiModelProperty(value = "页面名称")
private String pageName;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}

View File

@@ -1,55 +0,0 @@
package com.gxwebsoft.mp.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序配置查询参数
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "MpFieldParam对象", description = "小程序配置查询参数")
public class MpFieldParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "类型0文本 1图片 2其他")
@QueryField(type = QueryType.EQ)
private Integer type;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "名称")
private String value;
@ApiModelProperty(value = "页面ID")
@QueryField(type = QueryType.EQ)
private Integer pageId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}

View File

@@ -1,134 +0,0 @@
package com.gxwebsoft.mp.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序端菜单查询参数
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "MpMenuParam对象", description = "小程序端菜单查询参数")
public class MpMenuParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer menuId;
@ApiModelProperty(value = "上级id, 0是顶级")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@ApiModelProperty(value = "菜单名称")
private String title;
@ApiModelProperty(value = "类型 0功能图标 1订单状态图标 2首页导航图标 3 商城导航图标 4管理人员功能图标")
@QueryField(type = QueryType.EQ)
private Integer type;
@ApiModelProperty(value = "是否微信小程序菜单")
@QueryField(type = QueryType.EQ)
private Boolean isMpWeixin;
@ApiModelProperty(value = "菜单路由地址")
private String path;
@ApiModelProperty(value = "菜单组件地址, 目录可为空")
private String component;
@ApiModelProperty(value = "打开位置")
private String target;
@ApiModelProperty(value = "菜单图标")
private String avatar;
@ApiModelProperty(value = "图标颜色")
private String color;
@ApiModelProperty(value = "上传图标")
private String icon;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
@QueryField(type = QueryType.EQ)
private Integer hide;
@ApiModelProperty(value = "位置 0不限 1顶部 2底部")
@QueryField(type = QueryType.EQ)
private Integer position;
@ApiModelProperty(value = "0 第一行 1第二行")
@QueryField(type = QueryType.EQ)
private Integer rows;
@ApiModelProperty(value = "菜单侧栏选中的path")
private String active;
@ApiModelProperty(value = "其它路由元信息")
private String meta;
@ApiModelProperty(value = "绑定的页面")
@QueryField(type = QueryType.EQ)
private Integer pageId;
@ApiModelProperty(value = "绑定的文章分类ID")
@QueryField(type = QueryType.EQ)
private Integer articleCategoryId;
@ApiModelProperty(value = "绑定的文章ID")
@QueryField(type = QueryType.EQ)
private Integer articleId;
@ApiModelProperty(value = "绑定的表单ID")
@QueryField(type = QueryType.EQ)
private Integer formId;
@ApiModelProperty(value = "绑定的书籍标识")
private String bookCode;
@ApiModelProperty(value = "绑定的商品分类ID")
@QueryField(type = QueryType.EQ)
private Integer goodsCategoryId;
@ApiModelProperty(value = "绑定的商品ID")
@QueryField(type = QueryType.EQ)
private Integer goodsId;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "是否管理人员可见")
@QueryField(type = QueryType.EQ)
private Integer adminShow;
@ApiModelProperty(value = "设为首页")
@QueryField(type = QueryType.EQ)
private Integer home;
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
}

View File

@@ -1,75 +0,0 @@
package com.gxwebsoft.mp.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序页面查询参数
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "MpPagesParam对象", description = "小程序页面查询参数")
public class MpPagesParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "上级id, 0是顶级")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@ApiModelProperty(value = "页面名称")
private String title;
@ApiModelProperty(value = "页面路径")
private String path;
@ApiModelProperty(value = "设为首页")
@QueryField(type = QueryType.EQ)
private Integer home;
@ApiModelProperty(value = "分包")
private String subpackage;
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "未选中图标(废弃)")
private String iconPath;
@ApiModelProperty(value = "选中的图标(废弃)")
private String selectedIconPath;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}

View File

@@ -1,96 +0,0 @@
package com.gxwebsoft.mp.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序查询参数
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "MpParam对象", description = "小程序查询参数")
public class MpParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer mpId;
@ApiModelProperty(value = "是否主账号")
@QueryField(type = QueryType.EQ)
private Integer type;
@ApiModelProperty(value = "小程序ID")
private String appId;
@ApiModelProperty(value = "小程序密钥")
private String appSecret;
@ApiModelProperty(value = "小程序名称")
private String mpName;
@ApiModelProperty(value = "小程序简称")
private String shortName;
@ApiModelProperty(value = "头像")
private String avatar;
@ApiModelProperty(value = "小程序码")
private String mpQrcode;
@ApiModelProperty(value = "微信认证")
@QueryField(type = QueryType.EQ)
private Integer authentication;
@ApiModelProperty(value = "主体信息")
private String companyName;
@ApiModelProperty(value = "小程序备案")
private String icpNo;
@ApiModelProperty(value = "登录邮箱")
private String email;
@ApiModelProperty(value = "登录密码")
private String password;
@ApiModelProperty(value = "原始ID")
private String ghId;
@ApiModelProperty(value = "入口页面")
private String mainPath;
@ApiModelProperty(value = "过期时间")
private String expirationTime;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "介绍")
private String comments;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}

View File

@@ -1,34 +0,0 @@
package com.gxwebsoft.mp.param;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小程序查询参数
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "MpParam对象", description = "小程序查询参数")
public class MpWxParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "签名")
private String signature;
@ApiModelProperty(value = "时间戳")
private String timestamp;
@ApiModelProperty(value = "随机字符串")
private String nonce;
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.mp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.mp.entity.MpAd;
import com.gxwebsoft.mp.param.MpAdParam;
import java.util.List;
/**
* 小程序广告位Service
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpAdService extends IService<MpAd> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<MpAd>
*/
PageResult<MpAd> pageRel(MpAdParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<MpAd>
*/
List<MpAd> listRel(MpAdParam param);
/**
* 根据id查询
*
* @param adId ID
* @return MpAd
*/
MpAd getByIdRel(Integer adId);
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.mp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.mp.entity.MpField;
import com.gxwebsoft.mp.param.MpFieldParam;
import java.util.List;
/**
* 小程序配置Service
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpFieldService extends IService<MpField> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<MpField>
*/
PageResult<MpField> pageRel(MpFieldParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<MpField>
*/
List<MpField> listRel(MpFieldParam param);
/**
* 根据id查询
*
* @param id 自增ID
* @return MpField
*/
MpField getByIdRel(Integer id);
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.mp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.mp.entity.MpMenu;
import com.gxwebsoft.mp.param.MpMenuParam;
import java.util.List;
/**
* 小程序端菜单Service
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpMenuService extends IService<MpMenu> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<MpMenu>
*/
PageResult<MpMenu> pageRel(MpMenuParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<MpMenu>
*/
List<MpMenu> listRel(MpMenuParam param);
/**
* 根据id查询
*
* @param menuId ID
* @return MpMenu
*/
MpMenu getByIdRel(Integer menuId);
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.mp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.mp.entity.MpPages;
import com.gxwebsoft.mp.param.MpPagesParam;
import java.util.List;
/**
* 小程序页面Service
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpPagesService extends IService<MpPages> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<MpPages>
*/
PageResult<MpPages> pageRel(MpPagesParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<MpPages>
*/
List<MpPages> listRel(MpPagesParam param);
/**
* 根据id查询
*
* @param id ID
* @return MpPages
*/
MpPages getByIdRel(Integer id);
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.mp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.mp.entity.Mp;
import com.gxwebsoft.mp.param.MpParam;
import java.util.List;
/**
* 小程序Service
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
public interface MpService extends IService<Mp> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Mp>
*/
PageResult<Mp> pageRel(MpParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Mp>
*/
List<Mp> listRel(MpParam param);
/**
* 根据id查询
*
* @param mpId ID
* @return Mp
*/
Mp getByIdRel(Integer mpId);
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.mp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.mp.mapper.MpAdMapper;
import com.gxwebsoft.mp.service.MpAdService;
import com.gxwebsoft.mp.entity.MpAd;
import com.gxwebsoft.mp.param.MpAdParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小程序广告位Service实现
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Service
public class MpAdServiceImpl extends ServiceImpl<MpAdMapper, MpAd> implements MpAdService {
@Override
public PageResult<MpAd> pageRel(MpAdParam param) {
PageParam<MpAd, MpAdParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<MpAd> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<MpAd> listRel(MpAdParam param) {
List<MpAd> list = baseMapper.selectListRel(param);
// 排序
PageParam<MpAd, MpAdParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public MpAd getByIdRel(Integer adId) {
MpAdParam param = new MpAdParam();
param.setAdId(adId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.mp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.mp.mapper.MpFieldMapper;
import com.gxwebsoft.mp.service.MpFieldService;
import com.gxwebsoft.mp.entity.MpField;
import com.gxwebsoft.mp.param.MpFieldParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小程序配置Service实现
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Service
public class MpFieldServiceImpl extends ServiceImpl<MpFieldMapper, MpField> implements MpFieldService {
@Override
public PageResult<MpField> pageRel(MpFieldParam param) {
PageParam<MpField, MpFieldParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<MpField> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<MpField> listRel(MpFieldParam param) {
List<MpField> list = baseMapper.selectListRel(param);
// 排序
PageParam<MpField, MpFieldParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public MpField getByIdRel(Integer id) {
MpFieldParam param = new MpFieldParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.mp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.mp.mapper.MpMenuMapper;
import com.gxwebsoft.mp.service.MpMenuService;
import com.gxwebsoft.mp.entity.MpMenu;
import com.gxwebsoft.mp.param.MpMenuParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小程序端菜单Service实现
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Service
public class MpMenuServiceImpl extends ServiceImpl<MpMenuMapper, MpMenu> implements MpMenuService {
@Override
public PageResult<MpMenu> pageRel(MpMenuParam param) {
PageParam<MpMenu, MpMenuParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<MpMenu> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<MpMenu> listRel(MpMenuParam param) {
List<MpMenu> list = baseMapper.selectListRel(param);
// 排序
PageParam<MpMenu, MpMenuParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public MpMenu getByIdRel(Integer menuId) {
MpMenuParam param = new MpMenuParam();
param.setMenuId(menuId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.mp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.mp.mapper.MpPagesMapper;
import com.gxwebsoft.mp.service.MpPagesService;
import com.gxwebsoft.mp.entity.MpPages;
import com.gxwebsoft.mp.param.MpPagesParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小程序页面Service实现
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Service
public class MpPagesServiceImpl extends ServiceImpl<MpPagesMapper, MpPages> implements MpPagesService {
@Override
public PageResult<MpPages> pageRel(MpPagesParam param) {
PageParam<MpPages, MpPagesParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<MpPages> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<MpPages> listRel(MpPagesParam param) {
List<MpPages> list = baseMapper.selectListRel(param);
// 排序
PageParam<MpPages, MpPagesParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public MpPages getByIdRel(Integer id) {
MpPagesParam param = new MpPagesParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.mp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.mp.mapper.MpMapper;
import com.gxwebsoft.mp.service.MpService;
import com.gxwebsoft.mp.entity.Mp;
import com.gxwebsoft.mp.param.MpParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小程序Service实现
*
* @author 科技小王子
* @since 2025-04-18 10:52:36
*/
@Service
public class MpServiceImpl extends ServiceImpl<MpMapper, Mp> implements MpService {
@Override
public PageResult<Mp> pageRel(MpParam param) {
PageParam<Mp, MpParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Mp> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Mp> listRel(MpParam param) {
List<Mp> list = baseMapper.selectListRel(param);
// 排序
PageParam<Mp, MpParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public Mp getByIdRel(Integer mpId) {
MpParam param = new MpParam();
param.setMpId(mpId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -13,6 +13,8 @@ import com.gxwebsoft.common.core.config.ConfigProperties;
import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.shop.entity.ShopOrderGoods;
import com.gxwebsoft.shop.service.ShopOrderGoodsService;
import com.gxwebsoft.shop.service.ShopOrderService;
import com.gxwebsoft.shop.entity.ShopOrder;
import com.gxwebsoft.shop.param.ShopOrderParam;
@@ -32,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -53,6 +56,8 @@ public class ShopOrderController extends BaseController {
@Resource
private ShopOrderService shopOrderService;
@Resource
private ShopOrderGoodsService shopOrderGoodsService;
@Resource
private RedisUtil redisUtil;
@Resource
private ConfigProperties conf;

View File

@@ -1,50 +1,51 @@
package com.gxwebsoft.shop.service.impl;
package com.gxwebsoft.shop.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.config.ConfigProperties;
import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.shop.entity.ShopOrderGoods;
import com.gxwebsoft.shop.mapper.ShopOrderMapper;
import com.gxwebsoft.shop.service.ShopOrderGoodsService;
import com.gxwebsoft.shop.service.ShopOrderService;
import com.gxwebsoft.shop.entity.ShopOrder;
import com.gxwebsoft.shop.param.ShopOrderParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAConfig;
import com.wechat.pay.java.core.RSAPublicKeyConfig;
import com.wechat.pay.java.core.exception.ServiceException;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.*;
import com.wechat.pay.java.service.payments.model.Transaction;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.config.ConfigProperties;
import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.common.system.service.PaymentService;
import com.gxwebsoft.shop.entity.ShopOrderGoods;
import com.gxwebsoft.shop.mapper.ShopOrderMapper;
import com.gxwebsoft.shop.service.ShopOrderGoodsService;
import com.gxwebsoft.shop.service.ShopOrderService;
import com.gxwebsoft.shop.entity.ShopOrder;
import com.gxwebsoft.shop.param.ShopOrderParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAConfig;
import com.wechat.pay.java.core.RSAPublicKeyConfig;
import com.wechat.pay.java.core.exception.ServiceException;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.*;
import com.wechat.pay.java.service.payments.model.Transaction;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 订单Service实现
*
* @author 科技小王子
* @since 2025-01-11 10:45:12
*/
@Service
public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder> implements ShopOrderService {
/**
* 订单Service实现
*
* @author 科技小王子
* @since 2025-01-11 10:45:12
*/
@Service
public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder> implements ShopOrderService {
@Value("${spring.profiles.active}")
String active;
@Resource
@@ -53,6 +54,8 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
private RedisUtil redisUtil;
@Resource
private ShopOrderGoodsService shopOrderGoodsService;
@Resource
private PaymentService paymentService;
public static String privateKeyPath = "/Users/gxwebsoft/Downloads/ef7f7e0430cb47019d06b93f885bf95f/apiclient_key.pem";
public static String privateCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_cert.pem";
@@ -60,87 +63,87 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
@Override
public PageResult<ShopOrder> pageRel(ShopOrderParam param) {
PageParam<ShopOrder, ShopOrderParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<ShopOrder> list = baseMapper.selectPageRel(page, param);
PageParam<ShopOrder, ShopOrderParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<ShopOrder> list = baseMapper.selectPageRel(page, param);
// 整理订单数据
if (!CollectionUtils.isEmpty(list)) {
final Set<Integer> orderIds = list.stream().map(ShopOrder::getOrderId).collect(Collectors.toSet());
final List<ShopOrderGoods> goodsList = shopOrderGoodsService.list(new LambdaQueryWrapper<ShopOrderGoods>().in(ShopOrderGoods::getOrderId,orderIds));
final Map<Integer, List<ShopOrderGoods>> collect = goodsList.stream().collect(Collectors.groupingBy(ShopOrderGoods::getOrderId));
list.forEach(d -> {
d.setOrderGoods(collect.get(d.getOrderId()));
});
}
return new PageResult<>(list, page.getTotal());
// 整理订单数据
if (!CollectionUtils.isEmpty(list)) {
final Set<Integer> orderIds = list.stream().map(ShopOrder::getOrderId).collect(Collectors.toSet());
final List<ShopOrderGoods> goodsList = shopOrderGoodsService.list(new LambdaQueryWrapper<ShopOrderGoods>().in(ShopOrderGoods::getOrderId, orderIds));
final Map<Integer, List<ShopOrderGoods>> collect = goodsList.stream().collect(Collectors.groupingBy(ShopOrderGoods::getOrderId));
list.forEach(d -> {
d.setOrderGoods(collect.get(d.getOrderId()));
});
}
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ShopOrder> listRel(ShopOrderParam param) {
List<ShopOrder> list = baseMapper.selectListRel(param);
// 排序
PageParam<ShopOrder, ShopOrderParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
List<ShopOrder> list = baseMapper.selectListRel(param);
// 排序
PageParam<ShopOrder, ShopOrderParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public ShopOrder getByIdRel(Integer orderId) {
ShopOrderParam param = new ShopOrderParam();
param.setOrderId(orderId);
return param.getOne(baseMapper.selectListRel(param));
ShopOrderParam param = new ShopOrderParam();
param.setOrderId(orderId);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public HashMap<String, String> createWxOrder(ShopOrder order) {
// 后台微信支付配置信息
final Payment payment = getPayment(order);
// 微信小程序信息
final JSONObject wxConfig = getWxConfig(order);
// 返回的订单数据
final HashMap<String, String> orderInfo = new HashMap<>();
// 构建service
JsapiServiceExtension service = getWxService(order);
// 后台微信支付配置信息
final Payment payment = getPayment(order);
// 微信小程序信息
final JSONObject wxConfig = getWxConfig(order);
// 返回的订单数据
final HashMap<String, String> orderInfo = new HashMap<>();
// 构建service
JsapiServiceExtension service = getWxService(order);
// 订单金额
BigDecimal decimal = order.getTotalPrice();
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
Integer money = multiply.intValue();
// 订单金额
BigDecimal decimal = order.getTotalPrice();
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
Integer money = multiply.intValue();
PrepayRequest request = new PrepayRequest();
Amount amount = new Amount();
amount.setTotal(money);
amount.setCurrency("CNY");
PrepayRequest request = new PrepayRequest();
Amount amount = new Amount();
amount.setTotal(money);
amount.setCurrency("CNY");
request.setAmount(amount);
request.setAppid(wxConfig.getString("appId"));
request.setMchid(payment.getMchId());
request.setDescription(order.getComments());
request.setOutTradeNo(order.getOrderNo());
request.setAttach(order.getTenantId().toString());
final Payer payer = new Payer();
payer.setOpenid(order.getOpenid());
request.setPayer(payer);
request.setNotifyUrl("https://server.gxwebsoft.com/api/system/wx-pay/notify/" + order.getTenantId()); // 默认回调地址
// 测试环境
if (active.equals("dev")) {
amount.setTotal(1);
request.setAmount(amount);
request.setAppid(wxConfig.getString("appId"));
request.setMchid(payment.getMchId());
request.setDescription(order.getComments());
request.setOutTradeNo(order.getOrderNo());
request.setAttach(order.getTenantId().toString());
final Payer payer = new Payer();
payer.setOpenid(order.getOpenid());
request.setPayer(payer);
request.setNotifyUrl("https://server.gxwebsoft.com/api/system/wx-pay/notify/" + order.getTenantId()); // 默认回调地址
// 测试环境
if (active.equals("dev")) {
amount.setTotal(1);
request.setAmount(amount);
request.setNotifyUrl("http://jimei-api.natapp1.cc/api/shop/wx-pay/notify/" + order.getTenantId()); // 默认回调地址
}
// 后台配置的回调地址
if (StrUtil.isNotBlank(payment.getNotifyUrl())) {
request.setNotifyUrl(payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString()));
}
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
orderInfo.put("provider", "wxpay");
orderInfo.put("timeStamp", response.getTimeStamp());
orderInfo.put("nonceStr", response.getNonceStr());
orderInfo.put("package", response.getPackageVal());
orderInfo.put("signType", "RSA");
orderInfo.put("paySign", response.getPaySign());
orderInfo.put("orderNo", order.getOrderNo());
return orderInfo;
request.setNotifyUrl("http://jimei-api.natapp1.cc/api/shop/wx-pay/notify/" + order.getTenantId()); // 默认回调地址
}
// 后台配置的回调地址
if (StrUtil.isNotBlank(payment.getNotifyUrl())) {
request.setNotifyUrl(payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString()));
}
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
orderInfo.put("provider", "wxpay");
orderInfo.put("timeStamp", response.getTimeStamp());
orderInfo.put("nonceStr", response.getNonceStr());
orderInfo.put("package", response.getPackageVal());
orderInfo.put("signType", "RSA");
orderInfo.put("paySign", response.getPaySign());
orderInfo.put("orderNo", order.getOrderNo());
return orderInfo;
}
@Override
@@ -150,6 +153,7 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
/**
* 修复订单支付状态
*
* @param shopOrder
*/
@Override
@@ -163,7 +167,7 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
JsapiServiceExtension service = getWxService(shopOrder);
try {
Transaction result = service.queryOrderByOutTradeNo(queryRequest);
if(result.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)){
if (result.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)) {
shopOrder.setPayStatus(true);
shopOrder.setPayTime(DateUtil.date());
shopOrder.setTransactionId(result.getTransactionId());
@@ -178,41 +182,47 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
return false;
}
@Override
public void updateByOutTradeNo(ShopOrder order) {
baseMapper.updateByOutTradeNo(order);
}
@Override
public void updateByOutTradeNo(ShopOrder order) {
baseMapper.updateByOutTradeNo(order);
}
public Payment getPayment(ShopOrder order){
/**
* 读取微信支付配置
*
* @param order
* @return
*/
public Payment getPayment(ShopOrder order) {
String key2 = "Payment:".concat(order.getPayType().toString()).concat(":").concat(order.getTenantId().toString());
final Payment payment = redisUtil.get(key2, Payment.class);
if(ObjectUtil.isNotEmpty(payment)){
if (ObjectUtil.isNotEmpty(payment)) {
return payment;
};
return null;
};
}
return paymentService.getOne(new LambdaQueryWrapper<Payment>().eq(Payment::getType, order.getType()).last("LIMIT 1"));
}
public JSONObject getWxConfig(ShopOrder order){
public JSONObject getWxConfig(ShopOrder order) {
// 微信小程序(微信支付)
String key = "mp-weixin:".concat(order.getTenantId().toString());
final String string = redisUtil.get(key);
return JSONObject.parseObject(string);
}
public JsapiServiceExtension getWxService(ShopOrder order){
public JsapiServiceExtension getWxService(ShopOrder order) {
Integer payType = order.getPayType();
final String uploadPath = config.getUploadPath(); // 服务器本地路径
final HashMap<String, String> orderInfo = new HashMap<>();
// 微信小程序(微信支付)
String key = "mp-weixin:".concat(order.getTenantId().toString());
final String string = redisUtil.get(key);
// System.out.println("string = " + string);
// System.out.println("string = " + string);
final JSONObject mpWx = JSONObject.parseObject(string);
// System.out.println("mpWx = " + mpWx);
// System.out.println("mpWx = " + mpWx);
String key2 = "Payment:".concat(payType.toString()).concat(":").concat(order.getTenantId().toString());
final Payment payment = redisUtil.get(key2, Payment.class);
if (ObjectUtil.isEmpty(payment)) {
throw new BusinessException("支付配置信息为空");
throw new BusinessException("请完成支付配置");
}
String privateKey = uploadPath.concat("/file").concat(payment.getApiclientKey()); // 秘钥证书
@@ -248,4 +258,4 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
return new JsapiServiceExtension.Builder().config(config).build();
}
}
}

View File

@@ -1,124 +0,0 @@
package com.gxwebsoft.zhsq.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.zhsq.service.ZhsqBuildingService;
import com.gxwebsoft.zhsq.entity.ZhsqBuilding;
import com.gxwebsoft.zhsq.param.ZhsqBuildingParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 楼栋控制器
*
* @author 科技小王子
* @since 2025-05-17 16:11:41
*/
@Api(tags = "楼栋管理")
@RestController
@RequestMapping("/api/zhsq/zhsq-building")
public class ZhsqBuildingController extends BaseController {
@Resource
private ZhsqBuildingService zhsqBuildingService;
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:list')")
@ApiOperation("分页查询楼栋")
@GetMapping("/page")
public ApiResult<PageResult<ZhsqBuilding>> page(ZhsqBuildingParam param) {
// 使用关联查询
return success(zhsqBuildingService.pageRel(param));
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:list')")
@ApiOperation("查询全部楼栋")
@GetMapping()
public ApiResult<List<ZhsqBuilding>> list(ZhsqBuildingParam param) {
// 使用关联查询
return success(zhsqBuildingService.listRel(param));
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:list')")
@ApiOperation("根据id查询楼栋")
@GetMapping("/{id}")
public ApiResult<ZhsqBuilding> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(zhsqBuildingService.getByIdRel(id));
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:save')")
// @OperationLog
@ApiOperation("添加楼栋")
@PostMapping()
public ApiResult<?> save(@RequestBody ZhsqBuilding zhsqBuilding) {
if (zhsqBuildingService.save(zhsqBuilding)) {
return success("添加成功");
}
return fail("添加失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:update')")
// @OperationLog
@ApiOperation("修改楼栋")
@PutMapping()
public ApiResult<?> update(@RequestBody ZhsqBuilding zhsqBuilding) {
if (zhsqBuildingService.updateById(zhsqBuilding)) {
return success("修改成功");
}
return fail("修改失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:remove')")
// @OperationLog
@ApiOperation("删除楼栋")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (zhsqBuildingService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:save')")
// @OperationLog
@ApiOperation("批量添加楼栋")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<ZhsqBuilding> list) {
if (zhsqBuildingService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:update')")
// @OperationLog
@ApiOperation("批量修改楼栋")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<ZhsqBuilding> batchParam) {
if (batchParam.update(zhsqBuildingService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqBuilding:remove')")
// @OperationLog
@ApiOperation("批量删除楼栋")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (zhsqBuildingService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,121 +0,0 @@
package com.gxwebsoft.zhsq.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.zhsq.service.ZhsqXiaoquService;
import com.gxwebsoft.zhsq.entity.ZhsqXiaoqu;
import com.gxwebsoft.zhsq.param.ZhsqXiaoquParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 小区控制器
*
* @author 科技小王子
* @since 2025-05-17 14:48:39
*/
@Api(tags = "小区管理")
@RestController
@RequestMapping("/api/zhsq/zhsq-xiaoqu")
public class ZhsqXiaoquController extends BaseController {
@Resource
private ZhsqXiaoquService zhsqXiaoquService;
@ApiOperation("分页查询小区")
@GetMapping("/page")
public ApiResult<PageResult<ZhsqXiaoqu>> page(ZhsqXiaoquParam param) {
// 使用关联查询
return success(zhsqXiaoquService.pageRel(param));
}
@ApiOperation("查询全部小区")
@GetMapping()
public ApiResult<List<ZhsqXiaoqu>> list(ZhsqXiaoquParam param) {
// 使用关联查询
return success(zhsqXiaoquService.listRel(param));
}
@ApiOperation("根据id查询小区")
@GetMapping("/{id}")
public ApiResult<ZhsqXiaoqu> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(zhsqXiaoquService.getByIdRel(id));
}
// @PreAuthorize("hasAuthority('zhsq:zhsqXiaoqu:save')")
// @OperationLog
@ApiOperation("添加小区")
@PostMapping()
public ApiResult<?> save(@RequestBody ZhsqXiaoqu zhsqXiaoqu) {
if (zhsqXiaoquService.save(zhsqXiaoqu)) {
return success("添加成功");
}
return fail("添加失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqXiaoqu:update')")
// @OperationLog
@ApiOperation("修改小区")
@PutMapping()
public ApiResult<?> update(@RequestBody ZhsqXiaoqu zhsqXiaoqu) {
if (zhsqXiaoquService.updateById(zhsqXiaoqu)) {
return success("修改成功");
}
return fail("修改失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqXiaoqu:remove')")
// @OperationLog
@ApiOperation("删除小区")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (zhsqXiaoquService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqXiaoqu:save')")
// @OperationLog
@ApiOperation("批量添加小区")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<ZhsqXiaoqu> list) {
if (zhsqXiaoquService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqXiaoqu:update')")
// @OperationLog
@ApiOperation("批量修改小区")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<ZhsqXiaoqu> batchParam) {
if (batchParam.update(zhsqXiaoquService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
// @PreAuthorize("hasAuthority('zhsq:zhsqXiaoqu:remove')")
// @OperationLog
@ApiOperation("批量删除小区")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (zhsqXiaoquService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,115 +0,0 @@
package com.gxwebsoft.zhsq.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 楼栋
*
* @author 科技小王子
* @since 2025-05-17 16:11:41
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ZhsqBuilding对象", description = "楼栋")
public class ZhsqBuilding implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "楼栋名称")
private String name;
@ApiModelProperty(value = "所在社区")
private String shequ;
@ApiModelProperty(value = "楼栋号")
private String code;
@ApiModelProperty(value = "层数")
private Integer ceng;
@ApiModelProperty(value = "单元数")
private Integer danyuan;
@ApiModelProperty(value = "每层户数")
private Integer cengHouse;
@ApiModelProperty(value = "设计用途")
private String designPurpose;
@ApiModelProperty(value = "地下楼层数")
private Integer cengDixia;
@ApiModelProperty(value = "建筑占地面积(㎡):")
private BigDecimal area;
@ApiModelProperty(value = "经度")
private String lng;
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "楼栋总户数")
private Integer totalHouse;
@ApiModelProperty(value = "楼栋总人数")
private Integer totalPeople;
@ApiModelProperty(value = "楼栋类型")
private String ldType;
@ApiModelProperty(value = "楼栋结构")
private String jgType;
@ApiModelProperty(value = "建筑类型")
private String jzType;
@ApiModelProperty(value = "自然幢总面积(㎡)")
private BigDecimal areaZr;
@ApiModelProperty(value = "交付日期")
private Date jfTime;
@ApiModelProperty(value = "楼宇管家")
private String louAdmin;
@ApiModelProperty(value = "联系方式")
private String phone;
@ApiModelProperty(value = "责任物业")
private String wuyeAdmin;
@ApiModelProperty(value = "楼栋动工时间")
private Date dgTime;
@ApiModelProperty(value = "楼栋竣工日期")
private Date jgTime;
@ApiModelProperty(value = "预售日期")
private Date ysTime;
@ApiModelProperty(value = "楼高")
private Integer louHeight;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
}

View File

@@ -1,80 +0,0 @@
package com.gxwebsoft.zhsq.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小区
*
* @author 科技小王子
* @since 2025-05-17 14:48:39
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ZhsqXiaoqu对象", description = "小区")
public class ZhsqXiaoqu implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "小区名称")
private String name;
@ApiModelProperty(value = "所在社区")
private String shequ;
@ApiModelProperty(value = "是否为平房区")
private Boolean pingfang;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "经度")
private String lng;
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "邮政编码")
private String zipCode;
@ApiModelProperty(value = "期数")
private Integer qishu;
@ApiModelProperty(value = "5G面积(㎡)")
private String areaG5;
@ApiModelProperty(value = "占地面积(㎡)")
private BigDecimal area;
@ApiModelProperty(value = "建筑密度(%)")
private BigDecimal density;
@ApiModelProperty(value = "容积率(%)")
private BigDecimal ratio;
@ApiModelProperty(value = "绿化率")
private BigDecimal greening;
@ApiModelProperty(value = "建筑单位")
private String building;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.zhsq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.zhsq.entity.ZhsqBuilding;
import com.gxwebsoft.zhsq.param.ZhsqBuildingParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 楼栋Mapper
*
* @author 科技小王子
* @since 2025-05-17 16:11:41
*/
public interface ZhsqBuildingMapper extends BaseMapper<ZhsqBuilding> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<ZhsqBuilding>
*/
List<ZhsqBuilding> selectPageRel(@Param("page") IPage<ZhsqBuilding> page,
@Param("param") ZhsqBuildingParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<ZhsqBuilding> selectListRel(@Param("param") ZhsqBuildingParam param);
}

View File

@@ -1,37 +0,0 @@
package com.gxwebsoft.zhsq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.zhsq.entity.ZhsqXiaoqu;
import com.gxwebsoft.zhsq.param.ZhsqXiaoquParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小区Mapper
*
* @author 科技小王子
* @since 2025-05-17 14:48:39
*/
public interface ZhsqXiaoquMapper extends BaseMapper<ZhsqXiaoqu> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<ZhsqXiaoqu>
*/
List<ZhsqXiaoqu> selectPageRel(@Param("page") IPage<ZhsqXiaoqu> page,
@Param("param") ZhsqXiaoquParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<ZhsqXiaoqu> selectListRel(@Param("param") ZhsqXiaoquParam param);
}

View File

@@ -1,113 +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.gxwebsoft.zhsq.mapper.ZhsqBuildingMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM zhsq_building a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.shequ != null">
AND a.shequ LIKE CONCAT('%', #{param.shequ}, '%')
</if>
<if test="param.code != null">
AND a.code LIKE CONCAT('%', #{param.code}, '%')
</if>
<if test="param.ceng != null">
AND a.ceng = #{param.ceng}
</if>
<if test="param.danyuan != null">
AND a.danyuan = #{param.danyuan}
</if>
<if test="param.cengHouse != null">
AND a.ceng_house = #{param.cengHouse}
</if>
<if test="param.designPurpose != null">
AND a.design_purpose LIKE CONCAT('%', #{param.designPurpose}, '%')
</if>
<if test="param.cengDixia != null">
AND a.ceng_dixia = #{param.cengDixia}
</if>
<if test="param.area != null">
AND a.area = #{param.area}
</if>
<if test="param.lng != null">
AND a.lng LIKE CONCAT('%', #{param.lng}, '%')
</if>
<if test="param.lat != null">
AND a.lat LIKE CONCAT('%', #{param.lat}, '%')
</if>
<if test="param.totalHouse != null">
AND a.total_house = #{param.totalHouse}
</if>
<if test="param.totalPeople != null">
AND a.total_people = #{param.totalPeople}
</if>
<if test="param.ldType != null">
AND a.ld_type LIKE CONCAT('%', #{param.ldType}, '%')
</if>
<if test="param.jgType != null">
AND a.jg_type LIKE CONCAT('%', #{param.jgType}, '%')
</if>
<if test="param.jzType != null">
AND a.jz_type LIKE CONCAT('%', #{param.jzType}, '%')
</if>
<if test="param.areaZr != null">
AND a.area_zr = #{param.areaZr}
</if>
<if test="param.jfTime != null">
AND a.jf_time LIKE CONCAT('%', #{param.jfTime}, '%')
</if>
<if test="param.louAdmin != null">
AND a.lou_admin LIKE CONCAT('%', #{param.louAdmin}, '%')
</if>
<if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
</if>
<if test="param.wuyeAdmin != null">
AND a.wuye_admin LIKE CONCAT('%', #{param.wuyeAdmin}, '%')
</if>
<if test="param.dgTime != null">
AND a.dg_time LIKE CONCAT('%', #{param.dgTime}, '%')
</if>
<if test="param.jgTime != null">
AND a.jg_time LIKE CONCAT('%', #{param.jgTime}, '%')
</if>
<if test="param.ysTime != null">
AND a.ys_time LIKE CONCAT('%', #{param.ysTime}, '%')
</if>
<if test="param.louHeight != null">
AND a.lou_height = #{param.louHeight}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
OR a.name LIKE CONCAT('%', #{param.keywords}, '%')
OR a.code = #{param.keywords}
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.zhsq.entity.ZhsqBuilding">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.zhsq.entity.ZhsqBuilding">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -1,75 +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.gxwebsoft.zhsq.mapper.ZhsqXiaoquMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM zhsq_xiaoqu a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.shequ != null">
AND a.shequ LIKE CONCAT('%', #{param.shequ}, '%')
</if>
<if test="param.pingfang != null">
AND a.pingfang = #{param.pingfang}
</if>
<if test="param.address != null">
AND a.address LIKE CONCAT('%', #{param.address}, '%')
</if>
<if test="param.lng != null">
AND a.lng LIKE CONCAT('%', #{param.lng}, '%')
</if>
<if test="param.lat != null">
AND a.lat LIKE CONCAT('%', #{param.lat}, '%')
</if>
<if test="param.zipCode != null">
AND a.zip_code LIKE CONCAT('%', #{param.zipCode}, '%')
</if>
<if test="param.qishu != null">
AND a.qishu = #{param.qishu}
</if>
<if test="param.area != null">
AND a.area = #{param.area}
</if>
<if test="param.density != null">
AND a.density = #{param.density}
</if>
<if test="param.ratio != null">
AND a.ratio = #{param.ratio}
</if>
<if test="param.greening != null">
AND a.greening = #{param.greening}
</if>
<if test="param.building != null">
AND a.building LIKE CONCAT('%', #{param.building}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.zhsq.entity.ZhsqXiaoqu">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.zhsq.entity.ZhsqXiaoqu">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -1,121 +0,0 @@
package com.gxwebsoft.zhsq.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 楼栋查询参数
*
* @author 科技小王子
* @since 2025-05-17 16:11:41
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ZhsqBuildingParam对象", description = "楼栋查询参数")
public class ZhsqBuildingParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "楼栋名称")
private String name;
@ApiModelProperty(value = "所在社区")
private String shequ;
@ApiModelProperty(value = "楼栋号")
private String code;
@ApiModelProperty(value = "层数")
@QueryField(type = QueryType.EQ)
private Integer ceng;
@ApiModelProperty(value = "单元数")
@QueryField(type = QueryType.EQ)
private Integer danyuan;
@ApiModelProperty(value = "每层户数")
@QueryField(type = QueryType.EQ)
private Integer cengHouse;
@ApiModelProperty(value = "设计用途")
private String designPurpose;
@ApiModelProperty(value = "地下楼层数")
@QueryField(type = QueryType.EQ)
private Integer cengDixia;
@ApiModelProperty(value = "建筑占地面积(㎡):")
@QueryField(type = QueryType.EQ)
private BigDecimal area;
@ApiModelProperty(value = "经度")
private String lng;
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "楼栋总户数")
@QueryField(type = QueryType.EQ)
private Integer totalHouse;
@ApiModelProperty(value = "楼栋总人数")
@QueryField(type = QueryType.EQ)
private Integer totalPeople;
@ApiModelProperty(value = "楼栋类型")
private String ldType;
@ApiModelProperty(value = "楼栋结构")
private String jgType;
@ApiModelProperty(value = "建筑类型")
private String jzType;
@ApiModelProperty(value = "自然幢总面积(㎡)")
@QueryField(type = QueryType.EQ)
private BigDecimal areaZr;
@ApiModelProperty(value = "交付日期")
private String jfTime;
@ApiModelProperty(value = "楼宇管家")
private String louAdmin;
@ApiModelProperty(value = "联系方式")
private String phone;
@ApiModelProperty(value = "责任物业")
private String wuyeAdmin;
@ApiModelProperty(value = "楼栋动工时间")
private String dgTime;
@ApiModelProperty(value = "楼栋竣工日期")
private String jgTime;
@ApiModelProperty(value = "预售日期")
private String ysTime;
@ApiModelProperty(value = "楼高")
@QueryField(type = QueryType.EQ)
private Integer louHeight;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
}

View File

@@ -1,86 +0,0 @@
package com.gxwebsoft.zhsq.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 小区查询参数
*
* @author 科技小王子
* @since 2025-05-17 14:48:39
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ZhsqXiaoquParam对象", description = "小区查询参数")
public class ZhsqXiaoquParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "小区名称")
private String name;
@ApiModelProperty(value = "所在社区")
private String shequ;
@ApiModelProperty(value = "是否为平房区")
@QueryField(type = QueryType.EQ)
private Boolean pingfang;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "经度")
private String lng;
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "邮政编码")
private String zipCode;
@ApiModelProperty(value = "5G面积(㎡)")
@QueryField(type = QueryType.EQ)
private String areaG5;
@ApiModelProperty(value = "期数")
@QueryField(type = QueryType.EQ)
private Integer qishu;
@ApiModelProperty(value = "占地面积(㎡)")
@QueryField(type = QueryType.EQ)
private Integer area;
@ApiModelProperty(value = "建筑密度(%)")
@QueryField(type = QueryType.EQ)
private Integer density;
@ApiModelProperty(value = "容积率(%)")
@QueryField(type = QueryType.EQ)
private Integer ratio;
@ApiModelProperty(value = "绿化率")
@QueryField(type = QueryType.EQ)
private Integer greening;
@ApiModelProperty(value = "建筑单位")
private String building;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.zhsq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.zhsq.entity.ZhsqBuilding;
import com.gxwebsoft.zhsq.param.ZhsqBuildingParam;
import java.util.List;
/**
* 楼栋Service
*
* @author 科技小王子
* @since 2025-05-17 16:11:41
*/
public interface ZhsqBuildingService extends IService<ZhsqBuilding> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<ZhsqBuilding>
*/
PageResult<ZhsqBuilding> pageRel(ZhsqBuildingParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<ZhsqBuilding>
*/
List<ZhsqBuilding> listRel(ZhsqBuildingParam param);
/**
* 根据id查询
*
* @param id ID
* @return ZhsqBuilding
*/
ZhsqBuilding getByIdRel(Integer id);
}

View File

@@ -1,42 +0,0 @@
package com.gxwebsoft.zhsq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.zhsq.entity.ZhsqXiaoqu;
import com.gxwebsoft.zhsq.param.ZhsqXiaoquParam;
import java.util.List;
/**
* 小区Service
*
* @author 科技小王子
* @since 2025-05-17 14:48:39
*/
public interface ZhsqXiaoquService extends IService<ZhsqXiaoqu> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<ZhsqXiaoqu>
*/
PageResult<ZhsqXiaoqu> pageRel(ZhsqXiaoquParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<ZhsqXiaoqu>
*/
List<ZhsqXiaoqu> listRel(ZhsqXiaoquParam param);
/**
* 根据id查询
*
* @param id ID
* @return ZhsqXiaoqu
*/
ZhsqXiaoqu getByIdRel(Integer id);
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.zhsq.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.zhsq.mapper.ZhsqBuildingMapper;
import com.gxwebsoft.zhsq.service.ZhsqBuildingService;
import com.gxwebsoft.zhsq.entity.ZhsqBuilding;
import com.gxwebsoft.zhsq.param.ZhsqBuildingParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 楼栋Service实现
*
* @author 科技小王子
* @since 2025-05-17 16:11:41
*/
@Service
public class ZhsqBuildingServiceImpl extends ServiceImpl<ZhsqBuildingMapper, ZhsqBuilding> implements ZhsqBuildingService {
@Override
public PageResult<ZhsqBuilding> pageRel(ZhsqBuildingParam param) {
PageParam<ZhsqBuilding, ZhsqBuildingParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<ZhsqBuilding> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ZhsqBuilding> listRel(ZhsqBuildingParam param) {
List<ZhsqBuilding> list = baseMapper.selectListRel(param);
// 排序
PageParam<ZhsqBuilding, ZhsqBuildingParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public ZhsqBuilding getByIdRel(Integer id) {
ZhsqBuildingParam param = new ZhsqBuildingParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,47 +0,0 @@
package com.gxwebsoft.zhsq.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.zhsq.mapper.ZhsqXiaoquMapper;
import com.gxwebsoft.zhsq.service.ZhsqXiaoquService;
import com.gxwebsoft.zhsq.entity.ZhsqXiaoqu;
import com.gxwebsoft.zhsq.param.ZhsqXiaoquParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 小区Service实现
*
* @author 科技小王子
* @since 2025-05-17 14:48:39
*/
@Service
public class ZhsqXiaoquServiceImpl extends ServiceImpl<ZhsqXiaoquMapper, ZhsqXiaoqu> implements ZhsqXiaoquService {
@Override
public PageResult<ZhsqXiaoqu> pageRel(ZhsqXiaoquParam param) {
PageParam<ZhsqXiaoqu, ZhsqXiaoquParam> page = new PageParam<>(param);
page.setDefaultOrder("id asc");
List<ZhsqXiaoqu> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ZhsqXiaoqu> listRel(ZhsqXiaoquParam param) {
List<ZhsqXiaoqu> list = baseMapper.selectListRel(param);
// 排序
PageParam<ZhsqXiaoqu, ZhsqXiaoquParam> page = new PageParam<>();
page.setDefaultOrder("id asc");
return page.sortRecords(list);
}
@Override
public ZhsqXiaoqu getByIdRel(Integer id) {
ZhsqXiaoquParam param = new ZhsqXiaoquParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -1,6 +1,6 @@
# 端口
server:
port: 9000
port: 9200
# 多环境配置
spring:
profiles:
@@ -46,9 +46,9 @@ spring:
max-request-size: 100MB
redis:
database: 0
host: 127.0.0.1
port: 6379
password:
host: 8.134.169.209
port: 16379
password: redis_WSDb88
# 邮件服务器配置
mail:

View File

@@ -76,6 +76,7 @@ public class CmsGenerator {
// "cms_model"
// "cms_lang",
// "cms_lang_log",
"cms_statistics",
// "cms_website_setting"
};