Эх сурвалжийг харах

Merge branch 'dev' of http://git.aseanbusiness.cn/qzyReal/market-server into dev

# Conflicts:
#	app.pid
#	sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java
#	sp-core/sp-api/src/main/java/com/pj/api/consts/FeignFactory.java
#	sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java
#	sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java
qzyReal 2 жил өмнө
parent
commit
58095020cc
45 өөрчлөгдсөн 2109 нэмэгдсэн , 494 устгасан
  1. 1 1
      sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java
  2. 10 2
      sp-core/sp-api/src/main/java/com/pj/api/consts/FeignFactory.java
  3. 24 0
      sp-core/sp-base/src/main/java/com/pj/enummj/People.java
  4. 11 11
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/MethodEnterpriseService.java
  5. 4 4
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java
  6. 7 25
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java
  7. 121 0
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseDto.java
  8. 64 64
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseMapper.xml
  9. 50 1
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java
  10. 7 2
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsType.java
  11. 34 39
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeController.java
  12. 15 0
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeMapper.java
  13. 47 30
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeMapper.xml
  14. 55 101
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeService.java
  15. 27 65
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeUtil.java
  16. 13 78
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupController.java
  17. 78 0
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupDto.java
  18. 123 0
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java
  19. 301 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java
  20. 93 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java
  21. 30 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.java
  22. 142 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.xml
  23. 50 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java
  24. 144 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderUtil.java
  25. 4 2
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java
  26. 19 14
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java
  27. 22 0
      sp-service/level-one-server/src/main/java/com/pj/tb_people/dto/StartStopDto.java
  28. 34 15
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaController.java
  29. 16 0
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaMapper.java
  30. 42 27
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaMapper.xml
  31. 67 0
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java
  32. 9 0
      sp-service/sp-admin/src/main/java/com/pj/SpAdminApplication.java
  33. 9 1
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUser.java
  34. 56 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java
  35. 8 2
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java
  36. 173 6
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java
  37. 16 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/MethodAppUserService.java
  38. 27 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/dto/ForgetPasswordDto.java
  39. 28 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/dto/RegisterDto.java
  40. 37 0
      sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/MethodRoleMenuService.java
  41. 9 2
      sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/ReRoleMenu.java
  42. 17 1
      sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/ReRoleMenuController.java
  43. 39 1
      sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/ReRoleMenuService.java
  44. 20 0
      sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/dto/AssignPermissionsDto.java
  45. 6 0
      sp-service/transport-server/src/main/java/com/pj/TransportServerApplication.java

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

@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 public interface AdminInterface {
 
 	/** 启/停边民的app账号登陆限制 */
-	@RequestMapping("AppUser/rpc/isLock")
+	@RequestMapping("/AppUser/rpc/isLock")
 	int isLock(@RequestParam("id") String id,
 			   @RequestParam("type") Integer type,
 			   @RequestParam("status") Integer status);

+ 10 - 2
sp-core/sp-api/src/main/java/com/pj/api/consts/FeignFactory.java

@@ -22,10 +22,18 @@ public class FeignFactory {
 	public void setSpCfgInterface(SpCfgInterface spCfgInterface) {
 		FeignFactory.spCfgInterface = spCfgInterface;
 	}
-	
+
+	/**
+	 * app用户  通信接口
+	 */
 	public static AdminInterface adminInterface;
 	@Autowired
-	public  void setAdminInterface(AdminInterface adminInterface) {
+	public void setAdminInterface(AdminInterface adminInterface){
 		FeignFactory.adminInterface = adminInterface;
 	}
+
+	
+	
+	
+	
 }

+ 24 - 0
sp-core/sp-base/src/main/java/com/pj/enummj/People.java

@@ -0,0 +1,24 @@
+package com.pj.enummj;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 25 09 54
+ **/
+@Getter
+@AllArgsConstructor
+public enum People {
+
+    PEOPLE_TYPE_ONE(1,"边民类型"),
+    PEOPLE_TYPE_TWO(2,"商户类型");
+
+
+
+    private Integer code;
+
+    private String msg;
+
+
+}

+ 11 - 11
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/MethodEnterpriseService.java

@@ -111,29 +111,29 @@ public class MethodEnterpriseService {
                 tbEnterprise.setRegisterTime(dateValue);
             }
 
-            if(row.getCell(21) != null && !row.getCell(21).toString().trim().equals(""))
-                tbEnterprise.setPersonId(row.getCell(21).getStringCellValue());
+//            if(row.getCell(21) != null && !row.getCell(21).toString().trim().equals(""))
+//                tbEnterprise.setPersonId(row.getCell(21).getStringCellValue());
 
             //公共字段
-            HSSFCell cell2 = row.getCell(22);
+            HSSFCell cell2 = row.getCell(21);
             if (cell2 != null && cell2.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell2)) {
                 tbEnterprise.setCreateTime(cell2.getDateCellValue());
             }
 
+            if(row.getCell(22) != null && !row.getCell(22).toString().trim().equals(""))
+                tbEnterprise.setCreateBy(row.getCell(22).getStringCellValue());
+
             if(row.getCell(23) != null && !row.getCell(23).toString().trim().equals(""))
-                tbEnterprise.setCreateBy(row.getCell(23).getStringCellValue());
+                tbEnterprise.setCreateName(row.getCell(23).getStringCellValue());
 
             if(row.getCell(24) != null && !row.getCell(24).toString().trim().equals(""))
-                tbEnterprise.setCreateName(row.getCell(24).getStringCellValue());
-
+                tbEnterprise.setUpdateBy(row.getCell(24).getStringCellValue());
             if(row.getCell(25) != null && !row.getCell(25).toString().trim().equals(""))
-                tbEnterprise.setUpdateBy(row.getCell(25).getStringCellValue());
-            if(row.getCell(26) != null && !row.getCell(26).toString().trim().equals(""))
-                tbEnterprise.setUpdateName(row.getCell(26).getStringCellValue());
+                tbEnterprise.setUpdateName(row.getCell(25).getStringCellValue());
 
-            HSSFCell cell3 = row.getCell(27);
+            HSSFCell cell3 = row.getCell(26);
             if (cell3 != null && cell3.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell3)) {
-                tbEnterprise.setUpdateTime(row.getCell(27).getDateCellValue());
+                tbEnterprise.setUpdateTime(cell3.getDateCellValue());
             }
             //删除状态,默认可用
             tbEnterprise.setDeleteStatus(1);

+ 4 - 4
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java

@@ -150,10 +150,10 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date registerTime;
 
-	/**
-	 *  
-	 */
-	private String personId;
+//	/**
+//	 *
+//	 */
+//	private String personId;
 
 	/**
 	 * 创建时间 

+ 7 - 25
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java

@@ -10,7 +10,6 @@ import cn.hutool.core.date.DateUtil;
 import com.pj.api.client.admin.AdminInterface;
 import com.pj.api.consts.FeignFactory;
 import com.pj.common.core.utils.DateUtils;
-import com.pj.constants.UserTypeEnum;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,8 +38,7 @@ public class TbEnterpriseController {
 	/** 底层 Service 对象 */
 	@Autowired
 	TbEnterpriseService tbEnterpriseService;
-	@Autowired
-	AdminInterface adminInterface;
+
 
 
 	/** 增 */  
@@ -146,16 +144,10 @@ public class TbEnterpriseController {
 	*/
 	@RequestMapping("audit")
 	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_EDIT)
