Selaa lähdekoodia

app-商家、收购商认证

linbl 1 vuosi sitten
vanhempi
commit
8bb5c62b20

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

@@ -0,0 +1,52 @@
+package com.pj.tb_enterprise;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.pj.project4sp.SP;
+import com.pj.utils.sg.AjaxJson;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+
+/**
+ * @author lbl
+ */
+@RestController
+@RequestMapping("/app/TbEnterprise/")
+public class TbEnterpriseAppController {
+
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbEnterpriseService tbEnterpriseService;
+
+
+	/** 查个人信息 - 根据id */
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbEnterprise t = tbEnterpriseService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 改个人信息 */
+	@RequestMapping("update")
+	public AjaxJson update(TbEnterprise t){
+		tbEnterpriseService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 商家认证 */
+	@RequestMapping("identification")
+	public AjaxJson identification(TbEnterprise t){
+		boolean identification = tbEnterpriseService.identification(t);
+		if(!identification) return AjaxJson.getError("商家认证信息提交失败!!!");
+
+		return AjaxJson.getSuccess("商家认证信息已提交,管理员审核中,请耐心等待!");
+	}
+
+
+}

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

@@ -4,6 +4,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -32,7 +33,7 @@ import javax.swing.filechooser.FileSystemView;
 
 /**
  * Service: tb_enterprise -- 商家
- * @author qzy 
+ * @author qzy
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
@@ -69,9 +70,9 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 		return super.getById(id);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbEnterprise> getList(SoMap so) { 
-		return tbEnterpriseMapper.getList(so);	
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+	List<TbEnterprise> getList(SoMap so) {
+		return tbEnterpriseMapper.getList(so);
 	}
 
 	public int audit(TbEnterpriseDto tbEnterpriseDto){
@@ -115,6 +116,35 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 		return line;
 	}
 
+	/** 商家认证 */
+	boolean identification(TbEnterprise enterprise){
+		if(null == enterprise) return false;
+
+		//手机号去重
+		String idCard = enterprise.getIdCard();
+		if(tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getIdCard,idCard).eq(TbEnterprise::getDeleteStatus,1)).size() != 0)
+			throw new RuntimeException("当前手机号已被认证!");
+		//身份证号去重
+		String contact = enterprise.getContact();
+		if(tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getContact,contact).eq(TbEnterprise::getDeleteStatus,1)).size() != 0)
+			throw new RuntimeException("当前身份证号已被认证!");
+
+		//是否需要手机发送验证码认证?
+
+		//开始保存商家信息
+		//注册/认证时间
+		enterprise.setRegisterTime(new Date());
+		//创建时间
+		enterprise.setCreateTime(new Date());
+		//删除状态:启用
+		enterprise.setDeleteStatus(1);
+
+		// 保存商家信息
+		int insert = tbEnterpriseMapper.insert(enterprise);
+		return insert == 1;
+	}
+
+
 	/**
 	 * 导入
 	 * @param file excel文件

+ 10 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserAppController.java

@@ -42,5 +42,15 @@ public class TbPurchaserAppController {
 		return AjaxJson.getSuccess();
 	}
 
+	/** 收购商认证 */
+	@RequestMapping("identification")
+	public AjaxJson identification(TbPurchaser purchaser) {
+		boolean identification = tbPurchaserService.identification(purchaser);
+		if(!identification) return AjaxJson.getError("收购商认证信息提交失败!!!");
+
+		return AjaxJson.getSuccess("收购商认证信息已提交,管理员审核中,请耐心等待!");
+	}
+
+
 
 }

+ 32 - 4
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java

@@ -4,6 +4,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Date;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -23,7 +24,7 @@ import javax.swing.filechooser.FileSystemView;
 
 /**
  * Service: tb_purchaser -- 收购商
- * @author qzy 
+ * @author qzy
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
@@ -57,11 +58,38 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
 		return super.getById(id);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbPurchaser> getList(SoMap so) { 
-		return tbPurchaserMapper.getList(so);	
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+	List<TbPurchaser> getList(SoMap so) {
+		return tbPurchaserMapper.getList(so);
 	}
 
+	/** 收购商认证 */
+	boolean identification(TbPurchaser purchaser){
+		if(null == purchaser) return false;
+
+		//手机号去重
+		String idCard = purchaser.getIdCard();
+		if(tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getIdCard,idCard).eq(TbPurchaser::getDeleteStatus,1)).size() != 0)
+			throw new RuntimeException("当前手机号已被认证!");
+		//身份证号去重
+		String contact = purchaser.getContact();
+		if(tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getContact,contact).eq(TbPurchaser::getDeleteStatus,1)).size() != 0)
+			throw new RuntimeException("当前身份证号已被认证!");
+
+		//是否需要手机发送验证码认证?
+
+		//开始保存收购商信息
+		//注册/认证时间
+		purchaser.setRegisterTime(new Date());
+		//创建时间
+		purchaser.setCreateTime(new Date());
+		//删除状态:启用
+		purchaser.setDeleteStatus(1);
+
+		// 保存收购商信息
+		int insert = tbPurchaserMapper.insert(purchaser);
+		return insert == 1;
+	}
 
 	/**
 	 * 导入