parent
0d728020c3
commit
63770ba4d6
14 changed files with 403 additions and 280 deletions
@ -1,12 +0,0 @@ |
|||||||
package org.springblade.desk.basic.service; |
|
||||||
|
|
||||||
import org.springblade.core.mp.base.BaseService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 扩展框架中的BaseService. |
|
||||||
* |
|
||||||
* @param <T> |
|
||||||
*/ |
|
||||||
public interface ExBaseService<T> extends BaseService<T> { |
|
||||||
|
|
||||||
} |
|
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package org.springblade.desk.basic.service.en; |
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
|
/** |
||||||
|
* Enhance BaseService. |
||||||
|
* |
||||||
|
* @param <T> |
||||||
|
*/ |
||||||
|
public interface EnBaseService<T> extends BaseService<T> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,93 @@ |
|||||||
|
package org.springblade.desk.basic.service.en.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.desk.basic.pojo.vo.BaseEntityVO; |
||||||
|
import org.springblade.desk.basic.service.en.EnBaseService; |
||||||
|
import org.springblade.desk.basic.util.IdUtil; |
||||||
|
import org.springblade.system.feign.IDictClient; |
||||||
|
import org.springblade.system.feign.ISysClient; |
||||||
|
import org.springblade.system.feign.IUserClient; |
||||||
|
import org.springblade.system.pojo.entity.Dept; |
||||||
|
import org.springblade.system.pojo.entity.UserInfo; |
||||||
|
|
||||||
|
/** |
||||||
|
* Enhance BaseServiceImpl. |
||||||
|
* |
||||||
|
* @param <M> |
||||||
|
* @param <T> |
||||||
|
*/ |
||||||
|
public class EnBaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> |
||||||
|
extends BaseServiceImpl<M, T> implements EnBaseService<T> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 构建BaseEntityVO |
||||||
|
* |
||||||
|
* @param userClient feign IUserClient |
||||||
|
* @param dictClient feign ISysClient |
||||||
|
* @param sysClient feign IDictClient |
||||||
|
* @param be 不赋值可以传入null |
||||||
|
* @param statusCode 不需要可以传入null |
||||||
|
* @return BaseEntityVO |
||||||
|
*/ |
||||||
|
public BaseEntityVO setBaseVOValue(IUserClient userClient, ISysClient sysClient, IDictClient dictClient, |
||||||
|
BaseEntity be, String statusCode) { |
||||||
|
if (be == null) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
BaseEntityVO bv = new BaseEntityVO(); |
||||||
|
R<UserInfo> rUICR = null; |
||||||
|
R<UserInfo> rUIUP = null; |
||||||
|
R<Dept> rDept = null; |
||||||
|
// createUserRealName
|
||||||
|
if (IdUtil.isValid(be.getCreateUser())) { |
||||||
|
rUICR = userClient.userInfo(be.getCreateUser()); |
||||||
|
if (rUICR != null && rUICR.isSuccess() && |
||||||
|
rUICR.getData() != null && rUICR.getData().getUser() != null) { |
||||||
|
bv.setCreateUserRealName(rUICR.getData().getUser().getRealName()); |
||||||
|
} |
||||||
|
} |
||||||
|
// updateUserRealName
|
||||||
|
if (IdUtil.isValid(be.getUpdateUser())) { |
||||||
|
rUIUP = userClient.userInfo(be.getUpdateUser()); |
||||||
|
if (rUIUP != null && rUIUP.isSuccess() && |
||||||
|
rUIUP.getData() != null && rUIUP.getData().getUser() != null) { |
||||||
|
bv.setUpdateUserRealName(rUIUP.getData().getUser().getRealName()); |
||||||
|
} |
||||||
|
} |
||||||
|
// createDeptName
|
||||||
|
if (IdUtil.isValid(be.getCreateDept())) { |
||||||
|
rDept = sysClient.getDept(be.getCreateDept()); |
||||||
|
if (rDept != null && rDept.isSuccess() && rDept.getData() != null) { |
||||||
|
bv.setCreateDeptName(rDept.getData().getDeptName()); |
||||||
|
} |
||||||
|
} |
||||||
|
// setKeepUser setKeepUserRealName setKeepTime
|
||||||
|
if (be.getCreateTime() != null && be.getUpdateTime() != null) { |
||||||
|
if (be.getUpdateTime().after(be.getCreateTime())) { // 更新时间更晚
|
||||||
|
bv.setKeepUser(be.getUpdateUser()); |
||||||
|
bv.setKeepUserRealName(bv.getUpdateUserRealName()); |
||||||
|
bv.setKeepTime(be.getUpdateTime()); |
||||||
|
} else { // 等于或更早
|
||||||
|
bv.setKeepUser(be.getCreateUser()); |
||||||
|
bv.setKeepUserRealName(bv.getCreateUserRealName()); |
||||||
|
bv.setKeepTime(be.getCreateTime()); |
||||||
|
} |
||||||
|
} else if (be.getCreateTime() != null && be.getUpdateTime() == null) { |
||||||
|
bv.setKeepUser(be.getCreateUser()); |
||||||
|
bv.setKeepUserRealName(bv.getCreateUserRealName()); |
||||||
|
bv.setKeepTime(be.getCreateTime()); |
||||||
|
} |
||||||
|
// statusName
|
||||||
|
if (StringUtils.isNotBlank(statusCode)) { |
||||||
|
R<String> rStatusDic = dictClient.getValue(statusCode, "" + be.getStatus()); |
||||||
|
if (rStatusDic != null && rStatusDic.isSuccess() && rStatusDic.getData() != null) { |
||||||
|
bv.setStatusName(rStatusDic.getData()); |
||||||
|
} |
||||||
|
} |
||||||
|
return bv; |
||||||
|
} |
||||||
|
} |
||||||
@ -1,17 +0,0 @@ |
|||||||
package org.springblade.desk.basic.service.impl; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||||
import org.springblade.core.mp.base.BaseEntity; |
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl; |
|
||||||
import org.springblade.desk.basic.service.ExBaseService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 扩展框架中的BaseServiceImpl. |
|
||||||
* |
|
||||||
* @param <M> |
|
||||||
* @param <T> |
|
||||||
*/ |
|
||||||
public class ExBaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> |
|
||||||
extends BaseServiceImpl<M, T> implements ExBaseService<T> { |
|
||||||
|
|
||||||
} |
|
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package org.springblade.desk.quality.constant; |
||||||
|
|
||||||
|
public interface AuditFileConst { |
||||||
|
|
||||||
|
Integer S_NORMAL = 1; |
||||||
|
|
||||||
|
Integer S_ABANDON = 2; |
||||||
|
} |
||||||
Loading…
Reference in new issue