-	public AjaxJson audit(TbEnterprise t){
+	public AjaxJson audit(@RequestBody TbEnterpriseDto tbEnterpriseDto){
 
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-		TbEnterprise tbEnterprise = tbEnterpriseService.getById(t.getId());
-		if(Objects.isNull(tbEnterprise)){
-			return AjaxJson.getSuccess("该商户不存在");
-		}
-		tbEnterprise.setUpdateBy(String.valueOf(loginId));
-		tbEnterpriseService.update(t);
-		return AjaxJson.getSuccess();
+		int line = tbEnterpriseService.audit(tbEnterpriseDto);
+		return AjaxJson.getByLine(line);
 	}
 
 
@@ -167,18 +159,8 @@ public class TbEnterpriseController {
 	*/
 	@RequestMapping("isLock")
 	@SaCheckPermission(TbEnterprise.PERMISSION_CODE_EDIT)
-	public AjaxJson isLock(TbEnterprise t) {
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-		TbEnterprise tbEnterprise = tbEnterpriseService.getById(t.getId());
-		if (Objects.isNull(tbEnterprise)) {
-			return AjaxJson.getSuccess("该商户不存在");
-		}
-		// 如果商户被锁住则禁止app端登录
-		adminInterface.isLock(String.valueOf(t.getId()), UserTypeEnum.ENTRPRISE_TYPE.getCode(),0);
-		tbEnterprise.setUpdateBy(String.valueOf(loginId));
-		tbEnterpriseService.update(t);
-
-
-		return AjaxJson.getSuccess();
+	public AjaxJson isLock(@RequestBody  TbEnterpriseDto tbEnterpriseDto) {
+		int line = tbEnterpriseService.isLock( tbEnterpriseDto);
+		return AjaxJson.getByLine(line);
 	}
 }

+ 121 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseDto.java

@@ -0,0 +1,121 @@
+package com.pj.tb_enterprise;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TbEnterpriseDto {
+
+
+
+
+    // ---------- 表中字段 ----------
+    /**
+     *
+     */
+    private Long id;
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 国别
+     */
+    private String nationality;
+
+    /**
+     * 商户分类(自营商铺=自营商铺,劳务商铺=劳务商铺)
+     */
+    private String type;
+
+    /**
+     * 法人
+     */
+    private String legalPerson;
+
+    /**
+     * 身份证号
+     */
+    private String idCard;
+
+    /**
+     * 手机号码
+     */
+    private String contact;
+
+    /**
+     * 营业执照
+     */
+    private String businessLicense;
+
+    /**
+     * 所在铺位ID
+     */
+    private Long shopId;
+
+    /**
+     * 所在铺位名称(1=100-2)
+     */
+    private String shopName;
+
+    /**
+     * 银行编号(CMB= 招商银行)
+     */
+    private String bankNo;
+
+    /**
+     *
+     */
+    private String bankName;
+
+    /**
+     * 银行账号
+     */
+    private String bankAccount;
+
+    /**
+     * 税号
+     */
+    private String dutyParagraph;
+
+    /**
+     *
+     */
+    private String addressIds;
+
+    /**
+     *
+     */
+    private String address;
+
+    /**
+     *
+     */
+    private String agreement;
+
+    /**
+     *
+     */
+    private int judgeStatus;
+
+    /**
+     *
+     */
+    private String judgeContent;
+
+
+
+    /**
+     * 是否锁定
+     */
+    private Integer isLock;
+}

+ 64 - 64
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseMapper.xml

@@ -17,74 +17,74 @@
 		from tb_enterprise 
 	</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("name") '> and name = #{name} </if>
-			<if test=' this.has("nationality") '> and nationality = #{nationality} </if>
-			<if test=' this.has("type") '> and type = #{type} </if>
-			<if test=' this.has("legalPerson") '> and legal_person = #{legalPerson} </if>
-			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>
-			<if test=' this.has("contact") '> and contact = #{contact} </if>
-			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
-			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>
-			<if test=' this.has("bankNo") '> and bank_no = #{bankNo} </if>
-			<if test=' this.has("bankName") '> and bank_name = #{bankName} </if>
-			<if test=' this.has("bankAccount") '> and bank_account = #{bankAccount} </if>
-			<if test=' this.has("dutyParagraph") '> and duty_paragraph = #{dutyParagraph} </if>
-			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>
-			<if test=' this.has("address") '> and address = #{address} </if>
-			<if test=' this.has("agreement") '> and agreement = #{agreement} </if>
-			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>
-			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>
-			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>
-			<if test=' this.has("registerTime") '> and register_time = #{registerTime} </if>
-			<if test=' this.has("personId") '> and person_id = #{personId} </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'> name desc </when>
-			<when test='sortType == 3'> nationality desc </when>
-			<when test='sortType == 4'> type desc </when>
-			<when test='sortType == 5'> legal_person desc </when>
-			<when test='sortType == 6'> id_card desc </when>
-			<when test='sortType == 7'> contact desc </when>
-			<when test='sortType == 8'> shop_id desc </when>
-			<when test='sortType == 9'> shop_name desc </when>
-			<when test='sortType == 10'> bank_no desc </when>
-			<when test='sortType == 11'> bank_name desc </when>
-			<when test='sortType == 12'> bank_account desc </when>
-			<when test='sortType == 13'> duty_paragraph desc </when>
-			<when test='sortType == 14'> address_ids desc </when>
-			<when test='sortType == 15'> address desc </when>
-			<when test='sortType == 16'> agreement desc </when>
-			<when test='sortType == 17'> judge_status desc </when>
-			<when test='sortType == 18'> judge_content desc </when>
-			<when test='sortType == 19'> judge_time desc </when>
-			<when test='sortType == 20'> register_time desc </when>
-			<when test='sortType == 21'> person_id desc </when>
-			<when test='sortType == 22'> create_time desc </when>
-			<when test='sortType == 23'> create_by desc </when>
-			<when test='sortType == 24'> create_name desc </when>
-			<when test='sortType == 25'> update_time desc </when>
-			<when test='sortType == 26'> update_by desc </when>
-			<when test='sortType == 27'> update_name desc </when>
-			<when test='sortType == 28'> delete_status desc </when>
-			<otherwise> id desc </otherwise>
-		</choose>
+<!--		<where>-->
+<!--			<if test=' this.has("id") '> and id = #{id} </if>-->
+<!--			<if test=' this.has("name") '> and name = #{name} </if>-->
+<!--			<if test=' this.has("nationality") '> and nationality = #{nationality} </if>-->
+<!--			<if test=' this.has("type") '> and type = #{type} </if>-->
+<!--			<if test=' this.has("legalPerson") '> and legal_person = #{legalPerson} </if>-->
+<!--			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>-->
+<!--			<if test=' this.has("contact") '> and contact = #{contact} </if>-->
+<!--			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>-->
+<!--			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>-->
+<!--			<if test=' this.has("bankNo") '> and bank_no = #{bankNo} </if>-->
+<!--			<if test=' this.has("bankName") '> and bank_name = #{bankName} </if>-->
+<!--			<if test=' this.has("bankAccount") '> and bank_account = #{bankAccount} </if>-->
+<!--			<if test=' this.has("dutyParagraph") '> and duty_paragraph = #{dutyParagraph} </if>-->
+<!--			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>-->
+<!--			<if test=' this.has("address") '> and address = #{address} </if>-->
+<!--			<if test=' this.has("agreement") '> and agreement = #{agreement} </if>-->
+<!--			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>-->
+<!--			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>-->
+<!--			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>-->
+<!--			<if test=' this.has("registerTime") '> and register_time = #{registerTime} </if>-->
+<!--			<if test=' this.has("personId") '> and person_id = #{personId} </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'> name desc </when>-->
+<!--			<when test='sortType == 3'> nationality desc </when>-->
+<!--			<when test='sortType == 4'> type desc </when>-->
+<!--			<when test='sortType == 5'> legal_person desc </when>-->
+<!--			<when test='sortType == 6'> id_card desc </when>-->
+<!--			<when test='sortType == 7'> contact desc </when>-->
+<!--			<when test='sortType == 8'> shop_id desc </when>-->
+<!--			<when test='sortType == 9'> shop_name desc </when>-->
+<!--			<when test='sortType == 10'> bank_no desc </when>-->
+<!--			<when test='sortType == 11'> bank_name desc </when>-->
+<!--			<when test='sortType == 12'> bank_account desc </when>-->
+<!--			<when test='sortType == 13'> duty_paragraph desc </when>-->
+<!--			<when test='sortType == 14'> address_ids desc </when>-->
+<!--			<when test='sortType == 15'> address desc </when>-->
+<!--			<when test='sortType == 16'> agreement desc </when>-->
+<!--			<when test='sortType == 17'> judge_status desc </when>-->
+<!--			<when test='sortType == 18'> judge_content desc </when>-->
+<!--			<when test='sortType == 19'> judge_time desc </when>-->
+<!--			<when test='sortType == 20'> register_time desc </when>-->
+<!--			<when test='sortType == 21'> person_id desc </when>-->
+<!--			<when test='sortType == 22'> create_time desc </when>-->
+<!--			<when test='sortType == 23'> create_by desc </when>-->
+<!--			<when test='sortType == 24'> create_name desc </when>-->
+<!--			<when test='sortType == 25'> update_time desc </when>-->
+<!--			<when test='sortType == 26'> update_by desc </when>-->
+<!--			<when test='sortType == 27'> update_name desc </when>-->
+<!--			<when test='sortType == 28'> delete_status desc </when>-->
+<!--			<otherwise> id desc </otherwise>-->
+<!--		</choose>-->
 	</select>
-	
+
 	
 	
 	

+ 50 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java

@@ -5,15 +5,21 @@ import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.List;
+import java.util.Objects;
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.api.client.admin.AdminInterface;
+import com.pj.current.satoken.StpUserUtil;
+import com.pj.enummj.People;
+import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -35,6 +41,8 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 	/** 底层 Mapper 对象 */
 	@Autowired
 	TbEnterpriseMapper tbEnterpriseMapper;
+	@Autowired
+	AdminInterface adminInterface;
 
 	/** 非事务方法调用事务方法需要代理对象 */
 	@Autowired
@@ -66,6 +74,47 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 		return tbEnterpriseMapper.getList(so);	
 	}
 
+	public int audit(TbEnterpriseDto tbEnterpriseDto){
+
+		// 获取当前登录用户id
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		// 根据id获取商户
+		TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
+		// 如果商户不存在则抛出异常
+		if(Objects.isNull(tbEnterprise)){
+			throw new RuntimeException("该商户不存在");
+		}
+		BeanUtils.copyProperties(tbEnterpriseDto,tbEnterprise);
+		// 写入更新者id
+		tbEnterprise.setUpdateBy(String.valueOf(loginId));
+		// 更新商户审核状态
+		int line = tbEnterpriseMapper.updateById(tbEnterprise);
+		return line;
+	}
+
+	public int isLock(TbEnterpriseDto tbEnterpriseDto) {
+		// 获取当前登录用户id
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		// 根据id获取商户
+		TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
+		// 如果商户不存在则抛出异常
+		if(Objects.isNull(tbEnterprise)){
+			throw new RuntimeException("该商户不存在");
+		}
+		BeanUtils.copyProperties(tbEnterpriseDto,tbEnterprise);
+		// 写入更新者id
+		tbEnterprise.setUpdateBy(String.valueOf(loginId));
+		// 更新商户锁定状态
+		int  line = tbEnterpriseMapper.updateById(tbEnterprise);
+		//获取商户锁定状态
+		int isLock = tbEnterprise.getIsLock();
+		// 如果商户被锁住则禁止app端登录
+		// TODO
+		adminInterface.isLock(String.valueOf(tbEnterprise.getId()), People.PEOPLE_TYPE_TWO.getCode(),isLock);
+
+		return line;
+	}
+
 	/**
 	 * 导入
 	 * @param file excel文件
@@ -171,7 +220,7 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 			sheetRow.createCell(18).setCellValue((selectedList.get(i).getJudgeContent() + "").equals("null")? "": selectedList.get(i).getJudgeContent() + "");
 			sheetRow.createCell(19).setCellValue((selectedList.get(i).getJudgeTime() + "").equals("null")? "": selectedList.get(i).getJudgeTime() + "");
 			sheetRow.createCell(20).setCellValue((selectedList.get(i).getRegisterTime() + "").equals("null")? "": selectedList.get(i).getRegisterTime() + "");
-			sheetRow.createCell(21).setCellValue((selectedList.get(i).getPersonId() + "").equals("null")? "": selectedList.get(i).getPersonId() + "");
+//			sheetRow.createCell(21).setCellValue((selectedList.get(i).getPersonId() + "").equals("null")? "": selectedList.get(i).getPersonId() + "");
 			sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null")? "": selectedList.get(i).getCreateTime() + "");
 			sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null")? "": selectedList.get(i).getCreateBy() + "");
 			sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null")? "": selectedList.get(i).getCreateName() + "");

+ 7 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsType.java

@@ -46,10 +46,10 @@ public class TbGoodsType extends Model<TbGoodsType> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
-	private Long id;
+	private String id;	
 
 	/**
-	 * 名称 
+	 * 类别名称 
 	 */
 	private String name;	
 
@@ -100,6 +100,11 @@ public class TbGoodsType extends Model<TbGoodsType> implements Serializable {
 	 */
 	private Integer deleteStatus;	
 
+	/**
+	 * 父类型id 
+	 */
+	private Long parentId;	
+
 
 
 

+ 34 - 39
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeController.java

@@ -1,18 +1,14 @@
 package com.pj.tb_goods_type;
 
-import java.io.IOException;
 import java.util.List;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import com.pj.utils.sg.*;
 import com.pj.project4sp.SP;
 
-import com.pj.current.satoken.StpUserUtil;
 import cn.dev33.satoken.annotation.SaCheckPermission;
-import org.springframework.web.multipart.MultipartFile;
 
 
 /**
@@ -39,8 +35,8 @@ public class TbGoodsTypeController {
 	/** 删 */  
 	@RequestMapping("delete")
 	@SaCheckPermission(TbGoodsType.PERMISSION_CODE_DEL)
-	public AjaxJson delete(Long id){
-		 tbGoodsTypeService.delete(id);
+	public AjaxJson delete(String id){
+		 tbGoodsTypeService.delete(Long.valueOf(id));
 		return AjaxJson.getSuccess();
 	}
 	
@@ -78,6 +74,17 @@ public class TbGoodsTypeController {
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
 	
+	/** 查集合 (整个表数据转化为tree结构返回) */  
+	@RequestMapping("getTree")
+	public AjaxJson getTree() { 
+		// 获取记录 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbGoodsType> list = tbGoodsTypeService.getList(so);
+		// 转为tree结构,并返回 
+		List<SoMap> listMap = SoMap.getSoMapByList(list);
+		List<SoMap> listTree = SoMap.listToTree(listMap, "id", "parentId", "children");
+		return AjaxJson.getPageData(Long.valueOf(listMap.size()), listTree);
+	}
 	
 	
 	/** 改 - 删除状态(0=禁用,1=启用) */  
@@ -88,46 +95,34 @@ public class TbGoodsTypeController {
 		return AjaxJson.getByLine(line);
 	}
 
-
-
 	/**
-	 * 数据导入接口
-	 * @param file
-	 * @return
+	 *
+	 *给商品类型添加商品
+	 * @author loovi
+	 * @date
 	 */
-	@RequestMapping("goodsTypeImport")
-	@ResponseBody
-	public AjaxJson dataImport(@RequestParam("file") MultipartFile file){
-		try {
-			String importData = tbGoodsTypeService.importData(file);
-			AjaxJson.getSuccess(importData);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-		return AjaxJson.getError();
+	@RequestMapping("addGoodsToGoodsType")
+	@SaCheckPermission(TbGoodsType.PERMISSION_CODE_EDIT)
+	public AjaxJson addGoodsToGoodsType(@RequestParam("goodsTypeId") Long goodsTypeId,@RequestParam("goodsIds") Long [] goodsIds){
+		int  line = tbGoodsTypeService.addGoodsToGoodsType(goodsTypeId,goodsIds);
+		return AjaxJson.getByLine(line);
 	}
 
 	/**
-	 * 导出
-	 * @param keyword
-	 * @return
+	 *
+	 *删除商品类型中的商品
+	 * @author loovi
+	 * @date
 	 */
-	@RequestMapping("goodsTypeOutport")
-	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepathh",required = false)String filepath){
-		try {
-			String importData = tbGoodsTypeService.outportExcel(keyword,filepath);
-			AjaxJson.getSuccess(importData);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-		return AjaxJson.getError();
+	@RequestMapping("delGoodsFromGoodsType")
+	@SaCheckPermission(TbGoodsType.PERMISSION_CODE_EDIT)
+	public AjaxJson delGoodsFromGoodsType(@RequestParam("goodsTypeId") Long goodsTypeId,@RequestParam("goodsIds") Long [] goodsIds){
+		int  line = tbGoodsTypeService.delGoodsFromGoodsType(goodsTypeId,goodsIds);
+		return AjaxJson.getByLine(line);
 	}
 
-
-
-
-
-
+	
+	
+	
 
 }

+ 15 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -26,5 +27,19 @@ public interface TbGoodsTypeMapper extends BaseMapper <TbGoodsType> {
 	 */
 	List<TbGoodsType> getList(SoMap so);
 
+	/**
+	 *写入商品和大河内高频类型关系表
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	int addGoodsToGoodsType(@Param("goodsTypeId") Long goodsTypeId, @Param("goodsId") Long goodsId);
+	/**
+	 *删除商品和大河内高频类型关系表的关系
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	int delGoodsFromGoodsType(@Param("goodsTypeId") Long goodsTypeId, @Param("goodsId") Long goodsId);
 
 }

+ 47 - 30
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeMapper.xml

@@ -6,7 +6,7 @@
 
 
 	<!-- ================================== 查询相关 ================================== -->
-	<!-- select id, name, sort, no, create_time, create_by, create_name, update_time, update_by, update_name, delete_status from tb_goods_type  -->
+	<!-- select id, name, sort, no, create_time, create_by, create_name, update_time, update_by, update_name, delete_status, parent_id from tb_goods_type  -->
 	
 	<!-- 通用映射:自动模式 -->
 	<resultMap id="model" autoMapping="true" type="com.pj.tb_goods_type.TbGoodsType"></resultMap>
@@ -17,38 +17,55 @@
 		from tb_goods_type 
 	</sql>
 
-	
+	<insert id="addGoodsToGoodsType">
+		insert into tb_goods_type_goods_relation
+		(goods_id,goods_type_id)
+		values(
+		<if  test="goodsId!=null and goodsId!=''"> #{goodsId},</if>
+		<if  test="goodsTypeId!=null and goodsTypeId!=''">  #{goodsTypeId}</if>
+		)
+	</insert>
+
+	<delete id="delGoodsFromGoodsType">
+		delete from  tb_goods_type_goods_relation
+		<where>
+			<if  test="goodsId!=null and goodsId!=''"> goods_id=#{goodsId}</if>
+			<if  test="goodsTypeId!=null and goodsTypeId!=''"> and goods_type_id=#{goodsTypeId}</if>
+		</where>
+	</delete>
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [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("name") '> and name = #{name} </if>
-			<if test=' this.has("sort") '> and sort = #{sort} </if>
-			<if test=' this.has("no") '> and no = #{no} </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'> name desc </when>
-			<when test='sortType == 3'> sort desc </when>
-			<when test='sortType == 4'> no desc </when>
-			<when test='sortType == 5'> create_time desc </when>
-			<when test='sortType == 6'> create_by desc </when>
-			<when test='sortType == 7'> create_name desc </when>
-			<when test='sortType == 8'> update_time desc </when>
-			<when test='sortType == 9'> update_by desc </when>
-			<when test='sortType == 10'> update_name desc </when>
-			<when test='sortType == 11'> delete_status desc </when>
-			<otherwise> id desc </otherwise>
-		</choose>
+<!--		<where>-->
+<!--			<if test=' this.has("id") '> and id = #{id} </if>-->
+<!--			<if test=' this.has("name") '> and name = #{name} </if>-->
+<!--			<if test=' this.has("sort") '> and sort = #{sort} </if>-->
+<!--			<if test=' this.has("no") '> and no = #{no} </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>-->
+<!--			<if test=' this.has("parentId") '> and parent_id = #{parentId} </if>-->
+<!--		</where>-->
+<!--		order by-->
+<!--		<choose>-->
+<!--			<when test='sortType == 1'> id desc </when>-->
+<!--			<when test='sortType == 2'> name desc </when>-->
+<!--			<when test='sortType == 3'> sort desc </when>-->
+<!--			<when test='sortType == 4'> no desc </when>-->
+<!--			<when test='sortType == 5'> create_time desc </when>-->
+<!--			<when test='sortType == 6'> create_by desc </when>-->
+<!--			<when test='sortType == 7'> create_name desc </when>-->
+<!--			<when test='sortType == 8'> update_time desc </when>-->
+<!--			<when test='sortType == 9'> update_by desc </when>-->
+<!--			<when test='sortType == 10'> update_name desc </when>-->
+<!--			<when test='sortType == 11'> delete_status desc </when>-->
+<!--			<when test='sortType == 12'> parent_id desc </when>-->
+<!--			<otherwise> id asc </otherwise>-->
+<!--		</choose>-->
 	</select>
 	
 	

+ 55 - 101
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeService.java

@@ -1,27 +1,17 @@
 package com.pj.tb_goods_type;
 
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.pj.tb_goods.TbGoods;
+import com.pj.tb_goods.TbGoodsMapper;
 import com.pj.utils.so.SoMap;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 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.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.swing.filechooser.FileSystemView;
 
 /**
  * Service: tb_goods_type -- 商品分类
@@ -34,9 +24,8 @@ public class TbGoodsTypeService extends ServiceImpl<TbGoodsTypeMapper, TbGoodsTy
 	/** 底层 Mapper 对象 */
 	@Autowired
 	TbGoodsTypeMapper tbGoodsTypeMapper;
-
 	@Autowired
-	private MethodGoodsTypeService methodGoodsTypeService;
+	TbGoodsMapper tbGoodsMapper;
 
 	/** 增 */
 	void add(TbGoodsType t){
@@ -65,97 +54,62 @@ public class TbGoodsTypeService extends ServiceImpl<TbGoodsTypeMapper, TbGoodsTy
 	}
 
 	/**
-	 * 导入
-	 * @param file excel文件
-	 * @return
-	 * @throws IOException
-	 */
-	public String importData(MultipartFile file) throws IOException {
-		System.out.println("\n开始执行文件上传....\n");
+	*
+	*向商品分类添加商品
+	* @author loovi
+	* @date
+	*/
+	public int addGoodsToGoodsType(Long goodsTypeId,Long [] goodsIds){
+		// 获取当前登录用户id
+//		Long loginId = StpUserUtil.getLoginIdAsLong();
+		int line = 0;
+		// 获取商品类型信息
+		com.pj.tb_goods_type.TbGoodsType tbGoodsType = tbGoodsTypeMapper.selectById(goodsTypeId);
+		// 如果商品类型不存在则抛异常
+		if (Objects.isNull(tbGoodsType)){
+			throw new RuntimeException("该商品类型不存在");
+		}
+		List<Long> list = Arrays.asList(goodsIds);
+		// 把商品与类型关联id写入商品类型商品关系表
+		for (Long goodsId : list) {
+			TbGoods tbGoods = tbGoodsMapper.selectById(goodsId);
+			if(Objects.isNull(tbGoods)){
+				throw new RuntimeException("该商品不存在");
+			}
+			int i =tbGoodsTypeMapper.addGoodsToGoodsType(goodsTypeId,goodsId);
+			line = i+1;
+		}
+		return line;
 
-		//判空
-		if(file.isEmpty()) return "文件为空,无法执行上传...";
-		//获取文件上传数据
-		HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream());
-		//获取第一页sheet
-		HSSFSheet sheet = wb.getSheetAt(0);
-		//定义计数器
-		int count = 0;
-		//定义行对象
-		HSSFRow row = null;
-		//解析数据封装到集合
-		count = methodGoodsTypeService.importMethod(row, sheet, count);
-		wb.close();
-		System.out.println("\n文件上传完成,共上传 " + count + "条 " + "数据...\n");
-		return "上传完成,共上传"  + count + "条"  + "数据。";
 	}
-
 	/**
-	 * 导出 excel文件
-	 * @param keyword
-	 * @return
-	 */
-	public String outportExcel(String keyword,String filepath) throws IOException {
-		System.out.println("\n开始执行文件导出....\n");
-		//导出的文件的路径
-		if(filepath == null){
-			// 获取当前用户的桌面路径
-			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
-			filepath = fileSystemView.getHomeDirectory().getPath();
+	*删除商品分类中的商品
+	*
+	* @author loovi
+	* @date
+	*/
+	public int delGoodsFromGoodsType(Long goodsTypeId,Long [] goodsIds){
+
+		// 获取当前登录用户id
+//		Long loginId = StpUserUtil.getLoginIdAsLong();
+		int line = 0;
+		// 获取商品类型信息
+		com.pj.tb_goods_type.TbGoodsType tbGoodsType = tbGoodsTypeMapper.selectById(goodsTypeId);
+		// 如果商品类型不存在则抛异常
+		if (Objects.isNull(tbGoodsType)){
+			throw new RuntimeException("该商品类型不存在");
 		}
-		filepath = filepath + "\\商品分类数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
-		//根据需求查询数据
-		List<TbGoodsType> selectedList = tbGoodsTypeMapper.selectList
-				(new LambdaQueryWrapper<TbGoodsType>().eq(StringUtils.isNoneBlank(keyword), TbGoodsType::getName, keyword));
-		if(selectedList.size() == 0)return "没有可导出的数据。";
-		//建立excel对象封装数据
-		HSSFWorkbook workbook = new HSSFWorkbook();
-		//创建excel表格右下角的sheet页名称
-		HSSFSheet sheet = workbook.createSheet("1");
-		//创建表头
-		HSSFRow row = sheet.createRow(0);
-		row.createCell(0).setCellValue("序号");
-		row.createCell(1).setCellValue("名称");
-		row.createCell(2).setCellValue("排序");
-		row.createCell(3).setCellValue("编号");
-		row.createCell(12).setCellValue("创建时间");
-		row.createCell(13).setCellValue("创建人编号");
-		row.createCell(14).setCellValue("创建人名称");
-		row.createCell(15).setCellValue("更新时间");
-		row.createCell(16).setCellValue("更新人编号");
-		row.createCell(17).setCellValue("更新人名称");
-		row.createCell(18).setCellValue("删除状态");
-
-		//定义计数器
-		int count = 0;
-		//遍历集合
-		for (int i = 0; i < selectedList.size(); i++) {
-			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
-			sheetRow.createCell(0).setCellValue(i + 1);
-			sheetRow.createCell(1).setCellValue((selectedList.get(i).getName() + "").equals("null")? "": selectedList.get(i).getName() + "");
-			sheetRow.createCell(2).setCellValue((selectedList.get(i).getSort() + "").equals("null")? "": selectedList.get(i).getSort() + "");
-			sheetRow.createCell(3).setCellValue((selectedList.get(i).getNo() + "").equals("null")? "": selectedList.get(i).getNo() + "");
-			sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null")? "": selectedList.get(i).getCreateTime() + "");
-			sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null")? "": selectedList.get(i).getCreateBy() + "");
-			sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null")? "": selectedList.get(i).getCreateName() + "");
-			sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null")? "": selectedList.get(i).getUpdateTime() + "");
-			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
-			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
-			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
-			count += 1;
+		List<Long> list = Arrays.asList(goodsIds);
+		// 从商品类型商品关系表把商品与类型关联删除
+		for (Long goodsId : list) {
+			TbGoods tbGoods = tbGoodsMapper.selectById(goodsId);
+			if(Objects.isNull(tbGoods)){
+				throw new RuntimeException("该商品不存在");
+			}
+			int i =tbGoodsTypeMapper.delGoodsFromGoodsType(goodsTypeId,goodsId);
+			line = i+1;
 		}
-		//建立输出流,输出文件
-		FileOutputStream fos = new FileOutputStream(filepath);
-
-		workbook.write(fos);
-		fos.flush();
-		//关闭输出流
-		fos.close();
-		workbook.close();
-		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
-		return "数据导出完成!共导出 " + count + " 条数据。";
+		return line;
 	}
 
-
-
 }

+ 27 - 65
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeUtil.java

@@ -1,65 +1,27 @@
-package com.pj.tb_goods_type;//package com.pj.tb_goods_type;
-//
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Component;
-//
-//import com.pj.utils.sg.*;
-//
-///**
-// * 工具类:tb_goods_type -- 商品分类
-// * @author qzy
-// *
-// */
-//@Component
-//public class TbGoodsTypeUtil {
-//
-//
-//	/** 底层 Mapper 对象 */
-//	public static TbGoodsTypeMapper tbGoodsTypeMapper;
-//	@Autowired
-//	private void setTbGoodsTypeMapper(TbGoodsTypeMapper tbGoodsTypeMapper) {
-//		TbGoodsTypeUtil.tbGoodsTypeMapper = tbGoodsTypeMapper;
-//	}
-//
-//
-//	/**
-//	 * 将一个 TbGoodsType 对象进行进行数据完整性校验 (方便add/update等接口数据校验) [G]
-//	 */
-//	static void check(TbGoodsType t) {
-//		AjaxError.throwByIsNull(t.getId(), "[主键] 不能为空");		// 验证: 主键
-//		AjaxError.throwByIsNull(t.getName(), "[名称] 不能为空");		// 验证: 名称
-//		AjaxError.throwByIsNull(t.getSort(), "[排序] 不能为空");		// 验证: 排序
-//		AjaxError.throwByIsNull(t.getNo(), "[编号] 不能为空");		// 验证: 编号
-//		AjaxError.throwByIsNull(t.getCreateTime(), "[创建时间] 不能为空");		// 验证: 创建时间
-//		AjaxError.throwByIsNull(t.getCreateBy(), "[创建人编号] 不能为空");		// 验证: 创建人编号
-//		AjaxError.throwByIsNull(t.getCreateName(), "[创建人名称] 不能为空");		// 验证: 创建人名称
-//		AjaxError.throwByIsNull(t.getUpdateTime(), "[更新时间] 不能为空");		// 验证: 更新时间
-//		AjaxError.throwByIsNull(t.getUpdateBy(), "[更新人编号] 不能为空");		// 验证: 更新人编号
-//		AjaxError.throwByIsNull(t.getUpdateName(), "[更新人名称] 不能为空");		// 验证: 更新人名称
-//		AjaxError.throwByIsNull(t.getDeleteStatus(), "[删除状态] 不能为空");		// 验证: 删除状态(0=禁用,1=启用)
-//	}
-//
-//	/**
-//	 * 获取一个TbGoodsType (方便复制代码用) [G]
-//	 */
-//	static TbGoodsType getTbGoodsType() {
-//		TbGoodsType t = new TbGoodsType();	// 声明对象
-//		t.setId("");		// 主键
-//		t.setName("");		// 名称
-//		t.setSort(0);		// 排序
-//		t.setNo("");		// 编号
-//		t.setCreateTime("");		// 创建时间
-//		t.setCreateBy("");		// 创建人编号
-//		t.setCreateName("");		// 创建人名称
-//		t.setUpdateTime("");		// 更新时间
-//		t.setUpdateBy("");		// 更新人编号
-//		t.setUpdateName("");		// 更新人名称
-//		t.setDeleteStatus(0);		// 删除状态(0=禁用,1=启用)
-//		return t;
-//	}
-//
-//
-//
-//
-//
-//}
+package com.pj.tb_goods_type;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 工具类:tb_goods_type -- 商品分类
+ * @author qzy 
+ *
+ */
+@Component
+public class TbGoodsTypeUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbGoodsTypeMapper tbGoodsTypeMapper;
+	@Autowired
+	private void setTbGoodsTypeMapper(TbGoodsTypeMapper tbGoodsTypeMapper) {
+		TbGoodsTypeUtil.tbGoodsTypeMapper = tbGoodsTypeMapper;
+	}
+	
+
+
+	
+	
+	
+}

+ 13 - 78
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupController.java

@@ -35,8 +35,7 @@ public class TbGroupController {
 	/** 底层 Service 对象 */
 	@Autowired
 	TbGroupService tbGroupService;
-	@Autowired
-	TbPeopleService tbPeopleService;
+
 
 	/** 增 */  
 	@RequestMapping("add")
@@ -144,32 +143,10 @@ public class TbGroupController {
 	 */
 	@RequestMapping("setLeader")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson setLeader(Long groupId,Long leaderId){
-
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-
-		TbGroup tbGroup = tbGroupService.getById(groupId);
-		TbPeople tbPeople = tbPeopleService.getById(leaderId);
-		if (Objects.isNull(tbGroup)){
-			return AjaxJson.getSuccess("该互助组不存在");
-		}
-		if (Objects.isNull(tbPeople)){
-			return AjaxJson.getSuccess("该用户不存在");
-		}
-		if(tbGroup.getIsLock()==1){
-			return AjaxJson.getSuccess("该互助组已被锁定");
-		}
-		if (tbPeople.getIsLock()==1){
-			return AjaxJson.getSuccess("该用户已被锁定");
-		}
+	public AjaxJson setLeader(@RequestParam("groupId") Long groupId,@RequestParam("leaderId")Long leaderId){
+		int line = tbGroupService.setLeader(groupId,leaderId);
 
-		tbGroup.setLeaderId(tbGroup.getLeaderId());
-		tbGroup.setLeaderName(tbPeople.getName());
-		tbGroup.setLeaderPhone(tbGroup.getLeaderPhone());
-
-		tbGroup.setUpdateBy(String.valueOf(loginId));
-		tbGroupService.update(tbGroup);
-		return AjaxJson.getSuccess();
+		return AjaxJson.getByLine(line);
 	}
 	/**
 	*向互助组添加边民
@@ -179,27 +156,9 @@ public class TbGroupController {
 	*/
 	@RequestMapping("groupAddPeople")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson AddGroupPeople(Long groupId,Long [] peopleIds){
-
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-
-		TbGroup tbGroup = tbGroupService.getById(groupId);
-		if (Objects.isNull(tbGroup)){
-			return AjaxJson.getSuccess("该互助组不存在");
-		}
-		if(tbGroup.getIsLock()==1){
-			return AjaxJson.getSuccess("该互助组已被锁定");
-		}
-		List<Long> list = Arrays.asList(peopleIds);
-
-		list.forEach(peopleId->{
-			TbPeople tbPeople = tbPeopleService.getById(peopleId);
-			tbPeople.setGroupId(tbGroup.getId());
-			tbPeople.setGroupName(tbGroup.getName());
-			tbPeople.setUpdateBy(String.valueOf(loginId));
-			tbPeopleService.updateById(tbPeople);
-		});
-		return AjaxJson.getSuccess();
+	public AjaxJson AddGroupPeople(@RequestParam("groupId") Long groupId,@RequestParam("peopleIds") Long [] peopleIds){
+		int line = tbGroupService.AddGroupPeople(groupId,peopleIds);
+		return AjaxJson.getByLine(line);
 	}
 	/**
 	 *互助组删除边民
@@ -209,27 +168,9 @@ public class TbGroupController {
 	 */
 	@RequestMapping("groupDelPeople")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson DelGroupPeople(Long groupId,Long [] peopleIds){
-
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-
-		TbGroup tbGroup = tbGroupService.getById(groupId);
-		if (Objects.isNull(tbGroup)){
-			return AjaxJson.getSuccess("该互助组不存在");
-		}
-		if(tbGroup.getIsLock()==1){
-			return AjaxJson.getSuccess("该互助组已被锁定");
-		}
-		List<Long> list = Arrays.asList(peopleIds);
-
-		list.forEach(peopleId->{
-			TbPeople tbPeople = tbPeopleService.getById(peopleId);
-			tbPeople.setGroupId(0L);
-			tbPeople.setGroupName("");
-			tbPeople.setUpdateBy(String.valueOf(loginId));
-			tbPeopleService.updateById(tbPeople);
-		});
-		return AjaxJson.getSuccess();
+	public AjaxJson DelGroupPeople(@RequestParam("groupId") Long groupId,@RequestParam("peopleIds") Long [] peopleIds){
+		int line = tbGroupService.DelGroupPeople(groupId,peopleIds);
+		return AjaxJson.getByLine(line);
 	}
 	/**
 	 *是否锁住互助组
@@ -239,15 +180,9 @@ public class TbGroupController {
 	 */
 	@RequestMapping("isLock")
 	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson isLock(TbGroup t) {
-		Long loginId = StpUserUtil.getLoginIdAsLong();
-		TbGroup tbGroup = tbGroupService.getById(t.getId());
-		if (Objects.isNull(tbGroup)) {
-			return AjaxJson.getSuccess("该互助组不存在");
-		}
-		tbGroup.setUpdateBy(String.valueOf(loginId));
-		tbGroupService.update(t);
-		return AjaxJson.getSuccess();
+	public AjaxJson isLock(@RequestBody TbGroupDto tbGroupDto) {
+		int line = tbGroupService.isLock(tbGroupDto);
+		return AjaxJson.getByLine(line);
 	}
 
 

+ 78 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupDto.java

@@ -0,0 +1,78 @@
+package com.pj.tb_group;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TbGroupDto {
+    // ---------- 表中字段 ----------
+    /**
+     *
+     */
+    private Long id;
+
+    /**
+     *
+     */
+    private String addressIds;
+
+    /**
+     *
+     */
+    private String address;
+
+    /**
+     *
+     */
+    private String detailAddress;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 组长ID
+     */
+    private Long leaderId;
+
+    /**
+     * 组长名
+     */
+    private String leaderName;
+
+    /**
+     * 组长电话
+     */
+    private String leaderPhone;
+
+    /**
+     *
+     */
+    private String code;
+
+    /**
+     * 当天该组剩余额度
+     */
+    private Double leftPrice;
+
+
+
+    /**
+     * 删除状态(0=禁用,1=启用)
+     */
+    private Integer deleteStatus;
+
+    /**
+     * 是否锁定
+     */
+    private Integer isLock;
+}

+ 123 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java

@@ -4,15 +4,21 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.current.satoken.StpUserUtil;
 import com.pj.tb_goods_transit.TbGoodsTransit;
+import com.pj.tb_people.TbPeople;
+import com.pj.tb_people.TbPeopleMapper;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -34,6 +40,8 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 	/** 底层 Mapper 对象 */
 	@Autowired
 	TbGroupMapper tbGroupMapper;
+	@Autowired
+	TbPeopleMapper tbPeopleMapper;
 
 	@Autowired
 	private MethodGroupService methodGroupService;
@@ -62,8 +70,123 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 	List<TbGroup> getList(SoMap so) { 
 		return tbGroupMapper.getList(so);	
 	}
+	public int setLeader(Long groupId,Long leaderId){
+		// 获取当前登录用户id
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		// 获取互助组信息
+		TbGroup tbGroup = tbGroupMapper.selectById(groupId);
+		// 获取边民信息
+		TbPeople tbPeople = tbPeopleMapper.selectById(leaderId);
+		// 如果互助组不存在则抛异常
+		if (Objects.isNull(tbGroup)){
+			throw new RuntimeException("该互助组不存在");
+		}
+		// 如果边民不存在
+		if (Objects.isNull(tbPeople)){
+			throw new RuntimeException("该用户不存在");
+		}
+		// 如果互助组被锁定则抛异常
+		if(tbGroup.getIsLock()==1){
+			throw new RuntimeException("该互助组已被锁定");
+		}
+		// 如果边民不存在则抛异常
+		if (tbPeople.getIsLock()==1){
+			throw new RuntimeException("该用户已被锁定");
+		}
+		// 设置互助组组长
+		tbGroup.setLeaderId(tbPeople.getId());
+		tbGroup.setLeaderName(tbPeople.getName());
+		tbGroup.setLeaderPhone(tbPeople.getPhone());
+		// 写入更新者id
+		tbGroup.setUpdateBy(String.valueOf(loginId));
+		// 更新互助组
+		int line = tbGroupMapper.updateById(tbGroup);
+		return line;
+	}
+	public int AddGroupPeople(Long groupId,Long [] peopleIds){
+		// 获取当前登录用户id
+//		Long loginId = StpUserUtil.getLoginIdAsLong();
+		int line=0;
+		// 获取互助组信息
+		TbGroup tbGroup = tbGroupMapper.selectById(groupId);
+		// 如果互助组不存在则抛异常
+		if (Objects.isNull(tbGroup)){
+			throw new RuntimeException("该互助组不存在");
+		}
+		// 如果互助组被锁定则抛异常
+		if(tbGroup.getIsLock()==1){
+			throw new RuntimeException("该互助组已被锁定");
+		}
+		// 如果互助组被删除则抛异常
+		if(tbGroup.getDeleteStatus()==1){
+			throw new RuntimeException("该互助组已被删除");
+		}
+		List<Long> list = Arrays.asList(peopleIds);
+		// 把互助组信息写入边民表
+		for (Long peopleId : list) {
+			TbPeople tbPeople = tbPeopleMapper.selectById(peopleId);
+			tbPeople.setGroupId(tbGroup.getId());
+			tbPeople.setGroupName(tbGroup.getName());
+			// 写入更新者id
+//			tbPeople.setUpdateBy(String.valueOf(loginId));
+			int i = tbPeopleMapper.updateById(tbPeople);
+			line= i + 1;
+		}
+		return line;
 
+	}
+	public int DelGroupPeople(Long groupId,Long [] peopleIds){
 
+		// 获取当前登录用户id
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		int line=0;
+		// 获取互助组信息
+		TbGroup tbGroup = tbGroupMapper.selectById(groupId);
+		// 如果互助组不存在则抛异常
+		if (Objects.isNull(tbGroup)){
+			throw new RuntimeException("该互助组不存在");
+		}
+		// 如果互助组被锁定则抛异常
+		if(tbGroup.getIsLock()==1){
+			throw new RuntimeException("该互助组已被锁定");
+		}
+		// 如果互助组被删除则抛异常
+		if(tbGroup.getDeleteStatus()==1){
+			throw new RuntimeException("该互助组已被删除");
+		}
+		List<Long> list = Arrays.asList(peopleIds);
+		// 把边民表互助组信息置空
+		for (Long peopleId : list) {
+			TbPeople tbPeople = tbPeopleMapper.selectById(peopleId);
+			tbPeople.setGroupId(0L);
+			tbPeople.setGroupName("");
+			// 写入更新者id
+			tbPeople.setUpdateBy(String.valueOf(loginId));
+			int i = tbPeopleMapper.updateById(tbPeople);
+			line= i + 1;
+		}
+		return line;
+	}
+	public int isLock(TbGroupDto tbGroupDto) {
+		// 获取当前登录用户id
+		Long loginId = StpUserUtil.getLoginIdAsLong();
+		// 获取互助组信息
+		TbGroup tbGroup = tbGroupMapper.selectById(tbGroupDto.getId());
+		// 如果互助组不存在则抛异常
+		if (Objects.isNull(tbGroup)) {
+			throw new RuntimeException("该互助组不存在");
+		}
+		// 如果互助组被删除则抛异常
+		if (tbGroup.getDeleteStatus()==1) {
+			throw new RuntimeException("该互助组已被删除");
+		}
+		BeanUtils.copyProperties(tbGroupDto,tbGroup);
+		// 写入更新者id
+		tbGroup.setUpdateBy(String.valueOf(loginId));
+		// 更新互助组信息
+		int line = tbGroupMapper.updateById(tbGroup);
+		return line;
+	}
 	/**
 	 * 导入
 	 * @param file excel文件

+ 301 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -0,0 +1,301 @@
+package com.pj.tb_order;
+
+import java.io.Serializable;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_order -- 订单表
+ * @author loovi 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbOrder.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbOrder extends Model<TbOrder> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_order";
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-order";
+	public static final String PERMISSION_CODE_ADD = "tb-order-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-order-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-order-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;
+
+	/**
+	 *  
+	 */
+	private Long tradeAreaId;	
+
+	/**
+	 *  
+	 */
+	private String tradeAreaName;	
+
+	/**
+	 *  
+	 */
+	private String addressIds;	
+
+	/**
+	 *  
+	 */
+	private Long saleMainId;	
+
+	/**
+	 * 订单号 
+	 */
+	private String tradeNo;	
+
+	/**
+	 * 买家ID 
+	 */
+	private Long buyUserId;	
+
+	/**
+	 * 买家 
+	 */
+	private String buyUserName;	
+
+	/**
+	 * 购买用户类型(3=边民,2=组长) 
+	 */
+	private String buyUserType;	
+
+	/**
+	 * 商家ID 
+	 */
+	private Long enterpriseId;	
+
+	/**
+	 * 商家名称 
+	 */
+	private String enterpriseName;	
+
+	/**
+	 * 总重量 
+	 */
+	private Double totalWeight;	
+
+	/**
+	 * 总金额 
+	 */
+	private Double totalPrice;	
+
+	/**
+	 * 交易时间 
+	 */
+	private Date tradeTime;	
+
+	/**
+	 * 交易状态(0=未支付,1=已支付) 
+	 */
+	private String tradeStatus;	
+
+	/**
+	 * 支付方式(0=金融互助,1=现金刷卡) 
+	 */
+	private String payType;	
+
+	/**
+	 * 结算时间 
+	 */
+	private String settleTime;	
+
+	/**
+	 * 当前结算金额 
+	 */
+	private Double realPrice;	
+
+	/**
+	 * 应结金额 
+	 */
+	private Double shouldPrice;	
+
+	/**
+	 * 对账人 
+	 */
+	private Long settleUserId;	
+
+	/**
+	 * 对账人员 
+	 */
+	private Long recordUserId;	
+
+	/**
+	 * 对账时间 
+	 */
+	private String recordTime;	
+
+	/**
+	 * 是否对账(0=否,) 
+	 */
+	private String record;	
+
+	/**
+	 * 退款原因 
+	 */
+	private String refundReason;	
+
+	/**
+	 * 退款时间 
+	 */
+	private String refundTime;	
+
+	/**
+	 *  
+	 */
+	private String receiveName;	
+
+	/**
+	 *  
+	 */
+	private String receivePhone;	
+
+	/**
+	 *  
+	 */
+	private String receiveAddress;	
+
+	/**
+	 * 出互市区时间 
+	 */
+	private String outTime;	
+
+	/**
+	 * 商品名称字符串 
+	 */
+	private String goodsNames;	
+
+	/**
+	 * 是否申报 
+	 */
+	private String apply;	
+
+	/**
+	 * 申报时间 
+	 */
+	private String applyTime;	
+
+	/**
+	 * 申报结果 
+	 */
+	private String applyResult;	
+
+	/**
+	 *  
+	 */
+	private String applyFailReason;	
+
+	/**
+	 * 分配方式(0=均分,1=自选数量) 
+	 */
+	private String distribution;	
+
+	/**
+	 * 是否确认(0=否,1=是) 
+	 */
+	private String confirm;	
+
+	/**
+	 * 是否接单 
+	 */
+	private String pick;	
+
+	/**
+	 * 接单时间 
+	 */
+	private String pickTime;	
+
+	/**
+	 *  
+	 */
+	private Long shopId;	
+
+	/**
+	 *  
+	 */
+	private String shopName;	
+
+	/**
+	 * 是否发货 
+	 */
+	private String send;	
+
+	/**
+	 * 发货时间 
+	 */
+	private String sendTime;	
+
+	/**
+	 * 对应二级市场中的收购单ID 
+	 */
+	private Long levelTwoOrderId;	
+
+	/**
+	 * 创建时间 
+	 */
+	private String createTime;	
+
+	/**
+	 * 创建人编号 
+	 */
+	private String createBy;	
+
+	/**
+	 * 创建人名称 
+	 */
+	private String createName;	
+
+	/**
+	 * 更新时间 
+	 */
+	private String updateTime;	
+
+	/**
+	 * 更新人编号 
+	 */
+	private String updateBy;	
+
+	/**
+	 * 更新人名称 
+	 */
+	private String updateName;	
+
+	/**
+	 * 删除状态(0=禁用,1=启用) 
+	 */
+	private Integer deleteStatus;	
+
+
+
+
+
+	
+
+
+}

+ 93 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java

@@ -0,0 +1,93 @@
+package com.pj.tb_order;
+
+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_order -- 订单表
+ * @author loovi 
+ */
+@RestController
+@RequestMapping("/TbOrder/")
+public class TbOrderController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbOrderService tbOrderService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbOrder.PERMISSION_CODE_ADD)
+	public AjaxJson add(TbOrder t){
+		tbOrderService.add(t);
+		t = tbOrderService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 tbOrderService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbOrder.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
+	public AjaxJson update(TbOrder t){
+		tbOrderService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(TbOrder.PERMISSION_CODE)
+	public AjaxJson getById(Long id){
+		TbOrder t = tbOrderService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+//		@SaCheckPermission(TbOrder.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbOrder> list = tbOrderService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	/** 改 - 删除状态(0=禁用,1=启用) */  
+	@RequestMapping("updateDeleteStatus")
+	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
+	public AjaxJson updateDeleteStatus(Long id, Integer value){
+		int line = SP.publicMapper.updateColumnById(TbOrder.TABLE_NAME, "delete_status", value, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+
+	
+	
+	
+
+}

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

@@ -0,0 +1,30 @@
+package com.pj.tb_order;
+
+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_order -- 订单表
+ * @author loovi 
+ */
+
+@Mapper
+@Repository
+public interface TbOrderMapper extends BaseMapper <TbOrder> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbOrder> getList(SoMap so);
+
+
+}

+ 142 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.xml

@@ -0,0 +1,142 @@
+<?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_order.TbOrderMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, trade_area_id, trade_area_name, address_ids, sale_main_id, trade_no, buy_user_id, buy_user_name, buy_user_type, enterprise_id, enterprise_name, total_weight, total_price, trade_time, trade_status, pay_type, settle_time, real_price, should_price, settle_user_id, record_user_id, record_time, record, refund_reason, refund_time, receive_name, receive_phone, receive_address, out_time, goods_names, apply, apply_time, apply_result, apply_fail_reason, distribution, confirm, pick, pick_time, shop_id, shop_name, send, send_time, level_two_order_id, create_time, create_by, create_name, update_time, update_by, update_name, delete_status from tb_order  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.tb_order.TbOrder"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select trade_no,trade_area_name,buy_user_name,buy_user_type,enterprise_name,total_weight,total_price,
+			   trade_time, trade_status, real_price,pay_type,should_price,goods_names,apply,confirm,pick,pick_time,
+			   send,send_time,level_two_order_id
+		from tb_order 
+	</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("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </if>-->
+<!--			<if test=' this.has("tradeAreaName") '> and trade_area_name = #{tradeAreaName} </if>-->
+<!--			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>-->
+<!--			<if test=' this.has("saleMainId") '> and sale_main_id = #{saleMainId} </if>-->
+<!--			<if test=' this.has("tradeNo") '> and trade_no = #{tradeNo} </if>-->
+<!--			<if test=' this.has("buyUserId") '> and buy_user_id = #{buyUserId} </if>-->
+<!--			<if test=' this.has("buyUserName") '> and buy_user_name = #{buyUserName} </if>-->
+<!--			<if test=' this.has("buyUserType") '> and buy_user_type = #{buyUserType} </if>-->
+<!--			<if test=' this.has("enterpriseId") '> and enterprise_id = #{enterpriseId} </if>-->
+<!--			<if test=' this.has("enterpriseName") '> and enterprise_name = #{enterpriseName} </if>-->
+<!--			<if test=' this.has("totalWeight") '> and total_weight = #{totalWeight} </if>-->
+<!--			<if test=' this.has("totalPrice") '> and total_price = #{totalPrice} </if>-->
+<!--			<if test=' this.has("tradeStatus") '> and trade_status = #{tradeStatus} </if>-->
+<!--			<if test=' this.has("payType") '> and pay_type = #{payType} </if>-->
+<!--			<if test=' this.has("settleTime") '> and settle_time = #{settleTime} </if>-->
+<!--			<if test=' this.has("realPrice") '> and real_price = #{realPrice} </if>-->
+<!--			<if test=' this.has("shouldPrice") '> and should_price = #{shouldPrice} </if>-->
+<!--			<if test=' this.has("settleUserId") '> and settle_user_id = #{settleUserId} </if>-->
+<!--			<if test=' this.has("recordUserId") '> and record_user_id = #{recordUserId} </if>-->
+<!--			<if test=' this.has("recordTime") '> and record_time = #{recordTime} </if>-->
+<!--			<if test=' this.has("record") '> and record = #{record} </if>-->
+<!--			<if test=' this.has("refundReason") '> and refund_reason = #{refundReason} </if>-->
+<!--			<if test=' this.has("refundTime") '> and refund_time = #{refundTime} </if>-->
+<!--			<if test=' this.has("receiveName") '> and receive_name = #{receiveName} </if>-->
+<!--			<if test=' this.has("receivePhone") '> and receive_phone = #{receivePhone} </if>-->
+<!--			<if test=' this.has("receiveAddress") '> and receive_address = #{receiveAddress} </if>-->
+<!--			<if test=' this.has("outTime") '> and out_time = #{outTime} </if>-->
+<!--			<if test=' this.has("goodsNames") '> and goods_names = #{goodsNames} </if>-->
+<!--			<if test=' this.has("apply") '> and apply = #{apply} </if>-->
+<!--			<if test=' this.has("applyTime") '> and apply_time = #{applyTime} </if>-->
+<!--			<if test=' this.has("applyResult") '> and apply_result = #{applyResult} </if>-->
+<!--			<if test=' this.has("applyFailReason") '> and apply_fail_reason = #{applyFailReason} </if>-->
+<!--			<if test=' this.has("distribution") '> and distribution = #{distribution} </if>-->
+<!--			<if test=' this.has("confirm") '> and confirm = #{confirm} </if>-->
+<!--			<if test=' this.has("pick") '> and pick = #{pick} </if>-->
+<!--			<if test=' this.has("pickTime") '> and pick_time = #{pickTime} </if>-->
+<!--			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>-->
+<!--			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>-->
+<!--			<if test=' this.has("send") '> and send = #{send} </if>-->
+<!--			<if test=' this.has("sendTime") '> and send_time = #{sendTime} </if>-->
+<!--			<if test=' this.has("levelTwoOrderId") '> and level_two_order_id = #{levelTwoOrderId} </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'> trade_area_id desc </when>-->
+<!--			<when test='sortType == 3'> trade_area_name desc </when>-->
+<!--			<when test='sortType == 4'> address_ids desc </when>-->
+<!--			<when test='sortType == 5'> sale_main_id desc </when>-->
+<!--			<when test='sortType == 6'> trade_no desc </when>-->
+<!--			<when test='sortType == 7'> buy_user_id desc </when>-->
+<!--			<when test='sortType == 8'> buy_user_name desc </when>-->
+<!--			<when test='sortType == 9'> buy_user_type desc </when>-->
+<!--			<when test='sortType == 10'> enterprise_id desc </when>-->
+<!--			<when test='sortType == 11'> enterprise_name desc </when>-->
+<!--			<when test='sortType == 12'> total_weight desc </when>-->
+<!--			<when test='sortType == 13'> total_price desc </when>-->
+<!--			<when test='sortType == 14'> trade_time desc </when>-->
+<!--			<when test='sortType == 15'> trade_status desc </when>-->
+<!--			<when test='sortType == 16'> pay_type desc </when>-->
+<!--			<when test='sortType == 17'> settle_time desc </when>-->
+<!--			<when test='sortType == 18'> real_price desc </when>-->
+<!--			<when test='sortType == 19'> should_price desc </when>-->
+<!--			<when test='sortType == 20'> settle_user_id desc </when>-->
+<!--			<when test='sortType == 21'> record_user_id desc </when>-->
+<!--			<when test='sortType == 22'> record_time desc </when>-->
+<!--			<when test='sortType == 23'> record desc </when>-->
+<!--			<when test='sortType == 24'> refund_reason desc </when>-->
+<!--			<when test='sortType == 25'> refund_time desc </when>-->
+<!--			<when test='sortType == 26'> receive_name desc </when>-->
+<!--			<when test='sortType == 27'> receive_phone desc </when>-->
+<!--			<when test='sortType == 28'> receive_address desc </when>-->
+<!--			<when test='sortType == 29'> out_time desc </when>-->
+<!--			<when test='sortType == 30'> goods_names desc </when>-->
+<!--			<when test='sortType == 31'> apply desc </when>-->
+<!--			<when test='sortType == 32'> apply_time desc </when>-->
+<!--			<when test='sortType == 33'> apply_result desc </when>-->
+<!--			<when test='sortType == 34'> apply_fail_reason desc </when>-->
+<!--			<when test='sortType == 35'> distribution desc </when>-->
+<!--			<when test='sortType == 36'> confirm desc </when>-->
+<!--			<when test='sortType == 37'> pick desc </when>-->
+<!--			<when test='sortType == 38'> pick_time desc </when>-->
+<!--			<when test='sortType == 39'> shop_id desc </when>-->
+<!--			<when test='sortType == 40'> shop_name desc </when>-->
+<!--			<when test='sortType == 41'> send desc </when>-->
+<!--			<when test='sortType == 42'> send_time desc </when>-->
+<!--			<when test='sortType == 43'> level_two_order_id desc </when>-->
+<!--			<when test='sortType == 44'> create_time desc </when>-->
+<!--			<when test='sortType == 45'> create_by desc </when>-->
+<!--			<when test='sortType == 46'> create_name desc </when>-->
+<!--			<when test='sortType == 47'> update_time desc </when>-->
+<!--			<when test='sortType == 48'> update_by desc </when>-->
+<!--			<when test='sortType == 49'> update_name desc </when>-->
+<!--			<when test='sortType == 50'> delete_status desc </when>-->
+<!--			<otherwise> id desc </otherwise>-->
+<!--		</choose>-->
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 50 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -0,0 +1,50 @@
+package com.pj.tb_order;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+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;
+
+/**
+ * Service: tb_order -- 订单表
+ * @author loovi 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implements IService<TbOrder>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbOrderMapper tbOrderMapper;
+
+	/** 增 */
+	void add(TbOrder t){
+		save(t);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(TbOrder t){
+		updateById(t);
+
+	}
+
+	/** 查 */
+	TbOrder getById(Long id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbOrder> getList(SoMap so) { 
+		return tbOrderMapper.getList(so);	
+	}
+	
+
+}

+ 144 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderUtil.java

@@ -0,0 +1,144 @@
+package com.pj.tb_order;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.pj.utils.sg.*;
+import java.util.*;
+
+/**
+ * 工具类:tb_order -- 订单表
+ * @author loovi 
+ *
+ */
+@Component
+public class TbOrderUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbOrderMapper tbOrderMapper;
+	@Autowired
+	private void setTbOrderMapper(TbOrderMapper tbOrderMapper) {
+		TbOrderUtil.tbOrderMapper = tbOrderMapper;
+	}
+	
+	
+	/** 
+	 * 将一个 TbOrder 对象进行进行数据完整性校验 (方便add/update等接口数据校验) [G] 
+	 */
+	static void check(TbOrder t) {
+		AjaxError.throwByIsNull(t.getId(), "[主键] 不能为空");		// 验证: 主键 
+		AjaxError.throwByIsNull(t.getTradeAreaId(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getTradeAreaName(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getAddressIds(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getSaleMainId(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getTradeNo(), "[订单号] 不能为空");		// 验证: 订单号 
+		AjaxError.throwByIsNull(t.getBuyUserId(), "[买家ID] 不能为空");		// 验证: 买家ID 
+		AjaxError.throwByIsNull(t.getBuyUserName(), "[买家] 不能为空");		// 验证: 买家 
+		AjaxError.throwByIsNull(t.getBuyUserType(), "[购买用户类型] 不能为空");		// 验证: 购买用户类型(3=边民,2=组长) 
+		AjaxError.throwByIsNull(t.getEnterpriseId(), "[商家ID] 不能为空");		// 验证: 商家ID 
+		AjaxError.throwByIsNull(t.getEnterpriseName(), "[商家名称] 不能为空");		// 验证: 商家名称 
+		AjaxError.throwByIsNull(t.getTotalWeight(), "[总重量] 不能为空");		// 验证: 总重量 
+		AjaxError.throwByIsNull(t.getTotalPrice(), "[总金额] 不能为空");		// 验证: 总金额 
+		AjaxError.throwByIsNull(t.getTradeTime(), "[交易时间] 不能为空");		// 验证: 交易时间 
+		AjaxError.throwByIsNull(t.getTradeStatus(), "[交易状态] 不能为空");		// 验证: 交易状态(0=未支付,1=已支付) 
+		AjaxError.throwByIsNull(t.getPayType(), "[支付方式] 不能为空");		// 验证: 支付方式(0=金融互助,1=现金刷卡) 
+		AjaxError.throwByIsNull(t.getSettleTime(), "[结算时间] 不能为空");		// 验证: 结算时间 
+		AjaxError.throwByIsNull(t.getRealPrice(), "[当前结算金额] 不能为空");		// 验证: 当前结算金额 
+		AjaxError.throwByIsNull(t.getShouldPrice(), "[应结金额] 不能为空");		// 验证: 应结金额 
+		AjaxError.throwByIsNull(t.getSettleUserId(), "[对账人] 不能为空");		// 验证: 对账人 
+		AjaxError.throwByIsNull(t.getRecordUserId(), "[对账人员] 不能为空");		// 验证: 对账人员 
+		AjaxError.throwByIsNull(t.getRecordTime(), "[对账时间] 不能为空");		// 验证: 对账时间 
+		AjaxError.throwByIsNull(t.getRecord(), "[是否对账] 不能为空");		// 验证: 是否对账(0=否,) 
+		AjaxError.throwByIsNull(t.getRefundReason(), "[退款原因] 不能为空");		// 验证: 退款原因 
+		AjaxError.throwByIsNull(t.getRefundTime(), "[退款时间] 不能为空");		// 验证: 退款时间 
+		AjaxError.throwByIsNull(t.getReceiveName(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getReceivePhone(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getReceiveAddress(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getOutTime(), "[出互市区时间] 不能为空");		// 验证: 出互市区时间 
+		AjaxError.throwByIsNull(t.getGoodsNames(), "[商品名称字符串] 不能为空");		// 验证: 商品名称字符串 
+		AjaxError.throwByIsNull(t.getApply(), "[是否申报] 不能为空");		// 验证: 是否申报 
+		AjaxError.throwByIsNull(t.getApplyTime(), "[申报时间] 不能为空");		// 验证: 申报时间 
+		AjaxError.throwByIsNull(t.getApplyResult(), "[申报结果] 不能为空");		// 验证: 申报结果 
+		AjaxError.throwByIsNull(t.getApplyFailReason(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getDistribution(), "[分配方式] 不能为空");		// 验证: 分配方式(0=均分,1=自选数量) 
+		AjaxError.throwByIsNull(t.getConfirm(), "[是否确认] 不能为空");		// 验证: 是否确认(0=否,1=是) 
+		AjaxError.throwByIsNull(t.getPick(), "[是否接单] 不能为空");		// 验证: 是否接单 
+		AjaxError.throwByIsNull(t.getPickTime(), "[接单时间] 不能为空");		// 验证: 接单时间 
+		AjaxError.throwByIsNull(t.getShopId(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getShopName(), "[] 不能为空");		// 验证:  
+		AjaxError.throwByIsNull(t.getSend(), "[是否发货] 不能为空");		// 验证: 是否发货 
+		AjaxError.throwByIsNull(t.getSendTime(), "[发货时间] 不能为空");		// 验证: 发货时间 
+		AjaxError.throwByIsNull(t.getLevelTwoOrderId(), "[对应二级市场中的收购单ID] 不能为空");		// 验证: 对应二级市场中的收购单ID 
+		AjaxError.throwByIsNull(t.getCreateTime(), "[创建时间] 不能为空");		// 验证: 创建时间 
+		AjaxError.throwByIsNull(t.getCreateBy(), "[创建人编号] 不能为空");		// 验证: 创建人编号 
+		AjaxError.throwByIsNull(t.getCreateName(), "[创建人名称] 不能为空");		// 验证: 创建人名称 
+		AjaxError.throwByIsNull(t.getUpdateTime(), "[更新时间] 不能为空");		// 验证: 更新时间 
+		AjaxError.throwByIsNull(t.getUpdateBy(), "[更新人编号] 不能为空");		// 验证: 更新人编号 
+		AjaxError.throwByIsNull(t.getUpdateName(), "[更新人名称] 不能为空");		// 验证: 更新人名称 
+		AjaxError.throwByIsNull(t.getDeleteStatus(), "[删除状态] 不能为空");		// 验证: 删除状态(0=禁用,1=启用) 
+	}
+
+	/** 
+	 * 获取一个TbOrder (方便复制代码用) [G] 
+	 */ 
+	static TbOrder getTbOrder() {
+		TbOrder t = new TbOrder();	// 声明对象 
+		t.setId(0L);		// 主键
+		t.setTradeAreaId(0L);		//  
+		t.setTradeAreaName("");		//  
+		t.setAddressIds("");		//  
+		t.setSaleMainId(0L);		//  
+		t.setTradeNo("");		// 订单号 
+		t.setBuyUserId(0L);		// 买家ID 
+		t.setBuyUserName("");		// 买家 
+		t.setBuyUserType("");		// 购买用户类型(3=边民,2=组长) 
+		t.setEnterpriseId(0L);		// 商家ID 
+		t.setEnterpriseName("");		// 商家名称 
+		t.setTotalWeight(0.0);		// 总重量 
+		t.setTotalPrice(0.0);		// 总金额 
+		t.setTradeTime(new Date());		// 交易时间 
+		t.setTradeStatus("");		// 交易状态(0=未支付,1=已支付) 
+		t.setPayType("");		// 支付方式(0=金融互助,1=现金刷卡) 
+		t.setSettleTime("");		// 结算时间 
+		t.setRealPrice(0.0);		// 当前结算金额 
+		t.setShouldPrice(0.0);		// 应结金额 
+		t.setSettleUserId(0L);		// 对账人 
+		t.setRecordUserId(0L);		// 对账人员 
+		t.setRecordTime("");		// 对账时间 
+		t.setRecord("");		// 是否对账(0=否,) 
+		t.setRefundReason("");		// 退款原因 
+		t.setRefundTime("");		// 退款时间 
+		t.setReceiveName("");		//  
+		t.setReceivePhone("");		//  
+		t.setReceiveAddress("");		//  
+		t.setOutTime("");		// 出互市区时间 
+		t.setGoodsNames("");		// 商品名称字符串 
+		t.setApply("");		// 是否申报 
+		t.setApplyTime("");		// 申报时间 
+		t.setApplyResult("");		// 申报结果 
+		t.setApplyFailReason("");		//  
+		t.setDistribution("");		// 分配方式(0=均分,1=自选数量) 
+		t.setConfirm("");		// 是否确认(0=否,1=是) 
+		t.setPick("");		// 是否接单 
+		t.setPickTime("");		// 接单时间 
+		t.setShopId(0L);		//  
+		t.setShopName("");		//  
+		t.setSend("");		// 是否发货 
+		t.setSendTime("");		// 发货时间 
+		t.setLevelTwoOrderId(0L);		// 对应二级市场中的收购单ID 
+		t.setCreateTime("");		// 创建时间 
+		t.setCreateBy("");		// 创建人编号 
+		t.setCreateName("");		// 创建人名称 
+		t.setUpdateTime("");		// 更新时间 
+		t.setUpdateBy("");		// 更新人编号 
+		t.setUpdateName("");		// 更新人名称 
+		t.setDeleteStatus(0);		// 删除状态(0=禁用,1=启用) 
+		return t;
+	}
+	
+	
+	
+	
+	
+}

+ 4 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java

@@ -2,6 +2,8 @@ package com.pj.tb_people;
 
 import java.io.IOException;
 import java.util.List;
+
+import com.pj.tb_people.dto.StartStopDto;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -100,8 +102,8 @@ public class TbPeopleController {
 
 	/** 启/停 */
 	@PostMapping("isLock")
-	public AjaxJson isLock(TbPeople tbPeople){
-		boolean lock = tbPeopleService.isLock(tbPeople);
+	public AjaxJson isLock(StartStopDto startStopDto){
+		boolean lock = tbPeopleService.isLock(startStopDto);
 		return AjaxJson.getSuccess(lock + "");
 	}
 

+ 19 - 14
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -10,8 +10,9 @@ import java.util.List;
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.pj.api.client.admin.AdminInterface;
-import com.pj.constants.UserTypeEnum;
+import com.pj.enummj.People;
 import com.pj.tb_goods_transit.TbGoodsTransit;
+import com.pj.tb_people.dto.StartStopDto;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFRow;
@@ -76,7 +77,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	 * 审核
 	 */
 	boolean judge(TbPeople tbPeople){
-		//获取当前登陆人
+		//获取当前登陆人 todo:
 		String loginUser = "admin";
 		//获取当前被审核人的编号和审核情况
 		Long id = tbPeople.getId();
@@ -103,9 +104,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	/**
 	 * 启/停
 	 */
-	boolean isLock(TbPeople tbPeople){
+	boolean isLock(StartStopDto startStopDto){
 		//获取被修改用户id
-		Long id = tbPeople.getId();
+		Long id = startStopDto.getId();
 		//查询
 		TbPeople tbPeople1 = tbPeopleMapper.selectById(id);
 		if(tbPeople1 == null)throw new RuntimeException("审核用户不存在,请检查!");
@@ -113,14 +114,18 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 		Integer deleteStatus = tbPeople1.getDeleteStatus();
 		if(deleteStatus == 0)throw new RuntimeException("该用户已被删除,无法进行启/停操作!");
 		//获取启停状态
-		Integer isLock = tbPeople.getIsLock();
+		Integer isLock = startStopDto.getIsLock();
 		//设置启/停
-		tbPeople1.setIsLock(isLock);
+		tbPeople1.setStatus(isLock);
 		//保存结果
 		int i = tbPeopleMapper.updateById(tbPeople1);
-		//远程调用停用app user表中的便民账号
-		int lock = adminInterface.isLock(id.toString(), UserTypeEnum.PEOPLE_TYPE.getCode(), isLock);
-		return i == 1 && lock == 1;
+		//远程调用停用app user表中的边民账号
+		int lock = adminInterface.isLock(id.toString(), People.PEOPLE_TYPE_ONE.getCode(), isLock);
+		//todo: 处理远程调用后的返回结果
+//		if((lock + i) != 2)throw new RuntimeException("停用失败!");
+//
+//		return i == 1 && lock == 1;
+		return true;
 	}
 
 	/**
@@ -130,11 +135,11 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 
 	}
 
-
-	/** 边民账号停用后不能登录app */
-	void loginPeople(String userName,String password){
-
-	}
+//
+//	/** 边民账号停用后不能登录app */
+//	void loginPeople(String userName,String password){
+//
+//	}
 
 
 

+ 22 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_people/dto/StartStopDto.java

@@ -0,0 +1,22 @@
+package com.pj.tb_people.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 启停状态设置
+ * @Author Mechrevo
+ * @Date 2023 07 25 09 44
+ **/
+@Data
+public class StartStopDto {
+
+    /** 边民表主键 */
+    @NotNull
+    private Long id;
+
+    /** 锁定状态 1=启用,0=停用 */
+    @NotNull
+    private Integer isLock;
+}

+ 34 - 15
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaController.java

@@ -84,7 +84,31 @@ public class TbTradeAreaController {
 	}
 
 
+	/**
+	 *
+	 *给互市区添加商品
+	 * @author loovi
+	 * @date
+	 */
+	@RequestMapping("addGoodsToTradeArea")
+	@SaCheckPermission(TbTradeArea.PERMISSION_CODE_EDIT)
+	public AjaxJson addGoodsToTradeArea(@RequestParam("tradeAreaId") Long tradeAreaId,@RequestParam("goodsIds") Long [] goodsIds){
+		int  line = tbTradeAreaService.addGoodsToTradeArea(tradeAreaId,goodsIds);
+		return AjaxJson.getByLine(line);
+	}
 
+	/**
+	 *
+	 *删除互市区中的商品
+	 * @author loovi
+	 * @date
+	 */
+	@RequestMapping("delGoodsFromTradeArea")
+	@SaCheckPermission(TbTradeArea.PERMISSION_CODE_EDIT)
+	public AjaxJson delGoodsFromTradeArea(@RequestParam("tradeAreaId") Long tradeAreaId,@RequestParam("goodsIds") Long [] goodsIds){
+		int  line = tbTradeAreaService.delGoodsFromTradeArea(tradeAreaId,goodsIds);
+		return AjaxJson.getByLine(line);
+	}
 
 	/**
 	 * 数据导入接口
@@ -94,21 +118,16 @@ public class TbTradeAreaController {
 	@RequestMapping("tradeAreaImport")
 	@ResponseBody
 	public AjaxJson dataImport( @RequestParam("file") MultipartFile file){
-		List<TbTradeArea> areaList = tbTradeAreaService.list();
-		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
 
+		String importData = null;
 		try {
-			List<TbTradeArea> tbTradeAreas = excelUtil.importExcel(file.getInputStream());
-			System.out.println(tbTradeAreas);
-
-//			String importData = tbTradeAreaService.importData(file);
-//			AjaxJson.getSuccess(importData);
+			importData = tbTradeAreaService.importData(file);
+			return AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
-			throw new RuntimeException(e);
-		} catch (Exception e) {
-			throw new RuntimeException(e);
+			e.printStackTrace();
+			return AjaxJson.getError();
+
 		}
-		return AjaxJson.getError();
 	}
 
 	/**
@@ -119,10 +138,10 @@ public class TbTradeAreaController {
 	@RequestMapping("tradeAreaOutport")
 	@ResponseBody
 	public AjaxJson dataOutport(HttpServletResponse response,@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
-
-		List<TbTradeArea> areaList = tbTradeAreaService.list();
-		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
-		excelUtil.exportExcel(response,areaList,"区域表");
+//
+//		List<TbTradeArea> areaList = tbTradeAreaService.list();
+//		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
+//		excelUtil.exportExcel(response,areaList,"区域表");
 		try {
 			String importData = tbTradeAreaService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);

+ 16 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -26,5 +27,20 @@ public interface TbTradeAreaMapper extends BaseMapper <TbTradeArea> {
 	 */
 	List<TbTradeArea> getList(SoMap so);
 
+	/**
+	 *向互市区添加商品
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	int addGoodsToTradeArea(@Param("tradeAreaId") Long tradeAreaId, @Param("goodsId") Long goodsId);
+	/**
+	 *从互市区删除商品
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	int delGoodsFromTradeArea(@Param("tradeAreaId") Long tradeAreaId, @Param("goodsId") Long goodsId);
+
 
 }

+ 42 - 27
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaMapper.xml

@@ -16,38 +16,53 @@
 		select * 
 		from tb_trade_area 
 	</sql>
+	<insert id="addGoodsToTradeArea">
+		insert into tb_goods_trade_area_relation
+		(goods_id,trade_area_id)
+		values(
+		<if  test="goodsId!=null and goodsId!=''"> #{goodsId},</if>
+		<if  test="tradeAreaId!=null and tradeAreaId!=''">  #{tradeAreaId}</if>
+		)
+	</insert>
 
+	<delete id="delGoodsFromTradeArea">
+		delete from  tb_goods_trade_area_relation
+		<where>
+			<if  test="goodsId!=null and goodsId!=''"> goods_id=#{goodsId}</if>
+			<if  test="tradeAreaId!=null and tradeAreaId!=''"> and trade_area_id=#{tradeAreaId}</if>
+		</where>
+	</delete>
 	
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [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("name") '> and name = #{name} </if>
-			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>
-			<if test=' this.has("detailAddress") '> and detail_address = #{detailAddress} </if>
-			<if test=' this.has("address") '> and address = #{address} </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("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'> name desc </when>
-			<when test='sortType == 3'> address_ids desc </when>
-			<when test='sortType == 4'> detail_address desc </when>
-			<when test='sortType == 5'> address desc </when>
-			<when test='sortType == 6'> create_time desc </when>
-			<when test='sortType == 7'> create_by desc </when>
-			<when test='sortType == 8'> create_name desc </when>
-			<when test='sortType == 9'> update_by desc </when>
-			<when test='sortType == 10'> update_name desc </when>
-			<when test='sortType == 11'> update_time desc </when>
-			<otherwise> id desc </otherwise>
-		</choose>
+<!--		<where>-->
+<!--			<if test=' this.has("id") '> and id = #{id} </if>-->
+<!--			<if test=' this.has("name") '> and name = #{name} </if>-->
+<!--			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>-->
+<!--			<if test=' this.has("detailAddress") '> and detail_address = #{detailAddress} </if>-->
+<!--			<if test=' this.has("address") '> and address = #{address} </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("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'> name desc </when>-->
+<!--			<when test='sortType == 3'> address_ids desc </when>-->
+<!--			<when test='sortType == 4'> detail_address desc </when>-->
+<!--			<when test='sortType == 5'> address desc </when>-->
+<!--			<when test='sortType == 6'> create_time desc </when>-->
+<!--			<when test='sortType == 7'> create_by desc </when>-->
+<!--			<when test='sortType == 8'> create_name desc </when>-->
+<!--			<when test='sortType == 9'> update_by desc </when>-->
+<!--			<when test='sortType == 10'> update_name desc </when>-->
+<!--			<when test='sortType == 11'> update_time desc </when>-->
+<!--			<otherwise> id desc </otherwise>-->
+<!--		</choose>-->
 	</select>
 	
 	

+ 67 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java

@@ -4,9 +4,13 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.tb_goods.TbGoods;
+import com.pj.tb_goods.TbGoodsMapper;
 import com.pj.tb_people.TbPeople;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
@@ -35,6 +39,8 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 	@Autowired
 	TbTradeAreaMapper tbTradeAreaMapper;
 	@Autowired
+	TbGoodsMapper tbGoodsMapper;
+	@Autowired
 	private MethodTradeAreaService methodTradeAreaService;
 
 	/** 增 */
@@ -63,6 +69,67 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 		return tbTradeAreaMapper.getList(so);	
 	}
 
+	/**
+	 *
+	 *向商品分类添加商品
+	 * @author loovi
+	 * @date
+	 */
+	public int addGoodsToTradeArea(Long tradeAreaId,Long [] goodsIds){
+		// 获取当前登录用户id
+//		Long loginId = StpUserUtil.getLoginIdAsLong();
+		int line = 0;
+		// 获取互市区信息
+		TbTradeArea tbTradeArea = tbTradeAreaMapper.selectById(tradeAreaId);
+		// 如果互市区不存在则抛异常
+		if (Objects.isNull(tbTradeArea)){
+			throw new RuntimeException("该商品类型不存在");
+		}
+		List<Long> list = Arrays.asList(goodsIds);
+		// 添加商品到互市区
+		for (Long goodsId : list) {
+			TbGoods tbGoods = tbGoodsMapper.selectById(goodsId);
+			if(Objects.isNull(tbGoods)){
+				throw new RuntimeException("该商品不存在");
+			}
+			int i =tbTradeAreaMapper.addGoodsToTradeArea(tradeAreaId,goodsId);
+			line = i+1;
+		}
+		return line;
+
+	}
+	/**
+	 *删除商品分类中的商品
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	public int delGoodsFromTradeArea(Long tradeAreaId,Long [] goodsIds){
+
+		// 获取当前登录用户id
+//		Long loginId = StpUserUtil.getLoginIdAsLong();
+		int line = 0;
+		// 获取互市区信息
+		TbTradeArea tbTradeArea = tbTradeAreaMapper.selectById(tradeAreaId);
+		// 如果互市区不存在则抛异常
+		if (Objects.isNull(tbTradeArea)){
+			throw new RuntimeException("该商品类型不存在");
+		}
+		List<Long> list = Arrays.asList(goodsIds);
+		// 从互市区删除商品
+		for (Long goodsId : list) {
+			TbGoods tbGoods = tbGoodsMapper.selectById(goodsId);
+			if(Objects.isNull(tbGoods)){
+				throw new RuntimeException("该商品不存在");
+			}
+			int i =tbTradeAreaMapper.delGoodsFromTradeArea(tradeAreaId,goodsId);
+			line = i+1;
+		}
+		return line;
+	}
+
+
+
 
 	/**
 	 * 导入

+ 9 - 0
sp-service/sp-admin/src/main/java/com/pj/SpAdminApplication.java

@@ -5,7 +5,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.ApplicationPidFileWriter;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.Bean;
 import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 import com.pj.current.SpCloudUtil;
@@ -34,4 +37,10 @@ public class SpAdminApplication {
 		// 测试服务调用  
 	}
 
+	/** 密码加密模式 */
+	@Bean
+	public PasswordEncoder passwordEncoder(){
+//        return NoOpPasswordEncoder.getInstance();
+		return new BCryptPasswordEncoder();
+	}
 }

+ 9 - 1
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUser.java

@@ -109,9 +109,17 @@ public class AppUser extends Model<AppUser> implements Serializable {
 	/**
 	 * 更新时间 
 	 */
-	private Date updateTime;	
+	private Date updateTime;
 
+	/**
+	 * 逻辑删除
+	 */
+	private Integer deleteStatus;
 
+	/**
+	 * 密码
+	 */
+	private String password;
 
 
 

+ 56 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java

@@ -0,0 +1,56 @@
+package com.pj.project.app_user;
+
+import com.pj.project.app_user.dto.ForgetPasswordDto;
+import com.pj.project.app_user.dto.RegisterDto;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+
+
+/**
+ * Controller: app_user -- 移动端账号(只针对app端使用)
+ * @author yzs
+ */
+@RestController
+@RequestMapping("/app/AppUser/")
+public class AppUserApiController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	AppUserService appUserService;
+
+
+	/** 用户注册 */
+	@RequestMapping("register")
+	public AjaxJson register(@Validated @RequestBody RegisterDto registerDto) {
+		boolean register = appUserService.register(registerDto);
+		if(!register)return AjaxJson.getError("注册失败!");
+		return AjaxJson.getSuccess( "注册完成!");
+	}
+
+	/** 用户登录 */
+	@RequestMapping("login")
+	public AjaxJson login(@RequestParam("phone")String phone,@RequestParam("password")String password) {
+		return appUserService.login(phone,password);
+	}
+
+	/** 忘记密码 */
+	@RequestMapping("forgetPassword")
+	public AjaxJson forgetPassword(@Validated @RequestBody ForgetPasswordDto forgetPasswordDto) {
+		return appUserService.forgetPassword(forgetPasswordDto);
+	}
+
+	/** 获取短信验证码 */
+	@RequestMapping("getPhoneSmsCode")
+	public AjaxJson getPhoneSmsCode(String phone) {
+		boolean phoneSmsCode = appUserService.getPhoneSmsCode(phone);
+		if(phoneSmsCode)return AjaxJson.getSuccess("验证码发送成功!");
+		return AjaxJson.getError();
+	}
+
+}

+ 8 - 2
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java

@@ -1,9 +1,13 @@
 package com.pj.project.app_user;
 
 import java.util.List;
+
+import com.pj.project.app_user.dto.ForgetPasswordDto;
+import com.pj.project.app_user.dto.RegisterDto;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import com.pj.utils.sg.*;
@@ -78,14 +82,16 @@ public class AppUserController {
 
 
 
+	/*-----               正常业务接口👆👆    不越界     rpc远程调用 👇👇                     -----*/
+
 
 	/** 启/停边民的app账号登陆限制 */
 	@RequestMapping("rpc/isLock")
 	public AjaxJson isLock(@RequestParam("id") String id,
 						   @RequestParam("type") Integer type,
 						   @RequestParam("status") Integer status) {
-		boolean lock = appUserService.isLock(id,type,status);
-		if(lock) return AjaxJson.getSuccess();
+		int lock = appUserService.isLock(id,type,status);
+		if(lock == 1) return AjaxJson.getSuccess(lock + "");
 		return AjaxJson.getError();
 	}
 

+ 173 - 6
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -1,11 +1,22 @@
 package com.pj.project.app_user;
 
+import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.pj.api.client.admin.AdminInterface;
+import com.pj.current.satoken.StpUserUtil;
+import com.pj.project.app_user.dto.ForgetPasswordDto;
+import com.pj.project.app_user.dto.RegisterDto;
+import com.pj.project.re_role_menu.ReRoleMenu;
+import com.pj.project.re_role_menu.ReRoleMenuMapper;
+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.factory.annotation.Autowired;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -23,10 +34,15 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 	/** 底层 Mapper 对象 */
 	@Autowired
 	AppUserMapper appUserMapper;
-
-	/** 注入远程调用对象 admin */
+	/** 密码加密模式 */
+	@Autowired
+	private PasswordEncoder passwordEncoder;
+	//权限字符
 	@Autowired
-	private AdminInterface adminInterface;
+	private ReRoleMenuMapper reRoleMenuMapper;
+
+
+
 
 	/** 增 */
 	void add(AppUser t){
@@ -40,6 +56,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 
 	/** 改 */
 	void update(AppUser a){
+		a.setUpdateTime(new Date());
 		updateById(a);
 
 	}
@@ -55,7 +72,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 	}
 
 	/** 启/停边民的app账号登陆限制 */
-	boolean isLock(String id, Integer type, Integer status){
+	int isLock(String id, Integer type, Integer status){
 		//查询
 		LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
 		queryWrapper.eq(AppUser::getFkId,id);
@@ -66,8 +83,158 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 		appUser1.setStatus(status.toString());
 		//保存
 		int i = appUserMapper.updateById(appUser1);
-		return i == 1;
+		return i;
+	}
+
+	/** 注册 */
+	boolean register(RegisterDto registerDto){
+		if(registerDto == null)return false;
+		//手机号去重
+		String phone = registerDto.getPhone();
+		if(appUserMapper.selectList(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone,phone).eq(AppUser::getDeleteStatus,1)).size() != 0)
+			throw new RuntimeException("当前手机号已被注册!");
+		//开始进行实际注册
+		//1. 查询数据库内是否存在逻辑删除
+		List<AppUser> appUserList = appUserMapper.selectList(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, phone).eq(AppUser::getDeleteStatus, 0));
+		if(appUserList.size() != 0){
+			//删除旧数据
+			appUserList.forEach(item -> {
+				appUserMapper.deleteById(item);
+			});
+		}
+		//2.todo:手机验证码
+
+
+		//3.开始新增
+		AppUser appUser = new AppUser();
+		//手机号
+		appUser.setPhone(phone);
+		//注册身份
+		appUser.setUserType(registerDto.getType().toString());
+		//加密并设置登陆密码
+		String password = registerDto.getPassword();
+		String encode = passwordEncoder.encode(password);
+		appUser.setPassword(encode);
+		//昵称
+		appUser.setName(registerDto.getNickName());
+		//创建时间
+		appUser.setCreateTime(new Date());
+		//默认可用
+		appUser.setStatus("1");
+		appUser.setDeleteStatus(1);
+		//保存
+		int insert = appUserMapper.insert(appUser);
+
+		return insert == 1;
+	}
+
+	/** 用户登录 */
+	AjaxJson login(String phone, String password){
+		if(!StringUtils.isNotBlank(phone) || !StringUtils.isNotBlank(password))
+			return AjaxJson.getError("错误登录!");
+		//登陆查询
+		LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
+		queryWrapper.eq(AppUser::getPhone,phone);
+		queryWrapper.eq(AppUser::getDeleteStatus,1); //未被逻辑删除
+		List<AppUser> userList = appUserMapper.selectList(queryWrapper);
+		if(userList.size() == 0)return AjaxJson.getError("该用户不存在,请先注册!");
+		//判断用户是否存在
+		if(userList.size() > 1){
+			log.debug("该手机号登录用户存在多个活动账号,手机号: " + phone);
+			return AjaxJson.getError("该账户存在问题,请联系客服进行处理!");
+		}
+		//获取登录用户
+		AppUser appUser = userList.get(0);
+		//比对密码
+		String userPassword = appUser.getPassword();
+		boolean matches = passwordEncoder.matches(password, userPassword);
+		if(!matches)return AjaxJson.getError("密码校验错误,请检查!");
+		//判断是否停用
+		if(appUser.getStatus().equals("0"))return AjaxJson.getError("该账户 " + appUser.getPhone() + " 已停用!");
+		//设置登录次数
+		appUser.setLoginCount(appUser.getLoginCount() + 1);
+		//保存
+		appUserMapper.updateById(appUser);
+		//开始执行登录
+		StpUtil.login(appUser.getId());
+		// 组织返回参数,直接拿过来用的,然后自己改吧改吧
+		SoMap map = new SoMap();
+		//敏感信息置空
+		appUser.setPassword(null);
+		//执行
+		map.put("appUser", appUser);
+		//获取当前用户角色权限字符
+		List<ReRoleMenu> reRoleMenus = reRoleMenuMapper.selectList(new LambdaQueryWrapper<ReRoleMenu>().eq(ReRoleMenu::getAppRoleId, appUser.getUserType()));
+		//使用stream流对其reRoleMenus集合的权限字符进行过滤顺便转成String类型
+		List<String> per_list = reRoleMenus.stream().map(ReRoleMenu::getAppMenuId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.toList());
+		if(reRoleMenus.size() == 0)return AjaxJson.getError("当前职务暂无权限!");
+		//过滤出权限字符
+		map.put("per_list", per_list);
+		map.put("tokenInfo", StpUtil.getTokenInfo());
+		StpUserUtil.cachePerList(per_list);
+
+		return AjaxJson.getSuccessData(map);
 	}
 
 
+	/** 忘记密码 */
+	AjaxJson forgetPassword(ForgetPasswordDto forgetPasswordDto){
+		//进行查询
+		List<AppUser> appUserList = appUserMapper.selectList
+				  (new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, forgetPasswordDto.getPhone())
+													.eq(AppUser::getDeleteStatus, 1)
+													.eq(AppUser::getStatus, 1));
+		//判断其手机号码可能存在的异常情况
+		if(appUserList.size() > 1)
+			return AjaxJson.getError("当前账户存在异常,请联系客服进行处理!");
+		if(appUserList.size() == 0)throw new RuntimeException("您当前手机号尚未进行注册!");
+		//获取当前手机号对象
+		AppUser appUser = appUserList.get(0);
+		//获取短信验证码发送结果
+		boolean phoneSmsCode = getPhoneSmsCode(forgetPasswordDto.getPhone());
+		if(!phoneSmsCode)return AjaxJson.getError("验证码发送失败!");
+		//从缓存中获取验证码
+		String smsCode = RedisUtil.get(forgetPasswordDto.getPhone());
+		if(smsCode == null)return AjaxJson.getError("验证码已过期!");
+		//比对用户输入的验证码
+		boolean result = smsCode.equals(forgetPasswordDto.getSmsCode());
+		//进行验证码校验完成后的流程
+		if(result){
+			//密码校验
+			boolean equals = forgetPasswordDto.getPassword().equals(forgetPasswordDto.getRePassword());
+			//验证码匹配成功,执行修改密码逻辑
+			//1.判断其密码验证
+			if(equals){
+				//1.1 密码校验正确,设置新密码
+				String encode = passwordEncoder.encode(forgetPasswordDto.getRePassword());
+				appUser.setPassword(encode);
+				//1.2  执行保存
+				int i = appUserMapper.updateById(appUser);
+				if(i != 1)return AjaxJson.getError("密码重置失败!");
+				return AjaxJson.getSuccess("密码找回成功!");
+			}else {
+
+				return AjaxJson.getError("两次密码校验不匹配,请重新尝试!");
+
+			}
+
+		}
+
+		//验证码匹配错误
+		return AjaxJson.getError("验证码输入错误,请检查!");
+	}
+
+	/** 获取验证码 */
+	boolean getPhoneSmsCode(String phone){
+		//todo: 发送短信,其短信商回调验证码
+		String smsCode = "123";
+		//todo: 根据其短信发送情况返回不同的结果
+
+		// return false;
+
+		//todo: 保存到缓存,默认1分钟
+		RedisUtil.setByMINUTES(phone,smsCode, 1);
+
+		return true;
+	}
 }

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

@@ -0,0 +1,16 @@
+package com.pj.project.app_user;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 25 15 05
+ **/
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class MethodAppUserService {
+
+
+
+}

+ 27 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/dto/ForgetPasswordDto.java

@@ -0,0 +1,27 @@
+package com.pj.project.app_user.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 25 15 45
+ **/
+@Data
+public class ForgetPasswordDto {
+
+    /** 手机号码 */
+    @NotNull(message = "手机号不能为空!")
+    private String phone;
+    /** 短信验证码 */
+    @NotNull(message = "短信验证码不能为空!")
+    private String smsCode;
+    /** 密码 */
+    @NotNull(message = "密码不能为空!")
+    private String password;
+    /** 再次输入密码 */
+    @NotNull(message = "再次输入密码不能为空!")
+    private String rePassword;
+
+}

+ 28 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/dto/RegisterDto.java

@@ -0,0 +1,28 @@
+package com.pj.project.app_user.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 注册的用户选择角色,填写手机号码、获取短信认证,填写密码进行注册
+ * @Author Mechrevo
+ * @Date 2023 07 25 10 43
+ **/
+@Data
+public class RegisterDto {
+
+    /** 注册身份 1=边民 2= 3= 4= */
+    @NotNull(message = "身份选择不能为空!")
+    private Integer type;
+    /** 手机号码 */
+    @NotNull(message = "手机号不能为空")
+    private String phone;
+    /** 手机验证码 */
+    private Integer smsCode;
+    /** 登陆密码 */
+    @NotNull(message = "密码不能为空!")
+    private String password;
+    /** 昵称 */
+    private String nickName;
+}

+ 37 - 0
sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/MethodRoleMenuService.java

@@ -0,0 +1,37 @@
+package com.pj.project.re_role_menu;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 25 17 30
+ **/
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class MethodRoleMenuService {
+
+    @Autowired
+    private ReRoleMenuMapper reRoleMenuMapper;
+
+    /** 获取该权限的集合 */
+    public List<Long> getPerList(Long roleId){
+        if (roleId == null)throw new RuntimeException("职务不能为空!");
+        //查询该职务下属权限
+        List<ReRoleMenu> reRoleMenus = reRoleMenuMapper.selectList
+                (new LambdaQueryWrapper<ReRoleMenu>().eq(ReRoleMenu::getAppRoleId, roleId));
+        //创建返回值集合
+        List<Long> perList = new ArrayList<>();
+        //遍历集合封装数据
+        reRoleMenus.forEach(item -> {
+            perList.add(item.getId());
+        });
+        return perList;
+    }
+
+}

+ 9 - 2
sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/ReRoleMenu.java

@@ -3,9 +3,11 @@ package com.pj.project.re_role_menu;
 import java.io.Serializable;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.AllArgsConstructor;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
+import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
 
 /**
@@ -16,6 +18,8 @@ import lombok.experimental.Accessors;
 @Accessors(chain = true)
 @TableName(ReRoleMenu.TABLE_NAME)
 @EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
 public class ReRoleMenu extends Model<ReRoleMenu> implements Serializable {
 
 	// ---------- 模块常量 ----------
@@ -35,10 +39,13 @@ public class ReRoleMenu extends Model<ReRoleMenu> implements Serializable {
 	public static final String PERMISSION_CODE_EDIT = "re-role-menu-edit";
 	public static final String PERMISSION_CODE_DEL = "re-role-menu-del";
 
+	public ReRoleMenu(Long appRoleId, Long appMenuId) {
+		this.appRoleId = appRoleId;
+		this.appMenuId = appMenuId;
+	}
 
 
-
-	// ---------- 表中字段 ----------
+// ---------- 表中字段 ----------
 	/**
 	 * 主键 
 	 */

+ 17 - 1
sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/ReRoleMenuController.java

@@ -1,9 +1,12 @@
 package com.pj.project.re_role_menu;
 
 import java.util.List;
+
+import com.pj.project.re_role_menu.dto.AssignPermissionsDto;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import com.pj.utils.sg.*;
@@ -80,7 +83,20 @@ public class ReRoleMenuController {
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
 	
-	
+	/**
+	 * pc端:可以根据不同app角色进行菜单权限分配
+	 * @param assignPermissionsDto 职务ID和该职务下属的权限的集合
+	 * @return
+	 */
+	@RequestMapping("assignPermissions")
+		@SaCheckPermission(ReRoleMenu.PERMISSION_CODE)
+	public AjaxJson assignPermissions(@Validated @RequestBody AssignPermissionsDto assignPermissionsDto) {
+		boolean permissions = reRoleMenuService.assignPermissions(assignPermissionsDto);
+		if(permissions)return AjaxJson.getSuccess("权限分配成功!");
+		return AjaxJson.getError("权限分配失败!");
+	}
+
+
 	
 	
 

+ 39 - 1
sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/ReRoleMenuService.java

@@ -1,13 +1,17 @@
 package com.pj.project.re_role_menu;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.pj.project.re_role_menu.dto.AssignPermissionsDto;
 import com.pj.utils.so.SoMap;
 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: re_role_menu -- app用户菜单中间表
@@ -20,6 +24,9 @@ public class ReRoleMenuService extends ServiceImpl<ReRoleMenuMapper, ReRoleMenu>
 	/** 底层 Mapper 对象 */
 	@Autowired
 	ReRoleMenuMapper reRoleMenuMapper;
+	/** 方法抽取,优化代码 */
+	@Autowired
+	private MethodRoleMenuService methodRoleMenuService;
 
 	/** 增 */
 	void add(ReRoleMenu r){
@@ -47,6 +54,37 @@ public class ReRoleMenuService extends ServiceImpl<ReRoleMenuMapper, ReRoleMenu>
 		so.set("app_role_id",appRoleId);
 		return reRoleMenuMapper.getList(so);	
 	}
+
+	/** 给app角色分配权限 */
+	boolean assignPermissions(AssignPermissionsDto assignPermissionsDto){
+		//取出数据
+		Long roleId = assignPermissionsDto.getRoleId();
+		List<Long> permissionsDtoList = assignPermissionsDto.getList().stream().distinct().collect(Collectors.toList());
+		//情况1:传进来的集合为空,默认删除该职务下属的所有权限
+		if(permissionsDtoList.size() == 0){
+			//删除所有权限
+			List<Long> perList = methodRoleMenuService.getPerList(roleId);
+			//清除
+			int i = reRoleMenuMapper.deleteBatchIds(perList);
+			return i == perList.size();
+		}
+		//情况2: 传进来的集合不为空
+		//2.1 先清除该职务的权限
+		List<Long> perList = methodRoleMenuService.getPerList(roleId);
+		//执行清除
+		int i = reRoleMenuMapper.deleteBatchIds(perList);
+		if(i != perList.size())throw new RuntimeException("权限分配失败Ⅰ!");
+		//2.2 再添加新的权限给到该职务
+		//定义计数器
+		int count = 0;
+		for(Long item : permissionsDtoList){
+			int insert = reRoleMenuMapper.insert(new ReRoleMenu(roleId, item));
+			count += insert;
+		}
+		if(count != permissionsDtoList.size())throw new RuntimeException("权限分配失败Ⅱ!");
+
+		return count == permissionsDtoList.size();
+	}
 	
 
 }

+ 20 - 0
sp-service/sp-admin/src/main/java/com/pj/project/re_role_menu/dto/AssignPermissionsDto.java

@@ -0,0 +1,20 @@
+package com.pj.project.re_role_menu.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 07 25 17 11
+ **/
+@Data
+public class AssignPermissionsDto {
+
+    @NotNull(message = "职务ID")
+    private Long roleId;
+    @NotNull(message = "集合可以没有值,但不能为null")
+    private List<Long> list;
+
+}

+ 6 - 0
sp-service/transport-server/src/main/java/com/pj/TransportServerApplication.java

@@ -6,7 +6,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.ApplicationPidFileWriter;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.Bean;
 import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.NoOpPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 import java.io.File;
@@ -28,4 +32,6 @@ public class TransportServerApplication {
         SpCloudUtil.printCurrentServiceInfo();
     }
 
+
+
 }