feat: h5页面
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.budwk.app.zhgh.pointsmall.h5.index;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
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;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/points-mall")
|
||||
public class PointsMallH5IndexController {
|
||||
|
||||
@Inject
|
||||
private PointsMallSupplierService pointsMallSupplierService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/points-mall/index.html")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/supplierList")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public Result supplierList(@Param("mallType") Integer mallType) {
|
||||
return Result.success(pointsMallSupplierService.listByMallType(mallType));
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.pointsmall.h5.loveaid;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/points-mall/loveAid")
|
||||
public class PointsMallH5LoveAidController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/points-mall/loveAid/index.html")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public void index() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.budwk.app.zhgh.pointsmall.h5.me;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.pointsmall.points.service.PointsMallUserPointsService;
|
||||
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/h5/points-mall/me")
|
||||
public class PointsMallH5MeController {
|
||||
|
||||
@Inject
|
||||
private PointsMallUserPointsService pointsMallUserPointsService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/points-mall/me/index.html")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/points")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public Result points(@Param("userId") String userId) {
|
||||
return Result.success(pointsMallUserPointsService.availablePoints(currentUserId(userId)));
|
||||
}
|
||||
|
||||
@At("/userInfo")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public Result userInfo(@Param("userId") String userId) {
|
||||
return Result.success(pointsMallUserPointsService.userInfo(currentUserId(userId)));
|
||||
}
|
||||
|
||||
private String currentUserId(String userId) {
|
||||
if (StrUtil.isNotBlank(userId)) {
|
||||
return userId;
|
||||
}
|
||||
try {
|
||||
return StpUtil.getLoginIdAsString();
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.pointsmall.h5.movies;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/points-mall/movies")
|
||||
public class PointsMallH5MoviesController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/points-mall/movies/index.html")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public void index() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.budwk.app.zhgh.pointsmall.h5.order;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallMobileOrderPageParam;
|
||||
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/h5/points-mall/order")
|
||||
public class PointsMallH5OrderController {
|
||||
|
||||
@Inject
|
||||
private PointsMallOrderService pointsMallOrderService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/points-mall/order/index.html")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/stateList")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public Result stateList() {
|
||||
return Result.success(pointsMallOrderService.mobileOrderStates());
|
||||
}
|
||||
|
||||
@At("/pageData")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public Result pageData(PointsMallMobileOrderPageParam param) {
|
||||
return Result.success(pointsMallOrderService.mobileOrderPage(param, currentUserId()));
|
||||
}
|
||||
|
||||
@At("/supplierOrderUrl")
|
||||
@SaCheckPermission("h5.points.mall")
|
||||
public Result supplierOrderUrl(@Param("supplierId") String supplierId, @Param("orderId") String orderId, @Param("orderType") Integer orderType) {
|
||||
return Result.success(pointsMallOrderService.supplierOrderUrl(supplierId, orderId, orderType));
|
||||
}
|
||||
|
||||
private String currentUserId() {
|
||||
try {
|
||||
return StpUtil.getLoginIdAsString();
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
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 PointsMallMobileOrderPageParam extends PageForm {
|
||||
|
||||
private String supplierId;
|
||||
private String orderId;
|
||||
private String userId;
|
||||
private Integer orderState;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ 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.order.param.PointsMallMobileOrderPageParam;
|
||||
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
|
||||
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
|
||||
import org.nutz.dao.entity.Record;
|
||||
@@ -15,6 +16,12 @@ public interface PointsMallOrderService extends BaseService<PointsMallOrderMain>
|
||||
|
||||
Pagination<Record> pageSub(PointsMallOrderPageParam param);
|
||||
|
||||
Pagination<Record> mobileOrderPage(PointsMallMobileOrderPageParam param, String defaultUserId);
|
||||
|
||||
List<Record> mobileOrderStates();
|
||||
|
||||
Record supplierOrderUrl(String supplierId, String orderId, Integer orderType);
|
||||
|
||||
List<Record> listExchange(String mainOrderId);
|
||||
|
||||
List<Record> listSubProducts(String orderId);
|
||||
|
||||
+76
@@ -4,6 +4,7 @@ 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.order.param.PointsMallMobileOrderPageParam;
|
||||
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;
|
||||
@@ -14,6 +15,7 @@ import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@@ -62,6 +64,58 @@ public class PointsMallOrderServiceImpl extends BaseServiceImpl<PointsMallOrderM
|
||||
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination<Record> mobileOrderPage(PointsMallMobileOrderPageParam param, String defaultUserId) {
|
||||
Cnd cnd = Cnd.where("o.delFlag", "=", false);
|
||||
String userId = StrUtil.blankToDefault(param.getUserId(), defaultUserId);
|
||||
if (StrUtil.isNotBlank(userId)) {
|
||||
cnd.and("o.userId", "=", userId);
|
||||
}
|
||||
if (param.getOrderState() != null && param.getOrderState() >= 0) {
|
||||
cnd.and("o.orderState", "=", param.getOrderState());
|
||||
}
|
||||
if (StrUtil.isNotBlank(param.getSupplierId())) {
|
||||
cnd.and("o.supplierId", "=", param.getSupplierId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(param.getOrderId())) {
|
||||
cnd.and("o.orderId", "like", "%" + param.getOrderId() + "%");
|
||||
}
|
||||
cnd.desc("o.orderCreateTime");
|
||||
Sql sql = Sqls.create("select o.*, s.supplierName, s.supplierOrderUrl, s.supplierReturnOrderUrl 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);
|
||||
Pagination<Record> page = listPageMap(param.getPageNumber(), param.getPageSize(), sql);
|
||||
for (Record item : page.getList()) {
|
||||
item.put("productImgList", productImages(item.getString("orderId")));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Record> mobileOrderStates() {
|
||||
return Arrays.asList(
|
||||
state(-1, "全部"),
|
||||
state(0, "待付款"),
|
||||
state(1, "已支付"),
|
||||
state(2, "进行中"),
|
||||
state(4, "已签收"),
|
||||
state(5, "已完成"),
|
||||
state(6, "换货"),
|
||||
state(7, "退货")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Record supplierOrderUrl(String supplierId, String orderId, Integer orderType) {
|
||||
PointsMallSupplier supplier = dao().fetch(PointsMallSupplier.class, Cnd.where("supplierId", "=", supplierId).and("delFlag", "=", false));
|
||||
Record record = new Record();
|
||||
record.put("supplierOrderUrl", "");
|
||||
if (supplier != null) {
|
||||
String url = orderType != null && orderType == 2 ? supplier.getSupplierReturnOrderUrl() : supplier.getSupplierOrderUrl();
|
||||
record.put("supplierOrderUrl", appendOrderId(url, orderId));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Record> listExchange(String mainOrderId) {
|
||||
Cnd cnd = Cnd.where("e.delFlag", "=", false);
|
||||
@@ -95,4 +149,26 @@ public class PointsMallOrderServiceImpl extends BaseServiceImpl<PointsMallOrderM
|
||||
public List<PointsMallSupplier> listSuppliers() {
|
||||
return dao().query(PointsMallSupplier.class, Cnd.where("delFlag", "=", false).asc("sortCode"));
|
||||
}
|
||||
|
||||
private List<String> productImages(String orderId) {
|
||||
Sql sql = Sqls.create("select picInfo from points_mall_order_sub_product where orderSubId=@orderId and delFlag=0 and picInfo is not null and picInfo<>'' order by createdAt asc");
|
||||
sql.params().set("orderId", orderId);
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao().execute(sql);
|
||||
return sql.getList(String.class);
|
||||
}
|
||||
|
||||
private String appendOrderId(String url, String orderId) {
|
||||
if (StrUtil.isBlank(url) || StrUtil.isBlank(orderId)) {
|
||||
return url;
|
||||
}
|
||||
return url + (url.contains("?") ? "&" : "?") + "orderId=" + orderId;
|
||||
}
|
||||
|
||||
private Record state(Integer code, String name) {
|
||||
Record record = new Record();
|
||||
record.put("code", code);
|
||||
record.put("name", name);
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -9,6 +9,7 @@ import com.budwk.app.zhgh.pointsmall.points.param.PointsMallUserPointsLogPagePar
|
||||
import com.budwk.app.zhgh.pointsmall.points.param.PointsMallUserPointsPageParam;
|
||||
import org.nutz.dao.entity.Record;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface PointsMallUserPointsService extends BaseService<PointsMallUserPoints> {
|
||||
@@ -19,6 +20,10 @@ public interface PointsMallUserPointsService extends BaseService<PointsMallUserP
|
||||
|
||||
List<String> userIds(PointsMallUserPointsPageParam param);
|
||||
|
||||
BigDecimal availablePoints(String userId);
|
||||
|
||||
Record userInfo(String userId);
|
||||
|
||||
void grant(PointsMallUserPointsChangeParam param);
|
||||
|
||||
void deduction(PointsMallUserPointsChangeParam param);
|
||||
|
||||
+22
@@ -88,6 +88,28 @@ public class PointsMallUserPointsServiceImpl extends BaseServiceImpl<PointsMallU
|
||||
return sql.getList(String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal availablePoints(String userId) {
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
PointsMallUserPoints points = fetch(Cnd.where("userId", "=", userId).and("delFlag", "=", false));
|
||||
return points == null || points.getAvailablePoints() == null ? BigDecimal.ZERO : points.getAvailablePoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Record userInfo(String userId) {
|
||||
Record record = new Record();
|
||||
record.put("userId", userId);
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return record;
|
||||
}
|
||||
Sql sql = Sqls.create("select id, loginname, username, mobile from sys_user where id=@id or loginname=@id or username=@id limit 1");
|
||||
sql.params().set("id", userId);
|
||||
Record user = (Record) dao().execute(sql.setCallback(Sqls.callback.record())).getResult();
|
||||
return user == null ? record : user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grant(PointsMallUserPointsChangeParam param) {
|
||||
BigDecimal points = checkedPoints(param.getPoints());
|
||||
|
||||
+2
@@ -13,5 +13,7 @@ public interface PointsMallSupplierService extends BaseService<PointsMallSupplie
|
||||
|
||||
boolean existsSupplierId(String supplierId, String excludeId);
|
||||
|
||||
List<PointsMallSupplier> listByMallType(Integer mallType);
|
||||
|
||||
void deleteByIds(List<String> ids);
|
||||
}
|
||||
|
||||
+10
@@ -43,6 +43,16 @@ public class PointsMallSupplierServiceImpl extends BaseServiceImpl<PointsMallSup
|
||||
return dao().count(PointsMallSupplier.class, cnd) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointsMallSupplier> listByMallType(Integer mallType) {
|
||||
Cnd cnd = Cnd.where("delFlag", "=", false);
|
||||
if (mallType != null) {
|
||||
cnd.and("mallType", "=", mallType);
|
||||
}
|
||||
cnd.asc("sortCode");
|
||||
return dao().query(PointsMallSupplier.class, cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
|
||||
Reference in New Issue
Block a user