@@ -46,4 +46,15 @@ public enum CardBlackType { | |||
} | |||
return null; | |||
} | |||
// 判断code是否存在 | |||
public static boolean containsCode(Integer code) { | |||
if (code == null) return false; | |||
for (CardBlackType type : values()) { | |||
if (code.equals(type.code)) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
} |
@@ -49,4 +49,14 @@ public enum ObuBlackType { | |||
} | |||
return null; | |||
} | |||
// 判断code是否存在 | |||
public static boolean containsCode(Integer code) { | |||
if (code == null) return false; | |||
for (ObuBlackType type : values()) { | |||
if (code.equals(type.code)) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
} |
@@ -162,7 +162,7 @@ public class InvwEnterApplyManagerImpl extends AbstractInvwManager implements In | |||
@Override | |||
public InvwEnterApplyParseExcelResponseDTO parseExcel(InvwEnterApplyParseExcelRequestDTO dto) throws ManagerException { | |||
File file = minioUtile.getFileByUrl(dto.getExcelUrl()); | |||
List<EnterApplyDetailModel> modelList = EasyExcelUtil.readExcelColToModelList(file, EnterApplyDetailModel.class); | |||
List<EnterApplyDetailModel> modelList = EasyExcelUtil.readExcelColToModelList(file, EnterApplyDetailModel.class, 0); | |||
return new InvwEnterApplyParseExcelResponseDTO(modelList); | |||
} | |||
@@ -86,7 +86,7 @@ public class InvwStocktakingInfoManagerImpl extends AbstractInvwManager implemen | |||
} | |||
// 读取文件数据 | |||
List<InvwStocktakingInfoRemoveModel> models = EasyExcelUtil.readExcelColToModelList(file, InvwStocktakingInfoRemoveModel.class); | |||
List<InvwStocktakingInfoRemoveModel> models = EasyExcelUtil.readExcelColToModelList(file, InvwStocktakingInfoRemoveModel.class, 0); | |||
if (models.isEmpty()) { | |||
throw new ManagerException("导入文件为空"); | |||
} |
@@ -186,7 +186,7 @@ public class InvwTransferApplyManagerImpl extends AbstractInvwManager implements | |||
// 获取导入文件 | |||
File file = minioUtile.getFileByUrl(req.getFileUrl()); | |||
// 读取文件数据 | |||
List<InvwTransferApplyDetailsModel> models = EasyExcelUtil.readExcelColToModelList(file, InvwTransferApplyDetailsModel.class); | |||
List<InvwTransferApplyDetailsModel> models = EasyExcelUtil.readExcelColToModelList(file, InvwTransferApplyDetailsModel.class, 0); | |||
if (models.size() == 0) { | |||
throw new ManagerException("导入文件为空"); | |||
} |
@@ -54,7 +54,7 @@ public class EasyExcelUtil extends EasyExcelFactory { | |||
* @param modelClass 目标Model类(需标注@ExcelProperty) | |||
* @return List<T> 数据集合 | |||
*/ | |||
public static <T> List<T> readExcelColToModelList(File file, Class<T> modelClass) { | |||
public static <T> List<T> readExcelColToModelList(File file, Class<T> modelClass, Integer row) { | |||
List<T> dataList = new ArrayList<>(); | |||
EasyExcel.read(file, modelClass, new AnalysisEventListener<T>() { | |||
@@ -73,7 +73,7 @@ public class EasyExcelUtil extends EasyExcelFactory { | |||
throw new RuntimeException("第" + context.readRowHolder().getRowIndex() + "行解析失败", exception); | |||
} | |||
}).sheet() | |||
.headRowNumber(0) // 关键修改:设置从第0行开始读取(Excel行号从0开始计数) | |||
.headRowNumber(row) // 关键修改:设置从第0行开始读取(Excel行号从0开始计数) | |||
.doRead(); | |||
return dataList; |
@@ -10,6 +10,7 @@ dependencies { | |||
implementation "${groupname}:comm-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:sample-protocol:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:ats-protocol:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:bls-protocol:1.0.0-SNAPSHOT" | |||
implementation('cn.com.taiji.common:sso-client:2.3.10.7') | |||
implementation "org.springframework.boot:spring-boot-starter-security" | |||
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery" | |||
@@ -26,6 +27,11 @@ dependencies { | |||
//ORACLE+库编码问题 | |||
runtimeOnly 'com.oracle.database.jdbc:ojdbc8:19.10.0.0' | |||
runtimeOnly 'cn.easyproject:orai18n:12.1.0.2.0' | |||
implementation 'com.alibaba:easyexcel:3.2.1' | |||
// 添加 MapStruct 核心库依赖 | |||
implementation 'org.mapstruct:mapstruct:1.5.5.Final' | |||
// 添加 MapStruct 注解处理器依赖 | |||
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final' | |||
} | |||
@@ -0,0 +1,58 @@ | |||
package cn.com.taiji.managew.api.bls; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.web.ApiResponse; | |||
import cn.com.taiji.managew.api.MyValidController; | |||
import cn.com.taiji.managew.dto.bls.*; | |||
import cn.com.taiji.managew.manager.bls.BlackCardManager; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
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.RestController; | |||
import javax.validation.Valid; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:41 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Api(tags = {"卡黑名单管理"}) | |||
@RestController | |||
@RequestMapping("/api/bls/card") | |||
public class BlackCardController extends MyValidController { | |||
@Autowired | |||
private BlackCardManager manager; | |||
@ApiOperation("卡黑名单查询") | |||
@PostMapping("/query") | |||
public ApiResponse<BlackCardQueryResponseDTO> query(@Valid @RequestBody BlackCardQueryRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.query(req)); | |||
} | |||
@ApiOperation("卡下黑") | |||
@PostMapping("/cardIn") | |||
public ApiResponse<BlackCardInResponseDTO> cardIn(@Valid @RequestBody BlackCardInRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.cardIn(req)); | |||
} | |||
@ApiOperation("卡反白") | |||
@PostMapping("/cardOut") | |||
public ApiResponse<BlackCardOutResponseDTO> cardOut(@Valid @RequestBody BlackCardOutRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.cardOut(req)); | |||
} | |||
@ApiOperation("卡批量下黑反白导入") | |||
@PostMapping("/cardImport") | |||
public ApiResponse<BlackCardImportResponseDTO> cardImport(@Valid @RequestBody BlackCardImportRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.cardImport(req)); | |||
} | |||
} |
@@ -0,0 +1,58 @@ | |||
package cn.com.taiji.managew.api.bls; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.web.ApiResponse; | |||
import cn.com.taiji.managew.api.MyValidController; | |||
import cn.com.taiji.managew.dto.bls.*; | |||
import cn.com.taiji.managew.manager.bls.BlackCardManager; | |||
import cn.com.taiji.managew.manager.bls.BlackObuManager; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
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.RestController; | |||
import javax.validation.Valid; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:41 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Api(tags = {"签黑名单管理"}) | |||
@RestController | |||
@RequestMapping("/api/bls/obu") | |||
public class BlackObuController extends MyValidController { | |||
@Autowired | |||
private BlackObuManager manager; | |||
@ApiOperation("签黑名单查询") | |||
@PostMapping("/query") | |||
public ApiResponse<BlackObuQueryResponseDTO> query(@Valid @RequestBody BlackObuQueryRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.query(req)); | |||
} | |||
@ApiOperation("签下黑") | |||
@PostMapping("/obuIn") | |||
public ApiResponse<BlackObuInResponseDTO> obuIn(@Valid @RequestBody BlackObuInRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.obuIn(req)); | |||
} | |||
@ApiOperation("签反白") | |||
@PostMapping("/obuOut") | |||
public ApiResponse<BlackObuOutResponseDTO> obuOut(@Valid @RequestBody BlackObuOutRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.obuOut(req)); | |||
} | |||
@ApiOperation("签批量下黑反白导入") | |||
@PostMapping("/obuImport") | |||
public ApiResponse<BlackObuImportResponseDTO> obuImport(@Valid @RequestBody BlackObuImportRequestDTO req) throws ManagerException { | |||
return ApiResponse.of(manager.obuImport(req)); | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡批量下黑反白请求") | |||
public class BlackCardImportRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty("批量导入excel地址") | |||
@NotBlank | |||
private String excelUrl; | |||
} |
@@ -0,0 +1,29 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardImportErrorModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡下黑响应") | |||
public class BlackCardImportResponseDTO extends BaseModel { | |||
private List<BlackCardImportErrorModel> modelList; | |||
public BlackCardImportResponseDTO(List<BlackCardImportErrorModel> modelList) { | |||
this.modelList = modelList; | |||
} | |||
} |
@@ -0,0 +1,44 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.EnumInteger; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡下黑请求") | |||
public class BlackCardInRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty("卡号") | |||
@NotBlank | |||
private String cardId; | |||
@ApiModelProperty("下黑类型") | |||
@NotNull | |||
@EnumInteger(enumClazz = CardBlackType.class) | |||
private Integer type; | |||
@ApiModelProperty("下黑原因") | |||
@NotBlank | |||
private String reason; | |||
@ApiModelProperty("解决方案") | |||
@NotBlank | |||
private String solution; | |||
} |
@@ -0,0 +1,29 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardQueryModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡下黑响应") | |||
public class BlackCardInResponseDTO extends BaseModel { | |||
private Integer uploadStatus;// 0-失败 1-成功 | |||
public BlackCardInResponseDTO(Integer uploadStatus) { | |||
this.uploadStatus = uploadStatus; | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.EnumInteger; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡反白请求") | |||
public class BlackCardOutRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty("卡号") | |||
@NotBlank | |||
private String cardId; | |||
@ApiModelProperty("反白类型") | |||
@NotNull | |||
@EnumInteger(enumClazz = CardBlackType.class) | |||
private Integer type; | |||
@ApiModelProperty("反白原因") | |||
@NotBlank | |||
private String reason; | |||
} |
@@ -0,0 +1,26 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡反白响应") | |||
public class BlackCardOutResponseDTO extends BaseModel { | |||
private Integer uploadStatus;// 0-失败 1-成功 | |||
public BlackCardOutResponseDTO(Integer uploadStatus) { | |||
this.uploadStatus = uploadStatus; | |||
} | |||
} |
@@ -0,0 +1,45 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizPageRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡查询请求") | |||
public class BlackCardQueryRequestDTO extends AbstractStaffBizPageRequestDTO { | |||
@ApiModelProperty("卡号") | |||
@NotBlank | |||
private String cardId; | |||
@ApiModelProperty("车牌号+车牌颜色(必须要一起传)") | |||
private String vehicleId; | |||
@ApiModelProperty("下黑类型") | |||
private CardBlackType type; | |||
@ApiModelProperty("1-在黑 2-已返白") | |||
private Integer status; | |||
@ApiModelProperty("下黑开始时间") | |||
private LocalDateTime startTime; | |||
@ApiModelProperty("下黑结束时间") | |||
private LocalDateTime endTime; | |||
} |
@@ -0,0 +1,30 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardQueryModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡查询反映") | |||
public class BlackCardQueryResponseDTO extends BaseModel { | |||
private List<BlackCardQueryModel> results; | |||
public BlackCardQueryResponseDTO(List<BlackCardQueryModel> results) { | |||
this.results = results; | |||
} | |||
public BlackCardQueryResponseDTO(){} | |||
} |
@@ -0,0 +1,27 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签批量下黑反白请求") | |||
public class BlackObuImportRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty("批量导入excel地址") | |||
@NotBlank | |||
private String excelUrl; | |||
} |
@@ -0,0 +1,30 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardImportErrorModel; | |||
import cn.com.taiji.managew.model.bls.BlackObuImportErrorModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "卡下黑响应") | |||
public class BlackObuImportResponseDTO extends BaseModel { | |||
private List<BlackObuImportErrorModel> modelList; | |||
public BlackObuImportResponseDTO(List<BlackObuImportErrorModel> modelList) { | |||
this.modelList = modelList; | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.EnumInteger; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签下黑请求") | |||
public class BlackObuInRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty("签号") | |||
@NotBlank | |||
private String obuId; | |||
@ApiModelProperty("下黑类型") | |||
@NotNull | |||
@EnumInteger(enumClazz = ObuBlackType.class) | |||
private Integer type; | |||
@ApiModelProperty("下黑原因") | |||
@NotBlank | |||
private String reason; | |||
@ApiModelProperty("解决方案") | |||
@NotBlank | |||
private String solution; | |||
} |
@@ -0,0 +1,26 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签下黑响应") | |||
public class BlackObuInResponseDTO extends BaseModel { | |||
private Integer uploadStatus;// 0-失败 1-成功 | |||
public BlackObuInResponseDTO(Integer uploadStatus) { | |||
this.uploadStatus = uploadStatus; | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.EnumInteger; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签反白请求") | |||
public class BlackObuOutRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty("签号") | |||
@NotBlank | |||
private String obuId; | |||
@ApiModelProperty("反白类型") | |||
@NotNull | |||
@EnumInteger(enumClazz = ObuBlackType.class) | |||
private Integer type; | |||
@ApiModelProperty("反白原因") | |||
@NotBlank | |||
private String reason; | |||
} |
@@ -0,0 +1,26 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签反白响应") | |||
public class BlackObuOutResponseDTO extends BaseModel { | |||
private Integer uploadStatus;// 0-失败 1-成功 | |||
public BlackObuOutResponseDTO(Integer uploadStatus) { | |||
this.uploadStatus = uploadStatus; | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.core.dto.AbstractStaffBizPageRequestDTO; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 15:57 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签查询请求") | |||
public class BlackObuQueryRequestDTO extends AbstractStaffBizPageRequestDTO { | |||
@ApiModelProperty("签号") | |||
@NotBlank | |||
private String obuId; | |||
@ApiModelProperty("车牌号+车牌颜色(必须要一起传)") | |||
private String vehicleId; | |||
@ApiModelProperty("下黑类型") | |||
private ObuBlackType type; | |||
@ApiModelProperty("1-在黑 2-已返白") | |||
private Integer status; | |||
@ApiModelProperty("下黑开始时间") | |||
private LocalDateTime startTime; | |||
@ApiModelProperty("下黑结束时间") | |||
private LocalDateTime endTime; | |||
} |
@@ -0,0 +1,31 @@ | |||
package cn.com.taiji.managew.dto.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardQueryModel; | |||
import cn.com.taiji.managew.model.bls.BlackObuQueryModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:09 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
@ApiModel(description = "签查询响应") | |||
public class BlackObuQueryResponseDTO extends BaseModel { | |||
private List<BlackObuQueryModel> results; | |||
public BlackObuQueryResponseDTO(List<BlackObuQueryModel> results) { | |||
this.results = results; | |||
} | |||
public BlackObuQueryResponseDTO(){} | |||
} |
@@ -3,12 +3,11 @@ package cn.com.taiji.managew.manager; | |||
import java.io.IOException; | |||
import java.util.concurrent.Callable; | |||
import cn.com.taiji.managew.manager.FieldMsgConvertor; | |||
import cn.com.taiji.core.manager.cache.RedisCacheManager; | |||
import feign.RetryableException; | |||
import org.apache.http.NoHttpResponseException; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException; | |||
import cn.com.taiji.common.model.file.FileProtocolSystemError; | |||
@@ -23,7 +22,7 @@ import cn.com.taiji.core.model.comm.protocol.SignJsonResponse; | |||
import cn.com.taiji.core.model.comm.protocol.valid.FieldMsgBuilder; | |||
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; | |||
public abstract class AbstractCommManager extends AbstractManager { | |||
public abstract class AbstractCommManager extends RedisCacheManager { | |||
@Autowired | |||
protected FeignClientManager feignClientManager; |
@@ -0,0 +1,23 @@ | |||
package cn.com.taiji.managew.manager.bls; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.managew.dto.bls.*; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:11 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
public interface BlackCardManager { | |||
BlackCardQueryResponseDTO query(BlackCardQueryRequestDTO req) throws ManagerException; | |||
BlackCardInResponseDTO cardIn(BlackCardInRequestDTO req) throws ManagerException; | |||
BlackCardOutResponseDTO cardOut(BlackCardOutRequestDTO req) throws ManagerException; | |||
BlackCardImportResponseDTO cardImport(BlackCardImportRequestDTO req) throws ManagerException; | |||
} |
@@ -0,0 +1,144 @@ | |||
package cn.com.taiji.managew.manager.bls; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.pub.BeanTools; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.manager.tools.minio.MinioUtile; | |||
import cn.com.taiji.core.model.comm.protocol.bls.*; | |||
import cn.com.taiji.managew.dto.bls.*; | |||
import cn.com.taiji.managew.manager.AbstractCommManager; | |||
import cn.com.taiji.managew.model.bls.BlackCardImportErrorModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardImportModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardQueryModel; | |||
import cn.com.taiji.managew.tools.EasyExcelUtil; | |||
import cn.com.taiji.managew.tools.SourceTargetMapper; | |||
import org.apache.commons.compress.utils.Lists; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.io.File; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:12 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Service | |||
public class BlackCardManagerImpl extends AbstractCommManager implements BlackCardManager{ | |||
@Autowired | |||
private MinioUtile minioUtile; | |||
@Override | |||
public BlackCardQueryResponseDTO query(BlackCardQueryRequestDTO req) throws ManagerException { | |||
CardQueryRequest cardQueryRequest = copyProperties(req, new CardQueryRequest()); | |||
CardQueryResponse cardQueryResponse = null; | |||
try { | |||
cardQueryResponse = jsonPostRepeat(cardQueryRequest); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
if (cardQueryResponse == null){ | |||
return new BlackCardQueryResponseDTO(); | |||
}else { | |||
List<CardQueryModel> results = cardQueryResponse.getResults(); | |||
List<BlackCardQueryModel> blackCardQueryModels = SourceTargetMapper.INSTANCE.resultListToBlackCardQueryModelList(results); | |||
return new BlackCardQueryResponseDTO(blackCardQueryModels); | |||
} | |||
} | |||
@Override | |||
public BlackCardInResponseDTO cardIn(BlackCardInRequestDTO req) throws ManagerException { | |||
CardInRequest cardInRequest = copyProperties(req, new CardInRequest()); | |||
cardInRequest.setSourceIn(req.getLoginSource()); | |||
cardInRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
AbstractBlsResponse blsResponse = null; | |||
try { | |||
blsResponse = jsonPostRepeat(cardInRequest); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
return new BlackCardInResponseDTO(blsResponse.getUploadStatus()); | |||
} | |||
@Override | |||
public BlackCardOutResponseDTO cardOut(BlackCardOutRequestDTO req) throws ManagerException { | |||
CardOutRequest cardOutRequest = copyProperties(req, new CardOutRequest()); | |||
cardOutRequest.setSourceIn(req.getLoginSource()); | |||
cardOutRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
AbstractBlsResponse blsResponse = null; | |||
try { | |||
blsResponse = jsonPostRepeat(cardOutRequest); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
return new BlackCardOutResponseDTO(blsResponse.getUploadStatus()); | |||
} | |||
@Override | |||
public BlackCardImportResponseDTO cardImport(BlackCardImportRequestDTO req) throws ManagerException { | |||
File file = minioUtile.getFileByUrl(req.getExcelUrl()); | |||
List<BlackCardImportModel> modelList = EasyExcelUtil.readExcelColToModelList(file, BlackCardImportModel.class, 1); | |||
List<BlackCardImportErrorModel> errorModelList = Lists.newArrayList(); | |||
for (BlackCardImportModel blackCardImportModel : modelList) { | |||
BlackCardImportErrorModel importErrorModel = new BlackCardImportErrorModel(); | |||
StringBuffer errorMsg = new StringBuffer(); | |||
//校验excel的数据 | |||
importModelValid(blackCardImportModel, errorMsg); | |||
if (errorMsg.length() == 0){ | |||
if (blackCardImportModel.getStatus() == 1){ | |||
CardInRequest cardInRequest = copyProperties(blackCardImportModel, new CardInRequest()); | |||
cardInRequest.setSourceIn(req.getLoginSource()); | |||
cardInRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
try { | |||
jsonPostRepeat(cardInRequest); | |||
} catch (ManagerException e) { | |||
errorMsg.append(e.getMessage()); | |||
} | |||
}else{ | |||
CardOutRequest cardOutRequest = copyProperties(req, new CardOutRequest()); | |||
cardOutRequest.setSourceIn(req.getLoginSource()); | |||
cardOutRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
try { | |||
jsonPostRepeat(cardOutRequest); | |||
} catch (ManagerException e) { | |||
errorMsg.append(e.getMessage()); | |||
} | |||
} | |||
} | |||
if (errorMsg.length() > 0){ | |||
BeanTools.copyProperties(blackCardImportModel, importErrorModel); | |||
importErrorModel.setErrorMsg(errorMsg.toString()); | |||
errorModelList.add(importErrorModel); | |||
} | |||
} | |||
return new BlackCardImportResponseDTO(errorModelList); | |||
} | |||
private void importModelValid(BlackCardImportModel model, StringBuffer errorMsg) { | |||
if (model.getStatus() == null){ | |||
errorMsg.append("状态不能为空;"); | |||
}else if (StringUtils.isEmpty(model.getCardId())){ | |||
errorMsg.append("卡号不能为空;"); | |||
}else if(model.getType() == null){ | |||
errorMsg.append("类型不能为空;"); | |||
}else if(StringUtils.isEmpty(model.getReason())){ | |||
errorMsg.append("原因不能为空;"); | |||
}else if(StringUtils.isEmpty(model.getSolution())){ | |||
if (model.getStatus() == 2){ | |||
errorMsg.append("下黑时解决方案不能为空;"); | |||
} | |||
}else if(model.getStatus() != 1 || model.getStatus() != 2){ | |||
errorMsg.append("状态必须为1(下黑)或2(反白);"); | |||
}else if(!CardBlackType.containsCode(model.getType())){//类型判断 | |||
errorMsg.append("类型不符合规范;"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
package cn.com.taiji.managew.manager.bls; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.managew.dto.bls.*; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:11 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
public interface BlackObuManager { | |||
BlackObuQueryResponseDTO query(BlackObuQueryRequestDTO req) throws ManagerException; | |||
BlackObuInResponseDTO obuIn(BlackObuInRequestDTO req) throws ManagerException; | |||
BlackObuOutResponseDTO obuOut(BlackObuOutRequestDTO req) throws ManagerException; | |||
BlackObuImportResponseDTO obuImport(BlackObuImportRequestDTO req) throws ManagerException; | |||
} |
@@ -0,0 +1,142 @@ | |||
package cn.com.taiji.managew.manager.bls; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.pub.BeanTools; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import cn.com.taiji.core.manager.tools.minio.MinioUtile; | |||
import cn.com.taiji.core.model.comm.protocol.bls.*; | |||
import cn.com.taiji.managew.dto.bls.*; | |||
import cn.com.taiji.managew.manager.AbstractCommManager; | |||
import cn.com.taiji.managew.model.bls.*; | |||
import cn.com.taiji.managew.tools.EasyExcelUtil; | |||
import cn.com.taiji.managew.tools.SourceTargetMapper; | |||
import org.apache.commons.compress.utils.Lists; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.io.File; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:12 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Service | |||
public class BlackObuManagerImpl extends AbstractCommManager implements BlackObuManager{ | |||
@Autowired | |||
private MinioUtile minioUtile; | |||
@Override | |||
public BlackObuQueryResponseDTO query(BlackObuQueryRequestDTO req) throws ManagerException { | |||
ObuQueryRequest obuQueryRequest = copyProperties(req, new ObuQueryRequest()); | |||
ObuQueryResponse obuQueryResponse = null; | |||
try { | |||
obuQueryResponse = jsonPostRepeat(obuQueryRequest); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
if (obuQueryResponse == null){ | |||
return new BlackObuQueryResponseDTO(); | |||
}else { | |||
List<ObuQueryModel> results = obuQueryResponse.getResults(); | |||
List<BlackObuQueryModel> blackObuQueryModels = SourceTargetMapper.INSTANCE.resultListToBlackObuQueryModelList(results); | |||
return new BlackObuQueryResponseDTO(blackObuQueryModels); | |||
} | |||
} | |||
@Override | |||
public BlackObuInResponseDTO obuIn(BlackObuInRequestDTO req) throws ManagerException { | |||
ObuInRequest obuInRequest = copyProperties(req, new ObuInRequest()); | |||
obuInRequest.setSourceIn(req.getLoginSource()); | |||
obuInRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
AbstractBlsResponse blsResponse = null; | |||
try { | |||
blsResponse = jsonPostRepeat(obuInRequest); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
return new BlackObuInResponseDTO(blsResponse.getUploadStatus()); | |||
} | |||
@Override | |||
public BlackObuOutResponseDTO obuOut(BlackObuOutRequestDTO req) throws ManagerException { | |||
ObuOutRequest obuOutRequest = copyProperties(req, new ObuOutRequest()); | |||
obuOutRequest.setSourceIn(req.getLoginSource()); | |||
obuOutRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
AbstractBlsResponse blsResponse = null; | |||
try { | |||
blsResponse = jsonPostRepeat(obuOutRequest); | |||
} catch (ManagerException e) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
return new BlackObuOutResponseDTO(blsResponse.getUploadStatus()); | |||
} | |||
@Override | |||
public BlackObuImportResponseDTO obuImport(BlackObuImportRequestDTO req) throws ManagerException { | |||
File file = minioUtile.getFileByUrl(req.getExcelUrl()); | |||
List<BlackObuImportModel> modelList = EasyExcelUtil.readExcelColToModelList(file, BlackObuImportModel.class, 1); | |||
List<BlackObuImportErrorModel> errorModelList = Lists.newArrayList(); | |||
for (BlackObuImportModel blackObuImportModel : modelList) { | |||
BlackObuImportErrorModel importErrorModel = new BlackObuImportErrorModel(); | |||
StringBuffer errorMsg = new StringBuffer(); | |||
//校验excel的数据 | |||
importModelValid(blackObuImportModel, errorMsg); | |||
if (errorMsg.length() == 0){ | |||
if (blackObuImportModel.getStatus() == 1){ | |||
ObuInRequest obuInRequest = copyProperties(blackObuImportModel, new ObuInRequest()); | |||
obuInRequest.setSourceIn(req.getLoginSource()); | |||
obuInRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
try { | |||
jsonPostRepeat(obuInRequest); | |||
} catch (ManagerException e) { | |||
errorMsg.append(e.getMessage()); | |||
} | |||
}else{ | |||
ObuOutRequest obuOutRequest = copyProperties(blackObuImportModel, new ObuOutRequest()); | |||
obuOutRequest.setSourceIn(req.getLoginSource()); | |||
obuOutRequest.setOrgCode(findAgencyIdByToken(req.getAccessToken())); | |||
try { | |||
jsonPostRepeat(obuOutRequest); | |||
} catch (ManagerException e) { | |||
errorMsg.append(e.getMessage()); | |||
} | |||
} | |||
} | |||
if (errorMsg.length() > 0){ | |||
BeanTools.copyProperties(blackObuImportModel, importErrorModel); | |||
importErrorModel.setErrorMsg(errorMsg.toString()); | |||
errorModelList.add(importErrorModel); | |||
} | |||
} | |||
return new BlackObuImportResponseDTO(errorModelList); | |||
} | |||
private void importModelValid(BlackObuImportModel model, StringBuffer errorMsg) { | |||
if (model.getStatus() == null){ | |||
errorMsg.append("状态不能为空;"); | |||
}else if (StringUtils.isEmpty(model.getObuId())){ | |||
errorMsg.append("签号不能为空;"); | |||
}else if(model.getType() == null){ | |||
errorMsg.append("类型不能为空;"); | |||
}else if(StringUtils.isEmpty(model.getReason())){ | |||
errorMsg.append("原因不能为空;"); | |||
}else if(StringUtils.isEmpty(model.getSolution())){ | |||
if (model.getStatus() == 2){ | |||
errorMsg.append("下黑时解决方案不能为空;"); | |||
} | |||
}else if(model.getStatus() != 1 || model.getStatus() != 2){ | |||
errorMsg.append("状态必须为1(下黑)或2(反白);"); | |||
}else if(!ObuBlackType.containsCode(model.getType())){//类型判断 | |||
errorMsg.append("类型不符合规范;"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
package cn.com.taiji.managew.model.bls; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/6/3 20:27 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class BlackCardImportErrorModel extends BlackCardImportModel{ | |||
private String errorMsg; | |||
} |
@@ -0,0 +1,33 @@ | |||
package cn.com.taiji.managew.model.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import com.alibaba.excel.annotation.ExcelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/6/3 19:59 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class BlackCardImportModel extends BaseModel { | |||
@ExcelProperty(index = 0) | |||
private Integer status;//1下黑,2反白 | |||
@ExcelProperty(index = 1) | |||
private String cardId;//卡号 | |||
@ExcelProperty(index = 2) | |||
private Integer type; | |||
@ExcelProperty(index = 3) | |||
private String reason; | |||
@ExcelProperty(index = 4) | |||
private String solution; | |||
} |
@@ -0,0 +1,35 @@ | |||
package cn.com.taiji.managew.model.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:10 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class BlackCardQueryModel extends BaseModel { | |||
private CardBlackType type;//类型; | |||
private String cardId;//用户卡编号; | |||
private Integer status;//状态;1-在黑 2-反白 | |||
private LocalDateTime createTime;//下黑时间; | |||
private LocalDateTime releaseTime;//返白时间; | |||
private String reasonIn;//下黑原因 | |||
private String reasonOut;//返白原因 | |||
private String staffIdIn;//下黑人员 | |||
private String staffIdOut;//反白人员 | |||
private String solution;//解决方案 | |||
private SourceType sourceIn;//下黑来源 | |||
private SourceType sourceOut;//反白来源 | |||
private String agencyId;//渠道编号 | |||
} |
@@ -0,0 +1,18 @@ | |||
package cn.com.taiji.managew.model.bls; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/6/3 20:27 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class BlackObuImportErrorModel extends BlackObuImportModel{ | |||
private String errorMsg; | |||
} |
@@ -0,0 +1,33 @@ | |||
package cn.com.taiji.managew.model.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import com.alibaba.excel.annotation.ExcelProperty; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/6/3 19:59 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class BlackObuImportModel extends BaseModel { | |||
@ExcelProperty(index = 0) | |||
private Integer status;//1下黑,2反白 | |||
@ExcelProperty(index = 1) | |||
private String obuId;//卡号 | |||
@ExcelProperty(index = 2) | |||
private Integer type; | |||
@ExcelProperty(index = 3) | |||
private String reason; | |||
@ExcelProperty(index = 4) | |||
private String solution; | |||
} |
@@ -0,0 +1,35 @@ | |||
package cn.com.taiji.managew.model.bls; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/5/29 16:10 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
@Getter | |||
@Setter | |||
public class BlackObuQueryModel extends BaseModel { | |||
private ObuBlackType type;//类型; | |||
private String obuId;//用户签编号; | |||
private Integer status;//状态;1-在黑 2-反白 | |||
private LocalDateTime createTime;//下黑时间; | |||
private LocalDateTime releaseTime;//返白时间; | |||
private String reasonIn;//下黑原因 | |||
private String reasonOut;//返白原因 | |||
private String staffIdIn;//下黑人员 | |||
private String staffIdOut;//反白人员 | |||
private String solution;//解决方案 | |||
private SourceType sourceIn;//下黑来源 | |||
private SourceType sourceOut;//反白来源 | |||
private String agencyId;//渠道编号 | |||
} |
@@ -0,0 +1,83 @@ | |||
package cn.com.taiji.managew.tools; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.alibaba.excel.EasyExcelFactory; | |||
import com.alibaba.excel.ExcelWriter; | |||
import com.alibaba.excel.context.AnalysisContext; | |||
import com.alibaba.excel.event.AnalysisEventListener; | |||
import com.alibaba.excel.write.metadata.WriteSheet; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import java.io.File; | |||
import java.io.FileOutputStream; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @Auther: humh | |||
* @Description: | |||
* @Date: 2025/4/21 17:32 | |||
* @email: huminghao@mail.taiji.com.cn | |||
* @version: 1.0 | |||
*/ | |||
public class EasyExcelUtil extends EasyExcelFactory { | |||
protected static Logger logger = LoggerFactory.getLogger(EasyExcelUtil.class); | |||
/** | |||
* 导出Excel返回 File | |||
*/ | |||
public static File exportExcelFile(Class<?> clazz, List<?> list, String fileName) throws ManagerException { | |||
try { | |||
// 临时目录 临时文件名 | |||
File file = new File(fileName + ".xlsx"); | |||
FileOutputStream fileOutputStream = new FileOutputStream(file); | |||
ExcelWriter excelWriter = write(fileOutputStream).build(); | |||
WriteSheet writeSheet = writerSheet(0, fileName).head(clazz).build(); | |||
excelWriter.write(list, writeSheet); | |||
excelWriter.finish(); | |||
return file; | |||
} catch (Exception e) { | |||
logger.debug("导出Excel异常:{}", e.getMessage()); | |||
throw new ManagerException("导出Excel异常"); | |||
} | |||
} | |||
/** | |||
* 从第一行开始读取excel,根据列数读取数据 | |||
* 泛型方法:读取Excel到指定Model的List | |||
* @param file Excel文件 | |||
* @param modelClass 目标Model类(需标注@ExcelProperty) | |||
* @return List<T> 数据集合 | |||
*/ | |||
public static <T> List<T> readExcelColToModelList(File file, Class<T> modelClass, Integer row) { | |||
List<T> dataList = new ArrayList<>(); | |||
EasyExcel.read(file, modelClass, new AnalysisEventListener<T>() { | |||
@Override | |||
public void invoke(T data, AnalysisContext context) { | |||
dataList.add(data); // 逐行映射到Model | |||
} | |||
@Override | |||
public void doAfterAllAnalysed(AnalysisContext context) { | |||
logger.info("Excel解析完成,共读取{}行", dataList.size()); | |||
} | |||
@Override | |||
public void onException(Exception exception, AnalysisContext context) { | |||
throw new RuntimeException("第" + context.readRowHolder().getRowIndex() + "行解析失败", exception); | |||
} | |||
}).sheet() | |||
.headRowNumber(row) // 关键修改:设置从第0行开始读取(Excel行号从0开始计数) | |||
.doRead(); | |||
return dataList; | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
package cn.com.taiji.managew.tools; | |||
import cn.com.taiji.core.model.comm.protocol.bls.CardQueryModel; | |||
import cn.com.taiji.core.model.comm.protocol.bls.ObuQueryModel; | |||
import cn.com.taiji.managew.model.bls.BlackCardQueryModel; | |||
import cn.com.taiji.managew.model.bls.BlackObuQueryModel; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.ReportingPolicy; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE) | |||
public interface SourceTargetMapper { | |||
/** 通行流水 字段数量类型相同,数量少:仅能让多的转换成少的,故没有toEntity*/ | |||
SourceTargetMapper INSTANCE = Mappers.getMapper(SourceTargetMapper.class); | |||
List<BlackCardQueryModel> resultListToBlackCardQueryModelList(List<CardQueryModel> model); | |||
List<BlackObuQueryModel> resultListToBlackObuQueryModelList(List<ObuQueryModel> model); | |||
} |