feat: web端初步完成

This commit is contained in:
2026-07-27 08:41:32 +08:00
parent 08e6d08668
commit a6a2471111
16 changed files with 1669 additions and 0 deletions
@@ -0,0 +1,62 @@
package com.budwk.app.zhgh.pointsmall.order.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
import com.budwk.app.zhgh.pointsmall.order.service.PointsMallOrderService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/zhgh/points-mall/order")
public class PointsMallOrderController {
@Inject
private PointsMallOrderService pointsMallOrderService;
@At("")
@Ok("beetl:/platform/zhgh/points-mall/order/index.html")
@SaCheckPermission("points.mall.order")
public void index() {
}
@At
@SaCheckPermission("points.mall.order")
public Result pageData(PointsMallOrderPageParam param) {
return Result.success(pointsMallOrderService.pageMain(param));
}
@At
@SaCheckPermission("points.mall.order")
public Result supplierList() {
return Result.success(pointsMallOrderService.listSuppliers());
}
@At
@SaCheckPermission("points.mall.order")
public Result subPageData(PointsMallOrderPageParam param) {
return Result.success(pointsMallOrderService.pageSub(param));
}
@At
@SaCheckPermission("points.mall.order")
public Result exchangeList(@Param("mainOrderId") String mainOrderId) {
return Result.success(pointsMallOrderService.listExchange(mainOrderId));
}
@At
@SaCheckPermission("points.mall.order")
public Result productList(@Param("orderId") String orderId) {
return Result.success(pointsMallOrderService.listSubProducts(orderId));
}
@At
@SaCheckPermission("points.mall.order")
public Result exchangeProductList(@Param("orderId") String orderId) {
return Result.success(pointsMallOrderService.listExchangeProducts(orderId));
}
}
@@ -0,0 +1,115 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_exchange")
@Comment("积分商城退换货订单")
public class PointsMallOrderExchange extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("关联主订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderMainId;
@Column
@Comment("售后订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("应用名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String aplName;
@Column
@Comment("订单创建时间")
private Date orderCreateTime;
@Column
@Comment("订单更新时间")
private Date orderUpdateTime;
@Column
@Comment("完成时间")
private Date orderCompleteTime;
@Column
@Comment("发货状态")
private Integer deliveryStatus;
@Column
@Comment("运费")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal freightCost;
@Column
@Comment("退款")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal refund;
@Column
@Comment("物流单号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String logisticsOrderId;
@Column
@Comment("物流承运商")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String crrgBsnNm;
@Column
@Comment("订单状态")
private Integer orderState;
@Column
@Comment("订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal totalPrice;
@Column
@Comment("现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPay;
@Column
@Comment("消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pointsPrice;
@Column
@Comment("发票代码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String invoiceCode;
@Column
@Comment("商品扩展信息JSON")
@ColDefine(type = ColType.TEXT)
private String extJson;
}
@@ -0,0 +1,128 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_main")
@Comment("积分商城主订单")
public class PointsMallOrderMain extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("主订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("订单编号")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderNumberId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("应用名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String aplName;
@Column
@Comment("订单创建时间")
private Date orderCreateTime;
@Column
@Comment("订单更新时间")
private Date orderUpdateTime;
@Column
@Comment("发货时间")
private Date deliveryTime;
@Column
@Comment("确认收货时间")
private Date orderFinishTime;
@Column
@Comment("完成时间")
private Date orderCompleteTime;
@Column
@Comment("发货状态")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String deliveryStatus;
@Column
@Comment("运费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal freightCost;
@Column
@Comment("退款积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal refund;
@Column
@Comment("物流单号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String logisticsOrderId;
@Column
@Comment("物流承运商")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String crrgBsnNm;
@Column
@Comment("订单状态")
private Integer orderState;
@Column
@Comment("订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal totalPrice;
@Column
@Comment("现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPay;
@Column
@Comment("消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pointsPrice;
@Column
@Comment("发票代码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String invoiceCode;
@Column
@Comment("商品扩展信息JSON")
@ColDefine(type = ColType.TEXT)
private String extJson;
@Column
@Comment("现金支付状态")
private Integer cashPaid;
}
@@ -0,0 +1,146 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_sub")
@Comment("积分商城子订单")
public class PointsMallOrderSub extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("子订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("订单编号")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderNumberId;
@Column
@Comment("主订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String mainOrderId;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("应用名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String aplName;
@Column
@Comment("订单创建时间")
private Date orderCreateTime;
@Column
@Comment("订单更新时间")
private Date orderUpdateTime;
@Column
@Comment("发货时间")
private Date deliveryTime;
@Column
@Comment("确认收货时间")
private Date orderFinishTime;
@Column
@Comment("完成时间")
private Date orderCompleteTime;
@Column
@Comment("发货状态")
private Integer deliveryStatus;
@Column
@Comment("运费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal freightCost;
@Column
@Comment("运费现金")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPayFreightCost;
@Column
@Comment("退款积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal refund;
@Column
@Comment("退款现金")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPayRefund;
@Column
@Comment("物流单号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String logisticsOrderId;
@Column
@Comment("物流承运商")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String crrgBsnNm;
@Column
@Comment("订单状态")
private Integer orderState;
@Column
@Comment("订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal totalPrice;
@Column
@Comment("现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPay;
@Column
@Comment("消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pointsPrice;
@Column
@Comment("发票代码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String invoiceCode;
@Column
@Comment("扩展信息JSON")
@ColDefine(type = ColType.TEXT)
private String extJson;
@Column
@Comment("对账状态")
private Integer reconciliationStatus;
@Column
@Comment("开票状态")
private Integer invoiceStatus;
}
@@ -0,0 +1,58 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_sub_product")
@Comment("积分商城子订单商品")
public class PointsMallOrderSubProduct extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("子订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderSubId;
@Column
@Comment("商品SKU")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sku;
@Column
@Comment("购买数量")
private Integer number;
@Column
@Comment("商品单价")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal price;
@Column
@Comment("商品名称")
@ColDefine(type = ColType.VARCHAR, width = 300)
private String name;
@Column
@Comment("税率")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 4)
private BigDecimal taxRate;
@Column
@Comment("商品图片信息")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String picInfo;
}
@@ -0,0 +1,98 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_supplier")
@Comment("积分商城供应商")
public class PointsMallSupplier extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("供应商名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String supplierName;
@Column
@Comment("供应商首页跳转地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierUrl;
@Column
@Comment("供应商订单详情地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierOrderUrl;
@Column
@Comment("供应商售后订单地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierReturnOrderUrl;
@Column
@Comment("供应商接口地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierApiUrl;
@Column
@Comment("供应商图片访问地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPic;
@Column
@Comment("供应商图片文件路径")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPicPath;
@Column
@Comment("联系人信息")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String contactInfo;
@Column
@Comment("服务商编号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sroNo;
@Column
@Comment("合作到期时间")
private Date cooperationExpTime;
@Column
@Comment("客户端ID")
@ColDefine(type = ColType.VARCHAR, width = 128)
private String clientId;
@Column
@Comment("客户端密钥")
@ColDefine(type = ColType.VARCHAR, width = 256)
private String clientSecret;
@Column
@Comment("排序号")
@Default("0")
private Integer sortCode;
@Column
@Comment("商城类型")
@Default("1")
private Integer mallType;
}
@@ -0,0 +1,17 @@
package com.budwk.app.zhgh.pointsmall.order.param;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class PointsMallOrderPageParam extends PageForm {
private String supplierId;
private String orderId;
private String userId;
private String orderState;
private String logisticsOrderId;
private String mainOrderId;
}
@@ -0,0 +1,25 @@
package com.budwk.app.zhgh.pointsmall.order.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.pointsmall.order.models.PointsMallOrderMain;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
import org.nutz.dao.entity.Record;
import java.util.List;
public interface PointsMallOrderService extends BaseService<PointsMallOrderMain> {
Pagination<Record> pageMain(PointsMallOrderPageParam param);
Pagination<Record> pageSub(PointsMallOrderPageParam param);
List<Record> listExchange(String mainOrderId);
List<Record> listSubProducts(String orderId);
List<Record> listExchangeProducts(String orderId);
List<PointsMallSupplier> listSuppliers();
}
@@ -0,0 +1,98 @@
package com.budwk.app.zhgh.pointsmall.order.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.pointsmall.order.models.PointsMallOrderMain;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
import com.budwk.app.zhgh.pointsmall.order.service.PointsMallOrderService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.Sqls;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class PointsMallOrderServiceImpl extends BaseServiceImpl<PointsMallOrderMain> implements PointsMallOrderService {
public PointsMallOrderServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<Record> pageMain(PointsMallOrderPageParam param) {
Cnd cnd = Cnd.where("m.delFlag", "=", false);
if (StrUtil.isNotBlank(param.getSupplierId())) {
cnd.and("m.supplierId", "=", param.getSupplierId());
}
if (StrUtil.isNotBlank(param.getOrderId())) {
cnd.and("m.orderId", "like", "%" + param.getOrderId() + "%");
}
if (StrUtil.isNotBlank(param.getUserId())) {
cnd.and("m.userId", "like", "%" + param.getUserId() + "%");
}
if (StrUtil.isNotBlank(param.getOrderState())) {
cnd.and("m.orderState", "=", param.getOrderState());
}
if (StrUtil.isNotBlank(param.getLogisticsOrderId())) {
cnd.and("m.logisticsOrderId", "like", "%" + param.getLogisticsOrderId() + "%");
}
cnd.desc("m.orderCreateTime");
Sql sql = Sqls.create("select m.*, s.supplierName from points_mall_order_main m left join points_mall_supplier s on m.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
}
@Override
public Pagination<Record> pageSub(PointsMallOrderPageParam param) {
Cnd cnd = Cnd.where("o.delFlag", "=", false);
if (StrUtil.isNotBlank(param.getMainOrderId())) {
cnd.and("o.mainOrderId", "=", param.getMainOrderId());
}
if (StrUtil.isNotBlank(param.getOrderState())) {
cnd.and("o.orderState", "=", param.getOrderState());
}
cnd.desc("o.orderCreateTime");
Sql sql = Sqls.create("select o.*, s.supplierName from points_mall_order_sub o left join points_mall_supplier s on o.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
}
@Override
public List<Record> listExchange(String mainOrderId) {
Cnd cnd = Cnd.where("e.delFlag", "=", false);
if (StrUtil.isNotBlank(mainOrderId)) {
cnd.and("e.orderMainId", "=", mainOrderId);
}
cnd.desc("e.orderCreateTime");
Sql sql = Sqls.create("select e.*, s.supplierName from points_mall_order_exchange e left join points_mall_supplier s on e.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return list(sql);
}
@Override
public List<Record> listSubProducts(String orderId) {
Cnd cnd = Cnd.where("delFlag", "=", false);
if (StrUtil.isNotBlank(orderId)) {
cnd.and("orderSubId", "=", orderId);
}
cnd.asc("createdAt");
Sql sql = Sqls.create("select * from points_mall_order_sub_product $condition");
sql.setCondition(cnd);
return list(sql);
}
@Override
public List<Record> listExchangeProducts(String orderId) {
return listSubProducts(orderId);
}
@Override
public List<PointsMallSupplier> listSuppliers() {
return dao().query(PointsMallSupplier.class, Cnd.where("delFlag", "=", false).asc("sortCode"));
}
}
@@ -0,0 +1,104 @@
package com.budwk.app.zhgh.pointsmall.supplier.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.supplier.param.PointsMallSupplierPageParam;
import com.budwk.app.zhgh.pointsmall.supplier.service.PointsMallSupplierService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/zhgh/points-mall/supplier")
public class PointsMallSupplierController {
@Inject
private PointsMallSupplierService pointsMallSupplierService;
@At("")
@Ok("beetl:/platform/zhgh/points-mall/supplier/index.html")
@SaCheckPermission("points.mall.supplier")
public void index() {
}
@At
@SaCheckPermission("points.mall.supplier")
public Result pageData(PointsMallSupplierPageParam param) {
return Result.success(pointsMallSupplierService.page(param));
}
@At
@SLog(tag = "积分商城供应商管理", msg = "新增供应商")
@SaCheckPermission("points.mall.supplier")
public Result doAdd(PointsMallSupplier supplier) {
Result check = checkSupplier(supplier, false);
if (!check.isSuccess()) {
return check;
}
if (pointsMallSupplierService.existsSupplierId(supplier.getSupplierId(), null)) {
return Result.error("供应商编码已存在");
}
pointsMallSupplierService.insert(supplier);
return Result.success();
}
@At
@SLog(tag = "积分商城供应商管理", msg = "编辑供应商")
@SaCheckPermission("points.mall.supplier")
public Result doEdit(PointsMallSupplier supplier) {
if (StrUtil.isBlank(supplier.getId())) {
return Result.error("ID不能为空");
}
Result check = checkSupplier(supplier, true);
if (!check.isSuccess()) {
return check;
}
if (pointsMallSupplierService.existsSupplierId(supplier.getSupplierId(), supplier.getId())) {
return Result.error("供应商编码已存在");
}
pointsMallSupplierService.updateIgnoreNull(supplier);
return Result.success();
}
@At
@SLog(tag = "积分商城供应商管理", msg = "删除供应商")
@SaCheckPermission("points.mall.supplier")
public Result doDelete(@Param("ids") String ids) {
List<String> idList = StrUtil.split(ids, ',');
if (idList.isEmpty()) {
return Result.error("请选择需要删除的数据");
}
pointsMallSupplierService.deleteByIds(idList);
return Result.success();
}
private Result checkSupplier(PointsMallSupplier supplier, boolean update) {
if (supplier == null) {
return Result.error("供应商信息不能为空");
}
if (update && StrUtil.isBlank(supplier.getId())) {
return Result.error("ID不能为空");
}
if (StrUtil.isBlank(supplier.getSupplierId())) {
return Result.error("供应商编码不能为空");
}
if (StrUtil.isBlank(supplier.getSupplierName())) {
return Result.error("供应商名称不能为空");
}
if (supplier.getMallType() == null) {
return Result.error("商城类型不能为空");
}
if (supplier.getSortCode() == null) {
supplier.setSortCode(99);
}
return Result.success();
}
}
@@ -0,0 +1,98 @@
package com.budwk.app.zhgh.pointsmall.supplier.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_supplier")
@Comment("积分商城供应商")
public class PointsMallSupplier extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("供应商名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String supplierName;
@Column
@Comment("供应商首页跳转地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierUrl;
@Column
@Comment("供应商订单详情地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierOrderUrl;
@Column
@Comment("供应商售后订单地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierReturnOrderUrl;
@Column
@Comment("供应商接口地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierApiUrl;
@Column
@Comment("供应商图片访问地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPic;
@Column
@Comment("供应商图片文件路径")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPicPath;
@Column
@Comment("联系人信息")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String contactInfo;
@Column
@Comment("服务商编号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sroNo;
@Column
@Comment("合作到期时间")
private Date cooperationExpTime;
@Column
@Comment("客户端ID")
@ColDefine(type = ColType.VARCHAR, width = 128)
private String clientId;
@Column
@Comment("客户端密钥")
@ColDefine(type = ColType.VARCHAR, width = 256)
private String clientSecret;
@Column
@Comment("排序号")
@Default("0")
private Integer sortCode;
@Column
@Comment("商城类型")
@Default("1")
private Integer mallType;
}
@@ -0,0 +1,13 @@
package com.budwk.app.zhgh.pointsmall.supplier.param;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class PointsMallSupplierPageParam extends PageForm {
private String supplierName;
private Integer mallType;
}
@@ -0,0 +1,17 @@
package com.budwk.app.zhgh.pointsmall.supplier.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.supplier.param.PointsMallSupplierPageParam;
import java.util.List;
public interface PointsMallSupplierService extends BaseService<PointsMallSupplier> {
Pagination<PointsMallSupplier> page(PointsMallSupplierPageParam param);
boolean existsSupplierId(String supplierId, String excludeId);
void deleteByIds(List<String> ids);
}
@@ -0,0 +1,53 @@
package com.budwk.app.zhgh.pointsmall.supplier.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.supplier.param.PointsMallSupplierPageParam;
import com.budwk.app.zhgh.pointsmall.supplier.service.PointsMallSupplierService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class PointsMallSupplierServiceImpl extends BaseServiceImpl<PointsMallSupplier> implements PointsMallSupplierService {
public PointsMallSupplierServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<PointsMallSupplier> page(PointsMallSupplierPageParam param) {
Cnd cnd = Cnd.where("delFlag", "=", false);
if (StrUtil.isNotBlank(param.getSupplierName())) {
cnd.and("supplierName", "like", "%" + param.getSupplierName() + "%");
}
if (param.getMallType() != null) {
cnd.and("mallType", "=", param.getMallType());
}
cnd.asc("sortCode");
return listPage(param.getPageNumber(), param.getPageSize(), PointsMallSupplier.class, cnd);
}
@Override
public boolean existsSupplierId(String supplierId, String excludeId) {
Cnd cnd = Cnd.where("supplierId", "=", supplierId).and("delFlag", "=", false);
if (StrUtil.isNotBlank(excludeId)) {
cnd.and("id", "!=", excludeId);
}
return dao().count(PointsMallSupplier.class, cnd) > 0;
}
@Override
public void deleteByIds(List<String> ids) {
if (CollUtil.isEmpty(ids)) {
return;
}
dao().update(PointsMallSupplier.class, Chain.make("delFlag", true), Cnd.where("id", "in", ids));
}
}