first commit
This commit is contained in:
+75
@@ -0,0 +1,75 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.appLocation.repository.todo.AppLocationDO;
|
||||
import com.mhd.user.interfaces.dto.AppLocationDTO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.interfaces.dto.TmsVehicleLocationQueryDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* APP位置信息Assembler
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Component
|
||||
public class AppLocationAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public AppLocationDO toDO(AppLocationDTO appLocationDTO) {
|
||||
AppLocationDO appLocationDO = new AppLocationDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(appLocationDTO, appLocationDO, IgnoreNullUtil.getNullPropertyNames(appLocationDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(appLocationDTO.getAppLocationId() != null){
|
||||
if(userId != null){
|
||||
appLocationDO.setUpdateBy(userId);
|
||||
}else {
|
||||
appLocationDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
appLocationDO.setUpdateByName(userName);
|
||||
appLocationDO.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
appLocationDO.setCreateBy(userId);
|
||||
appLocationDO.setUpdateBy(userId);
|
||||
}else {
|
||||
appLocationDO.setCreateBy(new Long("0"));
|
||||
appLocationDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
appLocationDO.setCreateByName(userName);
|
||||
appLocationDO.setUpdateByName(userName);
|
||||
appLocationDO.setCreateTime(new Date());
|
||||
appLocationDO.setUpdateTime(new Date());
|
||||
appLocationDO.setDelFlag(1);
|
||||
}
|
||||
return appLocationDO;
|
||||
}
|
||||
|
||||
public AppLocationDO toAppLocationDO(TmsVehicleLocationQueryDTO tmsVehicleLocationQueryDTO) {
|
||||
AppLocationDO appLocationDO = new AppLocationDO();
|
||||
appLocationDO.setStartTime(tmsVehicleLocationQueryDTO.getStartTime());
|
||||
appLocationDO.setEndTime(tmsVehicleLocationQueryDTO.getEndTime());
|
||||
appLocationDO.setLicensePlate(tmsVehicleLocationQueryDTO.getVehicleLicenseNumber());
|
||||
appLocationDO.setType(tmsVehicleLocationQueryDTO.getType());
|
||||
appLocationDO.setWaybillNum(tmsVehicleLocationQueryDTO.getTransportationNumber());
|
||||
return appLocationDO;
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
import com.mhd.user.interfaces.dto.DriverCurrentPositionDTO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 司机当前位置信息Assembler
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Component
|
||||
public class DriverCurrentPositionAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public DriverCurrentPositionDO toDO(DriverCurrentPositionDTO driverCurrentPositionDTO) {
|
||||
DriverCurrentPositionDO driverCurrentPositionDO = new DriverCurrentPositionDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(driverCurrentPositionDTO, driverCurrentPositionDO, IgnoreNullUtil.getNullPropertyNames(driverCurrentPositionDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(driverCurrentPositionDTO.getDriverCurrentPositionId() != null){
|
||||
if(userId != null){
|
||||
driverCurrentPositionDO.setUpdateBy(userId);
|
||||
}else {
|
||||
driverCurrentPositionDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverCurrentPositionDO.setUpdateByName(userName);
|
||||
driverCurrentPositionDO.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
driverCurrentPositionDO.setCreateBy(userId);
|
||||
driverCurrentPositionDO.setUpdateBy(userId);
|
||||
}else {
|
||||
driverCurrentPositionDO.setCreateBy(new Long("0"));
|
||||
driverCurrentPositionDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverCurrentPositionDO.setCreateByName(userName);
|
||||
driverCurrentPositionDO.setUpdateByName(userName);
|
||||
driverCurrentPositionDO.setCreateTime(new Date());
|
||||
driverCurrentPositionDO.setUpdateTime(new Date());
|
||||
driverCurrentPositionDO.setDelFlag(1);
|
||||
}
|
||||
return driverCurrentPositionDO;
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO;
|
||||
import com.mhd.user.interfaces.dto.DriverFollowShipperDTO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车主关注货主Assembler
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
@Component
|
||||
public class DriverFollowShipperAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public DriverFollowShipperDO toDO(DriverFollowShipperDTO driverFollowShipperDTO) {
|
||||
DriverFollowShipperDO driverFollowShipperDO = new DriverFollowShipperDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(driverFollowShipperDTO, driverFollowShipperDO, IgnoreNullUtil.getNullPropertyNames(driverFollowShipperDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(driverFollowShipperDTO.getDriverFollowShipperId() != null){
|
||||
if(userId != null){
|
||||
driverFollowShipperDO.setUpdateBy(userId);
|
||||
}else {
|
||||
driverFollowShipperDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverFollowShipperDO.setUpdateByName(userName);
|
||||
driverFollowShipperDO.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
driverFollowShipperDO.setCreateBy(userId);
|
||||
driverFollowShipperDO.setUpdateBy(userId);
|
||||
}else {
|
||||
driverFollowShipperDO.setCreateBy(new Long("0"));
|
||||
driverFollowShipperDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverFollowShipperDO.setCreateByName(userName);
|
||||
driverFollowShipperDO.setUpdateByName(userName);
|
||||
driverFollowShipperDO.setCreateTime(new Date());
|
||||
driverFollowShipperDO.setUpdateTime(new Date());
|
||||
driverFollowShipperDO.setDelFlag(1);
|
||||
}
|
||||
return driverFollowShipperDO;
|
||||
}
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.userAggregate.entity.DriverVehicleBind;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.DriverVehicleBindDo;
|
||||
import com.mhd.user.interfaces.dto.DriverVehicleBindDto;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 司机车辆绑定关系Assembler
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-18
|
||||
*/
|
||||
@Slf4j
|
||||
public class DriverVehicleBindAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public DriverVehicleBindDo toDo(DriverVehicleBindDto driverVehicleBindDto) {
|
||||
DriverVehicleBindDo driverVehicleBindDo = new DriverVehicleBindDo();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(driverVehicleBindDto, driverVehicleBindDo, IgnoreNullUtil.getNullPropertyNames(driverVehicleBindDto));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
log.info("=============进入装配=============");
|
||||
log.info(loginUser.getToken());
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(driverVehicleBindDto.getDriverVehicleBindId() != null){
|
||||
if(userId != null){
|
||||
driverVehicleBindDo.setUpdateBy(userId);
|
||||
}else {
|
||||
driverVehicleBindDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverVehicleBindDo.setUpdateByName(userName);
|
||||
driverVehicleBindDo.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
driverVehicleBindDo.setCreateBy(userId);
|
||||
driverVehicleBindDo.setUpdateBy(userId);
|
||||
}else {
|
||||
driverVehicleBindDo.setCreateBy(new Long("0"));
|
||||
driverVehicleBindDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverVehicleBindDo.setCreateByName(userName);
|
||||
driverVehicleBindDo.setUpdateByName(userName);
|
||||
driverVehicleBindDo.setCreateTime(new Date());
|
||||
driverVehicleBindDo.setUpdateTime(new Date());
|
||||
driverVehicleBindDo.setDelFlag(1);
|
||||
}
|
||||
return driverVehicleBindDo;
|
||||
}
|
||||
|
||||
|
||||
public DriverVehicleBind toDo(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
DriverVehicleBind driverVehicleBind = new DriverVehicleBind();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(driverVehicleBindDo, driverVehicleBind, IgnoreNullUtil.getNullPropertyNames(driverVehicleBindDo));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(driverVehicleBindDo.getDriverVehicleBindId() != null){
|
||||
if(userId != null){
|
||||
driverVehicleBind.setUpdateBy(userId);
|
||||
}else {
|
||||
driverVehicleBind.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverVehicleBind.setUpdateByName(userName);
|
||||
driverVehicleBind.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
driverVehicleBind.setCreateBy(userId);
|
||||
driverVehicleBind.setUpdateBy(userId);
|
||||
}else {
|
||||
driverVehicleBind.setCreateBy(new Long("0"));
|
||||
driverVehicleBind.setUpdateBy(new Long("0"));
|
||||
}
|
||||
driverVehicleBind.setCreateByName(userName);
|
||||
driverVehicleBind.setUpdateByName(userName);
|
||||
driverVehicleBind.setCreateTime(new Date());
|
||||
driverVehicleBind.setUpdateTime(new Date());
|
||||
driverVehicleBind.setDelFlag(1);
|
||||
}
|
||||
return driverVehicleBind;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.FeedbackDO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.FeedbackDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Service
|
||||
public class FeedbackAssember {
|
||||
|
||||
public FeedbackDO tofeedbackDO(FeedbackDTO feedbackDTO) {
|
||||
FeedbackDO feedbackDO = new FeedbackDO();
|
||||
BeanUtils.copyProperties(feedbackDTO, feedbackDO, IgnoreNullUtil.getNullPropertyNames(feedbackDTO));
|
||||
return feedbackDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public FeedbackDO toDo(FeedbackDTO feedbackDTO) {
|
||||
FeedbackDO feedbackDO = new FeedbackDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(feedbackDTO, feedbackDO, IgnoreNullUtil.getNullPropertyNames(feedbackDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (ObjectUtil.isNull(loginUser) || ObjectUtil.isNull(userPo)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
// 获取登录人id
|
||||
Long userId = userPo.getUserId();
|
||||
String userName = userPo.getUserName();
|
||||
Long topOrganizationId = userPo.getTopOrganizationId();
|
||||
Long organizationId = userPo.getOrganizationId();
|
||||
if (feedbackDTO.getFeedbackId() == null){
|
||||
feedbackDO.setOrganizationId(organizationId);
|
||||
feedbackDO.setTopOrganizationId(topOrganizationId);
|
||||
feedbackDO.setCreateBy(userId);
|
||||
feedbackDO.setCreateByName(userName);
|
||||
feedbackDO.setCreateTime(new Date());
|
||||
}else {
|
||||
feedbackDO.setUpdateBy(userId);
|
||||
feedbackDO.setUpdateByName(userName);
|
||||
feedbackDO.setUpdateTime(new Date());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return feedbackDO;
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO;
|
||||
import com.mhd.user.interfaces.dto.MotorcadeDto;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车队Assembler
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public class MotorcadeAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public MotorcadeDO toDo(MotorcadeDto motorcadeDto) {
|
||||
MotorcadeDO motorcadeDo = new MotorcadeDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(motorcadeDto, motorcadeDo, IgnoreNullUtil.getNullPropertyNames(motorcadeDto));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if (loginUser.getUserPo() != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
motorcadeDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
if (organizationId != null && organizationId != 1){
|
||||
motorcadeDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(motorcadeDto.getMotorcadeId() != null){
|
||||
if(userId != null){
|
||||
motorcadeDo.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeDo.setUpdateByName(userName);
|
||||
motorcadeDo.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
motorcadeDo.setCreateBy(userId);
|
||||
motorcadeDo.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeDo.setCreateBy(new Long("0"));
|
||||
motorcadeDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeDo.setCreateByName(userName);
|
||||
motorcadeDo.setUpdateByName(userName);
|
||||
motorcadeDo.setCreateTime(new Date());
|
||||
motorcadeDo.setUpdateTime(new Date());
|
||||
motorcadeDo.setDelFlag(1);
|
||||
}
|
||||
return motorcadeDo;
|
||||
}
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
import com.mhd.user.interfaces.dto.MotorcadeCollectionDTO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车队代收协议Assembler
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
@Component
|
||||
public class MotorcadeCollectionAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public MotorcadeCollectionDO toDO(MotorcadeCollectionDTO motorcadeCollectionDTO) {
|
||||
MotorcadeCollectionDO motorcadeCollectionDO = new MotorcadeCollectionDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(motorcadeCollectionDTO, motorcadeCollectionDO, IgnoreNullUtil.getNullPropertyNames(motorcadeCollectionDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(motorcadeCollectionDTO.getMotorcadeCollectionId() != null){
|
||||
if(userId != null){
|
||||
motorcadeCollectionDO.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeCollectionDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeCollectionDO.setUpdateByName(userName);
|
||||
motorcadeCollectionDO.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
motorcadeCollectionDO.setCreateBy(userId);
|
||||
motorcadeCollectionDO.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeCollectionDO.setCreateBy(new Long("0"));
|
||||
motorcadeCollectionDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeCollectionDO.setCreateByName(userName);
|
||||
motorcadeCollectionDO.setUpdateByName(userName);
|
||||
motorcadeCollectionDO.setCreateTime(new Date());
|
||||
motorcadeCollectionDO.setUpdateTime(new Date());
|
||||
motorcadeCollectionDO.setDelFlag(1);
|
||||
}
|
||||
return motorcadeCollectionDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取do实体
|
||||
* @return
|
||||
*/
|
||||
public MotorcadeCollectionDO getDoEntity() {
|
||||
MotorcadeCollectionDO motorcadeCollectionDO = new MotorcadeCollectionDO();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(userId != null){
|
||||
motorcadeCollectionDO.setCreateBy(userId);
|
||||
motorcadeCollectionDO.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeCollectionDO.setCreateBy(new Long("0"));
|
||||
motorcadeCollectionDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeCollectionDO.setCreateByName(userName);
|
||||
motorcadeCollectionDO.setUpdateByName(userName);
|
||||
motorcadeCollectionDO.setCreateTime(new Date());
|
||||
motorcadeCollectionDO.setUpdateTime(new Date());
|
||||
motorcadeCollectionDO.setDelFlag(1);
|
||||
return motorcadeCollectionDO;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车队司机Assembler
|
||||
*
|
||||
*/
|
||||
public class MotorcadeDriverAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* 获取装配实体
|
||||
* @return
|
||||
*/
|
||||
public MotorcadeDriver getEntity() {
|
||||
|
||||
MotorcadeDriver motorcadeDriver = new MotorcadeDriver();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(userId != null){
|
||||
motorcadeDriver.setCreateBy(userId);
|
||||
motorcadeDriver.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeDriver.setCreateBy(new Long("0"));
|
||||
motorcadeDriver.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeDriver.setCreateByName(userName);
|
||||
motorcadeDriver.setUpdateByName(userName);
|
||||
motorcadeDriver.setCreateTime(new Date());
|
||||
motorcadeDriver.setUpdateTime(new Date());
|
||||
motorcadeDriver.setDelFlag(1);
|
||||
return motorcadeDriver;
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import com.mhd.user.interfaces.dto.MotorcadeRecordDto;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车队邀请记录Assembler
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public class MotorcadeRecordAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public MotorcadeRecordDO toDo(MotorcadeRecordDto motorcadeRecordDto) {
|
||||
MotorcadeRecordDO motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(motorcadeRecordDto, motorcadeRecordDo, IgnoreNullUtil.getNullPropertyNames(motorcadeRecordDto));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(motorcadeRecordDto.getMotorcadeRecordId() != null){
|
||||
if(userId != null){
|
||||
motorcadeRecordDo.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeRecordDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeRecordDo.setUpdateByName(userName);
|
||||
motorcadeRecordDo.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
motorcadeRecordDo.setCreateBy(userId);
|
||||
motorcadeRecordDo.setUpdateBy(userId);
|
||||
}else {
|
||||
motorcadeRecordDo.setCreateBy(new Long("0"));
|
||||
motorcadeRecordDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
motorcadeRecordDo.setCreateByName(userName);
|
||||
motorcadeRecordDo.setUpdateByName(userName);
|
||||
motorcadeRecordDo.setCreateTime(new Date());
|
||||
motorcadeRecordDo.setUpdateTime(new Date());
|
||||
motorcadeRecordDo.setDelFlag(1);
|
||||
}
|
||||
return motorcadeRecordDo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
||||
import com.mhd.user.interfaces.dto.addDTO.CustomAuthDTO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.RoleDTO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RoleAssember {
|
||||
|
||||
public RoleDo toRoleDo(RoleDTO roleDTO) {
|
||||
RoleDo roleDo = new RoleDo();
|
||||
BeanUtils.copyProperties(roleDTO, roleDo, IgnoreNullUtil.getNullPropertyNames(roleDTO));
|
||||
return roleDo;
|
||||
}
|
||||
public CustomAuthDO toCustomAuthDO(CustomAuthDTO authDTO) {
|
||||
CustomAuthDO authDO = new CustomAuthDO();
|
||||
BeanUtils.copyProperties(authDTO, authDO, IgnoreNullUtil.getNullPropertyNames(authDTO));
|
||||
return authDO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo;
|
||||
import com.mhd.user.interfaces.dto.addDTO.RoleMenuDTO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RoleMenuAssember {
|
||||
|
||||
public RoleMenuDo toRoleMenuDO(RoleMenuDTO roleMenuDTO) {
|
||||
RoleMenuDo roleMenuDo = new RoleMenuDo();
|
||||
BeanUtils.copyProperties(roleMenuDTO, roleMenuDo, IgnoreNullUtil.getNullPropertyNames(roleMenuDTO));
|
||||
return roleMenuDo;
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserAddressPO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserAddressDO;
|
||||
import com.mhd.user.interfaces.dto.UserAddressDTO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserAddressAddDTO;
|
||||
import com.mhd.user.interfaces.dto.updateDTO.UserAddressUpdateDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址组装器
|
||||
*
|
||||
* @author gen
|
||||
*/
|
||||
public class UserAddressAssembler {
|
||||
|
||||
/**
|
||||
* 新增DTO转DO
|
||||
*/
|
||||
public static UserAddressDO toAddDO(UserAddressAddDTO addDTO) {
|
||||
if (addDTO == null) {
|
||||
return null;
|
||||
}
|
||||
UserAddressDO userAddressDO = new UserAddressDO();
|
||||
BeanUtils.copyProperties(addDTO, userAddressDO);
|
||||
return userAddressDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改DTO转DO
|
||||
*/
|
||||
public static UserAddressDO toUpdateDO(UserAddressUpdateDTO updateDTO) {
|
||||
if (updateDTO == null) {
|
||||
return null;
|
||||
}
|
||||
UserAddressDO userAddressDO = new UserAddressDO();
|
||||
BeanUtils.copyProperties(updateDTO, userAddressDO, IgnoreNullUtil.getNullPropertyNames(updateDTO));
|
||||
return userAddressDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* PO转DTO
|
||||
*/
|
||||
public static UserAddressDTO toDTO(UserAddressPO userAddressPO) {
|
||||
if (userAddressPO == null) {
|
||||
return null;
|
||||
}
|
||||
UserAddressDTO userAddressDTO = new UserAddressDTO();
|
||||
BeanUtils.copyProperties(userAddressPO, userAddressDTO);
|
||||
return userAddressDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* PO列表转DTO列表
|
||||
*/
|
||||
public static List<UserAddressDTO> toDTOList(List<UserAddressPO> userAddressPOList) {
|
||||
if (userAddressPOList == null || userAddressPOList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<UserAddressDTO> userAddressDTOList = new ArrayList<>();
|
||||
for (UserAddressPO userAddressPO : userAddressPOList) {
|
||||
userAddressDTOList.add(toDTO(userAddressPO));
|
||||
}
|
||||
return userAddressDTOList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserDTO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserUpdateDTO;
|
||||
import com.mhd.common.core.utils.AESUtil;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class UserAssember {
|
||||
|
||||
public UserDO toUserDO(UserDTO userDTO) {
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(userDTO, userDO, IgnoreNullUtil.getNullPropertyNames(userDTO));
|
||||
if (StringUtils.isNotBlank(userDO.getUserIdcardNumberDes())){
|
||||
//解密身份证号
|
||||
String idcardNumber = AESUtil.decrypt(userDO.getUserIdcardNumberDes());
|
||||
userDO.setUserIdcardNumber(idcardNumber);
|
||||
}
|
||||
// 获取登录人id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if(userDO.getUserId() != null) {
|
||||
if(userId != null){
|
||||
userDO.setUpdateBy(userId);
|
||||
userDO.setUpdateByName(SecurityUtils.getUsername());
|
||||
}else {
|
||||
userDO.setUpdateBy(0L);
|
||||
}
|
||||
userDO.setUpdateTime(new Date());
|
||||
}else {
|
||||
if(userId != null){
|
||||
userDO.setCreateBy(userId);
|
||||
userDO.setCreateByName(SecurityUtils.getUsername());
|
||||
}else {
|
||||
userDO.setCreateBy(0L);
|
||||
}
|
||||
userDO.setDelFlag(1);
|
||||
userDO.setCreateTime(new Date());
|
||||
}
|
||||
return userDO;
|
||||
}
|
||||
|
||||
public UserDO toUserUpdateDO(UserUpdateDTO userDTO) {
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(userDTO, userDO, IgnoreNullUtil.getNullPropertyNames(userDTO));
|
||||
if (StringUtils.isNotBlank(userDO.getUserIdcardNumberDes())){
|
||||
//解密身份证号
|
||||
String idcardNumber = AESUtil.decrypt(userDO.getUserIdcardNumberDes());
|
||||
userDO.setUserIdcardNumber(idcardNumber);
|
||||
}
|
||||
return userDO;
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.*;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserDataPermissionDTO;
|
||||
import com.mhd.user.interfaces.dto.queryDTO.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserDataPermissionAssember {
|
||||
public List<UserDataPermissionDO> toUserDataPermissionDOList(UserDataPermissionDTO userRoleDTOList) {
|
||||
List<UserDataPermissionDO> userDataPermissionDOList= new ArrayList<>();
|
||||
for(MenuProductDO menuProductDO : userRoleDTOList.getMenuProductDOList()) {
|
||||
for (DataPermissionDO dataPermissionDO : userRoleDTOList.getDataPermissionDOList()) {
|
||||
UserDataPermissionDO userDataPermissionDO = new UserDataPermissionDO();
|
||||
BeanUtils.copyProperties(dataPermissionDO, userDataPermissionDO, IgnoreNullUtil.getNullPropertyNames(dataPermissionDO));
|
||||
userDataPermissionDO.setUserId(userRoleDTOList.getUserId());
|
||||
userDataPermissionDO.setMenuId(menuProductDO.getMenuId());
|
||||
userDataPermissionDO.setProductId(menuProductDO.getProductId());
|
||||
userDataPermissionDOList.add(userDataPermissionDO);
|
||||
}
|
||||
}
|
||||
return userDataPermissionDOList;
|
||||
}
|
||||
|
||||
public UserDataPermissionDO toUserDataPermissionDO(UserDataPermissionQueryDTO userDataPermissionQueryDTO) {
|
||||
UserDataPermissionDO userDataPermissionDO = new UserDataPermissionDO();
|
||||
BeanUtils.copyProperties(userDataPermissionQueryDTO, userDataPermissionDO, IgnoreNullUtil.getNullPropertyNames(userDataPermissionQueryDTO));
|
||||
return userDataPermissionDO;
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserDriverDTO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.AESUtil;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class UserDriverAssember {
|
||||
|
||||
public UserDriverDO toUserDriverDO(UserDriverDTO userDriverDTO) {
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
BeanUtils.copyProperties(userDriverDTO, userDriverDO, IgnoreNullUtil.getNullPropertyNames(userDriverDTO));
|
||||
if (StringUtils.isNotBlank(userDriverDO.getUserIdcardNumberDes())){
|
||||
//解密身份证号
|
||||
String idcardNumber = AESUtil.decrypt(userDriverDO.getUserIdcardNumberDes());
|
||||
userDriverDO.setUserIdcardNumber(idcardNumber);
|
||||
}
|
||||
return userDriverDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public UserDriverDO toDo(UserDriverDTO userDriverDTO) {
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(userDriverDTO, userDriverDO, IgnoreNullUtil.getNullPropertyNames(userDriverDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if (loginUser.getUserPo() != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
String organizationName = loginUser.getUserPo().getOrganizationName();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
userDriverDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
if (organizationId != null && organizationId != 1){
|
||||
userDriverDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(organizationName) && !"平台".equals(organizationName)) {
|
||||
userDriverDO.setOrganizationName(organizationName);
|
||||
}
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(userDriverDTO.getDriverId() != null){
|
||||
if(userId != null){
|
||||
userDriverDO.setUpdateBy(userId);
|
||||
}else {
|
||||
userDriverDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
userDriverDO.setUpdateByName(userName);
|
||||
userDriverDO.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
userDriverDO.setCreateBy(userId);
|
||||
userDriverDO.setUpdateBy(userId);
|
||||
}else {
|
||||
userDriverDO.setCreateBy(new Long("0"));
|
||||
userDriverDO.setUpdateBy(new Long("0"));
|
||||
}
|
||||
userDriverDO.setCreateByName(userName);
|
||||
userDriverDO.setUpdateByName(userName);
|
||||
userDriverDO.setCreateTime(new Date());
|
||||
userDriverDO.setUpdateTime(new Date());
|
||||
userDriverDO.setDelFlag(1);
|
||||
}
|
||||
return userDriverDO;
|
||||
}
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserDriverEnterprise;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverEnterpriseDo;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserDriverEnterpriseDto;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 运输企业Assembler
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-17
|
||||
*/
|
||||
public class UserDriverEnterpriseAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public UserDriverEnterpriseDo toDo(UserDriverEnterpriseDto userDriverEnterpriseDto) {
|
||||
UserDriverEnterpriseDo userDriverEnterpriseDo = new UserDriverEnterpriseDo();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(userDriverEnterpriseDto, userDriverEnterpriseDo, IgnoreNullUtil.getNullPropertyNames(userDriverEnterpriseDto));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if (loginUser.getUserPo() != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
String organizationName = loginUser.getUserPo().getOrganizationName();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
userDriverEnterpriseDto.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
if (organizationId != null && organizationId != 1){
|
||||
userDriverEnterpriseDto.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(organizationName) && !"平台".equals(organizationName)) {
|
||||
userDriverEnterpriseDto.setOrganizationName(organizationName);
|
||||
}
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(userDriverEnterpriseDto.getUserDriverEnterpriseId() != null){
|
||||
if(userId != null){
|
||||
userDriverEnterpriseDo.setUpdateBy(userId);
|
||||
}else {
|
||||
userDriverEnterpriseDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
userDriverEnterpriseDo.setUpdateByName(userName);
|
||||
userDriverEnterpriseDo.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
userDriverEnterpriseDo.setCreateBy(userId);
|
||||
userDriverEnterpriseDo.setUpdateBy(userId);
|
||||
}else {
|
||||
userDriverEnterpriseDo.setCreateBy(new Long("0"));
|
||||
userDriverEnterpriseDo.setUpdateBy(new Long("0"));
|
||||
}
|
||||
userDriverEnterpriseDo.setCreateByName(userName);
|
||||
userDriverEnterpriseDo.setUpdateByName(userName);
|
||||
userDriverEnterpriseDo.setCreateTime(new Date());
|
||||
userDriverEnterpriseDo.setUpdateTime(new Date());
|
||||
userDriverEnterpriseDo.setDelFlag(1);
|
||||
}
|
||||
return userDriverEnterpriseDo;
|
||||
}
|
||||
|
||||
|
||||
public UserDriverEnterprise toDo(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
UserDriverEnterprise userDriverEnterprise = new UserDriverEnterprise();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(userDriverEnterpriseDo, userDriverEnterprise, IgnoreNullUtil.getNullPropertyNames(userDriverEnterpriseDo));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String userName = loginUser.getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = loginUser.getUserid();
|
||||
if(userDriverEnterpriseDo.getUserDriverEnterpriseId() != null){
|
||||
if(userId != null){
|
||||
userDriverEnterprise.setUpdateBy(userId);
|
||||
}else {
|
||||
userDriverEnterprise.setUpdateBy(new Long("0"));
|
||||
}
|
||||
userDriverEnterprise.setUpdateByName(userName);
|
||||
userDriverEnterprise.setUpdateTime(new Date());
|
||||
|
||||
}else {
|
||||
if(userId != null){
|
||||
userDriverEnterprise.setCreateBy(userId);
|
||||
userDriverEnterprise.setUpdateBy(userId);
|
||||
}else {
|
||||
userDriverEnterprise.setCreateBy(new Long("0"));
|
||||
userDriverEnterprise.setUpdateBy(new Long("0"));
|
||||
}
|
||||
userDriverEnterprise.setCreateByName(userName);
|
||||
userDriverEnterprise.setUpdateByName(userName);
|
||||
userDriverEnterprise.setCreateTime(new Date());
|
||||
userDriverEnterprise.setUpdateTime(new Date());
|
||||
userDriverEnterprise.setDelFlag(1);
|
||||
}
|
||||
return userDriverEnterprise;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserMenuDo;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserMenuDTO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserMenuAssember {
|
||||
|
||||
public UserMenuDo toUserMenuDO(UserMenuDTO userMenuDTO) {
|
||||
UserMenuDo userMenuDo = new UserMenuDo();
|
||||
BeanUtils.copyProperties(userMenuDTO, userMenuDo, IgnoreNullUtil.getNullPropertyNames(userMenuDTO));
|
||||
return userMenuDo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserRoleDo;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserRoleDTO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserRoleAssember {
|
||||
|
||||
public UserRoleDo toUserRoleDO(UserRoleDTO userRoleDTO) {
|
||||
UserRoleDo userRoleDo = new UserRoleDo();
|
||||
BeanUtils.copyProperties(userRoleDTO, userRoleDo, IgnoreNullUtil.getNullPropertyNames(userRoleDTO));
|
||||
return userRoleDo;
|
||||
}
|
||||
public List<UserRoleDo> toUserRoleDOList(List<UserRoleDTO> userRoleDTOList) {
|
||||
List<UserRoleDo> userRoleDoList= new ArrayList<>();
|
||||
for(UserRoleDTO userRoleDTO : userRoleDTOList){
|
||||
UserRoleDo userRoleDo = new UserRoleDo();
|
||||
BeanUtils.copyProperties(userRoleDTO, userRoleDo, IgnoreNullUtil.getNullPropertyNames(userRoleDTO));
|
||||
userRoleDoList.add(userRoleDo);
|
||||
}
|
||||
return userRoleDoList;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.mhd.user.interfaces.assember;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserShipperDO;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserShipperDTO;
|
||||
import com.mhd.common.core.utils.AESUtil;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserShipperAssember {
|
||||
|
||||
public UserShipperDO toUserShipperDO(UserShipperDTO userShipperDTO) {
|
||||
UserShipperDO shipperDO = new UserShipperDO();
|
||||
BeanUtils.copyProperties(userShipperDTO, shipperDO, IgnoreNullUtil.getNullPropertyNames(userShipperDTO));
|
||||
if (StringUtils.isNotBlank(shipperDO.getUserIdcardNumberDes())){
|
||||
//解密身份证号
|
||||
String idcardNumber = AESUtil.decrypt(shipperDO.getUserIdcardNumberDes());
|
||||
shipperDO.setUserIdcardNumber(idcardNumber);
|
||||
}
|
||||
return shipperDO;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user