|
@@ -4,7 +4,6 @@ import com.caimei.mapper.AuthMapper;
|
|
|
import com.caimei.model.ResponseJson;
|
|
|
import com.caimei.model.po.CmBrandAuthPo;
|
|
|
import com.caimei.model.vo.AuthVo;
|
|
|
-import com.caimei.model.vo.BrandVo;
|
|
|
import com.caimei.service.AuthProductService;
|
|
|
import com.caimei.service.AuthService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -17,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.ListIterator;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -39,22 +39,29 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer authUserId, String authParty, Integer pageNum, Integer pageSize) {
|
|
|
+ public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer auditStatus, Integer lowerAuditStatus, Integer pageNum, Integer pageSize) {
|
|
|
if (null == authUserId) {
|
|
|
return ResponseJson.error("参数异常,请输入供应商用户id", null);
|
|
|
}
|
|
|
+ listType = null == listType ? 1 : listType;
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- List<AuthVo> authList = authMapper.getAuthList(authUserId, authParty);
|
|
|
- authList.forEach(auth->{
|
|
|
- Integer waitAuditNum = authMapper.getProductWaitAuditNum(auth.getAuthId());
|
|
|
+ List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, auditStatus);
|
|
|
+ ListIterator<AuthVo> iterator = authList.listIterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ AuthVo auth = iterator.next();
|
|
|
+ Integer waitAuditNum = auth.getWaitAuditNum();
|
|
|
if (waitAuditNum > 0) {
|
|
|
auth.setLowerAuditStatus(0);
|
|
|
- auth.setWaitAuditNum(waitAuditNum);
|
|
|
+ if (null != lowerAuditStatus && 1 == lowerAuditStatus) {
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
} else {
|
|
|
auth.setLowerAuditStatus(1);
|
|
|
- auth.setWaitAuditNum(0);
|
|
|
+ if (null != lowerAuditStatus && 0 == lowerAuditStatus) {
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
PageInfo<AuthVo> pageData = new PageInfo<>(authList);
|
|
|
return ResponseJson.success(pageData);
|
|
|
}
|
|
@@ -109,8 +116,9 @@ public class AuthServiceImpl implements AuthService {
|
|
|
CmBrandAuthPo auth = new CmBrandAuthPo();
|
|
|
auth.setAuthUserId(authUserId);
|
|
|
auth.setAuthParty(authParty);
|
|
|
- // 保存品牌授权信息,上线状态默认为“待上线”
|
|
|
+ // 保存品牌授权信息,上线状态默认为“待上线”,审核状态为“待审核”
|
|
|
auth.setStatus(2);
|
|
|
+ auth.setAuditStatus(2);
|
|
|
if (null == authId) {
|
|
|
auth.setCreateBy(createBy);
|
|
|
auth.setCreateTime(new Date());
|
|
@@ -129,7 +137,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson auditAuth(Integer authId, Integer auditStatus, String invalidReason) {
|
|
|
+ public ResponseJson auditAuth(Integer authId, Integer auditStatus, String invalidReason, Integer auditBy) {
|
|
|
if (authId == null) {
|
|
|
return ResponseJson.error("请输入授权id");
|
|
|
}
|
|
@@ -139,7 +147,20 @@ public class AuthServiceImpl implements AuthService {
|
|
|
if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
|
|
|
return ResponseJson.error("请输入审核不通过的理由");
|
|
|
}
|
|
|
- authMapper.updateAuthAuditStatus(authId, auditStatus, invalidReason);
|
|
|
+ if (auditBy == null) {
|
|
|
+ return ResponseJson.error("请输入审核人用户id");
|
|
|
+ }
|
|
|
+ Date auditTime = new Date();
|
|
|
+ // 授权状态更新
|
|
|
+ Integer status = null;
|
|
|
+ if (auditStatus == 0) {
|
|
|
+ // 审核不通过,下线授权
|
|
|
+ status = 0;
|
|
|
+ } else {
|
|
|
+ // 审核通过,上线授权
|
|
|
+ status = 1;
|
|
|
+ }
|
|
|
+ authMapper.updateAuthAuditStatus(authId, status, auditStatus, invalidReason, auditBy, auditTime);
|
|
|
return ResponseJson.success("审核品牌授权成功");
|
|
|
}
|
|
|
}
|