|
@@ -20,10 +20,7 @@ import com.pj.api.dto.MessageDto;
|
|
import com.pj.api.dto.PurchaserDto;
|
|
import com.pj.api.dto.PurchaserDto;
|
|
import com.pj.common.core.exception.ServiceException;
|
|
import com.pj.common.core.exception.ServiceException;
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
-import com.pj.enummj.DeleteStatus;
|
|
|
|
-import com.pj.enummj.IsLock;
|
|
|
|
-import com.pj.enummj.JudgeStatus;
|
|
|
|
-import com.pj.enummj.People;
|
|
|
|
|
|
+import com.pj.enummj.*;
|
|
import com.pj.tb_purchaser.param.PurchaserParam;
|
|
import com.pj.tb_purchaser.param.PurchaserParam;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -88,6 +85,13 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
|
|
/** 收购商认证 */
|
|
/** 收购商认证 */
|
|
boolean identification(PurchaserParam purchaser) throws ParseException {
|
|
boolean identification(PurchaserParam purchaser) throws ParseException {
|
|
if(null == purchaser) return false;
|
|
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());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
//身份证号去重
|
|
//身份证号去重
|
|
String idCard = purchaser.getCorporateIdCard();
|
|
String idCard = purchaser.getCorporateIdCard();
|
|
if(tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getIdCard,idCard).eq(TbPurchaser::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
|
|
if(tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getIdCard,idCard).eq(TbPurchaser::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
|
|
@@ -115,26 +119,56 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
|
|
public boolean audit(Long purchaserId,Boolean flag,String reason){
|
|
public boolean audit(Long purchaserId,Boolean flag,String reason){
|
|
//审核不通过
|
|
//审核不通过
|
|
if(!flag){
|
|
if(!flag){
|
|
|
|
+ TbPurchaser selectById = tbPurchaserMapper.selectById(purchaserId);
|
|
|
|
+ if(selectById == null)throw new ServiceException("商户信息异常!");
|
|
|
|
+ selectById.setJudgeStatus(JudgeStatus.JUDGE_STATUS_THREE.getCode());
|
|
|
|
+ selectById.setJudgeContent(reason);
|
|
|
|
+ tbPurchaserMapper.updateById(selectById);
|
|
//发送通知给收购商
|
|
//发送通知给收购商
|
|
MessageDto dto = new MessageDto();
|
|
MessageDto dto = new MessageDto();
|
|
dto.setUrl("/pages/market/one/merchant/order/list");
|
|
dto.setUrl("/pages/market/one/merchant/order/list");
|
|
dto.setUserId(purchaserId);
|
|
dto.setUserId(purchaserId);
|
|
dto.setContents("您发起的收购商认证审核不通过,原因是: " + reason);
|
|
dto.setContents("您发起的收购商认证审核不通过,原因是: " + reason);
|
|
adminInterface.messageSave(dto);
|
|
adminInterface.messageSave(dto);
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
//审核通过
|
|
//审核通过
|
|
TbPurchaser tbPurchaser = tbPurchaserMapper.selectById(purchaserId);
|
|
TbPurchaser tbPurchaser = tbPurchaserMapper.selectById(purchaserId);
|
|
if(tbPurchaser == null)throw new ServiceException("收购商信息异常。");
|
|
if(tbPurchaser == null)throw new ServiceException("收购商信息异常。");
|
|
//审核同构且完成数据插入则进行关联
|
|
//审核同构且完成数据插入则进行关联
|
|
- AppUserDto appUser = adminInterface.getByPhoneAndUserType(tbPurchaser.getContact(), 3);
|
|
|
|
|
|
+ AppUserDto appUser = adminInterface.getByPhoneAndUserType(tbPurchaser.getContact(), UserType.USER_TYPE_PURCHASER.getCode());
|
|
|
|
+ if(appUser == null)throw new ServiceException("审核的用户的信息异常!");
|
|
|
|
+ if(appUser.getAuth().equals("1") || appUser.getFkId() != null)
|
|
|
|
+ throw new ServiceException("该用户认证信息异常。");
|
|
|
|
+ //设置审核人和审核时间
|
|
|
|
+ tbPurchaser.setJudgeTime(new Date());
|
|
|
|
+ tbPurchaser.setPersonId(StpUserUtil.getLoginIdAsString());
|
|
|
|
+ tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ONE.getCode());
|
|
|
|
+ tbPurchaserMapper.updateById(tbPurchaser);
|
|
//设置关联属性
|
|
//设置关联属性
|
|
appUser.setFkId(String.valueOf(tbPurchaser.getId()));
|
|
appUser.setFkId(String.valueOf(tbPurchaser.getId()));
|
|
appUser.setAuth(1 + ""); // 1=审核通过
|
|
appUser.setAuth(1 + ""); // 1=审核通过
|
|
//保存
|
|
//保存
|
|
Boolean aBoolean = adminInterface.saveAppUserInfo(appUser);
|
|
Boolean aBoolean = adminInterface.saveAppUserInfo(appUser);
|
|
|
|
+ //发送message
|
|
|
|
+ if(aBoolean){
|
|
|
|
+ //发送通知给收购商
|
|
|
|
+ MessageDto dto = new MessageDto();
|
|
|
|
+ dto.setUrl("/pages/market/one/merchant/order/list");
|
|
|
|
+ dto.setUserId(appUser.getId());
|
|
|
|
+ dto.setContents("恭喜商户信息认证成功!");
|
|
|
|
+ adminInterface.messageSave(dto);
|
|
|
|
+ }
|
|
return aBoolean;
|
|
return aBoolean;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** 获取审核状态 */
|
|
|
|
+ public TbPurchaser auditStatus(Long appUserId){
|
|
|
|
+ List<TbPurchaser> purchaserList = tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getCreateBy, appUserId).orderByDesc(TbPurchaser::getCreateTime));
|
|
|
|
+ if(purchaserList.size() == 0)return null;
|
|
|
|
+ return purchaserList.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
/** 是否锁住收购商 */
|
|
/** 是否锁住收购商 */
|
|
public int isLock(TbPurchaserDto purchaserDto) {
|
|
public int isLock(TbPurchaserDto purchaserDto) {
|
|
// 获取当前登录用户id
|
|
// 获取当前登录用户id
|