Jelajahi Sumber

收购商bug

qzy 11 bulan lalu
induk
melakukan
de619b6578

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

@@ -102,4 +102,7 @@ public interface AdminInterface {
 
     @PostMapping("AppUser/rpc/updateAccount")
     int updateAccount(UpdateAccountDTO updateAccountDTO);
+
+    @PostMapping("AppUser/rpc/bindFkId")
+    boolean bindFkId(@RequestParam("appUserId") Long appUserId,@RequestParam("fkId")  Long fkId);
 }

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

@@ -105,6 +105,11 @@ public class AdminInterfaceFallback implements FallbackFactory<AdminInterface> {
                 return 0;
             }
 
+            @Override
+            public boolean bindFkId(Long appUserId, Long fkId) {
+                return false;
+            }
+
         };
     }
 

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsAppController.java

@@ -42,7 +42,7 @@ public class TbPortNewsAppController {
     @RequestMapping("getPortNewsList")
     public AjaxJson getPortNewsList() {
         SoMap so = SoMap.getRequestSoMap();
-        so.put("status", 1);
+        so.put("isRelease", 1);
         List<TbPortNews> list = tbPortNewsService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }

+ 2 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsService.java

@@ -40,7 +40,6 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
     void add(TbPortNews t) {
         PCLoginUserInfo userInfo = StpUserUtil.getPCLoginInfo();
         t.setIsRelease(0)
-                .setStatus(0)
                 .setCreateBy(userInfo.getLoginId())
                 .setCreateName(userInfo.getLoginName())
                 .setCreateTime(new Date());
@@ -126,11 +125,11 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
      */
     public AjaxJson getPortNewsDetails(Long id) {
         TbPortNews tbPortNews = tbPortNewsMapper.selectById(id);
-        if (tbPortNews != null && tbPortNews.getStatus() == 1) {
+        if (tbPortNews != null && tbPortNews.getIsRelease() == 1) {
             tbPortNews.setReadCount(tbPortNews.getReadCount() + 1);
             tbPortNewsMapper.updateById(tbPortNews);
             return AjaxJson.getSuccessData(tbPortNews);
         }
-        return AjaxJson.getError();
+        return AjaxJson.getError("资讯已下架");
     }
 }

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

@@ -36,60 +36,6 @@ public class MethodPurchaserService {
     private TbPurchaserService tbPurchaserService;
 
 
-    public TbPurchaser setPurchaserProperties(PurchaserParam purchaser) throws ParseException {
-        //开始保存收购商信息
-        //注册/认证时间
-        TbPurchaser tbPurchaser = new TbPurchaser();
-        //设置名称
-        tbPurchaser.setName(purchaser.getName());
-        //审核状态
-        tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode()); // 待审核
-        //默认未被锁
-        tbPurchaser.setIsLock(IsLock.IS_LOCK_ON.getCode());
-        //注册时间
-        tbPurchaser.setRegisterTime(new Date());
-        //创建时间
-        tbPurchaser.setCreateTime(new Date());
-        //创建人
-        tbPurchaser.setCreateBy(String.valueOf(purchaser.getLoginUserId()));
-        //删除状态:启用
-        tbPurchaser.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
-        //地址
-        tbPurchaser.setAddress(purchaser.getAddress());
-        //计算年龄
-        // 获取当前日期
-        Calendar calendar = Calendar.getInstance();
-        int currentYear = calendar.get(Calendar.YEAR);
-        // 提取身份证号中的出生日期
-        String idNumber = purchaser.getCorporateIdCard();
-        String birthDateStr = idNumber.substring(6, 14);
-        // 将出生日期字符串转换为Date类型
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
-        Date birthDate = dateFormat.parse(birthDateStr);
-        // 计算年龄
-        calendar.setTime(birthDate);
-        int birthYear = calendar.get(Calendar.YEAR);
-        int age = currentYear - birthYear;
-        tbPurchaser.setAge(age);
-        //法人
-        tbPurchaser.setLegalPerson(purchaser.getCorporateName());
-        //身份证
-        tbPurchaser.setIdCard(purchaser.getCorporateIdCard());
-        //手机号
-        tbPurchaser.setContact(purchaser.getLinkPhone());
-        //营业执照
-        tbPurchaser.setBusinessLicense(purchaser.getBusinessLicense());
-        //银行编号
-        tbPurchaser.setBankNo(purchaser.getBankNo());
-        //银行账户
-        tbPurchaser.setBankAccount(purchaser.getBankAccount());
-        //银行名称
-        tbPurchaser.setBankName(purchaser.getBankName());
-        //审核状态,默认待审核
-        tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode());
-        tbPurchaser.setDutyParagraph(purchaser.getDutyParagraph());
-        return tbPurchaser;
-    }
 
     /**
      * 认证时封装收购商信息

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

@@ -53,8 +53,12 @@ public class TbPurchaserAppController {
      * 收购商认证
      */
     @RequestMapping("identification")
-    public AjaxJson identification(@RequestBody @Validated PurchaserParam purchaser) throws ParseException {
-        boolean identification = tbPurchaserService.identification(purchaser);
+    public AjaxJson identification( @Validated PurchaserParam purchaser) throws ParseException {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("用户未登录!!!");
+        }
+        APPLoginUserInfo appLoginInfo=StpAPPUserUtil.getAPPLoginInfo();
+        boolean identification = tbPurchaserService.identification(purchaser,appLoginInfo.getLoginId(),appLoginInfo.getFk());
         if (!identification) return AjaxJson.getError("收购商认证信息提交失败!!!");
 
         return AjaxJson.getSuccess("收购商认证信息已提交,管理员审核中,请耐心等待!");

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

@@ -111,30 +111,29 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
     /**
      * 收购商认证
      */
-    boolean identification(PurchaserParam purchaser) throws ParseException {
-        if (null == purchaser) return false;
-        //验证之前是否有被拒的
-        List<TbPurchaser> tbPurchasers = tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getCreateBy, purchaser.getLoginUserId()));
-        if (tbPurchasers.size() > 0) {
-            tbPurchasers.forEach(item -> {
-                tbPurchaserMapper.deleteById(item.getId());
-            });
+    boolean identification(PurchaserParam purchaser,Long appUserId,Long fkId) throws ParseException {
+        TbPurchaser tbPurchaser=new TbPurchaser();
+        tbPurchaser.setCreateTime(new Date())
+                ;
+        if (fkId!=null){
+            tbPurchaser=getById(fkId);
+            tbPurchaser.setJudgeContent("再次提交审核");
+
+        }
+        tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode())
+                .setJudgeTime(null)
+                .setName(purchaser.getName())
+                .setRegisterTime(new Date())
+                .setLegalPerson(purchaser.getLegalPerson())
+                .setContact(purchaser.getContact())
+                .setIdCard(purchaser.getIdCard()).setType(purchaser.getType())
+                .setBusinessLicense(purchaser.getBusinessLicense())
+                .setBankAccount(purchaser.getBankAccount());
+        if (fkId==null){
+            FeignFactory.adminInterface.bindFkId(appUserId,tbPurchaser.getId());
         }
-        //身份证号去重
-        String idCard = purchaser.getCorporateIdCard();
-        if (tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getIdCard, idCard).eq(TbPurchaser::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
-            throw new RuntimeException("当前身份证号已被认证!");
-        //手机号去重
-        String contact = purchaser.getLinkPhone();
-        if (tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getContact, contact).eq(TbPurchaser::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
-            throw new RuntimeException("当前手机号已被认证!");
-        //TODO:是否需要手机发送验证码认证?
-
-        //封装收购商信息
-        TbPurchaser tbPurchaser = methodPurchaserService.setPurchaserProperties(purchaser);
-        // 保存收购商信息
-        int insert = tbPurchaserMapper.insert(tbPurchaser);
-        return insert == 1;
+        return this.saveOrUpdate(tbPurchaser);
+
     }
 
     /**
@@ -164,7 +163,6 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
                 adminInterface.messageSave(dto);
                 return updateById(tbPurchaser);
             }
-            throw new ServiceException("审核失败");
         }
         return updateById(tbPurchaser);
     }

+ 5 - 15
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/param/PurchaserParam.java

@@ -16,38 +16,28 @@ import javax.validation.constraints.NotNull;
 @NoArgsConstructor
 public class PurchaserParam {
 
-    @NotNull(message = "登录人ID")
-    private Long loginUserId;
 
     @NotNull(message = "公司名称")
     private String name;
 
-    @NotNull(message = "税号")
-    private String dutyParagraph;
+    private Integer type;
 
     @NotNull(message = "法人姓名")
-    private String corporateName;
+    private String legalPerson;
 
     @NotNull(message = "法人身份证")
-    private String corporateIdCard;
+    private String idCard;
 
     @NotNull(message = "联系号码")
-    private String linkPhone;
+    private String contact;
 
-    @NotNull(message = "银行编号")
-    private String bankNo;
-
-    @NotNull(message = "开户银行")
-    private String bankName;
 
     @NotNull(message = "银行账号")
     private String bankAccount;
 
-    @NotNull(message = "营业执照")
     private String businessLicense;
 
-    @NotNull(message = "地址")
-    private String address;
+
 
 
 

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

@@ -176,6 +176,10 @@ public class AppUserController {
 	public AppUserDto findUserByPhone(@RequestParam("phone") String phone) {
 		return appUserService.findUserByPhone(phone);
 	}
+	@RequestMapping("rpc/bindFkId")
+	public boolean bindFkId(@RequestParam("appUserId") Long appUserId,@RequestParam("fkId")  Long fkId){
+		return appUserService.bindFkId(appUserId,fkId);
+	}
 	@PostMapping("rpc/updateAccount")
 	public int updateAccount(@RequestBody UpdateAccountDTO phone) {
 		return appUserService.updateAccount(phone);

+ 18 - 9
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -802,16 +802,16 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
     }
 
     public AjaxJson purchaserLogin(LoginDto dto) {
-       String phone= dto.getPhone();
-       if (StrUtil.isEmpty(phone)) {
-           return AjaxJson.getError("手机号不正确");
-       }
-       String pwd= dto.getPassword();
+        String phone = dto.getPhone();
+        if (StrUtil.isEmpty(phone)) {
+            return AjaxJson.getError("手机号不正确");
+        }
+        String pwd = dto.getPassword();
         if (StrUtil.isEmpty(pwd)) {
             return AjaxJson.getError("请输入密码");
         }
         AppUser appUser = findByPhone(phone);
-        if (appUser == null|| !Objects.equals(appUser.getUserType(),UserType.USER_TYPE_PURCHASER.getCode())) {
+        if (appUser == null || !Objects.equals(appUser.getUserType(), UserType.USER_TYPE_PURCHASER.getCode())) {
             return AjaxJson.getError("账号不存在");
         }
         if (!passwordEncoder.matches(pwd, appUser.getPassword())) {
@@ -820,11 +820,11 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         if (appUser.getStatus().equals("0")) {
             return AjaxJson.getError("该账户 " + appUser.getPhone() + " 已停用!");
         }
-        PurchaserDto purchaserDto=  FeignFactory.levelTwoServerInterface.getByPurchaserId(appUser.getFkId());
-        if (purchaserDto==null){
+        PurchaserDto purchaserDto = FeignFactory.levelTwoServerInterface.getByPurchaserId(appUser.getFkId());
+        if (purchaserDto == null) {
             return AjaxJson.getError("商户不存在或未认证");
         }
-        if (purchaserDto.getJudgeStatus()==0){
+        if (purchaserDto.getJudgeStatus() == 0) {
             return AjaxJson.getError("商户未审核");
         }
         //开始执行登录
@@ -844,4 +844,13 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         map.put("companyInfo", companyInfo);
         return AjaxJson.getSuccessData(map);
     }
+
+    public boolean bindFkId(Long appUserId, Long fkId) {
+        AppUser appUser = this.getById(appUserId);
+        if (appUser == null) {
+            return false;
+        }
+        appUser.setFkId(fkId);
+        return this.updateById(appUser);
+    }
 }