|
@@ -16,6 +16,7 @@ import java.util.Objects;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
|
import com.pj.api.dto.AppUserDto;
|
|
|
+import com.pj.api.dto.EnterpriseAuditDto;
|
|
|
import com.pj.api.dto.MessageDto;
|
|
|
import com.pj.api.dto.PurchaserDto;
|
|
|
import com.pj.common.core.exception.ServiceException;
|
|
@@ -118,53 +119,30 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
|
|
|
* @param judgeContent 审核备注
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean audit(Long purchaserId,Integer judgeStatus,String judgeContent){
|
|
|
- //审核不通过
|
|
|
- if(judgeStatus.equals(JudgeStatus.JUDGE_STATUS_TWO.getCode())){
|
|
|
- TbPurchaser selectById = tbPurchaserMapper.selectById(purchaserId);
|
|
|
- if(selectById == null)throw new ServiceException("商户信息异常!");
|
|
|
- selectById.setJudgeStatus(JudgeStatus.JUDGE_STATUS_TWO.getCode());
|
|
|
- selectById.setJudgeContent(judgeContent);
|
|
|
- tbPurchaserMapper.updateById(selectById);
|
|
|
- //发送通知给收购商
|
|
|
- MessageDto dto = new MessageDto();
|
|
|
- dto.setUrl("/pages/market/one/merchant/order/list");
|
|
|
- dto.setUserId(purchaserId);
|
|
|
- dto.setContents("您发起的收购商认证审核不通过,原因是: " + judgeContent);
|
|
|
- adminInterface.messageSave(dto);
|
|
|
- return true;
|
|
|
- }
|
|
|
- if(!judgeStatus.equals(1))
|
|
|
- return false;
|
|
|
- //审核通过
|
|
|
+ public boolean audit(Long purchaserId,Integer judgeStatus,String judgeContent) {
|
|
|
TbPurchaser tbPurchaser = tbPurchaserMapper.selectById(purchaserId);
|
|
|
- if(tbPurchaser == null)throw new ServiceException("收购商信息异常。");
|
|
|
- //审核同构且完成数据插入则进行关联
|
|
|
- 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.setAuth(1 + ""); // 1=审核通过
|
|
|
- //保存
|
|
|
- Boolean aBoolean = adminInterface.saveAppUserInfo(appUser);
|
|
|
- //发送message
|
|
|
- if(aBoolean){
|
|
|
- //发送通知给收购商
|
|
|
- MessageDto dto = new MessageDto();
|
|
|
- dto.setUserId(appUser.getId());
|
|
|
- dto.setContents("恭喜商户信息认证成功!");
|
|
|
- adminInterface.messageSave(dto);
|
|
|
+ if (tbPurchaser == null) {
|
|
|
+ throw new AjaxError("收购商不存在");
|
|
|
+ }
|
|
|
+ String name = StpUserUtil.getLoginName();
|
|
|
+ tbPurchaser.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date()).setJudgeBy(name);
|
|
|
+ if (judgeStatus == 1) {
|
|
|
+ EnterpriseAuditDto auditDto = new EnterpriseAuditDto();
|
|
|
+ auditDto.setAuth("1");
|
|
|
+ auditDto.setFkId(purchaserId);
|
|
|
+ auditDto.setId(Long.parseLong(tbPurchaser.getCreateBy()));
|
|
|
+ if (adminInterface.audit(auditDto)) {
|
|
|
+ //发送通知给收购商
|
|
|
+ MessageDto dto = new MessageDto();
|
|
|
+ dto.setUserId(purchaserId);
|
|
|
+ dto.setContents("恭喜商户信息认证成功!");
|
|
|
+ adminInterface.messageSave(dto);
|
|
|
+ return updateById(tbPurchaser);
|
|
|
+ }
|
|
|
+ throw new ServiceException("审核失败");
|
|
|
}
|
|
|
- return aBoolean;
|
|
|
+ return updateById(tbPurchaser);
|
|
|
}
|
|
|
-
|
|
|
/** 获取审核状态 */
|
|
|
public PurchaserParamVo auditStatus(Long appUserId){
|
|
|
List<TbPurchaser> purchaserList = tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getCreateBy, appUserId).orderByDesc(TbPurchaser::getCreateTime));
|