浏览代码

7.26 一级市场 - app - 公共 - 商品列表

Mechrevo 1 年之前
父节点
当前提交
3403340794
共有 17 个文件被更改,包括 865 次插入13 次删除
  1. 3 1
      sp-core/sp-api/pom.xml
  2. 5 0
      sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java
  3. 7 0
      sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterfaceFallback.java
  4. 244 0
      sp-core/sp-api/src/main/java/com/pj/api/dto/AppUserDto.java
  5. 21 0
      sp-core/sp-base/src/main/java/com/pj/enummj/BuyType.java
  6. 154 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCart.java
  7. 33 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartApiController.java
  8. 88 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartController.java
  9. 30 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartMapper.java
  10. 80 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartMapper.xml
  11. 86 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartService.java
  12. 27 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartUtil.java
  13. 54 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/dto/GoodsCartInfoDto.java
  14. 3 3
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitController.java
  15. 5 9
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java
  16. 9 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java
  17. 16 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

+ 3 - 1
sp-core/sp-api/pom.xml

@@ -30,7 +30,9 @@
             <artifactId>spring-cloud-starter-feign</artifactId>
             <version>1.4.0.RELEASE</version>
         </dependency>
-        
+
+
+
     </dependencies>
 
 </project>

+ 5 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java

@@ -2,6 +2,7 @@ package com.pj.api.client.admin;
 
 import com.pj.api.FeignInterceptor;
 import com.pj.api.consts.FeignConsts;
+import com.pj.api.dto.AppUserDto;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -24,4 +25,8 @@ public interface AdminInterface {
 			   @RequestParam("type") Integer type,
 			   @RequestParam("status") Integer status);
 
+	/** 查单个app用户 - 根据id */
+	@RequestMapping("/AppUser/rpc/getById")
+	AppUserDto getAppUserById(@RequestParam("id") Long id);
+
 }

+ 7 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterfaceFallback.java

@@ -1,5 +1,6 @@
 package com.pj.api.client.admin;
 
+import com.pj.api.dto.AppUserDto;
 import feign.hystrix.FallbackFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,6 +35,12 @@ public class AdminInterfaceFallback implements FallbackFactory<AdminInterface>
 				log.error("错误的id:{},边民类型:{},状态:{},保护操作:{}",id,type,status,"熔断");
 				return 0;
 			}
+
+			@Override
+			public AppUserDto getAppUserById(Long id) {
+				log.error("错误的id:{},保护操作:{}",id,"熔断");
+				return null;
+			}
 		};
 	}
 

+ 244 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/AppUserDto.java

