jinhui.wang
Showing 22 changed files with 418 additions and 57 deletions
......@@ -33,7 +33,7 @@ public enum ResponseCode {
MESSAGE_CODE_30013(30013,"business_exception_30013"),
MESSAGE_CODE_30014(30014,"business_exception_30014"),
MESSAGE_CODE_30015(30015,"business_success_30015"),
MESSAGE_CODE_30016(30016,"business_exception_30016"),
/******打个样,编写样例*****/
// MESSAGE_CODE_30001(30001,"business_exception_30001"),
......
package com.fedex.connect.customer.repository.base;
import com.fedex.connect.common.dao.biz.AttachmentMapper;
import com.fedex.connect.common.dao.biz.ConsignmentMapper;
import com.fedex.connect.common.dao.biz.UploadRecordMapper;
import com.fedex.connect.common.dao.biz.UserConsignmentMappingMapper;
import com.fedex.connect.customer.repository.dao.AttachmentExtMapper;
import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper;
import org.springframework.beans.factory.annotation.Autowired;
public class BaseDao {
@Autowired
public ConsignmentMapper consignmentMapper;
protected UploadRecordMapper uploadRecordMapper;
@Autowired
public ConsignmentExtMapper consignmentExtMapper;
protected ConsignmentMapper consignmentMapper;
@Autowired
public AttachmentExtMapper attachmentExtMapper;
protected AttachmentMapper attachmentMapper;
@Autowired
protected UserConsignmentMappingMapper userConsignmentMappingMapper;
@Autowired
protected ConsignmentExtMapper consignmentExtMapper;
@Autowired
protected AttachmentExtMapper attachmentExtMapper;
}
......
......@@ -11,4 +11,8 @@ public interface IAttachmentRepository {
List<AttachmentHistoryDto> findHistory(AttachmentHistoryQuery attachmentHistoryQuery);
Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery);
Attachment save(Attachment entity);
void saveAll(List<Attachment> list);
}
\ No newline at end of file
......
package com.fedex.connect.customer.repository.repo;
public interface IUploadRecordRepository {
import com.fedex.connect.common.model.biz.UploadRecord;
import java.util.List;
public interface IUploadRecordRepository {
/**
* @Author mt
* @Description 上传记录保存或更新
* @Date 2024/11/19
* @param entity
* @return com.fedex.connect.common.model.biz.UploadRecord
*/
UploadRecord save(UploadRecord entity);
/**
* @Author mt
* @Description 上传记录批量保存或更新
* @Date 2024/11/19
* @param list
* @return void
*/
void saveAll(List<UploadRecord> list);
}
......
package com.fedex.connect.customer.repository.repo;
import com.fedex.connect.common.model.biz.UserConsignmentMapping;
import java.util.List;
public interface IUserConsignmentMappingRepository {
/**
* @Author mt
* @Description 根据用户id,运单号查找用户运单关系映射记录
* @Date 2024/11/19
* @param userId
* @param consignmentId
* @return com.fedex.connect.common.model.biz.UserConsignmentMapping
*/
UserConsignmentMapping findByUserIdConsignmentId(Long userId, Long consignmentId);
/**
* @Author mt
* @Description 用户与运单映射信息保存或更新
* @Date 2024/11/19
* @param entity
* @return com.fedex.connect.common.model.biz.UserConsignmentMapping
*/
UserConsignmentMapping save(UserConsignmentMapping entity);
/**
* @Author mt
* @Description 用户与运单映射信息批量保存或更新
* @Date 2024/11/19
* @param list
* @return void
*/
void saveAll(List<UserConsignmentMapping> list);
}
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.biz.Attachment;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.customer.data.dto.AttachmentHistoryDto;
import com.fedex.connect.customer.data.query.AttachmentHistoryQuery;
import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
......@@ -28,4 +29,27 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo
public Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){
return attachmentExtMapper.queryInfo(userConsignmentInfoQuery);
}
@Override
public Attachment save(Attachment entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
attachmentMapper.insertSelective(entity);
} else if (entity.getId() != null && entity.getId().longValue() > 0){
attachmentMapper.updateByPrimaryKeySelective(entity);
}
}
return entity;
}
@Override
public void saveAll(List<Attachment> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
attachmentMapper.insertSelective(p);
}else if(p.getId() != null && p.getId().longValue() >0){
attachmentMapper.updateByPrimaryKeySelective(p);
}
});
}
}
\ No newline at end of file
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IUploadRecordRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecordRepository {
@Override
public UploadRecord save(UploadRecord entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
uploadRecordMapper.insertSelective(entity);
} else if (entity.getId() != null && entity.getId().longValue() > 0){
uploadRecordMapper.updateByPrimaryKeySelective(entity);
}
}
return entity;
}
@Override
public void saveAll(List<UploadRecord> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
uploadRecordMapper.insertSelective(p);
}else if(p.getId() != null && p.getId().longValue() >0){
uploadRecordMapper.updateByPrimaryKeySelective(p);
}
});
}
}
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.dependencies.enums.base.StatusEnum;
import com.fedex.connect.common.model.biz.UserConsignmentMapping;
import com.fedex.connect.common.model.biz.UserConsignmentMappingExample;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IUserConsignmentMappingRepository;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Repository
public class UserConsignmentMappingRepositoryImpl extends BaseDao implements IUserConsignmentMappingRepository {
/**
* @Author mt
* @Description 根据用户id,运单号查找用户运单关系映射记录
* @Date 2024/11/19
* @param userId
* @param consignmentId
* @return com.fedex.connect.common.model.biz.UserConsignmentMapping
*/
public UserConsignmentMapping findByUserIdConsignmentId(Long userId,Long consignmentId){
UserConsignmentMappingExample example = new UserConsignmentMappingExample();
UserConsignmentMappingExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andConsignmentIdEqualTo(consignmentId);
criteria.andStatusEqualTo(StatusEnum.YES.getCode());
return CollectionUtils.firstElement(userConsignmentMappingMapper.selectByExample(example));
}
@Override
public UserConsignmentMapping save(UserConsignmentMapping entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
userConsignmentMappingMapper.insertSelective(entity);
} else if (entity.getId() != null && entity.getId().longValue() > 0){
userConsignmentMappingMapper.updateByPrimaryKeySelective(entity);
}
}
return entity;
}
@Override
public void saveAll(List<UserConsignmentMapping> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
userConsignmentMappingMapper.insertSelective(p);
}else if(p.getId() != null && p.getId().longValue() >0){
userConsignmentMappingMapper.updateByPrimaryKeySelective(p);
}
});
}
}
......@@ -4,19 +4,18 @@ import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.customer.repository.repo.IAttachmentRepository;
import com.fedex.connect.customer.repository.repo.IConsignmentRepository;
import com.fedex.connect.customer.repository.repo.IUploadRecordRepository;
import com.fedex.connect.customer.repository.repo.IUserConsignmentMappingRepository;
import org.springframework.beans.factory.annotation.Autowired;
public class BaseService {
@Autowired
protected ResponseUtils responseUtils;
@Autowired
protected IConsignmentRepository consignmentRepository;
@Autowired
protected IAttachmentRepository attachmentRepository;
@Autowired
protected IUploadRecordRepository uploadRecordRepository;
@Autowired
protected IUserConsignmentMappingRepository userConsignmentMappingRepository;
}
\ No newline at end of file
......
package com.fedex.connect.customer.service.biz.impl;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.dependencies.enums.base.StatusEnum;
import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.common.model.biz.Attachment;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.common.model.biz.UserConsignmentMapping;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.bo.AddBo;
import com.fedex.connect.customer.data.bo.ConsignmentBo;
......@@ -17,11 +20,15 @@ import com.fedex.connect.customer.util.service.biz.UploadRecordUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
* @Author Szl
......@@ -95,26 +102,91 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
* @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
*/
public ResponseVo submitConsignment(MultipartFile[] files,ConsignmentBo consignmentBo,User user){
List<Attachment> attachmentList = null;
try {
/**
* 上传附件,并将附件信息返回
*/
attachmentList = attachmentService.uploadAttachments(files,
consignmentBo.getAttachmentBizTypeList(),
user,
consignmentBo.getConsignmentCode());
/**
* 初始化运单信息
*/
Consignment consignment = consignmentUtil.initConsignment(consignmentBo, user);
/**
* 初始化上传记录信息
*/
UploadRecord uploadRecord = uploadRecordUtil.initUploadRecord(consignment.getConsignmentCode());
/**
* 保存运单相关信息
*/
this.saveSubmitInfo(consignment,attachmentList,uploadRecord,user);
/**
* 初始化插入预清关文件推送任务日志,szl添加
*/
/**
* 初始化插入预清关文件邮件推送日志,mt添加
*/
}catch(Exception ex){
/**
* 提交异常,需要删除对应已上传附件
*/
attachmentService.deleteAttachments(attachmentList);
responseUtils.fail(ResponseCode.MESSAGE_CODE_30016,ex);
}
return responseUtils.success(ResponseCode.MESSAGE_CODE_30015);
}
/**
* @Author mt
* @Description 保存运单相关信息
* @Date 2024/11/19
* @param consignment
* @param attachmentList
* @param uploadRecord
* @param user
* @return void
*/
@Transactional(rollbackFor = Exception.class)
public void saveSubmitInfo(Consignment consignment,
List<Attachment> attachmentList,
UploadRecord uploadRecord,
User user) throws Exception{
/**
* 上传附件,并将附件信息返回
* 保存或更新运单表
*/
List<Attachment> attachmentList = attachmentService.uploadAttachments(files,
consignmentBo.getAttachmentBizTypeList(),
user,
consignmentBo.getConsignmentCode());
consignmentRepository.save(consignment);
//设置上传记录表运单ID
uploadRecord.setConsignmentId(consignment.getId());
/**
* 初始化运单信息
* 保存上传记录表
*/
Consignment consignment = consignmentUtil.initConsignment(consignmentBo,user);
uploadRecordRepository.save(uploadRecord);
//设置附件表运单id,上传记录表id
Optional.ofNullable(attachmentList).orElse(new ArrayList<>()).stream().filter(Objects::nonNull).forEach(p->{
p.setBizId(consignment.getId());
p.setUploadRecordId(uploadRecord.getId());
});
/**
* 初始化上传记录信息
* 保存附件表信息
*/
// UploadRecord uploadRecord = uploadRecordUtil.initUploadRecord(consignment.getConsignmentCode());
return responseUtils.success(ResponseCode.MESSAGE_CODE_30015);
}
private void saveSubmitInfo(List<Attachment> attachmentList,Consignment consignment,UploadRecord uploadRecord){
attachmentRepository.saveAll(attachmentList);
//用户uuid与运单uuid不一致,则需要添加用户运单中间表信息
if(!user.getUserUuid().equals(consignment.getUserUuid())){
/**
* 查找用户与运单关联信息
*/
UserConsignmentMapping userConsignmentMapping = userConsignmentMappingRepository.findByUserIdConsignmentId(user.getId(),consignment.getId());
if(Objects.isNull(userConsignmentMapping)){
userConsignmentMapping = new UserConsignmentMapping();
userConsignmentMapping.setUserId(user.getId());
userConsignmentMapping.setConsignmentId(consignment.getId());
userConsignmentMapping.setStatus(StatusEnum.YES.getCode());
AssignmentFieldUtils.assignmentTableBaseField(userConsignmentMapping);
userConsignmentMappingRepository.save(userConsignmentMapping);
}
}
}
}
\ No newline at end of file
......
......@@ -21,9 +21,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* @Author mt
......@@ -77,7 +75,7 @@ public class AttachmentUtil {
* @return void
*/
public void deleteAttachments(List<Attachment> attachmentList){
attachmentList.stream().forEach(p->{
Optional.ofNullable(attachmentList).orElse(new ArrayList<>()).stream().filter(Objects::nonNull).forEach(p->{
String filePathName = p.getFilePath() + File.separator + p.getFileName();
try {
nioFileUtils.deleteIfExists(filePathName);
......@@ -105,6 +103,8 @@ public class AttachmentUtil {
String suffix = sourceFileName.substring(sourceFileName.lastIndexOf(BaseSeparatorConstants.SEPARATOR_POINT));
String filePathName = null;
try{
//设置运单号
attachment.setConsignmentCode(consignmentCode);
//用户上传原文件名称
attachment.setSourceFileName(sourceFileName);
//生成系统文件名称例子:AWB_123456789012_20241023164532982_001.pdf
......
......@@ -42,4 +42,5 @@ business_exception_30011=该运单已被其他人创建,不可以重复创建
business_exception_30012=UUID不一致
business_exception_30013=文件名为:#{0},上传失败,请检查后重试
business_exception_30014=运单信息加载失败,请稍后重试
business_success_30015=提交成功
\ No newline at end of file
business_success_30015=提交成功
business_exception_30016=运单提交失败
\ No newline at end of file
......
......@@ -42,4 +42,5 @@ business_exception_30011=该运单已被其他人创建,不可以重复创建
business_exception_30012=UUID不一致
business_exception_30013=文件名为:#{0},上传失败,请检查后重试
business_exception_30014=运单信息加载失败,请稍后重试
business_success_30015=提交成功
\ No newline at end of file
business_success_30015=提交成功
business_exception_30016=运单提交失败
\ No newline at end of file
......
......@@ -12,6 +12,7 @@
<result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="MODIFY_USER_ID" jdbcType="NUMERIC" property="modifyUserId" />
<result column="MODIFY_USER_NAME" jdbcType="VARCHAR" property="modifyUserName" />
<result column="CONSIGNMENT_CODE" jdbcType="VARCHAR" property="consignmentCode" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
......@@ -73,7 +74,7 @@
</sql>
<sql id="Base_Column_List">
ID, USER_ID, CONSIGNMENT_ID, STATUS, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME,
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME, CONSIGNMENT_CODE
</sql>
<select id="selectByExample" parameterType="com.fedex.connect.common.model.biz.UserConsignmentMappingExample" resultMap="BaseResultMap">
<include refid="OracleDialectPrefix" />
......@@ -115,11 +116,11 @@
insert into ICLEARIMP.T_BIZ_USER_CONSIGNMENT_MAPPING (ID, USER_ID, CONSIGNMENT_ID,
STATUS, CREATE_TIME, CREATE_USER_ID,
CREATE_USER_NAME, MODIFY_TIME, MODIFY_USER_ID,
MODIFY_USER_NAME)
MODIFY_USER_NAME, CONSIGNMENT_CODE)
values (#{id,jdbcType=NUMERIC}, #{userId,jdbcType=NUMERIC}, #{consignmentId,jdbcType=NUMERIC},
#{status,jdbcType=NUMERIC}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=NUMERIC},
#{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, #{modifyUserId,jdbcType=NUMERIC},
#{modifyUserName,jdbcType=VARCHAR})
#{modifyUserName,jdbcType=VARCHAR}, #{consignmentCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.fedex.connect.common.model.biz.UserConsignmentMapping">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
......@@ -155,6 +156,9 @@
<if test="modifyUserName != null">
MODIFY_USER_NAME,
</if>
<if test="consignmentCode != null">
CONSIGNMENT_CODE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=NUMERIC},
......@@ -185,6 +189,9 @@
<if test="modifyUserName != null">
#{modifyUserName,jdbcType=VARCHAR},
</if>
<if test="consignmentCode != null">
#{consignmentCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.fedex.connect.common.model.biz.UserConsignmentMappingExample" resultType="java.lang.Long">
......@@ -226,6 +233,9 @@
<if test="record.modifyUserName != null">
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
</if>
<if test="record.consignmentCode != null">
CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -242,7 +252,8 @@
CREATE_USER_NAME = #{record.createUserName,jdbcType=VARCHAR},
MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR}
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -277,6 +288,9 @@
<if test="modifyUserName != null">
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
</if>
<if test="consignmentCode != null">
CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=NUMERIC}
</update>
......@@ -290,7 +304,8 @@
CREATE_USER_NAME = #{createUserName,jdbcType=VARCHAR},
MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR}
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}
where ID = #{id,jdbcType=NUMERIC}
</update>
<sql id="OracleDialectPrefix">
......
......@@ -58,6 +58,11 @@ public class UserConsignmentMapping implements Serializable {
*/
private String modifyUserName;
/**
* 运单号
*/
private String consignmentCode;
private static final long serialVersionUID = 1L;
public Long getId() {
......@@ -140,6 +145,14 @@ public class UserConsignmentMapping implements Serializable {
this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim();
}
public String getConsignmentCode() {
return consignmentCode;
}
public void setConsignmentCode(String consignmentCode) {
this.consignmentCode = consignmentCode == null ? null : consignmentCode.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
......@@ -156,6 +169,7 @@ public class UserConsignmentMapping implements Serializable {
sb.append(", modifyTime=").append(modifyTime);
sb.append(", modifyUserId=").append(modifyUserId);
sb.append(", modifyUserName=").append(modifyUserName);
sb.append(", consignmentCode=").append(consignmentCode);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
......
......@@ -744,6 +744,76 @@ public class UserConsignmentMappingExample {
addCriterion("MODIFY_USER_NAME not between", value1, value2, "modifyUserName");
return (Criteria) this;
}
public Criteria andConsignmentCodeIsNull() {
addCriterion("CONSIGNMENT_CODE is null");
return (Criteria) this;
}
public Criteria andConsignmentCodeIsNotNull() {
addCriterion("CONSIGNMENT_CODE is not null");
return (Criteria) this;
}
public Criteria andConsignmentCodeEqualTo(String value) {
addCriterion("CONSIGNMENT_CODE =", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeNotEqualTo(String value) {
addCriterion("CONSIGNMENT_CODE <>", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeGreaterThan(String value) {
addCriterion("CONSIGNMENT_CODE >", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeGreaterThanOrEqualTo(String value) {
addCriterion("CONSIGNMENT_CODE >=", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeLessThan(String value) {
addCriterion("CONSIGNMENT_CODE <", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeLessThanOrEqualTo(String value) {
addCriterion("CONSIGNMENT_CODE <=", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeLike(String value) {
addCriterion("CONSIGNMENT_CODE like", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeNotLike(String value) {
addCriterion("CONSIGNMENT_CODE not like", value, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeIn(List<String> values) {
addCriterion("CONSIGNMENT_CODE in", values, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeNotIn(List<String> values) {
addCriterion("CONSIGNMENT_CODE not in", values, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeBetween(String value1, String value2) {
addCriterion("CONSIGNMENT_CODE between", value1, value2, "consignmentCode");
return (Criteria) this;
}
public Criteria andConsignmentCodeNotBetween(String value1, String value2) {
addCriterion("CONSIGNMENT_CODE not between", value1, value2, "consignmentCode");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -91,6 +91,8 @@ C:BRANCH 分支
*/
private String modifyUserName;
private String hidden;
private static final long serialVersionUID = 1L;
public Long getId() {
......@@ -221,6 +223,18 @@ C:BRANCH 分支
this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim();
}
public String getHidden() {
return hidden;
}
public void setHidden(String hidden) {
this.hidden = hidden;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
......
......@@ -73,12 +73,12 @@
generatedKey 指定KEY,Oracle需要指定序列。
sqlStatement 指定序列名称
-->
<!-- <table schema="ICLEARIMP" tableName="T_BIZ_USER_CONSIGNMENT_MAPPING" domainObjectName="UserConsignmentMapping"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_USER_CONSIGNMENT_MAPPING.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<table schema="ICLEARIMP" tableName="T_BIZ_USER_CONSIGNMENT_MAPPING" domainObjectName="UserConsignmentMapping"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
<generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_USER_CONSIGNMENT_MAPPING.NEXTVAL FROM DUAL" />
</table>
<!-- <table schema="ICLEARIMP" tableName="T_LOG_OPERATION" domainObjectName="Operation"-->
......@@ -117,12 +117,12 @@
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_CE_INFO.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<table tableName="T_BIZ_CONSIGNMENT" domainObjectName="Consignment"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
<generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_CONSIGNMENT.NEXTVAL FROM DUAL" />
</table>
<!-- <table tableName="T_BIZ_CONSIGNMENT" domainObjectName="Consignment"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
<!-- selectByExampleQueryId="true">-->
<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_BIZ_CONSIGNMENT.NEXTVAL FROM DUAL" />-->
<!-- </table>-->
<!-- <table tableName="T_BIZ_EMAIL" domainObjectName="Email"-->
<!-- enableCountByExample="true" enableUpdateByExample="true"-->
<!-- enableDeleteByExample="true" enableSelectByExample="true"-->
......
package com.fedex.connect.manager.controller.sys;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import org.springframework.web.bind.annotation.PathVariable;
public interface ISysPrivilegeController {
ResponseVo getPrivilege(@PathVariable Long userId);
ResponseVo getPrivilege();
}
......
package com.fedex.connect.manager.controller.sys.impl;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.manager.controller.base.BaseController;
import com.fedex.connect.manager.controller.sys.ISysPrivilegeController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -18,9 +18,13 @@ import org.springframework.web.bind.annotation.RestController;
public class SysPrivilegeController extends BaseController implements ISysPrivilegeController {
@Override
@GetMapping(value = {"/{userId}"})
@ApiOperation(value = "根据用户ID获取菜单")
public ResponseVo getPrivilege(@PathVariable Long userId){
return privilegeService.getPrivilegeByUserId(userId);
@GetMapping(value = {"/getPrivilege"})
@ApiOperation(value = "获取菜单")
public ResponseVo getPrivilege(){
/**
* 获取当前用户信息
*/
User user = this.getCurrentUserInfo();
return privilegeService.getPrivilege(user);
}
}
......
package com.fedex.connect.manager.service.sys;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.model.sys.User;
public interface IPrivilegeService {
ResponseVo getPrivilegeByUserId(Long id);
ResponseVo getPrivilege(User user);
}
......
......@@ -3,6 +3,7 @@ package com.fedex.connect.manager.service.sys.impl;
import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.model.sys.Privilege;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.common.model.sys.UserRole;
import com.fedex.connect.common.model.sys.UserRoleExample;
import com.fedex.connect.manager.service.base.BaseService;
......@@ -18,14 +19,14 @@ import java.util.stream.Collectors;
@Slf4j
public class PrivilegeServiceImpl extends BaseService implements IPrivilegeService {
public ResponseVo getPrivilegeByUserId(Long id){
public ResponseVo getPrivilege(User user){
/**
* 获取到该用户的角色
*/
UserRoleExample example = new UserRoleExample();
UserRoleExample.Criteria criteria = example.createCriteria();
criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID);
criteria.andUserIdEqualTo(id);
criteria.andUserIdEqualTo(user.getId());
List<UserRole> userRoles = userRoleRepository.selectByExample(example);
/**
* 根据角色获取菜单权限
......@@ -40,6 +41,9 @@ public class PrivilegeServiceImpl extends BaseService implements IPrivilegeServi
* 获取权限
*/
List<Privilege> privilegesByIds = privilegeRepository.findPrivilegesByIds(byRoleIds);
for (Privilege privilegesById : privilegesByIds) {
privilegesById.setHidden("false");
}
return responseUtils.success(privilegesByIds);
}
......