1、车船模块fix bug

2、运力模块fix bug
3、新增设备台账
4、其他bug 修复
5、调整组织、人员模块
This commit is contained in:
2026-08-07 08:27:47 +08:00
parent a1eea5075b
commit f716b3fc63
107 changed files with 2269 additions and 341 deletions

View File

@@ -21,9 +21,9 @@ public class FileCertificateBatchRecognitionDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 所有图像 obs key列表
* 所有图像完整 URL 列表
*/
@NotEmpty(message = "图像 obs key列表不能为空")
@NotEmpty(message = "图像 URL 列表不能为空")
private List<String> objectKeys;
/**
* 项目简称
@@ -38,19 +38,19 @@ public class FileCertificateBatchRecognitionDTO implements Serializable {
*/
private String dirName;
/**
* 磅单 obs key列表
* 磅单完整 URL 列表
*/
private List<String> poundUrls;
/**
* 车头 obs key列表
* 车头完整 URL 列表
*/
private List<String> carFrontUrls;
/**
* 驾驶证 obs key列表
* 驾驶证完整 URL 列表
*/
private List<String> driverLicenseUrls;
/**
* 行驶证 obs key列表
* 行驶证完整 URL 列表
*/
private List<String> vehicleLicenseUrls;

View File

@@ -134,6 +134,30 @@ public class Dept extends TenantEntity {
*/
@Schema(description = "部门编码")
private String deptCode;
/**
* 组织简称
*/
@Schema(description = "组织简称")
private String shortName;
/**
* 拼音助记码
*/
@Schema(description = "拼音助记码")
private String pinyinMnemonic;
/**
* 助记码
*/
@Schema(description = "助记码")
private String mnemonicCode;
/**
* 承运商客商档案主键
*/
@Schema(description = "承运商客商档案主键")
private Long carrierCustomerId;
/**
* 父部门编码
*/

View File

@@ -0,0 +1,41 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
import java.time.LocalDate;
/**
* 设备台账实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_equipment_ledger")
@Schema(description = "设备台账")
public class EquipmentLedger extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
private String vehicleType;
private String vehicleNo;
private String equipmentCode;
private String equipmentName;
private String equipmentBrand;
private String equipmentType;
private String specificationModel;
private LocalDate factoryDate;
private String originalEquipmentNo;
private String remark;
private String attachments;
private Integer onlineStatus;
}

View File

@@ -213,5 +213,11 @@ public class TransportVehicle extends TenantEntity {
*/
@Schema(description = "备注")
private String remark;
/** 认证状态0认证中 1认证通过 2认证驳回 */
@Schema(description = "认证状态0认证中 1认证通过 2认证驳回")
private Integer certificationStatus;
/** 认证驳回原因 */
@Schema(description = "认证驳回原因")
private String certificationRejectReason;
}

View File

@@ -0,0 +1,29 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.transport.pojo.entity.EquipmentLedger;
import java.io.Serial;
/**
* 设备台账视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "设备台账")
public class EquipmentLedgerVO extends EquipmentLedger {
@Serial
private static final long serialVersionUID = 1L;
@TableField(exist = false)
private String updateUserName;
}

View File

@@ -25,6 +25,7 @@
*/
package org.springblade.system.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -35,6 +36,7 @@ import org.springblade.system.pojo.context.IPhone;
import java.io.Serial;
import java.util.Date;
import java.util.List;
/**
* 实体类
@@ -133,6 +135,27 @@ public class User extends TenantEntity implements IPhone {
* 是否推送mk
*/
private Integer isPushMk;
/**
* 备注
*/
private String remark;
/**
* OA 人员 ID由用户部门关联表聚合查询返回
*/
@TableField(exist = false)
private String oaPersonId;
/** 人员类别1-内部员工2-承运商 */
private Integer personCategory;
/** 数据权限范围1-仅所属组织2-全部组织3-自定义 */
private Integer dataScopeRange;
/** 数据层级范围1-包含下级2-仅本级 */
private Integer dataLevelRange;
/** 是否包含新增客商 */
private Integer includeNewCustomer;
@TableField(exist = false)
private List<Long> dataScopeDeptIds;
@TableField(exist = false)
private List<Long> customerIds;
}

View File

@@ -0,0 +1,15 @@
package org.springblade.system.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("blade_user_customer_scope")
public class UserCustomerScope {
@TableId(type = IdType.ASSIGN_ID)
private Long id;
private Long userId;
private Long customerId;
}

View File

@@ -0,0 +1,15 @@
package org.springblade.system.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("blade_user_data_scope")
public class UserDataScope {
@TableId(type = IdType.ASSIGN_ID)
private Long id;
private Long userId;
private Long deptId;
}

View File