@@ -0,0 +1,244 @@
+package com.pj.api.dto;
+
+
+import java.util.Date;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 26 11 48
+ **/
+
+public class AppUserDto {
+
+    // ---------- 表中字段 ----------
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 手机号码
+     */
+    private String phone;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 类型(1=边民,2=组长,3=商户,4=收购商,5=司机)
+     */
+    private String userType;
+
+    /**
+     * 外联id,user_type=1=>边民ID;user_type=3=>商户ID
+     */
+    private String fkId;
+
+    /**
+     * 状态(0=禁用,1=启用)
+     */
+    private String status;
+
+    /**
+     * 是否认证(0=未认证,1=已认证)
+     */
+    private String auth;
+
+    /**
+     * 人证时间
+     */
+    private String authTime;
+
+    /**
+     * 登录次数
+     */
+    private Long loginCount;
+
+    /**
+     * 上次登录时间
+     */
+    private String lastLoginTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新者id
+     */
+    private String updateById;
+
+    /**
+     * 更新者名称
+     */
+    private String updateByName;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 逻辑删除
+     */
+    private Integer deleteStatus;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+
+    public AppUserDto() {
+    }
+
+    public AppUserDto(Long id, String phone, String name, String userType, String fkId, String status, String auth, String authTime, Long loginCount, String lastLoginTime, Date createTime, String updateById, String updateByName, Date updateTime, Integer deleteStatus, String password) {
+        this.id = id;
+        this.phone = phone;
+        this.name = name;
+        this.userType = userType;
+        this.fkId = fkId;
+        this.status = status;
+        this.auth = auth;
+        this.authTime = authTime;
+        this.loginCount = loginCount;
+        this.lastLoginTime = lastLoginTime;
+        this.createTime = createTime;
+        this.updateById = updateById;
+        this.updateByName = updateByName;
+        this.updateTime = updateTime;
+        this.deleteStatus = deleteStatus;
+        this.password = password;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUserType() {
+        return userType;
+    }
+
+    public void setUserType(String userType) {
+        this.userType = userType;
+    }
+
+    public String getFkId() {
+        return fkId;
+    }
+
+    public void setFkId(String fkId) {
+        this.fkId = fkId;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getAuth() {
+        return auth;
+    }
+
+    public void setAuth(String auth) {
+        this.auth = auth;
+    }
+
+    public String getAuthTime() {
+        return authTime;
+    }
+
+    public void setAuthTime(String authTime) {
+        this.authTime = authTime;
+    }
+
+    public Long getLoginCount() {
+        return loginCount;
+    }
+
+    public void setLoginCount(Long loginCount) {
+        this.loginCount = loginCount;
+    }
+
+    public String getLastLoginTime() {
+        return lastLoginTime;
+    }
+
+    public void setLastLoginTime(String lastLoginTime) {
+        this.lastLoginTime = lastLoginTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateById() {
+        return updateById;
+    }
+
+    public void setUpdateById(String updateById) {
+        this.updateById = updateById;
+    }
+
+    public String getUpdateByName() {
+        return updateByName;
+    }
+
+    public void setUpdateByName(String updateByName) {
+        this.updateByName = updateByName;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getDeleteStatus() {
+        return deleteStatus;
+    }
+
+    public void setDeleteStatus(Integer deleteStatus) {
+        this.deleteStatus = deleteStatus;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

+ 21 - 0
sp-core/sp-base/src/main/java/com/pj/enummj/BuyType.java

@@ -0,0 +1,21 @@
+package com.pj.enummj;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 26 10 42
+ **/
+@Getter
+@AllArgsConstructor
+public enum BuyType {
+
+
+    BUY_TYPE_GROUP(2,"互助组购买"),
+    BUY_TYPE_OWN(3,"个人购买");
+
+    private Integer code;
+
+    private String msg;
+}

+ 154 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCart.java

@@ -0,0 +1,154 @@
+package com.pj.tb_goods_cart;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_goods_cart -- 购物车
+ * @author qzy 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbGoodsCart.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbGoodsCart extends Model<TbGoodsCart> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_goods_cart";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-goods-cart";
+	public static final String PERMISSION_CODE_ADD = "tb-goods-cart-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-goods-cart-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-goods-cart-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private String id;	
+
+	/**
+	 * 商家ID 
+	 */
+	private Long enterpriseId;	
+
+	/**
+	 *  
+	 */
+	private Long shopId;	
+
+	/**
+	 *  
+	 */
+	private Long tradeAreaId;
+
+	private String goodsImg;
+
+	private String goodsName;
+
+	/**
+	 *  
+	 */
+	private Long buyUserId;	
+
+	/**
+	 * 购买金额 
+	 */
+	private Double totalPrice;	
+
+	/**
+	 * 售卖商品详情表ID 
+	 */
+	private Long saleGoodsInfoId;	
+
+	/**
+	 * 购买数量 
+	 */
+	private Double buyWeight;	
+
+	/**
+	 *  
+	 */
+	private String buyUserType;	
+
+	/**
+	 * 购买方式(2=互助组,3=个人购买) 
+	 */
+	private String buyType;	
+
+	/**
+	 * 分配方式 
+	 */
+	private Integer distribution;	
+
+	/**
+	 *  
+	 */
+	private Long publishGoodsId;	
+
+	/**
+	 * 创建时间 
+	 */
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date createTime;
+
+	/**
+	 * 创建人编号 
+	 */
+	private String createBy;	
+
+	/**
+	 * 创建人名称 
+	 */
+	private String createName;	
+
+	/**
+	 * 更新时间 
+	 */
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date updateTime;
+
+	/**
+	 * 更新人编号 
+	 */
+	private String updateBy;	
+
+	/**
+	 * 更新人名称 
+	 */
+	private String updateName;	
+
+	/**
+	 * 删除状态(0=禁用,1=启用) 
+	 */
+	private Integer deleteStatus;	
+
+
+
+
+
+	
+
+
+}

+ 33 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartApiController.java

@@ -0,0 +1,33 @@
+package com.pj.tb_goods_cart;
+
+import com.pj.tb_goods_cart.dto.GoodsCartInfoDto;
+import com.pj.utils.sg.AjaxJson;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+
+/**
+ * Controller: tb_goods_cart -- 购物车
+ * @author qzy 
+ */
+@RestController
+@RequestMapping("/app/TbGoodsCart/")
+public class TbGoodsCartApiController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbGoodsCartService tbGoodsCartService;
+
+	/** 添加购物车 */
+	@RequestMapping("addGoodsInShopCart")
+	public AjaxJson addGoodsInShopCart(@Validated @RequestBody GoodsCartInfoDto goodsCartInfoDto){
+		AjaxJson ajaxJson = tbGoodsCartService.addGoodsInShopCart(goodsCartInfoDto);
+		return ajaxJson;
+	}
+	
+
+}

+ 88 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartController.java

@@ -0,0 +1,88 @@
+package com.pj.tb_goods_cart;
+
+import java.util.List;
+
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_goods_cart -- 购物车
+ * @author qzy 
+ */
+@RestController
+@RequestMapping("/TbGoodsCart/")
+public class TbGoodsCartController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbGoodsCartService tbGoodsCartService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_ADD)
+	public AjaxJson add(TbGoodsCart t){
+		tbGoodsCartService.add(t);
+		t = tbGoodsCartService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 tbGoodsCartService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbGoodsCart.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_EDIT)
+	public AjaxJson update(TbGoodsCart t){
+		tbGoodsCartService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
+	public AjaxJson getById(String id){
+		TbGoodsCart t = tbGoodsCartService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+		@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbGoodsCart> list = tbGoodsCartService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	/** 改 - 删除状态(0=禁用,1=启用) */  
+	@RequestMapping("updateDeleteStatus")
+	@SaCheckPermission(TbGoodsCart.PERMISSION_CODE_EDIT)
+	public AjaxJson updateDeleteStatus(String id, Integer value){
+		int line = SP.publicMapper.updateColumnById(TbGoodsCart.TABLE_NAME, "delete_status", value, id);
+		return AjaxJson.getByLine(line);
+	}
+
+}

+ 30 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartMapper.java

@@ -0,0 +1,30 @@
+package com.pj.tb_goods_cart;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_goods_cart -- 购物车
+ * @author qzy 
+ */
+
+@Mapper
+@Repository
+public interface TbGoodsCartMapper extends BaseMapper <TbGoodsCart> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbGoodsCart> getList(SoMap so);
+
+
+}

+ 80 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartMapper.xml

@@ -0,0 +1,80 @@
+<?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.pj.tb_goods_cart.TbGoodsCartMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, enterprise_id, shop_id, trade_area_id, buy_user_id, total_price, sale_goods_info_id, buy_weight, buy_user_type, buy_type, distribution, publish_goods_id, create_time, create_by, create_name, update_time, update_by, update_name, delete_status from tb_goods_cart  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.tb_goods_cart.TbGoodsCart"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_goods_cart 
+	</sql>
+
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("enterpriseId") '> and enterprise_id = #{enterpriseId} </if>
+			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
+			<if test=' this.has("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </if>
+			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
+			<if test=' this.has("buyUserId") '> and buy_user_id = #{buyUserId} </if>
+			<if test=' this.has("totalPrice") '> and total_price = #{totalPrice} </if>
+			<if test=' this.has("saleGoodsInfoId") '> and sale_goods_info_id = #{saleGoodsInfoId} </if>
+			<if test=' this.has("buyWeight") '> and buy_weight = #{buyWeight} </if>
+			<if test=' this.has("buyUserType") '> and buy_user_type = #{buyUserType} </if>
+			<if test=' this.has("buyType") '> and buy_type = #{buyType} </if>
+			<if test=' this.has("distribution") '> and distribution = #{distribution} </if>
+			<if test=' this.has("publishGoodsId") '> and publish_goods_id = #{publishGoodsId} </if>
+			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
+			<if test=' this.has("createName") '> and create_name = #{createName} </if>
+			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
+			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
+			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> enterprise_id desc </when>
+			<when test='sortType == 3'> shop_id desc </when>
+			<when test='sortType == 4'> trade_area_id desc </when>
+			<when test='sortType == 5'> buy_user_id desc </when>
+			<when test='sortType == 6'> total_price desc </when>
+			<when test='sortType == 7'> sale_goods_info_id desc </when>
+			<when test='sortType == 8'> buy_weight desc </when>
+			<when test='sortType == 9'> buy_user_type desc </when>
+			<when test='sortType == 10'> buy_type desc </when>
+			<when test='sortType == 11'> distribution desc </when>
+			<when test='sortType == 12'> publish_goods_id desc </when>
+			<when test='sortType == 13'> create_time desc </when>
+			<when test='sortType == 14'> create_by desc </when>
+			<when test='sortType == 15'> create_name desc </when>
+			<when test='sortType == 16'> update_time desc </when>
+			<when test='sortType == 17'> update_by desc </when>
+			<when test='sortType == 18'> update_name desc </when>
+			<when test='sortType == 19'> delete_status desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 86 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartService.java

@@ -0,0 +1,86 @@
+package com.pj.tb_goods_cart;
+
+import java.util.Date;
+import java.util.List;
+
+import com.pj.api.client.admin.AdminInterface;
+import com.pj.api.dto.AppUserDto;
+import com.pj.current.satoken.StpUserUtil;
+import com.pj.enummj.DeleteStatus;
+import com.pj.tb_goods_cart.dto.GoodsCartInfoDto;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+import com.pj.utils.sg.*;
+
+/**
+ * Service: tb_goods_cart -- 购物车
+ * @author qzy 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbGoodsCartService extends ServiceImpl<TbGoodsCartMapper, TbGoodsCart> implements IService<TbGoodsCart>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbGoodsCartMapper tbGoodsCartMapper;
+
+	@Autowired
+	private AdminInterface adminInterface;
+
+	/** 增 */
+	void add(TbGoodsCart t){
+		save(t);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(TbGoodsCart t){
+		updateById(t);
+
+	}
+
+	/** 查 */
+	TbGoodsCart getById(String id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbGoodsCart> getList(SoMap so) { 
+		return tbGoodsCartMapper.getList(so);	
+	}
+
+	/** 添加商品进购物车 */
+	public AjaxJson addGoodsInShopCart(GoodsCartInfoDto goodsCartInfoDto){
+		//检查登录
+//		StpUserUtil.checkLogin();
+		//验证购买者
+		Long id = goodsCartInfoDto.getBuyUserId();
+		AppUserDto appUser = adminInterface.getAppUserById(id);
+		if(appUser == null)return AjaxJson.getError("购买者账号异常");
+		//创建保存对象
+		TbGoodsCart tbGoodsCart = new TbGoodsCart();
+		BeanUtils.copyProperties(goodsCartInfoDto,tbGoodsCart);
+		//设置基本属性
+		tbGoodsCart.setCreateTime(new Date());
+		tbGoodsCart.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
+		tbGoodsCart.setCreateBy(appUser.getId().toString());
+		tbGoodsCart.setCreateName(appUser.getName());
+		//执行保存
+		int insert = tbGoodsCartMapper.insert(tbGoodsCart);
+		//判断保存结果
+		if(insert != 1)AjaxJson.getError("购物车保存失败!");
+		return AjaxJson.getSuccess("添加购物车成功!");
+	}
+
+
+
+}

+ 27 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartUtil.java

@@ -0,0 +1,27 @@
+package com.pj.tb_goods_cart;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 工具类:tb_goods_cart -- 购物车
+ * @author qzy 
+ *
+ */
+@Component
+public class TbGoodsCartUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbGoodsCartMapper tbGoodsCartMapper;
+	@Autowired
+	private void setTbGoodsCartMapper(TbGoodsCartMapper tbGoodsCartMapper) {
+		TbGoodsCartUtil.tbGoodsCartMapper = tbGoodsCartMapper;
+	}
+	
+
+
+	
+	
+	
+}

+ 54 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/dto/GoodsCartInfoDto.java

@@ -0,0 +1,54 @@
+package com.pj.tb_goods_cart.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 26 10 38
+ **/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GoodsCartInfoDto {
+
+    /** 购买者ID(组长/个人) */
+    @NotNull(message = "购买者ID必填")
+    private Long buyUserId;
+    /** 商家ID */
+    @NotNull(message = "商家ID必填")
+    private String merchantId;
+    /** 店铺ID */
+    @NotNull(message = "店铺ID必填")
+    private String shopId;
+    /** 购买地点ID */
+    @NotNull(message = "区域ID必填")
+    private String tradeAreaId;
+    /** 购买总价 */
+    @NotNull(message = "必填")
+    @DecimalMin("0.0")
+    private Double totalPrice;
+    /** 商品ID */
+    @NotNull(message = "商品ID必填")
+    private Long goodsId;
+    /** 购买者类型(边民/...) */
+    @NotNull(message = "购买者ID必填")
+    private Integer buyUserType;
+    /** 购买方式 */
+    @NotNull(message = "购买类型(2=互助组,3=个人购买)必填")
+    private Integer buyType;
+    /** 商品图片 */
+    @NotNull(message = "商品ID必填")
+    private String goodsImg;
+    /** 商品名称 */
+    @NotNull(message = "商品名称必填")
+    private String goodsName;
+    /** 购买个数 */
+    @NotNull(message = "购买个数必填")
+    private Integer buyWeight;
+
+}

+ 3 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitController.java

@@ -106,11 +106,11 @@ public class TbGoodsTransitController {
 		return AjaxJson.getByLine(line);
 	}
 
-	/** 查看一级市场的在商品列表 */
+	/** 查看一级市场的在销/上架商品列表 */
 	@GetMapping("getTransitList")
-	public AjaxJson getTransitList(){
+	public AjaxJson getTransitList(@RequestParam("goodsType")String goodsType){
 		SoMap so = SoMap.getRequestSoMap();
-		List<TbGoodsTransit> transitList = tbGoodsTransitService.getTransitList(so.startPage());
+		List<TbGoodsTransit> transitList = tbGoodsTransitService.getTransitList(so.startPage(),goodsType);
 		return AjaxJson.getPageData(so.getDataCount(),transitList);
 	}
 

+ 5 - 9
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java

@@ -70,12 +70,15 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		return tbGoodsTransitMapper.getList(so);	
 	}
 
-	/** 查看一级市场在销商品 */
-	List<TbGoodsTransit> getTransitList(SoMap so){
+	/** 查看一级市场在销/上架商品 */
+	List<TbGoodsTransit> getTransitList(SoMap so,String goodsType){
 		//设置可展示的状态
 		so.set("audit_status", AuditStatus.AUDIT_STATUS_ON.getCode());
 		so.set("delete_status", DeleteStatus.DELETE_STATUS_ON.getCode());
 		so.set("goods_status", GoodsStatus.GOODS_STATUS_ON.getCode());
+		if(goodsType != null){
+			so.set("goods_type", goodsType);
+		}
 		//获取在销商品列表,根据日期进行降序排序
 		List<TbGoodsTransit> goodsTransitList = tbGoodsTransitMapper.getList(so);
 		return goodsTransitList;
@@ -110,13 +113,6 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		return "已完成 " + count + "条 数据审核!";
 	}
 
-	/** 查看一级市场上架的商品 */
-	public List<TbGoods> getSelfGoodsTransit(Integer goodsType){
-		//默认查询已上架的商品
-		LambdaQueryWrapper<TbGoods> queryWrapper = new LambdaQueryWrapper<>();
-
-		return null;
-	}
 
 	/**
 	 * 导入

+ 9 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java

@@ -2,6 +2,7 @@ package com.pj.project.app_user;
 
 import java.util.List;
 
+import com.pj.api.dto.AppUserDto;
 import com.pj.project.app_user.dto.ForgetPasswordDto;
 import com.pj.project.app_user.dto.RegisterDto;
 import com.pj.utils.so.SoMap;
@@ -95,5 +96,13 @@ public class AppUserController {
 		return AjaxJson.getError();
 	}
 
+	/** 查单个app有效用户 - 根据id */
+	@RequestMapping("rpc/getById")
+	public AppUserDto getAppUserById(@RequestParam("id") Long id){
+		AppUserDto appUser = appUserService.getUserById(id);
+		return appUser;
+	}
+
+
 
 }

+ 16 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
 
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.api.dto.AppUserDto;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.app_user.dto.ForgetPasswordDto;
 import com.pj.project.app_user.dto.RegisterDto;
@@ -15,6 +16,7 @@ import com.pj.utils.cache.RedisUtil;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
@@ -68,6 +70,20 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 		return super.getById(id);
 	}
 
+	/** 查询单个APP有效用户 */
+	public AppUserDto getUserById(Long id){
+		//查单个
+		AppUser appUser = appUserMapper.selectById(id);
+		if (appUser == null)return null;
+		//判断有效性
+		if(!appUser.getStatus().equals("0") && appUser.getDeleteStatus() != 0){
+			AppUserDto appUserDto = new AppUserDto();
+			BeanUtils.copyProperties(appUser,appUserDto);
+			return appUserDto;
+		}
+		return null;
+	}
+
 	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
 	List<AppUser> getList(SoMap so) {
 		return appUserMapper.getList(so);