humuyu 3 rokov pred
rodič
commit
c996b01fe4

+ 4 - 6
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOrderQueryReq.java

@@ -61,12 +61,10 @@ public class NotaryOrderQueryReq extends BaseRequest {
 
     private String status;
 
-    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
-    private LocalDateTime startDate;
-
-
-    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
-    private LocalDateTime endDate;
+   //开始时间
+    private String startDate;
+    //结束时间
+    private String endDate;
 
 
     // 查询使用

+ 28 - 81
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/AdminOrderServiceImpl.java

@@ -1,10 +1,9 @@
 package me.zhengjie.application.admin.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
-import cn.hutool.core.bean.BeanUtil;
 import me.zhengjie.application.admin.controller.vo.*;
 import me.zhengjie.application.bank.controller.vo.OrderDetailDto;
 import me.zhengjie.dao.mybatis.ContractOrderRepository;
@@ -14,7 +13,6 @@ import me.zhengjie.base.AppResultData;
 import me.zhengjie.dao.mybatis.mapper.*;
 import me.zhengjie.application.bank.service.FileInfoService;
 import me.zhengjie.application.bank.service.BankOrderService;
-import me.zhengjie.application.bank.service.impl.NotaryNoteServiceImpl;
 import me.zhengjie.application.bank.controller.vo.BankCustomerVo;
 import me.zhengjie.application.bank.controller.vo.FileVo;
 import me.zhengjie.base.ResultCode;
@@ -126,7 +124,13 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 	 */
 	private QueryWrapper<ContractOrderEntity> getQueryWrapper(NotaryOrderQueryReq req) {
 		ContractOrderEntity order = BeanCopyUtils.convertObj(req, ContractOrderEntity.class);
-		QueryWrapper<ContractOrderEntity> qw = QueryWrapperUtil.convertQuery(order);
+		JSONObject json = new JSONObject();
+		json.put("startDate", req.getStartDate());
+		json.put("endDate", req.getEndDate());
+		// 清楚
+		order.setStartDate("");
+		order.setEndDate("");
+		QueryWrapper<ContractOrderEntity> qw = QueryWrapperUtil.convertQuery(order, json);
 		SysUserEntity user = userDao.selectById(contextUtil.getCurrentUserId());
 		String maxRole = userDomain.getUserMaxRole();
 		if ("超级管理员".equals(maxRole)) {
@@ -142,40 +146,6 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 			return null;
 		}
 
-//		if (!StringUtils.isEmpty(req.getStatus())) {
-//			qw.eq("status", req.getStatus());
-//		}
-//		if (!StringUtils.isEmpty(req.getContractNo())) {
-//			qw.like("contract_no", req.getContractNo());
-//		}
-//		if (!StringUtils.isEmpty(req.getLoanName())) {
-//			qw.like("loan_name", req.getLoanName());
-//		}
-//		if (!StringUtils.isEmpty(req.getPhone())) {
-//			qw.like("phone", req.getPhone());
-//		}
-//		if (!StringUtils.isEmpty(req.getIdCard())) {
-//			qw.like("id_card", req.getIdCard());
-//		}
-//		if (!StringUtils.isEmpty(req.getLoanMoneyStart())) {
-//			qw.ge("loan_money", req.getLoanMoneyStart());
-//		}
-//		if (!StringUtils.isEmpty(req.getLoanMoneyEnd())) {
-//			qw.le("loan_money", req.getLoanMoneyEnd());
-//		}
-//		if (!StringUtils.isEmpty(req.getBankName())) {
-//			qw.like("bank_name", req.getBankName());
-//		}
-//		if (!StringUtils.isEmpty(req.getCustomerName())) {
-//			qw.like("customer_name", req.getCustomerName());
-//		}
-//		if (!StringUtils.isEmpty(req.getStartDate())) {
-//			qw.ge("createTime", req.getStartDate());
-//		}
-//		if (!StringUtils.isEmpty(req.getEndDate())) {
-//			qw.le("createTime", req.getEndDate());
-//		}
-		qw.orderByDesc("create_time");
 		return qw;
 	}
 
@@ -340,7 +310,8 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 	@Transactional(rollbackFor = Exception.class)
 	public AppBaseResponse partyPass(NotaryOrderQueryReq req) {
 		AppBaseResponse response = new AppBaseResponse();
-		ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(req.getBusinessNo());
+		ContractOrderEntity contractOrderEntity = contractOrderRepository
+				.getContractOrderWithBizNo(req.getBusinessNo());
 		if (OrderConstant.NOTARIZATION_GENERATE_HAND.equals(contractOrderEntity.getAutoGenerate())) {
 			response.fail(OrderBizCodeMessage.NOTARIZATION_GENERATE_TYPE_ERROR);
 			return response;
@@ -352,12 +323,14 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 			return response;
 		}
 		// 检查公证书模板是否处于编辑状态
-		if (modelRepository.existModelInEditing(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION)) {
+		if (modelRepository.existModelInEditing(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(),
+				contractOrderEntity.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION)) {
 			response.fail(OrderBizCodeMessage.MODEL_IN_EDITING);
 			return response;
 		}
 		// 检查是否具备可用的公证书编号
-		List<NotarizationNoEntity> notarizationNoList = modelRepository.getListWithOfficeId(contractOrderEntity.getNotaryOfficeId());
+		List<NotarizationNoEntity> notarizationNoList = modelRepository
+				.getListWithOfficeId(contractOrderEntity.getNotaryOfficeId());
 		if (notarizationNoList == null || notarizationNoList.size() == 0) {
 			response.fail(ResultCode.NO_NOTARIZARION_NO);
 			return response;
@@ -366,7 +339,9 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		int currentNum = notarizationNoEntity.getCurrentNum() == 0 ? notarizationNoEntity.getBeginNum()
 				: notarizationNoEntity.getCurrentNum() + 1;
 		// 生成并保存未签名公证书
-		ModelEntity modelEntity = modelRepository.getModelEntity(contractOrderEntity.getProdId(),contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION, "1");
+		ModelEntity modelEntity = modelRepository.getModelEntity(contractOrderEntity.getProdId(),
+				contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId(),
+				ModelConstant.MODEL_TYPE_NOTARIZATION, "1");
 		String content = modelSynthesizerDomain.composeNotarizationTemplate(currentNum, req.getContent());
 		String htmlPath = FileUploadUtil.saveHtml(content, contractOrderEntity.getBusinessNo());
 		String pdfPath = FileUploadUtil.savePdf(content, contractOrderEntity.getBusinessNo());
@@ -423,7 +398,8 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 	public AppBaseResponse<String> previewNotarization(NotaryOrderQueryReq req) {
 		AppBaseResponse<String> response = new AppBaseResponse<>();
 		ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(req.getBusinessNo());
-		ModelEntity model = modelRepository.getModelEntity(order.getProdId(), order.getContractType(), order.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION, "1");
+		ModelEntity model = modelRepository.getModelEntity(order.getProdId(), order.getContractType(),
+				order.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION, "1");
 		String previewContent = modelSynthesizerDomain.composeNotarizationPreview(order, model.getContent());
 		response.setData(new AppResultData<String>(previewContent));
 		return response;
@@ -559,10 +535,8 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		// 取出所有的图片
 		List<FileInfoEntity> fileInfo = getFileInfo(orderDetail);
 		Map<Integer, FileInfoEntity> map = new HashMap<>();
-		Map<String, String> returnMap = new HashMap<>();
 		for (FileInfoEntity file : fileInfo) {
 			map.put(file.getId(), file);
-			returnMap.put(String.valueOf(file.getId()), FileUploadUtil.getFileUrl(file.getPath()));
 		}
 		// 进行图片拼接,按上传顺序处理
 		// 身份证正面
@@ -615,37 +589,14 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 	public Map<String, FileInfoEntity> getUploadFile(String businessNo) {
 		Map<String, FileInfoEntity> fileInfo = new HashMap<String, FileInfoEntity>();
 		// 借款人
-		QueryWrapper<BorrowerEntity> borrowerQW = new QueryWrapper<>();
-		borrowerQW.eq("business_no", businessNo);
-		List<BorrowerEntity> borrows = borrowerMapper.selectList(borrowerQW);
-		for (BorrowerEntity input : borrows) {
-			OrderDetailDto orderDto = BeanCopyUtils.convertObj(input, OrderDetailDto.class);
-			List<FileInfoEntity> list = getFileInfo(orderDto);
-			for (FileInfoEntity f : list) {
-				fileInfo.put(String.valueOf(f.getId()), f);
-			}
-		}
-		// 抵押人
-		QueryWrapper<MortgageEntity> mortgageQW = new QueryWrapper<>();
-		mortgageQW.eq("business_no", businessNo);
-		List<MortgageEntity> mortgage = mortgageMapper.selectList(mortgageQW);
-		for (MortgageEntity input : mortgage) {
-			OrderDetailDto orderDto = BeanCopyUtils.convertObj(input, OrderDetailDto.class);
-			List<FileInfoEntity> list = getFileInfo(orderDto);
-			for (FileInfoEntity f : list) {
-				fileInfo.put(String.valueOf(f.getId()), f);
-			}
-		}
-		// 担保人
-		QueryWrapper<GuaranteeEntity> guaranteeQW = new QueryWrapper<>();
-		guaranteeQW.eq("business_no", businessNo);
-		List<GuaranteeEntity> guarantee = guaranteeMapper.selectList(guaranteeQW);
-		for (GuaranteeEntity input : guarantee) {
-			OrderDetailDto orderDto = BeanCopyUtils.convertObj(input, OrderDetailDto.class);
-			List<FileInfoEntity> list = getFileInfo(orderDto);
-			for (FileInfoEntity f : list) {
-				fileInfo.put(String.valueOf(f.getId()), f);
-			}
+		QueryWrapper<ContractOrderEntity> qw = new QueryWrapper<>();
+		qw.eq("business_no", businessNo);
+		ContractOrderEntity contractOrder = contractOrderMapper.selectOne(qw);
+
+		OrderDetailDto orderDto = BeanCopyUtils.convertObj(contractOrder, OrderDetailDto.class);
+		List<FileInfoEntity> list = getFileInfo(orderDto);
+		for (FileInfoEntity f : list) {
+			fileInfo.put(String.valueOf(f.getId()), f);
 		}
 		return fileInfo;
 	}
@@ -654,7 +605,6 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		// 将所有图片查询出来
 		// 1.身份证正面 2.身份证反面 3.结婚证 4.合同附件 5.房产证6.户口本 7.其他内容
 		List<Integer> list = new ArrayList<Integer>();
-
 		// 身份证正面
 		list.add(Integer.parseInt(orderDetail.getIdcardFrontPic()));
 		// 身份证反面
@@ -673,10 +623,7 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		addImageId(list, orderDetail.getJointIdcardBackPic());
 		// 其他内容
 		String otherUpload = orderDetail.getOtherUpload();
-		if (org.apache.commons.lang3.StringUtils.isNotBlank(otherUpload)) {
-			String[] otherArray = otherUpload.split(",");
-			list.addAll(toIntList(otherArray));
-		}
+		addImageId(list, otherUpload);
 		// 取出所有的图片
 		List<FileInfoEntity> fileInfo = fileInfoService.listByIds(list);
 		return fileInfo;

+ 10 - 14
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/CochainLogServiceImpl.java

@@ -57,7 +57,7 @@ public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLo
 	GuaranteeMapper guaranteeMapper;
 
 	@Autowired
-    BankOrderService bankOrderService;
+	BankOrderService bankOrderService;
 	@Autowired
 	AdminOrderService adminOrderService;
 	@Autowired
@@ -101,27 +101,23 @@ public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLo
 		}
 		// 先读取借款人的,
 		String businessNo = cochainEntity.getBusinessNo();
-		//得到文件的临时目录
+		// 得到文件的临时目录
 		String applicationDir = FileUploadUtil.getApplicationTempDir();
 		String downloadPath = applicationDir + "/" + businessNo;
 		// 查询数据
 		log.info("【开始】调用上链业务编号:" + businessNo);
-		CochainLogEntity cochainLog = new CochainLogEntity();
-		cochainLog.setBusinessNo(businessNo);
 
 		// 查询所有上传的图片
 		Map<String, FileInfoEntity> map = adminOrderService.getUploadFile(businessNo);
-		// 借款人查询数据
-		QueryWrapper<BorrowerEntity> borrowerQW = new QueryWrapper<>();
-		borrowerQW.eq("business_no", businessNo);
-		List<BorrowerEntity> borrowers = borrowerMapper.selectList(borrowerQW);
-		for (BorrowerEntity obj : borrowers) {
-			
-		}
+		// 身份证正面
+		//recordCochain(obj.getCardFront(), "");
+//		for (BorrowerEntity obj : borrowers) {
+//
+//		}
 //			List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
 //			final String borrower = "borrower";
-//			// 身份证正面
-//			recordCochain(obj.getCardFront(), "");
+//			
+//			
 //			// 身份证反面
 //			recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs, "身份证反面", borrower);
 //			// 合同
@@ -141,7 +137,7 @@ public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLo
 //			recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardBackPic(), map, logs, cochainLogs, "配偶身份证反面照片",
 //					borrower);
 
-			// 带有盖章的pdf
+		// 带有盖章的pdf
 //			QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
 //			wrapper.eq("business_no", businessNo);
 //			wrapper.eq("contract_id", obj.getId());

+ 116 - 123
eladmin-system/src/main/java/me/zhengjie/base/plus/AbstractService.java

@@ -1,17 +1,10 @@
 package me.zhengjie.base.plus;
 
-import java.lang.reflect.Field;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import org.springframework.core.annotation.AnnotationUtils;
-import org.springframework.util.ObjectUtils;
-
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
@@ -36,7 +29,7 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default boolean remove(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return remove(queryWrapper);
 	}
 
@@ -108,12 +101,12 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default T getOne(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return getOne(queryWrapper, true);
 	}
 
 	default Map<String, Object> getMap(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return getMap(queryWrapper);
 	}
 
@@ -124,7 +117,7 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default long count(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return count(queryWrapper);
 	}
 
@@ -135,7 +128,7 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default List<T> list(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return list(queryWrapper);
 	}
 
@@ -146,7 +139,7 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default List<Map<String, Object>> listMaps(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return listMaps(queryWrapper);
 	}
 
@@ -157,7 +150,7 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default List<Object> listObjs(T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		return listObjs(queryWrapper);
 	}
 
@@ -169,7 +162,7 @@ public interface AbstractService<T> extends IService<T> {
 	 *                     {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
 	 */
 	default <E extends IPage<T>> E page(E page, T t) {
-		Wrapper<T> queryWrapper = convertQuery(t);
+		Wrapper<T> queryWrapper = QueryWrapperUtil.convertQuery(t);
 		try {
 			return page(page, queryWrapper);
 		} catch (Exception e) {
@@ -178,113 +171,113 @@ public interface AbstractService<T> extends IService<T> {
 		return null;
 	}
 
-	/**
-	 * 拼接查询条件
-	 *
-	 * @param queryWrapper 条件对象
-	 * @param obj          数据实体
-	 * @return void 返回参数说明
-	 * @exception/throws
-	 */
-	 default QueryWrapper<T> convertQuery(T obj) {
-
-		QueryWrapper<T> queryWrapper = new QueryWrapper<>();
-		Class<?> clazz = obj.getClass();
-		try {
-			// 反射遍历属性
-			for (Field field : clazz.getDeclaredFields()) {
-				// 获取属性名
-				String fieldname = field.getName();
-				// 抑制Java对修饰符的检查
-				field.setAccessible(true);
-				// 获取属性值
-				Object fieldValue = field.get(obj);
-//            String fieldValue = getFieldValue(obj ,field.getName()).toString();
-				TableField tableField = AnnotationUtils.getAnnotation(field, TableField.class);
-				// 字段没有TableField这个注解和有这个主机上false的
-				if (ObjectUtils.isEmpty(tableField) || !tableField.exist()) {
-					continue;
-				}
-				String fieldName = tableField.value();
-				// 默认是相等
-				QueryWapper queryWapperAnnotation = AnnotationUtils.getAnnotation(field, QueryWapper.class);
-
-				if (ObjectUtils.isEmpty(queryWapperAnnotation)) {
-					queryWrapper.eq(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-				} else {
-					// 获取枚举
-					QueryKeyword queryWapperEnum = queryWapperAnnotation.value();
-					// 拼接查询条件
-					switch (queryWapperEnum) {
-					case NE:
-						queryWrapper.ne(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					// 这里需要,修改为集合
-					case IN:
-						if (fieldValue != null && fieldValue.toString().contains(",")) {
-							List<String> result = Arrays.asList(fieldValue.toString().split(","));
-							queryWrapper.in(!ObjectUtils.isEmpty(fieldValue), fieldName, result);
-						}
-						break;
-					case GT:
-						queryWrapper.gt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case GE:
-						queryWrapper.ge(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LT:
-						queryWrapper.lt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LE:
-						queryWrapper.le(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LIKE:
-						queryWrapper.like(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case NOT_LIKE:
-						queryWrapper.notLike(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LIKE_LEFT:
-						queryWrapper.likeLeft(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LIKE_RIGHT:
-						queryWrapper.likeRight(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case DESC:
-						queryWrapper.orderByDesc(fieldName);
-						break;
-					case ASC:
-						queryWrapper.orderByAsc(fieldName);
-						break;
-					case RANGE:
-						// 设置开始的值和结束的值
-						String[] attribute = queryWapperAnnotation.attribute();
-						// 得到开始的属性值,通过反射设置属性值
-						Field startRange = clazz.getDeclaredField(attribute[0]);
-						startRange.setAccessible(true);
-						Object val = startRange.get(obj);
-						if (!ObjectUtils.isEmpty(val)) {
-							queryWrapper.ge(fieldName, fieldValue);
-						}
-						// 结束的属性值,通过反射设置属性值
-						Field endRange = clazz.getDeclaredField(attribute[1]);
-						endRange.setAccessible(true);
-						val = endRange.get(obj);
-						if (!ObjectUtils.isEmpty(val)) {
-							queryWrapper.le(fieldName, val);
-						}
-						break;
-					default:
-						break;
-					}
-				}
-
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return queryWrapper;
-
-	}
+//	/**
+//	 * 拼接查询条件
+//	 *
+//	 * @param queryWrapper 条件对象
+//	 * @param obj          数据实体
+//	 * @return void 返回参数说明
+//	 * @exception/throws
+//	 */
+//	 default QueryWrapper<T> convertQuery(T obj) {
+//
+//		QueryWrapper<T> queryWrapper = new QueryWrapper<>();
+//		Class<?> clazz = obj.getClass();
+//		try {
+//			// 反射遍历属性
+//			for (Field field : clazz.getDeclaredFields()) {
+//				// 获取属性名
+//				String fieldname = field.getName();
+//				// 抑制Java对修饰符的检查
+//				field.setAccessible(true);
+//				// 获取属性值
+//				Object fieldValue = field.get(obj);
+////            String fieldValue = getFieldValue(obj ,field.getName()).toString();
+//				TableField tableField = AnnotationUtils.getAnnotation(field, TableField.class);
+//				// 字段没有TableField这个注解和有这个主机上false的
+//				if (ObjectUtils.isEmpty(tableField) || !tableField.exist()) {
+//					continue;
+//				}
+//				String fieldName = tableField.value();
+//				// 默认是相等
+//				QueryWapper queryWapperAnnotation = AnnotationUtils.getAnnotation(field, QueryWapper.class);
+//
+//				if (ObjectUtils.isEmpty(queryWapperAnnotation)) {
+//					queryWrapper.eq(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//				} else {
+//					// 获取枚举
+//					QueryKeyword queryWapperEnum = queryWapperAnnotation.value();
+//					// 拼接查询条件
+//					switch (queryWapperEnum) {
+//					case NE:
+//						queryWrapper.ne(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					// 这里需要,修改为集合
+//					case IN:
+//						if (fieldValue != null && fieldValue.toString().contains(",")) {
+//							List<String> result = Arrays.asList(fieldValue.toString().split(","));
+//							queryWrapper.in(!ObjectUtils.isEmpty(fieldValue), fieldName, result);
+//						}
+//						break;
+//					case GT:
+//						queryWrapper.gt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case GE:
+//						queryWrapper.ge(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case LT:
+//						queryWrapper.lt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case LE:
+//						queryWrapper.le(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case LIKE:
+//						queryWrapper.like(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case NOT_LIKE:
+//						queryWrapper.notLike(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case LIKE_LEFT:
+//						queryWrapper.likeLeft(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case LIKE_RIGHT:
+//						queryWrapper.likeRight(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+//						break;
+//					case DESC:
+//						queryWrapper.orderByDesc(fieldName);
+//						break;
+//					case ASC:
+//						queryWrapper.orderByAsc(fieldName);
+//						break;
+//					case RANGE:
+//						// 设置开始的值和结束的值
+//						String[] attribute = queryWapperAnnotation.attribute();
+//						// 得到开始的属性值,通过反射设置属性值
+//						Field startRange = clazz.getDeclaredField(attribute[0]);
+//						startRange.setAccessible(true);
+//						Object val = startRange.get(obj);
+//						if (!ObjectUtils.isEmpty(val)) {
+//							queryWrapper.ge(fieldName, fieldValue);
+//						}
+//						// 结束的属性值,通过反射设置属性值
+//						Field endRange = clazz.getDeclaredField(attribute[1]);
+//						endRange.setAccessible(true);
+//						val = endRange.get(obj);
+//						if (!ObjectUtils.isEmpty(val)) {
+//							queryWrapper.le(fieldName, val);
+//						}
+//						break;
+//					default:
+//						break;
+//					}
+//				}
+//
+//			}
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
+//		return queryWrapper;
+//
+//	}
 
 }

+ 1 - 2
eladmin-system/src/main/java/me/zhengjie/base/plus/QueryWapper.java

@@ -4,14 +4,13 @@ import org.springframework.stereotype.Indexed;
 
 import java.lang.annotation.*;
 
-
 @Target({ ElementType.FIELD })
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 @Indexed
 public @interface QueryWapper {
 
-	QueryKeyword value();
+	QueryKeyword[] value();
 
 	// 查询时间的范围
 	String[] attribute() default "";

+ 104 - 56
eladmin-system/src/main/java/me/zhengjie/base/plus/QueryWrapperUtil.java

@@ -1,16 +1,16 @@
 package me.zhengjie.base.plus;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
 
-import me.zhengjie.dao.mybatis.entity.BorrowerEntity;
+import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.util.ObjectUtils;
 
-import java.lang.reflect.Field;
-
-import static org.apache.commons.lang3.reflect.MethodUtils.invokeMethod;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 
 /**
  * @Description 拼接查询条件工具类
@@ -20,11 +20,16 @@ public class QueryWrapperUtil {
 	/**
 	 * 拼接查询条件
 	 *
-	 * @param obj          数据实体
+	 * @param obj 数据实体
 	 * @return void 返回参数说明
 	 * @exception/throws
 	 */
-	public static <T> QueryWrapper<T> convertQuery(Object obj) {
+	public static <T> QueryWrapper<T> convertQuery(Object obj, JSONObject... jsonObj) {
+		JSONObject param = new JSONObject();
+		if (ArrayUtils.isNotEmpty(jsonObj)) {
+			param = jsonObj[0];
+		}
+
 		QueryWrapper<T> queryWrapper = new QueryWrapper<>();
 		Class<?> clazz = obj.getClass();
 		try {
@@ -38,10 +43,8 @@ public class QueryWrapperUtil {
 				Object fieldValue = field.get(obj);
 //            String fieldValue = getFieldValue(obj ,field.getName()).toString();
 				TableField tableField = AnnotationUtils.getAnnotation(field, TableField.class);
-				if (ObjectUtils.isEmpty(tableField)) {
-					continue;
-				}
-				if(ObjectUtils.isEmpty(fieldValue)) {
+				// 字段没有TableField这个注解和有这个主机上false的
+				if (ObjectUtils.isEmpty(tableField) || !tableField.exist()) {
 					continue;
 				}
 				String fieldName = tableField.value();
@@ -52,46 +55,92 @@ public class QueryWrapperUtil {
 					queryWrapper.eq(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
 				} else {
 					// 获取枚举
-					QueryKeyword queryWapperEnum = queryWapperAnnotation.value();
-					// 拼接查询条件
-					switch (queryWapperEnum) {
-					case NE:
-						queryWrapper.ne(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case GT:
-						queryWrapper.gt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case GE:
-						queryWrapper.ge(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LT:
-						queryWrapper.lt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LE:
-						queryWrapper.le(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LIKE:
-						queryWrapper.like(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case NOT_LIKE:
-						queryWrapper.notLike(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LIKE_LEFT:
-						queryWrapper.likeLeft(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					case LIKE_RIGHT:
-						queryWrapper.likeRight(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-						break;
-					default:
-						break;
+					QueryKeyword[] queryWapperEnums = queryWapperAnnotation.value();
+					for (QueryKeyword queryWapperEnum : queryWapperEnums) {
+						// 拼接查询条件
+						switch (queryWapperEnum) {
+						case NE:
+							queryWrapper.ne(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						// 这里需要,修改为集合
+						case IN:
+							if (fieldValue != null && fieldValue.toString().contains(",")) {
+								List<String> result = Arrays.asList(fieldValue.toString().split(","));
+								queryWrapper.in(!ObjectUtils.isEmpty(fieldValue), fieldName, result);
+							}
+							break;
+						case GT:
+							queryWrapper.gt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case GE:
+							queryWrapper.ge(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case LT:
+							queryWrapper.lt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case LE:
+							queryWrapper.le(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case LIKE:
+							queryWrapper.like(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case NOT_LIKE:
+							queryWrapper.notLike(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case LIKE_LEFT:
+							queryWrapper.likeLeft(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case LIKE_RIGHT:
+							queryWrapper.likeRight(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
+							break;
+						case DESC:
+							queryWrapper.orderByDesc(fieldName);
+							break;
+						case ASC:
+							queryWrapper.orderByAsc(fieldName);
+							break;
+						case RANGE:
+							// obj.getClass().su
+							// 设置开始的值和结束的值
+							String[] attribute = queryWapperAnnotation.attribute();
+							// 得到开始的属性值,通过反射设置属性值
+							Field startRange = clazz.getDeclaredField(attribute[0]);
+							startRange.setAccessible(true);
+							Object val = startRange.get(obj);
+							if (!ObjectUtils.isEmpty(val)) {
+								queryWrapper.ge(fieldName, val);
+							}
+							// 然后通过参数查询
+							val = param.get(attribute[0]);
+							if (!ObjectUtils.isEmpty(val)) {
+								queryWrapper.ge(fieldName, val);
+							}
+							// 结束的属性值,通过反射设置属性值
+							Field endRange = clazz.getDeclaredField(attribute[1]);
+							endRange.setAccessible(true);
+							val = endRange.get(obj);
+							if (!ObjectUtils.isEmpty(val)) {
+								queryWrapper.le(fieldName, val);
+							}
+							// 然后通过参数查询
+							val = param.get(attribute[1]);
+							if (!ObjectUtils.isEmpty(val)) {
+								queryWrapper.le(fieldName, val);
+							}
+							break;
+						default:
+							break;
+						}
 					}
+
 				}
 
 			}
-		} catch (IllegalAccessException e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
 		return queryWrapper;
+
 	}
 
 	/**
@@ -99,17 +148,16 @@ public class QueryWrapperUtil {
 	 *
 	 * @exception/throws
 	 */
-	private static String getFieldValue(Object owner, String fieldName) {
-		try {
-			return invokeMethod(owner, fieldName, null).toString();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
+//	private static String getFieldValue(Object owner, String fieldName) {
+//		try {
+//			return invokeMethod(owner, fieldName, null).toString();
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
+//		return null;
+//	}
 
 	public static void main(String[] args) {
-		LambdaQueryWrapper<BorrowerEntity> queryWrapper = new LambdaQueryWrapper<BorrowerEntity>();
-		queryWrapper.eq(BorrowerEntity::getBirth, "");
+
 	}
 }

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/BankEntity.java

@@ -88,7 +88,8 @@ public class BankEntity implements Serializable {
 	 */
 	@TableField("subject_color")
 	private String subjectColor;
-	@QueryWapper(value = QueryKeyword.RANGE, attribute = { "startDate", "endDate" })
+	
+	@QueryWapper(value = {QueryKeyword.RANGE,QueryKeyword.DESC}, attribute = { "startDate", "endDate" })
 	@TableField("create_time")
 	private LocalDateTime createTime;
 

+ 8 - 4
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/ContractOrderEntity.java

@@ -3,6 +3,8 @@ package me.zhengjie.dao.mybatis.entity;
 import com.baomidou.mybatisplus.annotation.*;
 import lombok.*;
 import lombok.experimental.Accessors;
+import me.zhengjie.base.plus.QueryKeyword;
+import me.zhengjie.base.plus.QueryWapper;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -32,7 +34,8 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField("main_contract_no")
     private String mainContractNo;
-
+    
+    @QueryWapper(QueryKeyword.LIKE)
     @TableField("contract_no")
     private String contractNo;
 
@@ -65,7 +68,7 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField("contract_attachment")
     private String contractAttachment;
-
+    @QueryWapper(QueryKeyword.LIKE)
     @TableField("name")
     private String name;
 
@@ -74,7 +77,8 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField("birth")
     private String birth;
-
+    
+    @QueryWapper(QueryKeyword.LIKE)
     @TableField("id_card")
     private String idCard;
 
@@ -155,7 +159,7 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField("creator")
     private String creator;
-
+    @QueryWapper(value = {QueryKeyword.RANGE,QueryKeyword.DESC}, attribute = { "startDate", "endDate" })
     @TableField(value="create_time", fill = FieldFill.INSERT)
     private Date createTime;