@@ -5,18 +5,14 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.file.convert.OCRConverter;
import org.springblade.file.pojo.dto.FileCertificateBatchRecognitionDTO;
import org.springblade.file.service.IFileService;
import org.springblade.file.service.IOCRConvertService;
import org.springblade.thirdparty.ocr.pojo.dto.CertificateBatchRecognitionDTO;
import org.springblade.thirdparty.ocr.pojo.vo.TransportCertificateVO;
import org.springblade.thirdparty.ocr.service.IOCRService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author bfhuange
* @since 2025/3/13
@@ -26,7 +22,6 @@ import java.util.List;
@Service
public class OCRConvertServiceImpl implements IOCRConvertService {
private final IFileService fileService;
private final IOCRService ocrService;
private final OCRConverter converter;
@@ -34,48 +29,26 @@ public class OCRConvertServiceImpl implements IOCRConvertService {
public TransportCertificateVO recognitionTransportCertificate(FileCertificateBatchRecognitionDTO param) {
Func.requireNotNull(param, "参数不能为空");
if (CollectionUtil.isEmpty(param.getObjectKeys())) {
throw new ServiceException("图像obs key不能为空");
throw new ServiceException("图像 URL 列表不能为空");
}
CertificateBatchRecognitionDTO ocrParam = converter.dto2ocr(param);
ocrParam.setPoundUrls(resolveFileUrls(param.getPoundUrls()));
ocrParam.setCarFrontUrls(resolveFileUrls(param.getCarFrontUrls()));
ocrParam.setDriverLicenseUrls(resolveFileUrls(param.getDriverLicenseUrls()));
ocrParam.setVehicleLicenseUrls(resolveFileUrls(param.getVehicleLicenseUrls()));
if (!hasTypedObjectKeys(param)) {
// 旧格式字符串数组仍按通用 urls 传递。
List<String> fileUrls = param.getObjectKeys().stream()
.map(this::resolveFileUrl)
.toList();
ocrParam.setUrls(fileUrls);
ocrParam.setPoundUrls(param.getPoundUrls());
ocrParam.setCarFrontUrls(param.getCarFrontUrls());
ocrParam.setDriverLicenseUrls(param.getDriverLicenseUrls());
ocrParam.setVehicleLicenseUrls(param.getVehicleLicenseUrls());
if (!hasTypedUrls(param)) {
ocrParam.setUrls(param.getObjectKeys());
} else {
ocrParam.setUrls(null);
}
return ocrService.recognitionTransportCertificate(ocrParam);
}
private boolean hasTypedObjectKeys(FileCertificateBatchRecognitionDTO param) {
private boolean hasTypedUrls(FileCertificateBatchRecognitionDTO param) {
return CollectionUtil.isNotEmpty(param.getPoundUrls())
|| CollectionUtil.isNotEmpty(param.getCarFrontUrls())
|| CollectionUtil.isNotEmpty(param.getDriverLicenseUrls())
|| CollectionUtil.isNotEmpty(param.getVehicleLicenseUrls());
}
private List<String> resolveFileUrls(List<String> objectKeys) {
if (CollectionUtil.isEmpty(objectKeys)) {
return null;
}
return objectKeys.stream()
.map(this::resolveFileUrl)
.toList();
}
private String resolveFileUrl(String objectKey) {
if (StringUtil.isBlank(objectKey)) {
return objectKey;
}
if (objectKey.startsWith("http://") || objectKey.startsWith("https://")) {
return objectKey;
}
return fileService.getFileUrl(objectKey, null);
}
}

View File

@@ -135,6 +135,17 @@ public class UserController {
return R.data(UserWrapper.build().pageVO(pages));
}
/**
* 用户权限配置客商选项:不应用当前用户的客商数据权限。
*/
@IsAdmin
@GetMapping("/customer-options")
@ApiOperationSupport(order = 5)
@Operation(summary = "用户客商权限选项", description = "返回当前租户全部客商")
public R<List<Map<String, Object>>> customerOptions() {
return R.data(userService.selectCustomerOptions(AuthUtil.getTenantId()));
}
/**
* 新增或修改
*/

View File

@@ -9,9 +9,16 @@
<result column="dept_name" property="deptName"/>
<result column="full_name" property="fullName"/>
<result column="ancestors" property="ancestors"/>
<result column="leader_id" property="leaderId"/>
<result column="dept_category" property="deptCategory"/>
<result column="dept_code" property="deptCode"/>
<result column="short_name" property="shortName"/>
<result column="pinyin_mnemonic" property="pinyinMnemonic"/>
<result column="mnemonic_code" property="mnemonicCode"/>
<result column="carrier_customer_id" property="carrierCustomerId"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
@@ -21,9 +28,16 @@
<result column="dept_name" property="deptName"/>
<result column="full_name" property="fullName"/>
<result column="ancestors" property="ancestors"/>
<result column="leader_id" property="leaderId"/>
<result column="dept_category" property="deptCategory"/>
<result column="dept_code" property="deptCode"/>
<result column="short_name" property="shortName"/>
<result column="pinyin_mnemonic" property="pinyinMnemonic"/>
<result column="mnemonic_code" property="mnemonicCode"/>
<result column="carrier_customer_id" property="carrierCustomerId"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="has_children" property="hasChildren"/>
</resultMap>

View File

@@ -0,0 +1,7 @@
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.system.pojo.entity.UserCustomerScope;
public interface UserCustomerScopeMapper extends BaseMapper<UserCustomerScope> {
}

View File

@@ -0,0 +1,7 @@
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.system.pojo.entity.UserDataScope;
public interface UserDataScopeMapper extends BaseMapper<UserDataScope> {
}

View File

@@ -33,6 +33,7 @@ import org.springblade.system.pojo.entity.User;
import org.springblade.system.excel.UserExcel;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
@@ -78,4 +79,6 @@ public interface UserMapper extends BaseMapper<User> {
*/
List<UserExcel> exportUser(@Param("ew") Wrapper<User> queryWrapper);
List<Map<String, Object>> selectCustomerOptions(@Param("tenantId") String tenantId);
}

View File

@@ -25,30 +25,41 @@
<result column="role_id" property="roleId"/>
<result column="dept_id" property="deptId"/>
<result column="post_id" property="postId"/>
<result column="remark" property="remark"/>
<result column="oa_person_id" property="oaPersonId"/>
</resultMap>
<select id="selectUserPage" resultMap="userResultMap">
select * from blade_user where is_deleted = 0
select bu.*, (
select max(bud.oa_id)
from blade_user_dept bud
where bud.user_id = bu.id and bud.is_deleted = 0
) as oa_person_id
from blade_user bu
where bu.is_deleted = 0
<if test="tenantId!=null and tenantId != ''">
and tenant_id = #{tenantId}
and bu.tenant_id = #{tenantId}
</if>
<if test="user.tenantId!=null and user.tenantId != ''">
and tenant_id = #{user.tenantId}
and bu.tenant_id = #{user.tenantId}
</if>
<if test="user.account!=null and user.account != ''">
and account = #{user.account}
and bu.account = #{user.account}
</if>
<if test="user.realName!=null and user.realName != ''">
and real_name = #{user.realName}
and bu.real_name = #{user.realName}
</if>
<if test="user.phone!=null and user.phone != ''">
and bu.phone = #{user.phone}
</if>
<if test="user.userType!=null and user.userType != ''">
and user_type = #{user.userType}
and bu.user_type = #{user.userType}
</if>
<if test="user.status!=null and user.status>=0">
and status = #{user.status}
and bu.status = #{user.status}
</if>
<if test="deptIdList!=null and deptIdList.size>0">
and id in (
and bu.id in (
SELECT
user_id
FROM
@@ -60,7 +71,7 @@
</foreach>
)
</if>
ORDER BY id
ORDER BY bu.id
</select>
<select id="getUser" resultMap="userResultMap">
@@ -87,4 +98,13 @@
SELECT id, tenant_id, user_type, account, name, real_name, email, phone, birthday, role_id, dept_id, post_id FROM blade_user ${ew.customSqlSegment}
</select>
<select id="selectCustomerOptions" resultType="java.util.HashMap">
SELECT id, customer_code AS customerCode, full_name AS fullName, short_name AS shortName,
customer_type AS customerType, status, approval_status AS approvalStatus
FROM blade_customer_archive
WHERE tenant_id = #{tenantId}
AND is_deleted = 0
ORDER BY create_time DESC
</select>
</mapper>

View File

@@ -105,6 +105,9 @@ public interface IUserService extends BaseService<User> {
*/
IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId);
/** 用户权限配置使用的当前租户全量客商选项。 */
List<Map<String, Object>> selectCustomerOptions(String tenantId);
/**
* 自定义用户搜索分页(按姓名 / 部门 / 岗位模糊匹配,限定当前会话租户)
*

View File

@@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.springblade.core.tenant.TenantGuard.EntityType.DEPT;
@@ -189,6 +190,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
List<Long> idList = Func.toLongList(ids);
// 租户守卫:批量校验目标部门全部归属当前会话租户
TenantGuard.verifyBatch(this, idList, DEPT);
boolean containsRootDept = listByIds(idList).stream()
.anyMatch(dept -> BladeConstant.TOP_PARENT_ID.equals(dept.getParentId()));
if (containsRootDept) {
throw new ServiceException("根节点不能删除!");
}
Long cnt = baseMapper.selectCount(Wrappers.<Dept>query().lambda().in(Dept::getParentId, idList));
if (cnt > 0L) {
throw new ServiceException("请先删除子节点!");
@@ -200,6 +206,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
@Transactional(rollbackFor = Exception.class)
public boolean submit(Dept dept) {
Long parentId = dept.getParentId();
Dept parent = null;
// 顶级语义parentId 为 null 或 TOP_PARENT_ID (0L) 均视为顶级部门
if (parentId == null || parentId.equals(BladeConstant.TOP_PARENT_ID)) {
// 顶级部门:租户守卫统一处理新增 / 修改路径的租户绑定
@@ -213,7 +220,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
}
Dept self = Func.isNotEmpty(dept.getId())
? TenantGuard.verify(this, dept.getId(), DEPT) : null;
Dept parent = TenantGuard.verify(this, dept.getParentId(), DEPT_PARENT);
parent = TenantGuard.verify(this, dept.getParentId(), DEPT_PARENT);
if (parent == null) {
throw new ServiceException("上级部门不存在!");
}
@@ -228,9 +235,59 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
if (Func.isEmpty(dept.getTenantId())) {
throw new ServiceException("租户ID不能为空");
}
validateDeptCategory(dept, parent);
validateDeptCode(dept, parent);
return saveOrUpdate(dept);
}
private void validateDeptCategory(Dept dept, Dept parent) {
if (parent == null) {
throw new ServiceException("请选择上级组织");
}
List<Integer> allowedCategories;
if (BladeConstant.TOP_PARENT_ID.equals(parent.getParentId())) {
allowedCategories = "外部组织".equals(parent.getDeptName()) ? List.of(6) : List.of(1);
} else if (Integer.valueOf(1).equals(parent.getDeptCategory())) {
allowedCategories = List.of(2, 3);
} else if (List.of(2, 3).contains(parent.getDeptCategory())) {
allowedCategories = List.of(4, 5, 6);
} else {
throw new ServiceException("上级组织层级不支持新增下级组织");
}
if (!allowedCategories.contains(dept.getDeptCategory())) {
throw new ServiceException("组织类型不符合上级组织层级规则");
}
if (Integer.valueOf(6).equals(dept.getDeptCategory()) && Func.isEmpty(dept.getCarrierCustomerId())) {
throw new ServiceException("请选择承运商");
}
}
private void validateDeptCode(Dept dept, Dept parent) {
String deptCode = dept.getDeptCode();
if (StringUtil.isBlank(deptCode)) {
throw new ServiceException("组织编码不能为空");
}
deptCode = deptCode.trim();
if (deptCode.length() > 30) {
throw new ServiceException("组织编码不能超过30个字符");
}
if (parent == null || StringUtil.isBlank(parent.getDeptCode())) {
throw new ServiceException("请选择已配置组织编码的上级组织");
}
String pattern = Pattern.quote(parent.getDeptCode()) + "-\\d+";
if (!deptCode.matches(pattern)) {
throw new ServiceException("组织编码格式应为:上级编码-分段数字");
}
LambdaQueryWrapper<Dept> queryWrapper = Wrappers.<Dept>lambdaQuery().eq(Dept::getDeptCode, deptCode);
if (Func.isNotEmpty(dept.getId())) {
queryWrapper.ne(Dept::getId, dept.getId());
}
if (baseMapper.selectCount(queryWrapper) > 0) {
throw new ServiceException("组织编码已存在");
}
dept.setDeptCode(deptCode);
}
@Override
public List<DeptVO> search(String deptName, Long parentId) {
String tenantId = AuthUtil.getTenantId();

View File

@@ -56,6 +56,8 @@ import org.springblade.system.cache.SysCache;
import org.springblade.system.cache.UserCache;
import org.springblade.system.excel.UserExcel;
import org.springblade.system.mapper.UserMapper;
import org.springblade.system.mapper.UserDataScopeMapper;
import org.springblade.system.mapper.UserCustomerScopeMapper;
import org.springblade.system.pojo.context.IPhone;
import org.springblade.system.pojo.entity.*;
import org.springblade.system.pojo.enums.DictEnum;
@@ -95,6 +97,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
private final IUserDeptService userDeptService;
private final UserDataScopeMapper userDataScopeMapper;
private final UserCustomerScopeMapper userCustomerScopeMapper;
private final IUserOauthService userOauthService;
private final IRoleService roleService;
private final BladeTenantProperties tenantProperties;
@@ -106,7 +110,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
public User getDetail(User user) {
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user);
applyTenantScope(queryWrapper);
return getOne(queryWrapper);
return fillUserScopes(getOne(queryWrapper));
}
@Override
@@ -120,6 +124,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
@Transactional(rollbackFor = Exception.class)
public boolean submit(User user) {
bindSessionTenant(user);
if (user.getUserType() == null) {
user.setUserType(UserType.WEB.getCategory());
}
applyUserDefaults(user);
return saveUser(user);
}
@@ -148,7 +156,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
throw new ServiceException(StringUtil.format("当前手机 [{}] 已存在!", user.getPhone()));
}
CacheUtil.clear(USER_CACHE);
return submitUserInfo(user) && submitUserDept(user);
applyUserDefaults(user);
return submitUserInfo(user) && submitUserDept(user) && submitUserScopes(user);
}
@Override
@@ -198,6 +207,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
return page.setRecords(baseMapper.selectUserPage(page, user, deptIdList, tenantId));
}
@Override
public List<Map<String, Object>> selectCustomerOptions(String tenantId) {
return baseMapper.selectCustomerOptions(tenantId);
}
@Override
public IPage<UserVO> selectUserSearch(UserVO user, Query query) {
LambdaQueryWrapper<User> queryWrapper = Wrappers.<User>query().lambda();
@@ -676,7 +690,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
? Func.toStrWithEmpty(tenantId, AuthUtil.getTenantId())
: AuthUtil.getTenantId();
LambdaQueryWrapper<User> queryWrapper = Wrappers.<User>query().lambda()
.select(User::getId, User::getRealName)
.select(User::getId, User::getRealName, User::getPhone)
.like(StringUtil.isNoneBlank(realName), User::getRealName, realName)
.eq(User::getTenantId, resolvedTenantId)
.eq(User::getIsLeader, BladeConstant.DB_STATUS_1)
@@ -756,9 +770,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
throw new ServiceException("当前租户已到最大账号额度!");
}
}
if (Func.isNotEmpty(user.getPassword())) {
user.setPassword(DigestUtil.encrypt(user.getPassword()));
if (Func.isEmpty(user.getPassword())) {
user.setPassword(ParamCache.getValue(DEFAULT_PARAM_PASSWORD));
}
user.setPassword(DigestUtil.encrypt(user.getPassword()));
Long userCount = baseMapper.selectCount(Wrappers.<User>query().lambda().eq(User::getTenantId, tenantId).eq(User::getAccount, user.getAccount()));
if (userCount > 0L && Func.isEmpty(user.getId())) {
throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
@@ -768,7 +783,45 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
throw new ServiceException(StringUtil.format("当前手机 [{}] 已存在!", user.getPhone()));
}
CacheUtil.clear(USER_CACHE);
return save(user) && submitUserDept(user);
return save(user) && submitUserDept(user) && submitUserScopes(user);
}
private void applyUserDefaults(User user) {
if (user.getPersonCategory() == null) user.setPersonCategory(1);
if (user.getDataScopeRange() == null) user.setDataScopeRange(1);
if (user.getDataLevelRange() == null) user.setDataLevelRange(1);
if (user.getIncludeNewCustomer() == null) user.setIncludeNewCustomer(0);
}
private boolean submitUserScopes(User user) {
userDataScopeMapper.delete(Wrappers.<UserDataScope>lambdaQuery().eq(UserDataScope::getUserId, user.getId()));
userCustomerScopeMapper.delete(Wrappers.<UserCustomerScope>lambdaQuery().eq(UserCustomerScope::getUserId, user.getId()));
if (Objects.equals(user.getDataScopeRange(), 3) && user.getDataScopeDeptIds() != null) {
user.getDataScopeDeptIds().forEach(deptId -> {
UserDataScope scope = new UserDataScope();
scope.setUserId(user.getId());
scope.setDeptId(deptId);
userDataScopeMapper.insert(scope);
});
}
if (user.getCustomerIds() != null) {
user.getCustomerIds().forEach(customerId -> {
UserCustomerScope scope = new UserCustomerScope();
scope.setUserId(user.getId());
scope.setCustomerId(customerId);
userCustomerScopeMapper.insert(scope);
});
}
return true;
}
private User fillUserScopes(User user) {
if (user == null || user.getId() == null) return user;
user.setDataScopeDeptIds(userDataScopeMapper.selectList(Wrappers.<UserDataScope>lambdaQuery()
.eq(UserDataScope::getUserId, user.getId())).stream().map(UserDataScope::getDeptId).toList());
user.setCustomerIds(userCustomerScopeMapper.selectList(Wrappers.<UserCustomerScope>lambdaQuery()
.eq(UserCustomerScope::getUserId, user.getId())).stream().map(UserCustomerScope::getCustomerId).toList());
return user;
}
/**

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.AccidentRecordExcel;
import org.springblade.transport.excel.AccidentRecordExportExcel;
import org.springblade.transport.excel.AccidentRecordImporter;
import org.springblade.transport.pojo.entity.AccidentRecord;
import org.springblade.transport.pojo.vo.AccidentRecordVO;
@@ -144,8 +145,8 @@ public class AccidentRecordController extends BladeController {
public void exportAccidentRecord(AccidentRecordVO accidentRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<AccidentRecordExcel> list = accidentRecordService.exportAccidentRecord(buildExportQuery(accidentRecord, ids));
ExcelUtil.export(response, "事故记录" + DateUtil.time(), "事故记录表", list, AccidentRecordExcel.class);
List<AccidentRecordExportExcel> list = accidentRecordService.exportAccidentRecord(buildExportQuery(accidentRecord, ids));
ExcelUtil.export(response, "事故记录" + DateUtil.time(), "事故记录表", list, AccidentRecordExportExcel.class);
}
/**

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.AnnualInspectionRecordExcel;
import org.springblade.transport.excel.AnnualInspectionRecordExportExcel;
import org.springblade.transport.excel.AnnualInspectionRecordImporter;
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
@@ -126,8 +127,8 @@ public class AnnualInspectionRecordController extends BladeController {
public void exportAnnualInspectionRecord(AnnualInspectionRecordVO annualInspectionRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<AnnualInspectionRecordExcel> list = annualInspectionRecordService.exportAnnualInspectionRecord(buildExportQuery(annualInspectionRecord, ids));
ExcelUtil.export(response, "年检记录" + DateUtil.time(), "年检记录表", list, AnnualInspectionRecordExcel.class);
List<AnnualInspectionRecordExportExcel> list = annualInspectionRecordService.exportAnnualInspectionRecord(buildExportQuery(annualInspectionRecord, ids));
ExcelUtil.export(response, "年检记录" + DateUtil.time(), "年检记录表", list, AnnualInspectionRecordExportExcel.class);
}
@GetMapping("/export-template")

View File

@@ -36,6 +36,7 @@ import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
@@ -187,6 +188,10 @@ public class CustomerArchiveController extends BladeController {
LambdaQueryWrapper<CustomerArchive> queryWrapper = Wrappers.<CustomerArchive>lambdaQuery()
.eq(CustomerArchive::getIsDeleted, 0)
.orderByDesc(CustomerArchive::getCreateTime);
Long userId = AuthUtil.getUserId();
queryWrapper.and(wrapper -> wrapper
.exists("SELECT 1 FROM blade_user_customer_scope bucs WHERE bucs.user_id = " + userId
+ " AND bucs.customer_id = blade_customer_archive.id"));
if (Func.isNotEmpty(ids)) {
queryWrapper.in(CustomerArchive::getId, Func.toLongList(ids));
}

View File

@@ -0,0 +1,135 @@
package org.springblade.transport.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.EquipmentLedgerExcel;
import org.springblade.transport.pojo.entity.EquipmentLedger;
import org.springblade.transport.pojo.vo.EquipmentLedgerVO;
import org.springblade.transport.service.IEquipmentLedgerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
/**
* 设备台账控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@PreAuth(menu = "equipment_ledger")
@RequestMapping("/equipment-ledger")
@Tag(name = "设备台账", description = "设备台账")
public class EquipmentLedgerController extends BladeController {
private static final int DEFAULT_CURRENT = 1;
private static final int DEFAULT_SIZE = 10;
private static final int MAX_SIZE = 100;
private final IEquipmentLedgerService equipmentLedgerService;
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入设备台账ID")
public R<EquipmentLedger> detail(@RequestParam Long id) {
return R.data(equipmentLedgerService.getById(id));
}
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页")
public R<IPage<EquipmentLedgerVO>> list(EquipmentLedgerVO equipmentLedger, Query query) {
return R.data(equipmentLedgerService.selectEquipmentLedgerPage(Condition.getPage(normalizeQuery(query)), equipmentLedger));
}
@GetMapping("/next-equipment-code")
@ApiOperationSupport(order = 3)
@Operation(summary = "获取下一个设备编号")
public R<String> nextEquipmentCode() {
return R.data(equipmentLedgerService.nextEquipmentCode());
}
@PostMapping("/submit")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增或修改")
public R submit(@Valid @RequestBody EquipmentLedger equipmentLedger) {
return R.status(equipmentLedgerService.submit(equipmentLedger));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 5)
@Operation(summary = "逻辑删除")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(equipmentLedgerService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/import-equipment-ledger")
@ApiOperationSupport(order = 6)
@Operation(summary = "导入设备台账")
public R importEquipmentLedger(MultipartFile file, HttpServletResponse response) {
List<EquipmentLedgerExcel> failureList = equipmentLedgerService.importEquipmentLedger(ExcelUtil.read(file, EquipmentLedgerExcel.class));
if (Func.isNotEmpty(failureList)) {
org.springblade.common.excel.ImportFailureExcelUtil.export(response, "设备台账导入失败明细" + DateUtil.time(), "导入失败明细", failureList, EquipmentLedgerExcel.class);
return null;
}
return R.success("操作成功");
}
@GetMapping("/export-equipment-ledger")
@ApiOperationSupport(order = 7)
@Operation(summary = "导出设备台账")
public void exportEquipmentLedger(EquipmentLedgerVO equipmentLedger, @RequestParam(required = false) String ids, HttpServletResponse response) {
List<EquipmentLedgerExcel> list = equipmentLedgerService.exportEquipmentLedger(buildExportQuery(equipmentLedger, ids));
ExcelUtil.export(response, "设备台账" + DateUtil.time(), "设备台账表", list, EquipmentLedgerExcel.class);
}
@GetMapping("/export-template")
@ApiOperationSupport(order = 8)
@Operation(summary = "导出模板")
public void exportTemplate(HttpServletResponse response) {
ExcelUtil.export(response, "设备台账模板", "设备台账表", new ArrayList<>(), EquipmentLedgerExcel.class);
}
private Query normalizeQuery(Query query) {
if (query == null) query = new Query();
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) query.setCurrent(DEFAULT_CURRENT);
if (query.getSize() == null || query.getSize() <= 0) query.setSize(DEFAULT_SIZE);
if (query.getSize() > MAX_SIZE) query.setSize(MAX_SIZE);
return query;
}
private LambdaQueryWrapper<EquipmentLedger> buildExportQuery(EquipmentLedgerVO equipmentLedger, String ids) {
LambdaQueryWrapper<EquipmentLedger> queryWrapper = Wrappers.<EquipmentLedger>lambdaQuery()
.eq(EquipmentLedger::getIsDeleted, 0)
.orderByDesc(EquipmentLedger::getCreateTime);
if (Func.isNotEmpty(ids)) queryWrapper.in(EquipmentLedger::getId, Func.toLongList(ids));
if (Func.isNotEmpty(equipmentLedger.getVehicleNo())) queryWrapper.like(EquipmentLedger::getVehicleNo, equipmentLedger.getVehicleNo());
if (Func.isNotEmpty(equipmentLedger.getVehicleType())) queryWrapper.eq(EquipmentLedger::getVehicleType, equipmentLedger.getVehicleType());
if (Func.isNotEmpty(equipmentLedger.getEquipmentCode())) queryWrapper.like(EquipmentLedger::getEquipmentCode, equipmentLedger.getEquipmentCode());
if (Func.isNotEmpty(equipmentLedger.getCreateDept())) queryWrapper.eq(EquipmentLedger::getCreateDept, equipmentLedger.getCreateDept());
return queryWrapper;
}
}

View File

@@ -25,6 +25,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.EtcRecordExcel;
import org.springblade.transport.excel.EtcRecordExportExcel;
import org.springblade.transport.excel.EtcRecordImporter;
import org.springblade.transport.pojo.entity.EtcRecord;
import org.springblade.transport.pojo.vo.EtcRecordVO;
@@ -107,8 +108,8 @@ public class EtcRecordController extends BladeController {
public void exportEtcRecord(EtcRecordVO etcRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<EtcRecordExcel> list = etcRecordService.exportEtcRecord(buildExportQuery(etcRecord, ids));
ExcelUtil.export(response, "ETC记录" + DateUtil.time(), "ETC记录表", list, EtcRecordExcel.class);
List<EtcRecordExportExcel> list = etcRecordService.exportEtcRecord(buildExportQuery(etcRecord, ids));
ExcelUtil.export(response, "ETC记录" + DateUtil.time(), "ETC记录表", list, EtcRecordExportExcel.class);
}
@GetMapping("/export-template")

View File

@@ -45,6 +45,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.InsuranceRecordExcel;
import org.springblade.transport.excel.InsuranceRecordExportExcel;
import org.springblade.transport.excel.InsuranceRecordImporter;
import org.springblade.transport.pojo.entity.InsuranceRecord;
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
@@ -145,8 +146,8 @@ public class InsuranceRecordController extends BladeController {
public void exportInsuranceRecord(InsuranceRecordVO insuranceRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<InsuranceRecordExcel> list = insuranceRecordService.exportInsuranceRecord(buildExportQuery(insuranceRecord, ids));
ExcelUtil.export(response, "保险记录" + DateUtil.time(), "保险记录表", list, InsuranceRecordExcel.class);
List<InsuranceRecordExportExcel> list = insuranceRecordService.exportInsuranceRecord(buildExportQuery(insuranceRecord, ids));
ExcelUtil.export(response, "保险记录" + DateUtil.time(), "保险记录表", list, InsuranceRecordExportExcel.class);
}
/**

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.MaintenancePlanExcel;
import org.springblade.transport.excel.MaintenancePlanExportExcel;
import org.springblade.transport.excel.MaintenancePlanImporter;
import org.springblade.transport.pojo.entity.MaintenancePlan;
import org.springblade.transport.pojo.vo.MaintenancePlanVO;
@@ -144,8 +145,8 @@ public class MaintenancePlanController extends BladeController {
public void exportMaintenancePlan(MaintenancePlanVO maintenancePlan,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<MaintenancePlanExcel> list = maintenancePlanService.exportMaintenancePlan(buildExportQuery(maintenancePlan, ids));
ExcelUtil.export(response, "保养记录" + DateUtil.time(), "保养记录表", list, MaintenancePlanExcel.class);
List<MaintenancePlanExportExcel> list = maintenancePlanService.exportMaintenancePlan(buildExportQuery(maintenancePlan, ids));
ExcelUtil.export(response, "保养记录" + DateUtil.time(), "保养记录表", list, MaintenancePlanExportExcel.class);
}
/**

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.MaintenanceRecordExcel;
import org.springblade.transport.excel.MaintenanceRecordExportExcel;
import org.springblade.transport.excel.MaintenanceRecordImporter;
import org.springblade.transport.pojo.entity.MaintenanceRecord;
import org.springblade.transport.pojo.vo.MaintenanceRecordVO;
@@ -144,8 +145,8 @@ public class MaintenanceRecordController extends BladeController {
public void exportMaintenanceRecord(MaintenanceRecordVO maintenanceRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<MaintenanceRecordExcel> list = maintenanceRecordService.exportMaintenanceRecord(buildExportQuery(maintenanceRecord, ids));
ExcelUtil.export(response, "维修记录" + DateUtil.time(), "维修记录表", list, MaintenanceRecordExcel.class);
List<MaintenanceRecordExportExcel> list = maintenanceRecordService.exportMaintenanceRecord(buildExportQuery(maintenanceRecord, ids));
ExcelUtil.export(response, "维修记录" + DateUtil.time(), "维修记录表", list, MaintenanceRecordExportExcel.class);
}
/**

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.MileageRecordExcel;
import org.springblade.transport.excel.MileageRecordExportExcel;
import org.springblade.transport.excel.MileageRecordImporter;
import org.springblade.transport.pojo.entity.MileageRecord;
import org.springblade.transport.pojo.vo.MileageRecordVO;
@@ -126,8 +127,8 @@ public class MileageRecordController extends BladeController {
public void exportMileageRecord(MileageRecordVO mileageRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<MileageRecordExcel> list = mileageRecordService.exportMileageRecord(buildExportQuery(mileageRecord, ids));
ExcelUtil.export(response, "里程记录" + DateUtil.time(), "里程记录表", list, MileageRecordExcel.class);
List<MileageRecordExportExcel> list = mileageRecordService.exportMileageRecord(buildExportQuery(mileageRecord, ids));
ExcelUtil.export(response, "里程记录" + DateUtil.time(), "里程记录表", list, MileageRecordExportExcel.class);
}
@GetMapping("/export-template")

View File

@@ -25,6 +25,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.OilElectricRecordExcel;
import org.springblade.transport.excel.OilElectricRecordExportExcel;
import org.springblade.transport.excel.OilElectricRecordImporter;
import org.springblade.transport.pojo.entity.OilElectricRecord;
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
@@ -107,8 +108,8 @@ public class OilElectricRecordController extends BladeController {
public void exportOilElectricRecord(OilElectricRecordVO oilElectricRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<OilElectricRecordExcel> list = oilElectricRecordService.exportOilElectricRecord(buildExportQuery(oilElectricRecord, ids));
ExcelUtil.export(response, "油电记录" + DateUtil.time(), "油电记录表", list, OilElectricRecordExcel.class);
List<OilElectricRecordExportExcel> list = oilElectricRecordService.exportOilElectricRecord(buildExportQuery(oilElectricRecord, ids));
ExcelUtil.export(response, "油电记录" + DateUtil.time(), "油电记录表", list, OilElectricRecordExportExcel.class);
}
@GetMapping("/export-template")

View File

@@ -25,6 +25,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.OtherExpenseRecordExcel;
import org.springblade.transport.excel.OtherExpenseRecordExportExcel;
import org.springblade.transport.excel.OtherExpenseRecordImporter;
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
@@ -107,8 +108,8 @@ public class OtherExpenseRecordController extends BladeController {
public void exportOtherExpenseRecord(OtherExpenseRecordVO otherExpenseRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<OtherExpenseRecordExcel> list = otherExpenseRecordService.exportOtherExpenseRecord(buildExportQuery(otherExpenseRecord, ids));
ExcelUtil.export(response, "其他费用记录" + DateUtil.time(), "其他费用记录表", list, OtherExpenseRecordExcel.class);
List<OtherExpenseRecordExportExcel> list = otherExpenseRecordService.exportOtherExpenseRecord(buildExportQuery(otherExpenseRecord, ids));
ExcelUtil.export(response, "其他费用记录" + DateUtil.time(), "其他费用记录表", list, OtherExpenseRecordExportExcel.class);
}
@GetMapping("/export-template")

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.TireReplacementRecordExcel;
import org.springblade.transport.excel.TireReplacementRecordExportExcel;
import org.springblade.transport.excel.TireReplacementRecordImporter;
import org.springblade.transport.pojo.entity.TireReplacementRecord;
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
@@ -144,8 +145,8 @@ public class TireReplacementRecordController extends BladeController {
public void exportTireReplacementRecord(TireReplacementRecordVO tireReplacementRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<TireReplacementRecordExcel> list = tireReplacementRecordService.exportTireReplacementRecord(buildExportQuery(tireReplacementRecord, ids));
ExcelUtil.export(response, "换胎记录" + DateUtil.time(), "换胎记录表", list, TireReplacementRecordExcel.class);
List<TireReplacementRecordExportExcel> list = tireReplacementRecordService.exportTireReplacementRecord(buildExportQuery(tireReplacementRecord, ids));
ExcelUtil.export(response, "换胎记录" + DateUtil.time(), "换胎记录表", list, TireReplacementRecordExportExcel.class);
}
/**

View File

@@ -44,6 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.TransportChangeRecordExcel;
import org.springblade.transport.excel.TransportChangeRecordExportExcel;
import org.springblade.transport.excel.TransportChangeRecordImporter;
import org.springblade.transport.pojo.entity.TransportChangeRecord;
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
@@ -126,8 +127,8 @@ public class TransportChangeRecordController extends BladeController {
public void exportTransportChangeRecord(TransportChangeRecordVO transportChangeRecord,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<TransportChangeRecordExcel> list = transportChangeRecordService.exportTransportChangeRecord(buildExportQuery(transportChangeRecord, ids));
ExcelUtil.export(response, "变更记录" + DateUtil.time(), "变更记录表", list, TransportChangeRecordExcel.class);
List<TransportChangeRecordExportExcel> list = transportChangeRecordService.exportTransportChangeRecord(buildExportQuery(transportChangeRecord, ids));
ExcelUtil.export(response, "变更记录" + DateUtil.time(), "变更记录表", list, TransportChangeRecordExportExcel.class);
}
@GetMapping("/export-template")

View File

@@ -132,6 +132,14 @@ public class TransportVehicleController extends BladeController {
return R.status(transportVehicleService.changeStatus(id, status));
}
@PostMapping("/audit-certification")
@ApiOperationSupport(order = 6)
@Operation(summary = "审核车辆认证")
public R auditCertification(@RequestParam Long id, @RequestParam Integer certificationStatus,
@RequestParam(required = false) String rejectReason) {
return R.status(transportVehicleService.auditCertification(id, certificationStatus, rejectReason));
}
/**
* 证件有效期统计
*/

View File

@@ -44,7 +44,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.ViolationRecordExcel;
import org.springblade.transport.excel.ViolationRecordImporter;
import org.springblade.transport.excel.ViolationRecordImportExcel;
import org.springblade.transport.pojo.entity.ViolationRecord;
import org.springblade.transport.pojo.vo.ViolationRecordVO;
import org.springblade.transport.service.IViolationRecordService;
@@ -127,9 +127,9 @@ public class ViolationRecordController extends BladeController {
@ApiOperationSupport(order = 5)
@Operation(summary = "导入违章记录", description = "传入excel")
public R importViolationRecord(MultipartFile file, HttpServletResponse response) {
List<ViolationRecordExcel> failureList = violationRecordService.importViolationRecord(ExcelUtil.read(file, ViolationRecordExcel.class));
List<ViolationRecordImportExcel> failureList = violationRecordService.importViolationRecord(ExcelUtil.read(file, ViolationRecordImportExcel.class));
if (Func.isNotEmpty(failureList)) {
org.springblade.common.excel.ImportFailureExcelUtil.export(response, "违章记录导入失败明细" + DateUtil.time(), "导入失败明细", failureList, ViolationRecordExcel.class);
org.springblade.common.excel.ImportFailureExcelUtil.export(response, "违章记录导入失败明细" + DateUtil.time(), "导入失败明细", failureList, ViolationRecordImportExcel.class);
return null;
}
return R.success("操作成功");
@@ -155,8 +155,8 @@ public class ViolationRecordController extends BladeController {
@ApiOperationSupport(order = 7)
@Operation(summary = "导出模板")
public void exportTemplate(HttpServletResponse response) {
List<ViolationRecordExcel> list = new ArrayList<>();
ExcelUtil.export(response, "违章记录模板", "违章记录表", list, ViolationRecordExcel.class);
List<ViolationRecordImportExcel> list = new ArrayList<>();
ExcelUtil.export(response, "违章记录模板", "违章记录表", list, ViolationRecordImportExcel.class);
}
private Query normalizeQuery(Query query) {

View File

@@ -86,7 +86,7 @@ public class AccidentRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,98 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.format.NumberFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 事故记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(18)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class AccidentRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("事故发生日期")
private LocalDate accidentDate;
@ExcelProperty("事故发生地点")
private String accidentLocation;
@ExcelProperty("事故性质")
private String accidentNature;
@ExcelProperty("事故责任")
private String accidentResponsibility;
@ExcelProperty("直接经济损失")
@NumberFormat("0.00")
private BigDecimal directEconomicLoss;
@ExcelProperty("保险理赔金额")
@NumberFormat("0.00")
private BigDecimal insuranceClaimAmount;
@ExcelProperty("事故原因及损坏情况")
private String accidentReasonDamage;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -86,7 +86,7 @@ public class AnnualInspectionRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,98 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 年检记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(22)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class AnnualInspectionRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("检测评定日期")
private LocalDate inspectionAssessmentDate;
@ExcelProperty("有效期截止日")
private LocalDate validUntilDate;
@ExcelProperty("车辆技术等级")
private String vehicleTechnicalLevel;
@ExcelProperty("船舶检验类型")
private String shipInspectionType;
@ExcelProperty("客车类型及等级")
private String passengerTypeLevel;
@ExcelProperty("检测评定单位")
private String inspectionUnit;
@ExcelProperty("费用")
private BigDecimal fee;
@ExcelProperty("评定(复核)单位")
private String assessmentUnit;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -53,67 +53,76 @@ public class DriverExcel implements Serializable {
@ExcelIgnore
private Long id;
@ExcelProperty("司机姓名")
@ExcelProperty("司机姓名 *")
private String driverName;
@ExcelProperty("身份证号")
@ExcelProperty("身份证号 *")
private String idCardNo;
@ExcelProperty("手机号")
private String mobile;
@ExcelProperty("出生年月")
private LocalDate birthday;
@ExcelProperty("性别")
@ExcelProperty("性别 *")
private String gender;
@ExcelProperty("司机类型")
private String driverType;
@ExcelProperty("民族")
private String nation;
@ExcelProperty("岗位")
@ExcelProperty("学历")
private String education;
@ExcelProperty("住址")
private String address;
@ExcelProperty("岗位 *")
private String posts;
@ExcelProperty("所属组织")
private String organizationName;
@ExcelProperty("状态")
private String statusName;
@ExcelProperty("准驾车型")
@ExcelProperty("准驾车型 *")
private String drivingType;
@ExcelProperty("驾驶证档案编号")
@ExcelProperty("档案编号 *")
private String drivingLicenseNo;
@ExcelProperty("驾驶证有效期")
private LocalDate drivingLicenseStartDate;
@ExcelProperty("驾驶证有效期止")
@ExcelProperty("有效期 *")
private LocalDate drivingLicenseEndDate;
@ExcelProperty("驾驶证长期有效")
private String drivingLicenseLongTermName;
@ExcelProperty("驾驶证主页图片上传")
private String drivingLicenseFront;
@ExcelProperty("从业资格证类型")
@ExcelProperty("驾驶证副页图片上传")
private String drivingLicenseBack;
@ExcelProperty("从业资格证类型 *")
private String qualificationType;
@ExcelProperty("资格证")
@ExcelProperty("资格证编号 *")
private String qualificationNo;
@ExcelProperty("从业资格证有效期")
@ExcelProperty("有效期 *")
private LocalDate qualificationEndDate;
@ExcelProperty("从业资格证长期有效")
private String qualificationLongTermName;
@ExcelProperty("证件首页上传")
private String qualificationFront;
@ExcelProperty("紧急联系人")
@ExcelProperty("证件内页上传")
private String qualificationBack;
@ExcelProperty("司机类型 *")
private String driverType;
@ExcelProperty("手机号 *")
private String mobile;
@ExcelProperty("紧急联系人姓名 *")
private String emergencyContactName;
@ExcelProperty("紧急联系人手机号")
@ExcelProperty("紧急联系人手机号 *")
private String emergencyContactMobile;
@ExcelProperty("与联系人关系")
private String contactRelation;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("所属组织 *")
private String organizationName;
}

View File

@@ -0,0 +1,35 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
/**
* 设备台账 Excel
*
* @author Chill
*/
@Data
public class EquipmentLedgerExcel implements Serializable {
@Serial private static final long serialVersionUID = 1L;
@ExcelProperty("*车船类型") private String vehicleType;
@ExcelProperty("*车牌号/船号") private String vehicleNo;
@ExcelProperty("*设备号") private String equipmentCode;
@ExcelProperty("*设备名称") private String equipmentName;
@ExcelProperty("设备品牌") private String equipmentBrand;
@ExcelProperty("设备类型") private String equipmentType;
@ExcelProperty("规格型号") private String specificationModel;
@ExcelProperty("出厂日期") @DateTimeFormat("yyyy-MM-dd") private LocalDate factoryDate;
@ExcelProperty("备注") private String remark;
@ExcelIgnore private String errorMessage;
}

View File

@@ -58,7 +58,7 @@ public class EtcRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,64 @@
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ETC记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(22)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class EtcRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车牌号")
private String vehicleNo;
@ExcelProperty("入口时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime entryTime;
@ExcelProperty("ETC卡号")
private String etcCardNo;
@ExcelProperty("出口时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime exitTime;
@ExcelProperty("入口站")
private String entryStation;
@ExcelProperty("交易金额")
private BigDecimal transactionAmount;
@ExcelProperty("出口站")
private String exitStation;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -89,7 +89,7 @@ public class InsuranceRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,98 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 保险记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(18)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class InsuranceRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("保险类型")
private String insuranceType;
@ExcelProperty("保单号")
private String policyNo;
@ExcelProperty("开始日期")
private LocalDate startDate;
@ExcelProperty("结束日期")
private LocalDate endDate;
@ExcelProperty("保额")
private BigDecimal insuredAmount;
@ExcelProperty("保费")
private BigDecimal premium;
@ExcelProperty("发票号")
private String invoiceNo;
@ExcelProperty("开票日期")
private LocalDate invoiceDate;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -100,7 +100,7 @@ public class MaintenancePlanExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,37 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.time.LocalDateTime;
/**
* 车辆保养记录导出 Excel
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MaintenancePlanExportExcel extends MaintenancePlanExcel {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "创建时间", index = 12)
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty(value = "更新人", index = 13)
private String updateUserName;
@ExcelProperty(value = "更新时间", index = 14)
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -27,6 +27,7 @@ package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.format.NumberFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
@@ -64,6 +65,7 @@ public class MaintenanceRecordExcel implements Serializable {
private String maintainer;
@ExcelProperty("*维修时间")
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime maintenanceTime;
@ExcelProperty("维修位置")
@@ -86,12 +88,24 @@ public class MaintenanceRecordExcel implements Serializable {
private String address;
@ExcelProperty("出厂时间")
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime factoryTime;
@ExcelProperty("里程/航程数")
@NumberFormat("0.00")
private BigDecimal mileage;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("里程单位")
private String mileageUnit;
@@ -101,7 +115,7 @@ public class MaintenanceRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,48 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 车辆维修记录导出 Excel
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MaintenanceRecordExportExcel extends MaintenanceRecordExcel {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "导出失败原因", index = 17)
private String errorMessage;
}

View File

@@ -81,7 +81,7 @@ public class MileageRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,90 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.format.NumberFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 里程记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(22)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class MileageRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("上月统计里程数")
@NumberFormat("0.00")
private BigDecimal previousMonthMileage;
@ExcelProperty("本月统计里程数")
@NumberFormat("0.00")
private BigDecimal currentMonthMileage;
@ExcelProperty("本月行驶里程数")
@NumberFormat("0.00")
private BigDecimal monthlyMileage;
@ExcelProperty("累计行驶里程数")
@NumberFormat("0.00")
private BigDecimal totalMileage;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -37,7 +37,7 @@ public class OilElectricRecordExcel implements Serializable {
@ExcelIgnore
private Long id;
@ExcelProperty("卡号")
@ExcelIgnore
private String cardNo;
@ExcelProperty("*交易时间")
@@ -79,7 +79,7 @@ public class OilElectricRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,75 @@
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 油电记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(22)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class OilElectricRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("交易时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime transactionTime;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("费用类型")
private String feeType;
@ExcelProperty("油品")
private String oilProduct;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("持卡人")
private String cardHolder;
@ExcelProperty("数量")
private BigDecimal quantity;
@ExcelProperty("单价")
private BigDecimal unitPrice;
@ExcelProperty("交易金额")
private BigDecimal transactionAmount;
@ExcelProperty("余额")
private BigDecimal balance;
@ExcelProperty("站点")
private String station;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -52,7 +52,7 @@ public class OtherExpenseRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,57 @@
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 其他费用记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(22)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class OtherExpenseRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("费用日期")
private LocalDate expenseDate;
@ExcelProperty("费用类型")
private String expenseType;
@ExcelProperty("金额")
private BigDecimal amount;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -79,7 +79,7 @@ public class TireReplacementRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,91 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.format.NumberFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 换胎记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(18)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class TireReplacementRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车牌号")
private String vehicleNo;
@ExcelProperty("处理人")
private String handler;
@ExcelProperty("换胎时间")
private LocalDate replacementTime;
@ExcelProperty("轮胎品牌")
private String tireBrand;
@ExcelProperty("换胎数量")
private Integer tireQuantity;
@ExcelProperty("换胎费用")
@NumberFormat("0.00")
private BigDecimal replacementCost;
@ExcelProperty("换胎说明")
private String replacementDescription;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -66,7 +66,7 @@ public class TransportChangeRecordExcel implements Serializable {
@ExcelProperty("备注")
private String remark;
@ExcelProperty
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,72 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to these terms.
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 变更记录导出 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(24)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class TransportChangeRecordExportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("车船类型")
private String vehicleType;
@ExcelProperty("车牌号/船号")
private String vehicleNo;
@ExcelProperty("变更事项")
private String changeItem;
@ExcelProperty("变更内容")
private String changeContent;
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -54,46 +54,40 @@ public class TransportShipExcel implements Serializable {
@ExcelIgnore
private Long id;
@ExcelProperty("船舶名")
private String shipName;
@ExcelProperty("船舶识别号")
private String shipIdentifierNo;
@ExcelProperty("所属组织")
@ExcelProperty("所属组织 *")
private String organizationName;
@ExcelProperty("安放龙骨日期")
private LocalDate keelLayingDate;
@ExcelProperty("船名 *")
private String shipName;
@ExcelProperty("建造完工日期")
private LocalDate buildCompletionDate;
@ExcelProperty("安放龙骨日期 / 建造完工日期")
private String constructionDateRange;
@ExcelProperty("总长")
@ExcelProperty("总长 (m)")
private BigDecimal totalLength;
@ExcelProperty("船宽")
@ExcelProperty("船宽 (m)")
private BigDecimal shipWidth;
@ExcelProperty("型深")
@ExcelProperty("型深 (m)")
private BigDecimal moldedDepth;
@ExcelProperty("最大船高")
@ExcelProperty("最大船高 (m)")
private BigDecimal maxShipHeight;
@ExcelProperty("空载吃水")
@ExcelProperty("空载吃水 (t)")
private BigDecimal lightDraft;
@ExcelProperty("满载吃水")
@ExcelProperty("满载吃水 (t)")
private BigDecimal fullLoadDraft;
@ExcelProperty("航区")
@ExcelProperty("航区 *")
private String navigationArea;
@ExcelProperty("登记号码")
@ExcelProperty("登记号码 *")
private String ownershipRegistrationNo;
@ExcelProperty("初次登记号码")
@ExcelProperty("初次登记号码 *")
private String initialRegistrationNo;
@ExcelProperty("船舶所有人")
@@ -102,67 +96,52 @@ public class TransportShipExcel implements Serializable {
@ExcelProperty("取得所有权日期")
private LocalDate ownershipAcquisitionDate;
@ExcelProperty("检登记号")
private String shipInspectionNo;
@ExcelProperty("舶识别号 *")
private String shipIdentifierNo;
@ExcelProperty("船舶类型")
private String shipType;
@ExcelProperty("总吨")
@ExcelProperty("总吨 *")
private BigDecimal grossTonnage;
@ExcelProperty("净吨")
@ExcelProperty("净吨 *")
private BigDecimal netTonnage;
@ExcelProperty("国籍证有效期自")
@ExcelProperty("船检登记号 *")
private String shipInspectionNo;
@ExcelProperty("船舶类型 *")
private String shipType;
@ExcelProperty("证书有效期自 *(国籍证书)")
private LocalDate nationalityCertStartDate;
@ExcelProperty("国籍证有效期至")
@ExcelProperty("至 *(国籍证书)")
private LocalDate nationalityCertEndDate;
@ExcelProperty("国籍证长期有效")
private String nationalityCertLongTermName;
@ExcelProperty("最低安全配员证书有效期自")
@ExcelProperty("证书有效期自 *(最低安全配员证书)")
private LocalDate safeManningCertStartDate;
@ExcelProperty("最低安全配员证书有效期至")
@ExcelProperty("至 *最低安全配员证书")
private LocalDate safeManningCertEndDate;
@ExcelProperty("最低安全配员证书长期有效")
private String safeManningCertLongTermName;
@ExcelProperty("营业运输证证书编号")
private String businessTransportCertNo;
@ExcelProperty("营业运输证发证日期")
private LocalDate businessTransportCertIssueDate;
@ExcelProperty("营业运输证有效期至")
private LocalDate businessTransportCertEndDate;
@ExcelProperty("营业运输证长期有效")
private String businessTransportCertLongTermName;
@ExcelProperty("起租日期")
private LocalDate leaseStartDate;
@ExcelProperty("承租有效期至")
@ExcelProperty("终止日期")
private LocalDate leaseEndDate;
@ExcelProperty("承租长期有效")
private String leaseLongTermName;
@ExcelProperty("船舶承租人")
private String shipLessee;
@ExcelProperty("证书编号(营业运输证)")
private String businessTransportCertNo;
@ExcelProperty("发证日期 *")
private LocalDate businessTransportCertIssueDate;
@ExcelProperty("有效期至 *")
private LocalDate businessTransportCertEndDate;
@ExcelProperty("船舶经营人")
private String shipOperator;
@ExcelProperty("状态")
private String statusName;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -53,88 +53,31 @@ public class TransportVehicleExcel implements Serializable {
@ExcelIgnore
private Long id;
@ExcelProperty("所属组织")
private String organizationName;
@ExcelProperty("车牌号")
@ExcelProperty("车牌号 *")
private String plateNo;
@ExcelProperty("车牌颜色")
private String plateColor;
@ExcelProperty("所属组织 *")
private String organizationName;
@ExcelProperty("车辆类型")
private String vehicleType;
@ExcelProperty("外廓长度(mm)")
private Integer outerLength;
@ExcelProperty("外廓宽度(mm)")
private Integer outerWidth;
@ExcelProperty("外廓高度(mm)")
private Integer outerHeight;
@ExcelProperty("核定载质量(KG)")
private Integer approvedLoadKg;
@ExcelProperty("准牵引总质量(KG)")
private Integer tractionMassKg;
@ExcelProperty("业务关系")
@ExcelProperty("业务关系 *")
private String businessRelation;
@ExcelProperty("能源类型")
private String energyType;
@ExcelProperty("车辆类型 *")
private String vehicleType;
@ExcelProperty("强制报废日期")
private LocalDate compulsoryScrapDate;
@ExcelProperty("核定载质量(KG) *")
private Integer approvedLoadKg;
@ExcelProperty("强制报废长期有效")
private String compulsoryScrapLongTermName;
@ExcelProperty("海关备案号")
private String customsRecordNo;
@ExcelProperty("行驶证档案编号")
private String drivingLicenseNo;
@ExcelProperty("行驶证有效期起")
private LocalDate drivingLicenseStartDate;
@ExcelProperty("行驶证有效期止")
private LocalDate drivingLicenseEndDate;
@ExcelProperty("行驶证长期有效")
private String drivingLicenseLongTermName;
@ExcelProperty("道路运输证号")
private String roadTransportCertNo;
@ExcelProperty("道路运输证有效期起")
private LocalDate roadTransportCertStartDate;
@ExcelProperty("道路运输证有效期止")
private LocalDate roadTransportCertEndDate;
@ExcelProperty("道路运输证长期有效")
private String roadTransportCertLongTermName;
@ExcelProperty("道路运输年审有效期")
private LocalDate annualReviewEndDate;
@ExcelProperty("道路运输年审长期有效")
private String annualReviewLongTermName;
@ExcelProperty("机动车登记编号")
private String registrationNo;
@ExcelProperty("机动车登记日期")
private LocalDate registrationDate;
@ExcelProperty("状态")
@ExcelProperty("车辆状态")
private String statusName;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("行驶证有效期 *")
private LocalDate drivingLicenseEndDate;
@ExcelProperty("道路运输证有效期 *")
private LocalDate roadTransportCertEndDate;
@ExcelProperty("年审有效期")
private LocalDate annualReviewEndDate;
}

View File

@@ -27,6 +27,7 @@ package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
@@ -92,7 +93,18 @@ public class ViolationRecordExcel implements Serializable {
@ExcelProperty("处理结果")
private String processResult;
@ExcelProperty
@ExcelProperty("创建时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@ExcelProperty("更新人")
private String updateUserName;
@ExcelProperty("更新时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@ExcelIgnore
private String errorMessage;
}

View File

@@ -0,0 +1,94 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 违章记录导入 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(18)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class ViolationRecordImportExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("*车船类型")
private String vehicleType;
@ExcelProperty("*车牌号/船号")
private String vehicleNo;
@ExcelProperty("*驾驶人")
private String driverName;
@ExcelProperty("*类型/事项")
private String violationTypeOrItem;
@ExcelProperty("*时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime violationTime;
@ExcelProperty("*地址")
private String location;
@ExcelProperty("被罚金额")
private BigDecimal fineAmount;
@ExcelProperty("被扣分数")
private Integer deductPoints;
@ExcelProperty("被罚单位")
private String penaltyUnit;
@ExcelProperty("*状态")
private String processStatus;
@ExcelProperty("*过程描述")
private String processDescription;
@ExcelProperty("处理结果")
private String processResult;
@ExcelIgnore
private String errorMessage;
}

View File

@@ -37,12 +37,12 @@ import java.util.List;
* @author Chill
*/
@RequiredArgsConstructor
public class ViolationRecordImporter implements ExcelImporter<ViolationRecordExcel> {
public class ViolationRecordImporter implements ExcelImporter<ViolationRecordImportExcel> {
private final IViolationRecordService service;
@Override
public void save(List<ViolationRecordExcel> data) {
public void save(List<ViolationRecordImportExcel> data) {
service.importViolationRecord(data);
}

View File

@@ -44,6 +44,11 @@ public interface CustomerArchiveMapper extends BaseMapper<CustomerArchive> {
* @param customer 查询参数
* @return 客商档案列表
*/
List<CustomerArchiveVO> selectCustomerArchivePage(IPage<CustomerArchiveVO> page, @Param("customer") CustomerArchiveVO customer);
List<CustomerArchiveVO> selectCustomerArchivePage(IPage<CustomerArchiveVO> page,
@Param("customer") CustomerArchiveVO customer, @Param("userId") Long userId);
int selectCustomerPermissionCount(@Param("customerId") Long customerId, @Param("userId") Long userId);
List<Long> selectIncludeNewCustomerUserIds(@Param("tenantId") String tenantId);
}

View File

@@ -91,6 +91,14 @@
approved_time
FROM blade_customer_archive
WHERE is_deleted = 0
<if test="userId != null">
AND EXISTS (
SELECT 1
FROM blade_user_customer_scope bucs
WHERE bucs.user_id = #{userId}
AND bucs.customer_id = blade_customer_archive.id
)
</if>
<if test="customer.customerCode != null and customer.customerCode != ''">
<bind name="customerCodeLike" value="'%' + customer.customerCode + '%'"/>
AND customer_code LIKE #{customerCodeLike}
@@ -136,4 +144,25 @@
ORDER BY create_time DESC
</select>
<select id="selectCustomerPermissionCount" resultType="int">
SELECT COUNT(1)
FROM blade_customer_archive ca
WHERE ca.id = #{customerId}
AND ca.is_deleted = 0
AND EXISTS (
SELECT 1
FROM blade_user_customer_scope bucs
WHERE bucs.user_id = #{userId}
AND bucs.customer_id = ca.id
)
</select>
<select id="selectIncludeNewCustomerUserIds" resultType="long">
SELECT id
FROM blade_user
WHERE tenant_id = #{tenantId}
AND include_new_customer = 1
AND is_deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,23 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.transport.pojo.entity.EquipmentLedger;
import org.springblade.transport.pojo.vo.EquipmentLedgerVO;
import java.util.List;
/**
* 设备台账 Mapper 接口
*
* @author Chill
*/
public interface EquipmentLedgerMapper extends BaseMapper<EquipmentLedger> {
List<EquipmentLedgerVO> selectEquipmentLedgerPage(IPage<EquipmentLedgerVO> page, @Param("equipmentLedger") EquipmentLedgerVO equipmentLedger);
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.transport.mapper.EquipmentLedgerMapper">
<select id="selectEquipmentLedgerPage" resultType="org.springblade.transport.pojo.vo.EquipmentLedgerVO">
SELECT * FROM blade_equipment_ledger
WHERE is_deleted = 0
<if test="equipmentLedger.vehicleNo != null and equipmentLedger.vehicleNo != ''">AND vehicle_no LIKE CONCAT('%', #{equipmentLedger.vehicleNo}, '%')</if>
<if test="equipmentLedger.vehicleType != null and equipmentLedger.vehicleType != ''">AND vehicle_type = #{equipmentLedger.vehicleType}</if>
<if test="equipmentLedger.equipmentCode != null and equipmentLedger.equipmentCode != ''">AND equipment_code LIKE CONCAT('%', #{equipmentLedger.equipmentCode}, '%')</if>
<if test="equipmentLedger.createDept != null">AND create_dept = #{equipmentLedger.createDept}</if>
ORDER BY create_time DESC
</select>
</mapper>

View File

@@ -45,6 +45,8 @@
<result column="registration_date" property="registrationDate"/>
<result column="registration_image" property="registrationImage"/>
<result column="remark" property="remark"/>
<result column="certification_status" property="certificationStatus"/>
<result column="certification_reject_reason" property="certificationRejectReason"/>
</resultMap>
<sql id="BaseColumn">
@@ -90,23 +92,21 @@
registration_date,
registration_image,
remark
, certification_status
, certification_reject_reason
</sql>
<sql id="ExpiryWithin30Condition">
(
(compulsory_scrap_long_term != 1 AND compulsory_scrap_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
OR (driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
(driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
OR (road_transport_cert_long_term != 1 AND road_transport_cert_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
OR (annual_review_long_term != 1 AND annual_review_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
)
</sql>
<sql id="ExpiryExpiredCondition">
(
(compulsory_scrap_long_term != 1 AND compulsory_scrap_date &lt; #{vehicle.today})
OR (driving_license_long_term != 1 AND driving_license_end_date &lt; #{vehicle.today})
(driving_license_long_term != 1 AND driving_license_end_date &lt; #{vehicle.today})
OR (road_transport_cert_long_term != 1 AND road_transport_cert_end_date &lt; #{vehicle.today})
OR (annual_review_long_term != 1 AND annual_review_end_date &lt; #{vehicle.today})
)
</sql>
@@ -132,6 +132,9 @@
<if test="vehicle.status != null">
AND status = #{vehicle.status}
</if>
<if test="vehicle.certificationStatus != null">
AND certification_status = #{vehicle.certificationStatus}
</if>
<if test="vehicle.expireStatus != null and vehicle.expireStatus == 'within30'">
AND <include refid="ExpiryWithin30Condition"/>
</if>

View File

@@ -0,0 +1,7 @@
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.system.pojo.entity.UserCustomerScope;
public interface UserCustomerScopeMapper extends BaseMapper<UserCustomerScope> {
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.AccidentRecordExcel;
import org.springblade.transport.excel.AccidentRecordExportExcel;
import org.springblade.transport.pojo.entity.AccidentRecord;
import org.springblade.transport.pojo.vo.AccidentRecordVO;
@@ -71,6 +72,6 @@ public interface IAccidentRecordService extends BaseService<AccidentRecord> {
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<AccidentRecordExcel> exportAccidentRecord(Wrapper<AccidentRecord> queryWrapper);
List<AccidentRecordExportExcel> exportAccidentRecord(Wrapper<AccidentRecord> queryWrapper);
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.AnnualInspectionRecordExcel;
import org.springblade.transport.excel.AnnualInspectionRecordExportExcel;
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
@@ -47,6 +48,6 @@ public interface IAnnualInspectionRecordService extends BaseService<AnnualInspec
List<AnnualInspectionRecordExcel> importAnnualInspectionRecord(List<AnnualInspectionRecordExcel> data);
List<AnnualInspectionRecordExcel> exportAnnualInspectionRecord(Wrapper<AnnualInspectionRecord> queryWrapper);
List<AnnualInspectionRecordExportExcel> exportAnnualInspectionRecord(Wrapper<AnnualInspectionRecord> queryWrapper);
}

View File

@@ -0,0 +1,28 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.EquipmentLedgerExcel;
import org.springblade.transport.pojo.entity.EquipmentLedger;
import org.springblade.transport.pojo.vo.EquipmentLedgerVO;
import java.util.List;
/**
* 设备台账服务接口
*
* @author Chill
*/
public interface IEquipmentLedgerService extends BaseService<EquipmentLedger> {
IPage<EquipmentLedgerVO> selectEquipmentLedgerPage(IPage<EquipmentLedgerVO> page, EquipmentLedgerVO equipmentLedger);
boolean submit(EquipmentLedger equipmentLedger);
List<EquipmentLedgerExcel> importEquipmentLedger(List<EquipmentLedgerExcel> data);
List<EquipmentLedgerExcel> exportEquipmentLedger(Wrapper<EquipmentLedger> queryWrapper);
String nextEquipmentCode();
}

View File

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.EtcRecordExcel;
import org.springblade.transport.excel.EtcRecordExportExcel;
import org.springblade.transport.pojo.entity.EtcRecord;
import org.springblade.transport.pojo.vo.EtcRecordVO;
@@ -28,6 +29,6 @@ public interface IEtcRecordService extends BaseService<EtcRecord> {
List<EtcRecordExcel> importEtcRecord(List<EtcRecordExcel> data);
List<EtcRecordExcel> exportEtcRecord(Wrapper<EtcRecord> queryWrapper);
List<EtcRecordExportExcel> exportEtcRecord(Wrapper<EtcRecord> queryWrapper);
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.InsuranceRecordExcel;
import org.springblade.transport.excel.InsuranceRecordExportExcel;
import org.springblade.transport.pojo.entity.InsuranceRecord;
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
import org.springframework.web.multipart.MultipartFile;
@@ -72,7 +73,7 @@ public interface IInsuranceRecordService extends BaseService<InsuranceRecord> {
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<InsuranceRecordExcel> exportInsuranceRecord(Wrapper<InsuranceRecord> queryWrapper);
List<InsuranceRecordExportExcel> exportInsuranceRecord(Wrapper<InsuranceRecord> queryWrapper);
/**
* 识别保单文件

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.MaintenancePlanExcel;
import org.springblade.transport.excel.MaintenancePlanExportExcel;
import org.springblade.transport.pojo.entity.MaintenancePlan;
import org.springblade.transport.pojo.vo.MaintenancePlanVO;
@@ -71,6 +72,6 @@ public interface IMaintenancePlanService extends BaseService<MaintenancePlan> {
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<MaintenancePlanExcel> exportMaintenancePlan(Wrapper<MaintenancePlan> queryWrapper);
List<MaintenancePlanExportExcel> exportMaintenancePlan(Wrapper<MaintenancePlan> queryWrapper);
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.MaintenanceRecordExcel;
import org.springblade.transport.excel.MaintenanceRecordExportExcel;
import org.springblade.transport.pojo.entity.MaintenanceRecord;
import org.springblade.transport.pojo.vo.MaintenanceRecordVO;
@@ -71,6 +72,6 @@ public interface IMaintenanceRecordService extends BaseService<MaintenanceRecord
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<MaintenanceRecordExcel> exportMaintenanceRecord(Wrapper<MaintenanceRecord> queryWrapper);
List<MaintenanceRecordExportExcel> exportMaintenanceRecord(Wrapper<MaintenanceRecord> queryWrapper);
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.MileageRecordExcel;
import org.springblade.transport.excel.MileageRecordExportExcel;
import org.springblade.transport.pojo.entity.MileageRecord;
import org.springblade.transport.pojo.vo.MileageRecordVO;
@@ -47,6 +48,6 @@ public interface IMileageRecordService extends BaseService<MileageRecord> {
List<MileageRecordExcel> importMileageRecord(List<MileageRecordExcel> data);
List<MileageRecordExcel> exportMileageRecord(Wrapper<MileageRecord> queryWrapper);
List<MileageRecordExportExcel> exportMileageRecord(Wrapper<MileageRecord> queryWrapper);
}

View File

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.OilElectricRecordExcel;
import org.springblade.transport.excel.OilElectricRecordExportExcel;
import org.springblade.transport.pojo.entity.OilElectricRecord;
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
@@ -28,6 +29,6 @@ public interface IOilElectricRecordService extends BaseService<OilElectricRecord
List<OilElectricRecordExcel> importOilElectricRecord(List<OilElectricRecordExcel> data);
List<OilElectricRecordExcel> exportOilElectricRecord(Wrapper<OilElectricRecord> queryWrapper);
List<OilElectricRecordExportExcel> exportOilElectricRecord(Wrapper<OilElectricRecord> queryWrapper);
}

View File

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.OtherExpenseRecordExcel;
import org.springblade.transport.excel.OtherExpenseRecordExportExcel;
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
@@ -28,6 +29,6 @@ public interface IOtherExpenseRecordService extends BaseService<OtherExpenseReco
List<OtherExpenseRecordExcel> importOtherExpenseRecord(List<OtherExpenseRecordExcel> data);
List<OtherExpenseRecordExcel> exportOtherExpenseRecord(Wrapper<OtherExpenseRecord> queryWrapper);
List<OtherExpenseRecordExportExcel> exportOtherExpenseRecord(Wrapper<OtherExpenseRecord> queryWrapper);
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.TireReplacementRecordExcel;
import org.springblade.transport.excel.TireReplacementRecordExportExcel;
import org.springblade.transport.pojo.entity.TireReplacementRecord;
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
@@ -71,6 +72,6 @@ public interface ITireReplacementRecordService extends BaseService<TireReplaceme
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<TireReplacementRecordExcel> exportTireReplacementRecord(Wrapper<TireReplacementRecord> queryWrapper);
List<TireReplacementRecordExportExcel> exportTireReplacementRecord(Wrapper<TireReplacementRecord> queryWrapper);
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.TransportChangeRecordExcel;
import org.springblade.transport.excel.TransportChangeRecordExportExcel;
import org.springblade.transport.pojo.entity.TransportChangeRecord;
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
@@ -47,6 +48,6 @@ public interface ITransportChangeRecordService extends BaseService<TransportChan
List<TransportChangeRecordExcel> importTransportChangeRecord(List<TransportChangeRecordExcel> data);
List<TransportChangeRecordExcel> exportTransportChangeRecord(Wrapper<TransportChangeRecord> queryWrapper);
List<TransportChangeRecordExportExcel> exportTransportChangeRecord(Wrapper<TransportChangeRecord> queryWrapper);
}

View File

@@ -68,6 +68,9 @@ public interface ITransportVehicleService extends BaseService<TransportVehicle>
*/
boolean changeStatus(Long id, Integer status);
/** 审核车辆认证 */
boolean auditCertification(Long id, Integer certificationStatus, String rejectReason);
/**
* 证件有效期统计
*

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.ViolationRecordExcel;
import org.springblade.transport.excel.ViolationRecordImportExcel;
import org.springblade.transport.pojo.entity.ViolationRecord;
import org.springblade.transport.pojo.vo.ViolationRecordVO;
@@ -63,7 +64,7 @@ public interface IViolationRecordService extends BaseService<ViolationRecord> {
*
* @param data 导入数据
*/
List<ViolationRecordExcel> importViolationRecord(List<ViolationRecordExcel> data);
List<ViolationRecordImportExcel> importViolationRecord(List<ViolationRecordImportExcel> data);
/**
* 导出违章记录

View File

@@ -32,6 +32,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.AccidentRecordExcel;
import org.springblade.transport.excel.AccidentRecordExportExcel;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.mapper.AccidentRecordMapper;
import org.springblade.transport.pojo.entity.AccidentRecord;
import org.springblade.transport.pojo.vo.AccidentRecordVO;
@@ -63,7 +65,9 @@ public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMap
@Override
public IPage<AccidentRecordVO> selectAccidentRecordPage(IPage<AccidentRecordVO> page, AccidentRecordVO accidentRecord) {
return page.setRecords(baseMapper.selectAccidentRecordPage(page, accidentRecord));
List<AccidentRecordVO> records = baseMapper.selectAccidentRecordPage(page, accidentRecord);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -96,11 +100,12 @@ public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMap
}
@Override
public List<AccidentRecordExcel> exportAccidentRecord(Wrapper<AccidentRecord> queryWrapper) {
public List<AccidentRecordExportExcel> exportAccidentRecord(Wrapper<AccidentRecord> queryWrapper) {
return list(queryWrapper).stream().map(accidentRecord -> {
AccidentRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(accidentRecord, AccidentRecordExcel.class));
AccidentRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(accidentRecord, AccidentRecordExportExcel.class));
excel.setDirectEconomicLoss(nonNegative(accidentRecord.getDirectEconomicLoss()));
excel.setInsuranceClaimAmount(nonNegative(accidentRecord.getInsuranceClaimAmount()));
excel.setUpdateUserName(UserCache.getUserRealName(accidentRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -31,7 +31,9 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.AnnualInspectionRecordExcel;
import org.springblade.transport.excel.AnnualInspectionRecordExportExcel;
import org.springblade.transport.mapper.AnnualInspectionRecordMapper;
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
@@ -65,7 +67,9 @@ public class AnnualInspectionRecordServiceImpl extends BaseServiceImpl<AnnualIns
@Override
public IPage<AnnualInspectionRecordVO> selectAnnualInspectionRecordPage(IPage<AnnualInspectionRecordVO> page, AnnualInspectionRecordVO annualInspectionRecord) {
return page.setRecords(baseMapper.selectAnnualInspectionRecordPage(page, annualInspectionRecord));
List<AnnualInspectionRecordVO> records = baseMapper.selectAnnualInspectionRecordPage(page, annualInspectionRecord);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -98,12 +102,13 @@ public class AnnualInspectionRecordServiceImpl extends BaseServiceImpl<AnnualIns
}
@Override
public List<AnnualInspectionRecordExcel> exportAnnualInspectionRecord(Wrapper<AnnualInspectionRecord> queryWrapper) {
public List<AnnualInspectionRecordExportExcel> exportAnnualInspectionRecord(Wrapper<AnnualInspectionRecord> queryWrapper) {
return list(queryWrapper).stream().map(annualInspectionRecord -> {
AnnualInspectionRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(annualInspectionRecord, AnnualInspectionRecordExcel.class));
AnnualInspectionRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(annualInspectionRecord, AnnualInspectionRecordExportExcel.class));
excel.setVehicleTechnicalLevel(VEHICLE.equals(annualInspectionRecord.getVehicleType()) ? annualInspectionRecord.getVehicleTechnicalLevel() : null);
excel.setShipInspectionType(SHIP.equals(annualInspectionRecord.getVehicleType()) ? annualInspectionRecord.getShipInspectionType() : null);
excel.setFee(nonNegative(annualInspectionRecord.getFee()));
excel.setUpdateUserName(UserCache.getUserRealName(annualInspectionRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -46,6 +46,7 @@ import org.springblade.transport.mapper.CustomerCreditScoreDetailMapper;
import org.springblade.transport.mapper.CustomerCreditScoreMapper;
import org.springblade.transport.mapper.CustomerInvoiceInfoMapper;
import org.springblade.transport.mapper.CustomerReceiptAccountMapper;
import org.springblade.transport.mapper.UserCustomerScopeMapper;
import org.springblade.transport.pojo.entity.CreditRatingStandard;
import org.springblade.transport.pojo.entity.CreditScoreCategory;
import org.springblade.transport.pojo.entity.CreditScoreItem;
@@ -67,6 +68,7 @@ import org.springblade.transport.pojo.vo.CreditRatingStandardVO;
import org.springblade.transport.pojo.vo.CustomerInvoiceInfoVO;
import org.springblade.transport.pojo.vo.CustomerReceiptAccountVO;
import org.springblade.transport.service.ICustomerArchiveService;
import org.springblade.system.pojo.entity.UserCustomerScope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -112,10 +114,11 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
private final CreditScoreItemMapper itemMapper;
private final CreditScoreItemOptionMapper optionMapper;
private final CreditRatingStandardMapper standardMapper;
private final UserCustomerScopeMapper userCustomerScopeMapper;
@Override
public IPage<CustomerArchiveVO> selectCustomerArchivePage(IPage<CustomerArchiveVO> page, CustomerArchiveVO customer) {
return page.setRecords(baseMapper.selectCustomerArchivePage(page, customer));
return page.setRecords(baseMapper.selectCustomerArchivePage(page, customer, AuthUtil.getUserId()));
}
@Override
@@ -127,6 +130,9 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
if (Func.isEmpty(customer) || Objects.equals(customer.getIsDeleted(), 1)) {
throw new ServiceException("客商档案不存在");
}
if (baseMapper.selectCustomerPermissionCount(id, AuthUtil.getUserId()) == 0) {
throw new ServiceException("无权访问该客商档案");
}
CustomerArchiveVO detail = Objects.requireNonNull(BeanUtil.copyProperties(customer, CustomerArchiveVO.class));
detail.setContacts(loadContacts(id));
detail.setReceiptAccounts(loadReceiptAccounts(id));
@@ -149,6 +155,9 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
boolean result = saveOrUpdate(entity);
customer.setId(entity.getId());
replaceDetail(entity.getId(), customer);
if (created && result) {
grantNewCustomerToIncludedUsers(entity);
}
addChangeRecord(entity.getId(), created ? "新增客商档案" : "修改客商档案");
return result;
}
@@ -708,6 +717,15 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
}
}
private void grantNewCustomerToIncludedUsers(CustomerArchive customer) {
baseMapper.selectIncludeNewCustomerUserIds(customer.getTenantId()).forEach(userId -> {
UserCustomerScope scope = new UserCustomerScope();
scope.setUserId(userId);
scope.setCustomerId(customer.getId());
userCustomerScopeMapper.insert(scope);
});
}
private String nextCustomerCode() {
CustomerArchive latest = list(Wrappers.<CustomerArchive>lambdaQuery()
.likeRight(CustomerArchive::getCustomerCode, CUSTOMER_CODE_PREFIX)

View File

@@ -53,7 +53,7 @@ import java.util.Objects;
@Service
public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> implements IDriverService {
private static final int NAME_MAX_LENGTH = 20;
private static final int NAME_MAX_LENGTH = 10;
private static final int ID_CARD_MAX_LENGTH = 18;
private static final int MOBILE_MAX_LENGTH = 20;
private static final int SHORT_TEXT_MAX_LENGTH = 50;
@@ -110,9 +110,8 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
public List<DriverExcel> exportDriver(Wrapper<Driver> queryWrapper) {
return list(queryWrapper).stream().map(driver -> {
DriverExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(driver, DriverExcel.class));
excel.setStatusName(driver.getStatus() != null && driver.getStatus() == 2 ? "停用" : "启用");
excel.setDrivingLicenseLongTermName(driver.getDrivingLicenseLongTerm() != null && driver.getDrivingLicenseLongTerm() == 1 ? "" : "");
excel.setQualificationLongTermName(driver.getQualificationLongTerm() != null && driver.getQualificationLongTerm() == 1 ? "" : "");
excel.setAddress((driver.getAddressRegion() == null ? "" : driver.getAddressRegion())
+ (driver.getAddress() == null ? "" : driver.getAddress()));
return excel;
}).toList();
}
@@ -210,6 +209,9 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
if (Func.isEmpty(driver.getEmergencyContactName())) {
throw new ServiceException("紧急联系人姓名不能为空");
}
if (driver.getEmergencyContactName().matches(".*\\d.*")) {
throw new ServiceException("紧急联系人姓名不能包含数字");
}
if (Func.isEmpty(driver.getEmergencyContactMobile())) {
throw new ServiceException("紧急联系人手机号不能为空");
}
@@ -219,7 +221,7 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
if (Func.isEmpty(driver.getDrivingLicenseFront()) || Func.isEmpty(driver.getDrivingLicenseBack())) {
throw new ServiceException("驾驶证主页和副页不能为空");
}
validateLength(driver.getDriverName(), NAME_MAX_LENGTH, "司机姓名不能超过20字");
validateLength(driver.getDriverName(), NAME_MAX_LENGTH, "司机姓名不能超过10字");
validateLength(driver.getIdCardNo(), ID_CARD_MAX_LENGTH, "身份证号不能超过18字");
validateLength(driver.getMobile(), MOBILE_MAX_LENGTH, "手机号不能超过20字");
validateLength(driver.getEmergencyContactMobile(), MOBILE_MAX_LENGTH, "紧急联系人手机号不能超过20字");

View File

@@ -0,0 +1,181 @@
package org.springblade.transport.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.EquipmentLedgerExcel;
import org.springblade.transport.mapper.EquipmentLedgerMapper;
import org.springblade.transport.pojo.entity.EquipmentLedger;
import org.springblade.transport.pojo.vo.EquipmentLedgerVO;
import org.springblade.transport.service.IEquipmentLedgerService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 设备台账服务实现
*
* @author Chill
*/
@Service
public class EquipmentLedgerServiceImpl extends BaseServiceImpl<EquipmentLedgerMapper, EquipmentLedger> implements IEquipmentLedgerService {
private static final String VEHICLE = "车辆";
private static final String SHIP = "船舶";
private static final int VEHICLE_NO_MAX_LENGTH = 30;
private static final int EQUIPMENT_CODE_MAX_LENGTH = 12;
private static final int EQUIPMENT_NAME_MAX_LENGTH = 100;
private static final int EQUIPMENT_BRAND_MAX_LENGTH = 50;
private static final int EQUIPMENT_TYPE_MAX_LENGTH = 50;
private static final int SPECIFICATION_MODEL_MAX_LENGTH = 100;
private static final int ORIGINAL_EQUIPMENT_NO_MAX_LENGTH = 100;
private static final int REMARK_MAX_LENGTH = 200;
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
@Override
public IPage<EquipmentLedgerVO> selectEquipmentLedgerPage(IPage<EquipmentLedgerVO> page, EquipmentLedgerVO equipmentLedger) {
List<EquipmentLedgerVO> records = baseMapper.selectEquipmentLedgerPage(page, equipmentLedger);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(EquipmentLedger equipmentLedger) {
prepare(equipmentLedger);
if (equipmentLedger.getId() == null && Func.isEmpty(equipmentLedger.getEquipmentCode())) {
equipmentLedger.setEquipmentCode(nextEquipmentCode());
}
validate(equipmentLedger);
validateEquipmentCodeImmutable(equipmentLedger);
return saveOrUpdate(equipmentLedger);
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<EquipmentLedgerExcel> importEquipmentLedger(List<EquipmentLedgerExcel> data) {
if (Func.isEmpty(data)) {
throw new ServiceException("导入数据不能为空");
}
List<EquipmentLedgerExcel> errorList = new ArrayList<>();
for (int index = 0; index < data.size(); index++) {
EquipmentLedgerExcel excel = data.get(index);
try {
EquipmentLedger equipmentLedger = Objects.requireNonNull(BeanUtil.copyProperties(excel, EquipmentLedger.class));
submit(equipmentLedger);
} catch (Exception exception) {
excel.setErrorMessage("" + (index + 2) + "行:" + exception.getMessage());
errorList.add(excel);
}
}
return errorList;
}
@Override
public List<EquipmentLedgerExcel> exportEquipmentLedger(Wrapper<EquipmentLedger> queryWrapper) {
return list(queryWrapper).stream()
.map(item -> Objects.requireNonNull(BeanUtil.copyProperties(item, EquipmentLedgerExcel.class)))
.toList();
}
@Override
public String nextEquipmentCode() {
String prefix = "EQ" + LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
for (int sequence = 1; sequence <= 99; sequence++) {
String code = prefix + String.format("%02d", sequence);
if (!exists(new LambdaQueryWrapper<EquipmentLedger>().eq(EquipmentLedger::getEquipmentCode, code))) {
return code;
}
}
throw new ServiceException("当天设备编号已达到上限");
}
private void prepare(EquipmentLedger equipmentLedger) {
equipmentLedger.setVehicleType(trimToEmpty(equipmentLedger.getVehicleType()));
equipmentLedger.setVehicleNo(trimToEmpty(equipmentLedger.getVehicleNo()));
if (VEHICLE.equals(equipmentLedger.getVehicleType())) {
equipmentLedger.setVehicleNo(equipmentLedger.getVehicleNo().toUpperCase());
}
equipmentLedger.setEquipmentCode(trimToNull(equipmentLedger.getEquipmentCode()));
equipmentLedger.setEquipmentName(trimToNull(equipmentLedger.getEquipmentName()));
equipmentLedger.setEquipmentBrand(trimToNull(equipmentLedger.getEquipmentBrand()));
equipmentLedger.setEquipmentType(trimToNull(equipmentLedger.getEquipmentType()));
equipmentLedger.setSpecificationModel(trimToNull(equipmentLedger.getSpecificationModel()));
equipmentLedger.setOriginalEquipmentNo(trimToNull(equipmentLedger.getOriginalEquipmentNo()));
equipmentLedger.setAttachments(trimToNull(equipmentLedger.getAttachments()));
equipmentLedger.setRemark(trimToNull(equipmentLedger.getRemark()));
if (equipmentLedger.getOnlineStatus() == null) {
equipmentLedger.setOnlineStatus(0);
}
}
private void validate(EquipmentLedger equipmentLedger) {
if (!VEHICLE.equals(equipmentLedger.getVehicleType()) && !SHIP.equals(equipmentLedger.getVehicleType())) {
throw new ServiceException("车船类型不正确");
}
if (Func.isEmpty(equipmentLedger.getVehicleNo())) {
throw new ServiceException("车牌号/船号不能为空");
}
if (Func.isEmpty(equipmentLedger.getEquipmentCode())) {
throw new ServiceException("设备编号不能为空");
}
if (Func.isEmpty(equipmentLedger.getEquipmentName())) {
throw new ServiceException("设备名称不能为空");
}
if (equipmentLedger.getOnlineStatus() != 0 && equipmentLedger.getOnlineStatus() != 1) {
throw new ServiceException("是否在线不正确");
}
validateLength(equipmentLedger.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
validateLength(equipmentLedger.getEquipmentCode(), EQUIPMENT_CODE_MAX_LENGTH, "设备编号格式不正确");
validateLength(equipmentLedger.getEquipmentName(), EQUIPMENT_NAME_MAX_LENGTH, "设备名称不能超过100字");
validateLength(equipmentLedger.getEquipmentBrand(), EQUIPMENT_BRAND_MAX_LENGTH, "设备品牌不能超过50字");
validateLength(equipmentLedger.getEquipmentType(), EQUIPMENT_TYPE_MAX_LENGTH, "设备类型不能超过50字");
validateLength(equipmentLedger.getSpecificationModel(), SPECIFICATION_MODEL_MAX_LENGTH, "规格型号不能超过100字");
validateLength(equipmentLedger.getOriginalEquipmentNo(), ORIGINAL_EQUIPMENT_NO_MAX_LENGTH, "原厂设备号不能超过100字");
validateLength(equipmentLedger.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
validateLength(equipmentLedger.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
}
private void validateEquipmentCodeImmutable(EquipmentLedger equipmentLedger) {
EquipmentLedger existing = getOne(new LambdaQueryWrapper<EquipmentLedger>()
.eq(EquipmentLedger::getEquipmentCode, equipmentLedger.getEquipmentCode())
.ne(equipmentLedger.getId() != null, EquipmentLedger::getId, equipmentLedger.getId()));
if (existing != null) {
throw new ServiceException("设备编号已存在");
}
if (equipmentLedger.getId() != null) {
EquipmentLedger current = getById(equipmentLedger.getId());
if (current == null) {
throw new ServiceException("设备台账不存在");
}
if (!Objects.equals(current.getEquipmentCode(), equipmentLedger.getEquipmentCode())) {
throw new ServiceException("设备编号不允许修改");
}
}
}
private void validateLength(String value, int maxLength, String message) {
if (Func.isNotEmpty(value) && value.length() > maxLength) {
throw new ServiceException(message);
}
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}
private String trimToNull(String value) {
String trimValue = trimToEmpty(value);
return trimValue.isEmpty() ? null : trimValue;
}
}

View File

@@ -14,6 +14,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.EtcRecordExcel;
import org.springblade.transport.excel.EtcRecordExportExcel;
import org.springblade.transport.mapper.EtcRecordMapper;
import org.springblade.transport.pojo.entity.EtcRecord;
import org.springblade.transport.pojo.vo.EtcRecordVO;
@@ -78,10 +79,11 @@ public class EtcRecordServiceImpl extends BaseServiceImpl<EtcRecordMapper, EtcRe
}
@Override
public List<EtcRecordExcel> exportEtcRecord(Wrapper<EtcRecord> queryWrapper) {
public List<EtcRecordExportExcel> exportEtcRecord(Wrapper<EtcRecord> queryWrapper) {
return list(queryWrapper).stream().map(etcRecord -> {
EtcRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(etcRecord, EtcRecordExcel.class));
EtcRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(etcRecord, EtcRecordExportExcel.class));
excel.setTransactionAmount(nonNegative(etcRecord.getTransactionAmount()));
excel.setUpdateUserName(UserCache.getUserRealName(etcRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -32,7 +32,9 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.InsuranceRecordExcel;
import org.springblade.transport.excel.InsuranceRecordExportExcel;
import org.springblade.transport.mapper.InsuranceRecordMapper;
import org.springblade.transport.pojo.entity.InsuranceRecord;
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
@@ -66,7 +68,9 @@ public class InsuranceRecordServiceImpl extends BaseServiceImpl<InsuranceRecordM
@Override
public IPage<InsuranceRecordVO> selectInsuranceRecordPage(IPage<InsuranceRecordVO> page, InsuranceRecordVO insuranceRecord) {
return page.setRecords(baseMapper.selectInsuranceRecordPage(page, insuranceRecord));
List<InsuranceRecordVO> records = baseMapper.selectInsuranceRecordPage(page, insuranceRecord);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -99,11 +103,12 @@ public class InsuranceRecordServiceImpl extends BaseServiceImpl<InsuranceRecordM
}
@Override
public List<InsuranceRecordExcel> exportInsuranceRecord(Wrapper<InsuranceRecord> queryWrapper) {
public List<InsuranceRecordExportExcel> exportInsuranceRecord(Wrapper<InsuranceRecord> queryWrapper) {
return list(queryWrapper).stream().map(insuranceRecord -> {
InsuranceRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(insuranceRecord, InsuranceRecordExcel.class));
InsuranceRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(insuranceRecord, InsuranceRecordExportExcel.class));
excel.setInsuredAmount(nonNegative(insuranceRecord.getInsuredAmount()));
excel.setPremium(nonNegative(insuranceRecord.getPremium()));
excel.setUpdateUserName(UserCache.getUserRealName(insuranceRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -31,7 +31,9 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.MaintenancePlanExcel;
import org.springblade.transport.excel.MaintenancePlanExportExcel;
import org.springblade.transport.mapper.MaintenancePlanMapper;
import org.springblade.transport.pojo.entity.MaintenancePlan;
import org.springblade.transport.pojo.vo.MaintenancePlanVO;
@@ -60,7 +62,9 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM
@Override
public IPage<MaintenancePlanVO> selectMaintenancePlanPage(IPage<MaintenancePlanVO> page, MaintenancePlanVO maintenancePlan) {
return page.setRecords(baseMapper.selectMaintenancePlanPage(page, maintenancePlan));
List<MaintenancePlanVO> records = baseMapper.selectMaintenancePlanPage(page, maintenancePlan);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -92,9 +96,10 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM
}
@Override
public List<MaintenancePlanExcel> exportMaintenancePlan(Wrapper<MaintenancePlan> queryWrapper) {
public List<MaintenancePlanExportExcel> exportMaintenancePlan(Wrapper<MaintenancePlan> queryWrapper) {
return list(queryWrapper).stream().map(maintenancePlan -> {
MaintenancePlanExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(maintenancePlan, MaintenancePlanExcel.class));
MaintenancePlanExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(maintenancePlan, MaintenancePlanExportExcel.class));
excel.setUpdateUserName(UserCache.getUserRealName(maintenancePlan.getUpdateUser()));
excel.setMileage(nonNegative(maintenancePlan.getMileage()));
excel.setNextMaintenanceMileage(nonNegative(maintenancePlan.getNextMaintenanceMileage()));
if (Func.isEmpty(excel.getMileageUnit())) {

View File

@@ -31,7 +31,9 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.MaintenanceRecordExcel;
import org.springblade.transport.excel.MaintenanceRecordExportExcel;
import org.springblade.transport.mapper.MaintenanceRecordMapper;
import org.springblade.transport.pojo.entity.MaintenanceRecord;
import org.springblade.transport.pojo.vo.MaintenanceRecordVO;
@@ -62,7 +64,9 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
@Override
public IPage<MaintenanceRecordVO> selectMaintenanceRecordPage(IPage<MaintenanceRecordVO> page, MaintenanceRecordVO maintenanceRecord) {
return page.setRecords(baseMapper.selectMaintenanceRecordPage(page, maintenanceRecord));
List<MaintenanceRecordVO> records = baseMapper.selectMaintenanceRecordPage(page, maintenanceRecord);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -84,6 +88,8 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
MaintenanceRecordExcel excel = data.get(index);
try {
MaintenanceRecord maintenanceRecord = Objects.requireNonNull(BeanUtil.copyProperties(excel, MaintenanceRecord.class));
maintenanceRecord.setCreateTime(null);
maintenanceRecord.setUpdateTime(null);
submit(maintenanceRecord);
} catch (Exception exception) {
excel.setErrorMessage("" + (index + 2) + "行:" + exception.getMessage());
@@ -94,11 +100,12 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
}
@Override
public List<MaintenanceRecordExcel> exportMaintenanceRecord(Wrapper<MaintenanceRecord> queryWrapper) {
public List<MaintenanceRecordExportExcel> exportMaintenanceRecord(Wrapper<MaintenanceRecord> queryWrapper) {
return list(queryWrapper).stream().map(maintenanceRecord -> {
MaintenanceRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(maintenanceRecord, MaintenanceRecordExcel.class));
MaintenanceRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(maintenanceRecord, MaintenanceRecordExportExcel.class));
excel.setCost(scaleAmount(maintenanceRecord.getCost()));
excel.setMileage(scaleAmount(nonNegative(maintenanceRecord.getMileage())));
excel.setUpdateUserName(UserCache.getUserRealName(maintenanceRecord.getUpdateUser()));
if (Func.isEmpty(excel.getMileageUnit())) {
excel.setMileageUnit(defaultMileageUnit(maintenanceRecord.getVehicleType()));
}

View File

@@ -33,6 +33,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.MileageRecordExcel;
import org.springblade.transport.excel.MileageRecordExportExcel;
import org.springblade.transport.mapper.MileageRecordMapper;
import org.springblade.transport.pojo.entity.MileageRecord;
import org.springblade.transport.pojo.vo.MileageRecordVO;
@@ -97,18 +98,16 @@ public class MileageRecordServiceImpl extends BaseServiceImpl<MileageRecordMappe
}
@Override
public List<MileageRecordExcel> exportMileageRecord(Wrapper<MileageRecord> queryWrapper) {
public List<MileageRecordExportExcel> exportMileageRecord(Wrapper<MileageRecord> queryWrapper) {
return list(queryWrapper).stream().map(mileageRecord -> {
MileageRecordExcel excel = Objects.requireNonNull(
BeanUtil.copyProperties(mileageRecord, MileageRecordExcel.class)
MileageRecordExportExcel excel = Objects.requireNonNull(
BeanUtil.copyProperties(mileageRecord, MileageRecordExportExcel.class)
);
excel.setPreviousMonthMileage(nonNegative(mileageRecord.getPreviousMonthMileage()));
excel.setCurrentMonthMileage(nonNegative(mileageRecord.getCurrentMonthMileage()));
excel.setMonthlyMileage(nonNegative(mileageRecord.getMonthlyMileage()));
excel.setTotalMileage(nonNegative(mileageRecord.getTotalMileage()));
if (Func.isEmpty(excel.getMileageUnit())) {
excel.setMileageUnit(defaultMileageUnit(mileageRecord.getVehicleType()));
}
excel.setUpdateUserName(UserCache.getUserRealName(mileageRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -14,6 +14,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.OilElectricRecordExcel;
import org.springblade.transport.excel.OilElectricRecordExportExcel;
import org.springblade.transport.mapper.OilElectricRecordMapper;
import org.springblade.transport.pojo.entity.OilElectricRecord;
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
@@ -87,13 +88,14 @@ public class OilElectricRecordServiceImpl extends BaseServiceImpl<OilElectricRec
}
@Override
public List<OilElectricRecordExcel> exportOilElectricRecord(Wrapper<OilElectricRecord> queryWrapper) {
public List<OilElectricRecordExportExcel> exportOilElectricRecord(Wrapper<OilElectricRecord> queryWrapper) {
return list(queryWrapper).stream().map(oilElectricRecord -> {
OilElectricRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(oilElectricRecord, OilElectricRecordExcel.class));
OilElectricRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(oilElectricRecord, OilElectricRecordExportExcel.class));
excel.setQuantity(nonNegative(oilElectricRecord.getQuantity()));
excel.setUnitPrice(nonNegative(oilElectricRecord.getUnitPrice()));
excel.setTransactionAmount(nonNegative(oilElectricRecord.getTransactionAmount()));
excel.setBalance(nonNegative(oilElectricRecord.getBalance()));
excel.setUpdateUserName(UserCache.getUserRealName(oilElectricRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -14,6 +14,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.OtherExpenseRecordExcel;
import org.springblade.transport.excel.OtherExpenseRecordExportExcel;
import org.springblade.transport.mapper.OtherExpenseRecordMapper;
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
@@ -81,10 +82,11 @@ public class OtherExpenseRecordServiceImpl extends BaseServiceImpl<OtherExpenseR
}
@Override
public List<OtherExpenseRecordExcel> exportOtherExpenseRecord(Wrapper<OtherExpenseRecord> queryWrapper) {
public List<OtherExpenseRecordExportExcel> exportOtherExpenseRecord(Wrapper<OtherExpenseRecord> queryWrapper) {
return list(queryWrapper).stream().map(otherExpenseRecord -> {
OtherExpenseRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(otherExpenseRecord, OtherExpenseRecordExcel.class));
OtherExpenseRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(otherExpenseRecord, OtherExpenseRecordExportExcel.class));
excel.setAmount(nonNegative(otherExpenseRecord.getAmount()));
excel.setUpdateUserName(UserCache.getUserRealName(otherExpenseRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -31,7 +31,9 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.TireReplacementRecordExcel;
import org.springblade.transport.excel.TireReplacementRecordExportExcel;
import org.springblade.transport.mapper.TireReplacementRecordMapper;
import org.springblade.transport.pojo.entity.TireReplacementRecord;
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
@@ -62,7 +64,9 @@ public class TireReplacementRecordServiceImpl extends BaseServiceImpl<TireReplac
@Override
public IPage<TireReplacementRecordVO> selectTireReplacementRecordPage(IPage<TireReplacementRecordVO> page, TireReplacementRecordVO tireReplacementRecord) {
return page.setRecords(baseMapper.selectTireReplacementRecordPage(page, tireReplacementRecord));
List<TireReplacementRecordVO> records = baseMapper.selectTireReplacementRecordPage(page, tireReplacementRecord);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -94,11 +98,12 @@ public class TireReplacementRecordServiceImpl extends BaseServiceImpl<TireReplac
}
@Override
public List<TireReplacementRecordExcel> exportTireReplacementRecord(Wrapper<TireReplacementRecord> queryWrapper) {
public List<TireReplacementRecordExportExcel> exportTireReplacementRecord(Wrapper<TireReplacementRecord> queryWrapper) {
return list(queryWrapper).stream().map(tireReplacementRecord -> {
TireReplacementRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(tireReplacementRecord, TireReplacementRecordExcel.class));
TireReplacementRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(tireReplacementRecord, TireReplacementRecordExportExcel.class));
excel.setTireQuantity(validQuantity(tireReplacementRecord.getTireQuantity()));
excel.setReplacementCost(nonNegative(tireReplacementRecord.getReplacementCost()));
excel.setUpdateUserName(UserCache.getUserRealName(tireReplacementRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -33,6 +33,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.TransportChangeRecordExcel;
import org.springblade.transport.excel.TransportChangeRecordExportExcel;
import org.springblade.transport.mapper.TransportChangeRecordMapper;
import org.springblade.transport.pojo.entity.TransportChangeRecord;
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
@@ -97,9 +98,13 @@ public class TransportChangeRecordServiceImpl extends BaseServiceImpl<TransportC
}
@Override
public List<TransportChangeRecordExcel> exportTransportChangeRecord(Wrapper<TransportChangeRecord> queryWrapper) {
public List<TransportChangeRecordExportExcel> exportTransportChangeRecord(Wrapper<TransportChangeRecord> queryWrapper) {
return list(queryWrapper).stream()
.map(transportChangeRecord -> Objects.requireNonNull(BeanUtil.copyProperties(transportChangeRecord, TransportChangeRecordExcel.class)))
.map(transportChangeRecord -> {
TransportChangeRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(transportChangeRecord, TransportChangeRecordExportExcel.class));
excel.setUpdateUserName(UserCache.getUserRealName(transportChangeRecord.getUpdateUser()));
return excel;
})
.toList();
}

View File

@@ -55,11 +55,13 @@ import java.util.Objects;
public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMapper, TransportShip> implements ITransportShipService {
private static final int NAME_MAX_LENGTH = 50;
private static final int SHIP_NAME_MAX_LENGTH = 20;
private static final int SHORT_TEXT_MAX_LENGTH = 50;
private static final int REMARK_MAX_LENGTH = 200;
private static final int DEFAULT_ENABLED_STATUS = 1;
private static final int DEFAULT_FALSE = 0;
private static final BigDecimal ZERO = BigDecimal.ZERO;
private static final List<String> SHIP_TYPES = List.of("散货船", "集装箱船", "杂货船", "油船");
@Override
public IPage<TransportShipVO> selectTransportShipPage(IPage<TransportShipVO> page, TransportShipVO ship) {
@@ -109,11 +111,9 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
public List<TransportShipExcel> exportTransportShip(Wrapper<TransportShip> queryWrapper) {
return list(queryWrapper).stream().map(ship -> {
TransportShipExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(ship, TransportShipExcel.class));
excel.setStatusName(ship.getStatus() != null && ship.getStatus() == 2 ? "停用" : "启用");
excel.setNationalityCertLongTermName(yesNo(ship.getNationalityCertLongTerm()));
excel.setSafeManningCertLongTermName(yesNo(ship.getSafeManningCertLongTerm()));
excel.setBusinessTransportCertLongTermName(yesNo(ship.getBusinessTransportCertLongTerm()));
excel.setLeaseLongTermName(yesNo(ship.getLeaseLongTerm()));
excel.setConstructionDateRange(formatDateRange(
ship.getKeelLayingDate(), ship.getBuildCompletionDate()
));
return excel;
}).toList();
}
@@ -198,6 +198,9 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
if (Func.isEmpty(ship.getShipType())) {
throw new ServiceException("船舶类型不能为空");
}
if (!SHIP_TYPES.contains(ship.getShipType())) {
throw new ServiceException("船舶类型只能选择散货船、集装箱船、杂货船或油船");
}
if (ship.getNationalityCertLongTerm() != 1
&& (Func.isEmpty(ship.getNationalityCertStartDate()) || Func.isEmpty(ship.getNationalityCertEndDate()))) {
throw new ServiceException("船舶国籍证书有效期不能为空");
@@ -215,7 +218,7 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
if (ship.getBusinessTransportCertLongTerm() != 1 && Func.isEmpty(ship.getBusinessTransportCertEndDate())) {
throw new ServiceException("营业运输证有效期至不能为空");
}
validateLength(ship.getShipName(), NAME_MAX_LENGTH, "名不能超过50字");
validateLength(ship.getShipName(), SHIP_NAME_MAX_LENGTH, "船名不能超过20个字符");
validateLength(ship.getShipIdentifierNo(), SHORT_TEXT_MAX_LENGTH, "船舶识别号不能超过50字");
validateLength(ship.getOrganizationName(), NAME_MAX_LENGTH, "所属组织不能超过50字");
validateLength(ship.getNavigationArea(), SHORT_TEXT_MAX_LENGTH, "航区不能超过50字");
@@ -275,8 +278,8 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
return value == null ? 0L : value;
}
private String yesNo(Integer value) {
return value != null && value == 1 ? "" : "";
private String formatDateRange(LocalDate startDate, LocalDate endDate) {
return String.format("%s / %s", startDate == null ? "" : startDate, endDate == null ? "" : endDate);
}
private String trimToEmpty(String value) {

View File

@@ -60,6 +60,9 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
private static final int REMARK_MAX_LENGTH = 200;
private static final int DEFAULT_ENABLED_STATUS = 1;
private static final int DEFAULT_FALSE = 0;
private static final int CERTIFICATION_PENDING = 0;
private static final int CERTIFICATION_APPROVED = 1;
private static final int CERTIFICATION_REJECTED = 2;
@Override
public IPage<TransportVehicleVO> selectTransportVehiclePage(IPage<TransportVehicleVO> page, TransportVehicleVO vehicle) {
@@ -73,9 +76,29 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
prepare(vehicle);
validate(vehicle);
checkUniquePlateNo(vehicle);
vehicle.setCertificationStatus(CERTIFICATION_PENDING);
vehicle.setCertificationRejectReason(null);
return saveOrUpdate(vehicle);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean auditCertification(Long id, Integer certificationStatus, String rejectReason) {
if (Func.isEmpty(id) || (certificationStatus != CERTIFICATION_APPROVED && certificationStatus != CERTIFICATION_REJECTED)) {
throw new ServiceException("认证审核参数不正确");
}
String reason = trimToNull(rejectReason);
if (certificationStatus == CERTIFICATION_REJECTED && Func.isEmpty(reason)) {
throw new ServiceException("请输入认证驳回原因");
}
validateLength(reason, REMARK_MAX_LENGTH, "认证驳回原因不能超过200字");
TransportVehicle vehicle = new TransportVehicle();
vehicle.setId(id);
vehicle.setCertificationStatus(certificationStatus);
vehicle.setCertificationRejectReason(certificationStatus == CERTIFICATION_REJECTED ? reason : null);
return updateById(vehicle);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean changeStatus(Long id, Integer status) {
@@ -110,10 +133,6 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
return list(queryWrapper).stream().map(vehicle -> {
TransportVehicleExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(vehicle, TransportVehicleExcel.class));
excel.setStatusName(vehicle.getStatus() != null && vehicle.getStatus() == 2 ? "停用" : "启用");
excel.setCompulsoryScrapLongTermName(yesNo(vehicle.getCompulsoryScrapLongTerm()));
excel.setDrivingLicenseLongTermName(yesNo(vehicle.getDrivingLicenseLongTerm()));
excel.setRoadTransportCertLongTermName(yesNo(vehicle.getRoadTransportCertLongTerm()));
excel.setAnnualReviewLongTermName(yesNo(vehicle.getAnnualReviewLongTerm()));
return excel;
}).toList();
}
@@ -256,10 +275,6 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
return value == null ? 0L : value;
}
private String yesNo(Integer value) {
return value != null && value == 1 ? "" : "";
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}

View File

@@ -31,7 +31,9 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.UserCache;
import org.springblade.transport.excel.ViolationRecordExcel;
import org.springblade.transport.excel.ViolationRecordImportExcel;
import org.springblade.transport.mapper.ViolationRecordMapper;
import org.springblade.transport.pojo.entity.ViolationRecord;
import org.springblade.transport.pojo.vo.ViolationRecordVO;
@@ -68,7 +70,9 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
@Override
public IPage<ViolationRecordVO> selectViolationRecordPage(IPage<ViolationRecordVO> page, ViolationRecordVO violationRecord) {
return page.setRecords(baseMapper.selectViolationRecordPage(page, violationRecord));
List<ViolationRecordVO> records = baseMapper.selectViolationRecordPage(page, violationRecord);
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
return page.setRecords(records);
}
@Override
@@ -82,15 +86,20 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
@Override
@Transactional(rollbackFor = Exception.class)
public List<ViolationRecordExcel> importViolationRecord(List<ViolationRecordExcel> data) {
public List<ViolationRecordImportExcel> importViolationRecord(List<ViolationRecordImportExcel> data) {
if (Func.isEmpty(data)) {
throw new ServiceException("导入数据不能为空");
}
List<ViolationRecordExcel> errorList = new ArrayList<>();
List<ViolationRecordImportExcel> errorList = new ArrayList<>();
for (int index = 0; index < data.size(); index++) {
ViolationRecordExcel excel = data.get(index);
ViolationRecordImportExcel excel = data.get(index);
try {
ViolationRecord violationRecord = Objects.requireNonNull(BeanUtil.copyProperties(excel, ViolationRecord.class));
if ("船舶".equals(trimToEmpty(excel.getVehicleType()))) {
violationRecord.setViolationItem(excel.getViolationTypeOrItem());
} else {
violationRecord.setViolationType(excel.getViolationTypeOrItem());
}
submit(violationRecord);
} catch (Exception exception) {
excel.setErrorMessage("" + (index + 2) + "行:" + exception.getMessage());
@@ -106,6 +115,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
ViolationRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(violationRecord, ViolationRecordExcel.class));
excel.setFineAmount(nonNegative(violationRecord.getFineAmount()));
excel.setDeductPoints(validDeductPoints(violationRecord.getDeductPoints()));
excel.setUpdateUserName(UserCache.getUserRealName(violationRecord.getUpdateUser()));
return excel;
}).toList();
}

View File

@@ -268,6 +268,10 @@ CREATE TABLE `blade_datasource` (
`password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码',
`sharding_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '分库分表配置',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`person_category` tinyint NOT NULL DEFAULT 1 COMMENT '人员类别1内部员工2承运商',
`data_scope_range` tinyint NOT NULL DEFAULT 1 COMMENT '数据权限范围1所属组织2全部组织3自定义',
`data_level_range` tinyint NOT NULL DEFAULT 1 COMMENT '数据层级范围1包含下级2仅本级',
`include_new_customer` tinyint NOT NULL DEFAULT 0 COMMENT '包含新增客商0否1是',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
@@ -298,11 +302,17 @@ CREATE TABLE `blade_dept` (
`dept_category` int NULL DEFAULT NULL COMMENT '部门类型',
`dept_name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门名',
`full_name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门全称',
`dept_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组织编码',
`short_name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组织简称',
`pinyin_mnemonic` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拼音助记码',
`mnemonic_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '助记码',
`carrier_customer_id` bigint NULL DEFAULT NULL COMMENT '承运商客商档案主键',
`sort` int NULL DEFAULT NULL COMMENT '排序',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `uk_blade_dept_dept_code` (`dept_code`)
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '机构表';
-- ----------------------------
@@ -1253,6 +1263,7 @@ CREATE TABLE `blade_user` (
`post_id` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '岗位id',
`leader_id` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主管id',
`is_leader` int NULL DEFAULT 0 COMMENT '是否主管',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
@@ -1299,6 +1310,14 @@ CREATE TABLE `blade_user_dept` (
`dept_id` bigint NULL DEFAULT 0 COMMENT '部门ID',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
`company_code` varchar(64) NULL DEFAULT NULL COMMENT 'OA公司编码',
`company_name` varchar(255) NULL DEFAULT NULL COMMENT 'OA公司名称',
`dept_code` varchar(64) NULL DEFAULT NULL COMMENT 'OA部门编码',
`dept_name` varchar(255) NULL DEFAULT NULL COMMENT 'OA部门名称',
`sort` int NULL DEFAULT NULL COMMENT '排序',
`oa_id` varchar(64) NULL DEFAULT NULL COMMENT 'OA人员ID',
`oa_login_id` varchar(128) NULL DEFAULT NULL COMMENT 'OA登录账号',
`sync_time` datetime NULL DEFAULT NULL COMMENT '同步时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户部门表';

Some files were not shown because too many files have changed in this diff Show More