Explorar o código

Merge branch 'branch-nt-1.0.0' into branch-nt-1.0.1

humuyu %!s(int64=3) %!d(string=hai) anos
pai
achega
b766531748
Modificáronse 25 ficheiros con 684 adicións e 424 borrados
  1. 57 47
      eladmin-security/src/main/java/me/zhengjie/security/service/dto/OnlineUserDto.java
  2. 3 0
      eladmin-sign/src/main/java/me/zhengjie/sign/connector/HttpConnector.java
  3. 40 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/AdminNotarizationManageController.java
  4. 15 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/BankController.java
  5. 5 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotarizationNoReq.java
  6. 2 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOfficeQueryRsp.java
  7. 72 65
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOrderQueryReq.java
  8. 2 1
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOrderQueryRsp.java
  9. 1 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/UserReq.java
  10. 7 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/AdminNotarizationManageService.java
  11. 80 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/AdminNotarizationManageServiceImpl.java
  12. 25 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/AdminOrderServiceImpl.java
  13. 219 201
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/ModelNotarizationServiceImpl.java
  14. 88 64
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotarizationNoServiceImpl.java
  15. 4 4
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotaryOfficeServiceImpl.java
  16. 9 10
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/OrderCochainServiceImpl.java
  17. 9 2
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/SmsTemplateServiceImpl.java
  18. 1 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/UserDetailsServiceImpl.java
  19. 4 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/UserServiceImpl.java
  20. 5 0
      eladmin-system/src/main/java/me/zhengjie/application/bank/service/UserAXQInfoService.java
  21. 6 1
      eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/BankLoginServiceImpl.java
  22. 3 2
      eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/UserAXQInfoServiceImpl.java
  23. 3 2
      eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/ContractOrderEntity.java
  24. 1 1
      eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/SmsTemplateEntity.java
  25. 23 24
      eladmin-system/src/main/java/me/zhengjie/domain/model/ModelSynthesizerDomain.java

+ 57 - 47
eladmin-security/src/main/java/me/zhengjie/security/service/dto/OnlineUserDto.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import lombok.ToString;
+
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
 
@@ -15,58 +17,66 @@ import java.util.List;
 @Setter
 @NoArgsConstructor
 public class OnlineUserDto implements UserDetails {
-    private Long userId;
-    private String username;
-    private String password;
-    private String nickName;
-    private String dept;
-    private String key;
-    private String onlineToken;
-    private String ip;
-    private String address;
-    private String browser;
-    private Date loginTime;
-    private boolean enabled;
-    private List<Long> dataScopes;
-    private List<GrantedAuthority> authorities;
 
-    @Override
-    public List<GrantedAuthority> getAuthorities() {
-        return authorities;
-    }
+	private Long userId;
+	private String username;
+	private String password;
+	private String nickName;
+	private String dept;
+	private String key;
+	private String onlineToken;
+	private String ip;
+	private String address;
+	private String browser;
+	private Date loginTime;
+	private boolean enabled;
+	private List<Long> dataScopes;
+	private List<GrantedAuthority> authorities;
+	private String orgName;
+
+	@Override
+	public List<GrantedAuthority> getAuthorities() {
+		return authorities;
+	}
+
+	@Override
+	@JSONField(serialize = false)
+	public String getPassword() {
+		return password;
+	}
 
-    @Override
-    @JSONField(serialize = false)
-    public String getPassword() {
-        return password;
-    }
+	@Override
+	public String getUsername() {
+		return username;
+	}
 
-    @Override
-    public String getUsername() {
-        return username;
-    }
+	@JSONField(serialize = false)
+	@Override
+	public boolean isAccountNonExpired() {
+		return true;
+	}
 
-    @JSONField(serialize = false)
-    @Override
-    public boolean isAccountNonExpired() {
-        return true;
-    }
+	@JSONField(serialize = false)
+	@Override
+	public boolean isAccountNonLocked() {
+		return true;
+	}
 
-    @JSONField(serialize = false)
-    @Override
-    public boolean isAccountNonLocked() {
-        return true;
-    }
+	@JSONField(serialize = false)
+	@Override
+	public boolean isCredentialsNonExpired() {
+		return true;
+	}
 
-    @JSONField(serialize = false)
-    @Override
-    public boolean isCredentialsNonExpired() {
-        return true;
-    }
+	@Override
+	@JSONField(serialize = false)
+	public boolean isEnabled() {
+		return enabled;
+	}
 
-    @Override
-    @JSONField(serialize = false)
-    public boolean isEnabled() {
-        return enabled;
-    }
+	@Override
+	public String toString() {
+		return "OnlineUserDto [" + username + "," + nickName + "," + dept + "," + ip + ", address=" + address + ","
+				+ browser + "" + orgName + "]";
+	}
 }

+ 3 - 0
eladmin-sign/src/main/java/me/zhengjie/sign/connector/HttpConnector.java

@@ -55,6 +55,9 @@ public class HttpConnector implements InitializingBean {
     @Override
     public void afterPropertiesSet() throws Exception {
         Path temp = Paths.get(new File(HttpConnector.class.getClassLoader().getResource("").getPath().concat(keyStorePath)).getAbsolutePath());
+        if(Files.exists(temp)) {
+        	Files.delete(temp);
+        }
         Files.copy(HttpClient.class.getClassLoader().getResourceAsStream(keyStorePath), temp, StandardCopyOption.REPLACE_EXISTING);
         keyStorePath = temp.toFile().getPath();
         trustStorePath = keyStorePath;

+ 40 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/AdminNotarizationManageController.java

@@ -0,0 +1,40 @@
+package me.zhengjie.application.admin.controller;
+
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.application.admin.service.AdminNotarizationManageService;
+import me.zhengjie.base.AppBaseResponse;
+import me.zhengjie.base.ResultCode;
+import me.zhengjie.domain.user.UserDomain;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("${fqgz.admin.web.url-prefix}/notarization-manage")
+public class AdminNotarizationManageController {
+    private final UserDomain userDomain;
+    private final AdminNotarizationManageService adminNotarizationManageService;
+
+    @GetMapping("/recreate-common-doc/{businessNo}")
+    public AppBaseResponse recreateCommonDoc(@PathVariable String businessNo) {
+        String maxRole = userDomain.getUserMaxRole();
+        if (!"超级管理员".equals(maxRole)) {
+            return AppBaseResponse.error(ResultCode.PERMISSION_UNAUTHORISE);
+        }
+        adminNotarizationManageService.recreateCommonDoc(businessNo);
+        return AppBaseResponse.success();
+    }
+
+
+    @GetMapping("/resign-common-doc/{businessNo}")
+    public AppBaseResponse resignCommonDoc(@PathVariable String businessNo) {
+        String maxRole = userDomain.getUserMaxRole();
+        if (!"超级管理员".equals(maxRole)) {
+            return AppBaseResponse.error(ResultCode.PERMISSION_UNAUTHORISE);
+        }
+        adminNotarizationManageService.resignCommonDoc(businessNo);
+        return AppBaseResponse.success();
+    }
+}

+ 15 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/BankController.java

@@ -1,6 +1,9 @@
 package me.zhengjie.application.admin.controller;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -10,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import me.zhengjie.base.AppBaseResponse;
 import me.zhengjie.base.util.FileUploadUtil;
+import me.zhengjie.dao.mybatis.entity.BankEntity;
 import me.zhengjie.application.admin.controller.vo.BankCreateReq;
 import me.zhengjie.application.admin.controller.vo.BankQueryReq;
 import me.zhengjie.application.admin.controller.vo.BankQueryRsp;
@@ -46,6 +50,17 @@ public class BankController {
 	 *
 	 * @return
 	 */
+	@RequestMapping("/all")
+	public AppBaseResponse<?> all() {
+		List<BankEntity> banks = bankService.list();		
+		return AppBaseResponse.succ(banks);
+	}
+
+	/**
+	 * 银行 查询
+	 *
+	 * @return
+	 */
 	@RequestMapping("/detail")
 	public AppBaseResponse<BankQueryRsp> detail(@RequestBody BankQueryReq req) {
 		AppBaseResponse<BankQueryRsp> response = new AppBaseResponse<>();

+ 5 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotarizationNoReq.java

@@ -23,4 +23,9 @@ public class NotarizationNoReq extends BaseRequest {
     private Integer leftNum;
     private Date createTime;
     private String usedYear;
+    
+    private String notaryName;
+    
+    private String startDate;
+    private String endDate;
 }

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOfficeQueryRsp.java

@@ -48,6 +48,8 @@ public class NotaryOfficeQueryRsp {
 
     private String sealImg;
     
+    private String sealImgUrl;
+    
     /**
      * 图片的id
      */

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

@@ -17,69 +17,76 @@ import java.time.LocalDateTime;
 @Data
 public class NotaryOrderQueryReq extends BaseRequest {
 
-    /**
-     * 合同
-     */
-    private String contractNo;
-
-
-    /**
-     * 借款人姓名
-     */
-    private String loanName;
-
-
-    /**
-     * 手机号
-     */
-    private String phone;
-
-    /**
-     * 证件号
-     */
-    private String idCard;
-
-    /**
-     * 借款起始金额
-     */
-    private String loanMoneyStart;
-
-    /**
-     * 借款终止金额
-     */
-    private String loanMoneyEnd;
-
-    /**
-     * 所属银行
-     */
-    private String bankName;
-
-    /**
-     * 客户经理名称
-     */
-    private String customerName;
-
-    private String status;
-
-   //开始时间
-    private String startDate;
-    //结束时间
-    private String endDate;
-
-
-    // 查询使用
-    private String id;
-
-    // 退户原因
-    private String returnReason;
-    // 驳回原因
-    private String rejectReason;
-    // 当事人 通过 使用入参
-    private String partyId;
-    private String roleId; // 1 借款人  2 抵押人  3 担保人
-
-    private String businessNo;
-    private String orderType;
-    private String prodId;
-    private String content;
+	/**
+	 * 合同
+	 */
+	private String contractNo;
+
+	/**
+	 * 借款人姓名
+	 */
+	private String loanName;
+
+	/**
+	 * 手机号
+	 */
+	private String phone;
+
+	/**
+	 * 证件号
+	 */
+	private String idCard;
+
+	/**
+	 * 借款起始金额
+	 */
+	private String loanMoneyStart;
+
+	/**
+	 * 借款终止金额
+	 */
+	private String loanMoneyEnd;
+
+	/**
+	 * 所属银行
+	 */
+	private String bankName;
+	/**
+	 * 所属银行id
+	 */
+	private String  bankId;
+	/**
+	 * 客户经理名称
+	 */
+	private String customerName;
+
+	private String status;
+
+	// 开始时间
+	private String startDate;
+	// 结束时间
+	private String endDate;
+
+	// 查询使用
+	private String id;
+
+	// 退户原因
+	private String returnReason;
+	// 驳回原因
+	private String rejectReason;
+	// 当事人 通过 使用入参
+	private String partyId;
+	private String roleId; // 1 借款人 2 抵押人 3 担保人
+
+	private String businessNo;
+	private String orderType;
+	private String prodId;
+	private String content;
+	// 咨询受理号
+	private String consultNo;
+	//公证员姓名
+	private String notaryUserName;
+	//当事人
+	private String name;
+	
 }

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOrderQueryRsp.java

@@ -60,7 +60,8 @@ public class NotaryOrderQueryRsp {
 	// 申请时间
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
 	private LocalDateTime applyTime;
-
+	// 流程是否已经完成
+	private String notarizedFlag;
 	public LocalDateTime getApplyTime() {
 
 		return applyTime = createTime;

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/UserReq.java

@@ -16,4 +16,5 @@ public class UserReq extends BaseRequest {
     private String blurry;
     private Boolean enabled;
     private List<Timestamp> createTime;
+    private String orgId;
 }

+ 7 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/AdminNotarizationManageService.java

@@ -0,0 +1,7 @@
+package me.zhengjie.application.admin.service;
+
+public interface AdminNotarizationManageService {
+    void recreateCommonDoc(String businessNo);
+
+    void resignCommonDoc(String businessNo);
+}

+ 80 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/AdminNotarizationManageServiceImpl.java

@@ -0,0 +1,80 @@
+package me.zhengjie.application.admin.service.impl;
+
+import cfca.trustsign.common.vo.cs.UploadSignInfoVO;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.application.admin.service.AdminNotarizationManageService;
+import me.zhengjie.application.bank.service.UserAXQInfoService;
+import me.zhengjie.dao.mybatis.ContractOrderRepository;
+import me.zhengjie.dao.mybatis.UserAXQInfoRepository;
+import me.zhengjie.dao.mybatis.entity.ContractOrderEntity;
+import me.zhengjie.dao.mybatis.entity.SysUserEntity;
+import me.zhengjie.dao.mybatis.entity.UserAXQInfoEntity;
+import me.zhengjie.dao.mybatis.mapper.SysUserMapper;
+import me.zhengjie.domain.model.ModelSynthesizerDomain;
+import me.zhengjie.domain.order.OrderConstant;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@RequiredArgsConstructor
+public class AdminNotarizationManageServiceImpl implements AdminNotarizationManageService {
+
+    private final ContractOrderRepository contractOrderRepository;
+    private final UserAXQInfoRepository userAXQInfoRepository;
+    private final UserAXQInfoService userAXQInfoService;
+    private final SysUserMapper userMapper;
+    private final ModelSynthesizerDomain modelSynthesizerDomain;
+
+    @Override
+    public void recreateCommonDoc(final String businessNo) {
+        ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
+        JSONArray jsonArray = new JSONArray();
+        JSONObject userMain = new JSONObject();
+        userMain.put("imageId", userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getIdCard()).getImgSealId());
+        jsonArray.add(userMain);
+        //
+        if (contractOrderEntity.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
+            JSONObject userJoint = new JSONObject();
+            userJoint.put("imageId", userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getJointIdCard()).getImgSealId());
+            jsonArray.add(userJoint);
+        }
+        modelSynthesizerDomain.recreateCommonDoc(businessNo, jsonArray);
+    }
+
+    @Override
+    public void resignCommonDoc(final String businessNo) {
+        ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
+        List<UploadSignInfoVO> signInfoList = new ArrayList<>();
+        List<String> idCardList = new ArrayList<>();
+        idCardList.add(contractOrderEntity.getIdCard());
+        if (contractOrderEntity.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
+            idCardList.add(contractOrderEntity.getJointIdCard());
+        }
+        for (String idCard : idCardList) {
+            UserAXQInfoEntity entity = userAXQInfoRepository.getUserAXQInfoWithIdcard(idCard);
+            UploadSignInfoVO notartyUser = new UploadSignInfoVO();
+            notartyUser.setUserId(entity.getAxqUserId());
+            notartyUser.setSealId(entity.getAxqSealId());
+            notartyUser.setLocation("210.74.41.0");
+            notartyUser.setAuthorizationTime("20220214171200");
+            signInfoList.add(notartyUser);
+        }
+        SysUserEntity customer = userMapper.selectById(contractOrderEntity.getCustomerId());
+        UploadSignInfoVO notartyUser = new UploadSignInfoVO();
+        notartyUser.setUserId(customer.getAxqUserId());
+        notartyUser.setSealId(customer.getAxqSealId());
+        notartyUser.setLocation("210.74.41.0");
+        notartyUser.setAuthorizationTime("20220214171200");
+        signInfoList.add(notartyUser);
+        //
+        try {
+            userAXQInfoService.signContract(signInfoList, businessNo);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

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

@@ -5,9 +5,12 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 import me.zhengjie.dao.mybatis.entity.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +37,7 @@ import me.zhengjie.application.admin.controller.vo.PartyEntity;
 import me.zhengjie.application.admin.service.AdminOrderService;
 import me.zhengjie.application.admin.service.OrderCochainService;
 import me.zhengjie.application.admin.service.SmsTemplateService;
+import me.zhengjie.application.bank.controller.vo.BankOrderVO;
 import me.zhengjie.application.bank.service.BankOrderService;
 import me.zhengjie.application.bank.service.FileInfoService;
 import me.zhengjie.base.AppBaseResponse;
@@ -44,6 +48,7 @@ import me.zhengjie.base.util.ApplicationContextUtil;
 import me.zhengjie.base.util.BeanCopyUtils;
 import me.zhengjie.base.util.FileUploadUtil;
 import me.zhengjie.base.util.StatusEnum;
+import me.zhengjie.base.util.StatusEnum.NotaryStatusEnum;
 import me.zhengjie.dao.mybatis.ContractOrderRepository;
 import me.zhengjie.dao.mybatis.ModelRepository;
 import me.zhengjie.dao.mybatis.OrderFileRepository;
@@ -141,8 +146,28 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		page = contractOrderMapper.selectPage(page, qw);
 		List<ContractOrderEntity> list = page.getRecords();
 		List<NotaryOrderQueryRsp> res = BeanCopyUtils.convertList2List(list, NotaryOrderQueryRsp.class);
+	
+		//待公证增加状态
+		String status=NotaryStatusEnum.NOTARIZED.getStatus().toString();
+		if(status.equals(req.getStatus())) {
+			 List<String> bizNoList = res.stream().map(NotaryOrderQueryRsp::getBusinessNo).collect(Collectors.toList());
+		        if (bizNoList != null && bizNoList.size() > 0) {
+		            Set<String> set = new HashSet<>();
+		            List<OrderFileEntity> fileList = orderFileRepository.getOrderNoteList(bizNoList);
+		            if (fileList != null && fileList.size() > 0) {
+		                set = fileList.stream().map(OrderFileEntity::getBusinessNo).collect(Collectors.toSet());
+		            }
+		            for (NotaryOrderQueryRsp order : res) {
+		            	//流程是否已经完成
+		                order.setNotarizedFlag(set.contains(order.getBusinessNo()) ? "1" : "0");
+		            }
+		        }
+		}
+		
 		response.setData(new AppResultData<List<NotaryOrderQueryRsp>>(res,
 				new me.zhengjie.base.Page(req.getIndex(), req.getSize(), (int) page.getTotal())));
+		 
+		
 		return response;
 	}
 

+ 219 - 201
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/ModelNotarizationServiceImpl.java

@@ -36,212 +36,230 @@ import java.util.*;
 @Slf4j
 public class ModelNotarizationServiceImpl implements ModelNotarizationService {
 
-    @Autowired
-    private ModelMapper modelMapper;
-    @Autowired
-    private UserDomain userDomain;
-    @Autowired
-    private NotaryNoteMapper notaryNoteDao;
-    @Autowired
-    private NotaryOfficeMapper notaryOfficeMapper;
-    @Autowired
-    private ApplicationContextUtil contextUtil;
+	@Autowired
+	private ModelMapper modelMapper;
+	@Autowired
+	private UserDomain userDomain;
+	@Autowired
+	private NotaryNoteMapper notaryNoteDao;
+	@Autowired
+	private NotaryOfficeMapper notaryOfficeMapper;
+	@Autowired
+	private ApplicationContextUtil contextUtil;
 
-    /**
-     * 查询公证文书列表
-     *
-     * @param req
-     * @return
-     */
-    @Override
-    public AppBaseResponse query(ModelReq req) {
-        AppBaseResponse<List<ModelReq>> response = new AppBaseResponse<>();
-        QueryWrapper<ModelEntity> qw = getQueryWrapper(req);
-        if (qw == null) {
-            return AppBaseResponse.error(ResultCode.PERMISSION_UNAUTHORISE);
-        }
-        IPage<ModelEntity> page = new Page<>(req.getIndex(), req.getSize());
-        page = modelMapper.selectPage(page, qw);
-        List<ModelEntity> list = page.getRecords();
-        List<ModelReq> res = BeanCopyUtils.convertList2List(list, ModelReq.class);
-        if (list != null && list.size() > 0) {
-            Set<Integer> officeNames = new HashSet<>();
-            for (ModelReq modelReq : res) {
-                officeNames.add(modelReq.getNotaryOfficeId());
-            }
-            List<NotaryOfficeEntity> officeList = notaryOfficeMapper.selectBatchIds(officeNames);
-            Map<String, String> officeNameMap = new HashMap<String, String>();
-            for (NotaryOfficeEntity entity : officeList) {
-                officeNameMap.put(String.valueOf(entity.getId()), entity.getName());
-            }
-            for (ModelReq model : res) {
-                model.setNotaryOfficeName(officeNameMap.get(String.valueOf(model.getNotaryOfficeId())));
-                if (ModelConstant.MODEL_TYPE_NOTE.equals(model.getCode())) {
-                    model.setNotaryNote(getNotaryNote(model));
-                }
-            }
-        }
-        response.setData(new AppResultData<List<ModelReq>>(res, new me.zhengjie.base.Page(req.getIndex(), req.getSize(), (int) page.getTotal())));
-        return response;
-    }
+	/**
+	 * 查询公证文书列表
+	 *
+	 * @param req
+	 * @return
+	 */
+	@Override
+	public AppBaseResponse query(ModelReq req) {
+		AppBaseResponse<List<ModelReq>> response = new AppBaseResponse<>();
+		QueryWrapper<ModelEntity> qw = getQueryWrapper(req);
+		if (qw == null) {
+			return AppBaseResponse.error(ResultCode.PERMISSION_UNAUTHORISE);
+		}
+		IPage<ModelEntity> page = new Page<>(req.getIndex(), req.getSize());
+		page = modelMapper.selectPage(page, qw);
+		List<ModelEntity> list = page.getRecords();
+		List<ModelReq> res = BeanCopyUtils.convertList2List(list, ModelReq.class);
+		if (list != null && list.size() > 0) {
+			Set<Integer> officeNames = new HashSet<>();
+			for (ModelReq modelReq : res) {
+				officeNames.add(modelReq.getNotaryOfficeId());
+			}
+			List<NotaryOfficeEntity> officeList = notaryOfficeMapper.selectBatchIds(officeNames);
+			Map<String, String> officeNameMap = new HashMap<String, String>();
+			for (NotaryOfficeEntity entity : officeList) {
+				officeNameMap.put(String.valueOf(entity.getId()), entity.getName());
+			}
+			for (ModelReq model : res) {
+				model.setNotaryOfficeName(officeNameMap.get(String.valueOf(model.getNotaryOfficeId())));
+				if (ModelConstant.MODEL_TYPE_NOTE.equals(model.getCode())) {
+					model.setNotaryNote(getNotaryNote(model));
+				}
+			}
+		}
+		response.setData(new AppResultData<List<ModelReq>>(res,
+				new me.zhengjie.base.Page(req.getIndex(), req.getSize(), (int) page.getTotal())));
+		return response;
+	}
 
-    /**
-     * 获取面谈笔录
-     *
-     * @param res
-     * @return
-     */
-    private List<NotaryNoteReq> getNotaryNote(ModelReq res) {
-        QueryWrapper<NotaryNoteEntity> notaryNoteQw = new QueryWrapper<>();
-        notaryNoteQw.eq("model_id", res.getId());
-        notaryNoteQw.orderByAsc("sort");
-        List<NotaryNoteEntity> notaryNoteList = notaryNoteDao.selectList(notaryNoteQw);
-        return BeanCopyUtils.convertList2List(notaryNoteList, NotaryNoteReq.class);
-    }
+	/**
+	 * 获取面谈笔录
+	 *
+	 * @param res
+	 * @return
+	 */
+	private List<NotaryNoteReq> getNotaryNote(ModelReq res) {
+		QueryWrapper<NotaryNoteEntity> notaryNoteQw = new QueryWrapper<>();
+		notaryNoteQw.eq("model_id", res.getId());
+		notaryNoteQw.orderByAsc("sort");
+		List<NotaryNoteEntity> notaryNoteList = notaryNoteDao.selectList(notaryNoteQw);
+		return BeanCopyUtils.convertList2List(notaryNoteList, NotaryNoteReq.class);
+	}
 
-    /**
-     * 获取查询对象
-     *
-     * @param req
-     * @return
-     */
-    private QueryWrapper<ModelEntity> getQueryWrapper(ModelReq req) {
-        QueryWrapper<ModelEntity> qw = new QueryWrapper<>();
-        String roleName = userDomain.getUserMaxRole();
-        if ("超级管理员".equals(roleName)) {
-        } else if ("公证处管理员".equals(roleName)) {
-            JwtUserDto user = contextUtil.getCurrentUser();
-            qw.eq("notary_office_id", user.getUser().getOrgId().split("_")[1]);
-        } else {
-            return null;
-        }
-        Set<String> codes = null;
-        if ("notary".equals(req.getChannel())) {
-            codes = new HashSet<>(Arrays.asList("10,11,12".split(",")));
-        } else {
-            codes = new HashSet<>(Arrays.asList("1,2,3,4,5,6,7,8,9".split(",")));
-        }
-        qw.in("code", codes);
-        qw.in("status", "0", "1");
-        qw.orderByAsc("sort");
-        return qw;
-    }
+	/**
+	 * 获取查询对象
+	 *
+	 * @param req
+	 * @return
+	 */
+	private QueryWrapper<ModelEntity> getQueryWrapper(ModelReq req) {
+		QueryWrapper<ModelEntity> qw = new QueryWrapper<>();
+		String roleName = userDomain.getUserMaxRole();
+		if ("超级管理员".equals(roleName)) {
+		} else if ("公证处管理员".equals(roleName)) {
+			JwtUserDto user = contextUtil.getCurrentUser();
+			qw.eq("notary_office_id", user.getUser().getOrgId().split("_")[1]);
+		} else {
+			return null;
+		}
+		// 产品类型
+		if (StringUtils.isNotBlank(req.getProductType())) {
+			qw.eq("product_type", req.getProductType());
+		}
+		// 合同类型
+		if (req.getContractType() != null) {
+			qw.eq("contract_type", req.getContractType());
+		}
+		// 文书类型
+		if (StringUtils.isNotBlank(req.getCode())) {
+			qw.eq("code", req.getCode());
+		}
+		// 所属机构notary_office_id
+		if (req.getNotaryOfficeId()!=null) {
+			qw.eq("notary_office_id", req.getNotaryOfficeId());
+		}
+		Set<String> codes = null;
+		if ("notary".equals(req.getChannel())) {
+			codes = new HashSet<>(Arrays.asList("10,11,12".split(",")));
+		} else {
+			codes = new HashSet<>(Arrays.asList("1,2,3,4,5,6,7,8,9".split(",")));
+		}
+		qw.in("code", codes);
+		qw.in("status", "0", "1");
+		qw.orderByAsc("sort");
+		return qw;
+	}
 
-    /**
-     * 创建公证文书模板
-     *
-     * @param req
-     * @return
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public AppBaseResponse create(ModelReq req) {
-        AppBaseResponse response = new AppBaseResponse();
-        ModelEntity existModel = getModel(req);
-        if (existModel != null) {
-            response.fail(ResultCode.MODEL_ALREADY_EXISGT);
-            return response;
-        }
-        if ("1,2,3,4,5,6,7,8,9".indexOf(req.getCode()) > -1 && isSortExist(req)) {
-            response.fail(ResultCode.MODEL_SORT_EXISTED);
-            return response;
-        }
-        ModelEntity model = ModelEntity.builder().code(req.getCode()).content(req.getContent())
-                .ifModify(0).notaryOfficeId(req.getNotaryOfficeId()).productType(req.getProductType()).contractType(req.getContractType())
-                .status(1).title(req.getTitle()).createTime(new Date()).build();
-        if ("1,2,3,4,5,6,7,8,9".indexOf(req.getCode()) > -1) {
-            model.setSort(req.getSort());
-        } else {
-            model.setSort(0);
-        }
-        modelMapper.insert(model);
-        //
-        if (ModelConstant.MODEL_TYPE_NOTE.equals(req.getCode())) {
-            ModelEntity savedModel = getModel(req);
-            List<NotaryNoteEntity> entityList = BeanCopyUtils.convertList2List(req.getNotaryNote(), NotaryNoteEntity.class);
-            int i = 1;
-            for (NotaryNoteEntity entity : entityList) {
-                entity.setModelId(savedModel.getId());
-                entity.setCreateTime(LocalDateTime.now());
-                entity.setSort(i++);
-                notaryNoteDao.insert(entity);
-            }
-        }
-        return response;
-    }
+	/**
+	 * 创建公证文书模板
+	 *
+	 * @param req
+	 * @return
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public AppBaseResponse create(ModelReq req) {
+		AppBaseResponse response = new AppBaseResponse();
+		ModelEntity existModel = getModel(req);
+		if (existModel != null) {
+			response.fail(ResultCode.MODEL_ALREADY_EXISGT);
+			return response;
+		}
+		if ("1,2,3,4,5,6,7,8,9".indexOf(req.getCode()) > -1 && isSortExist(req)) {
+			response.fail(ResultCode.MODEL_SORT_EXISTED);
+			return response;
+		}
+		ModelEntity model = ModelEntity.builder().code(req.getCode()).content(req.getContent()).ifModify(0)
+				.notaryOfficeId(req.getNotaryOfficeId()).productType(req.getProductType())
+				.contractType(req.getContractType()).status(1).title(req.getTitle()).createTime(new Date()).build();
+		if ("1,2,3,4,5,6,7,8,9".indexOf(req.getCode()) > -1) {
+			model.setSort(req.getSort());
+		} else {
+			model.setSort(0);
+		}
+		modelMapper.insert(model);
+		//
+		if (ModelConstant.MODEL_TYPE_NOTE.equals(req.getCode())) {
+			ModelEntity savedModel = getModel(req);
+			List<NotaryNoteEntity> entityList = BeanCopyUtils.convertList2List(req.getNotaryNote(),
+					NotaryNoteEntity.class);
+			int i = 1;
+			for (NotaryNoteEntity entity : entityList) {
+				entity.setModelId(savedModel.getId());
+				entity.setCreateTime(LocalDateTime.now());
+				entity.setSort(i++);
+				notaryNoteDao.insert(entity);
+			}
+		}
+		return response;
+	}
 
-    /**
-     * 获取模型
-     * @param req
-     * @return
-     */
-    private ModelEntity getModel(ModelReq req) {
-        QueryWrapper<ModelEntity> qw = new QueryWrapper<>();
-        qw.eq("code", req.getCode());
-        qw.eq("notary_office_id", req.getNotaryOfficeId());
-        qw.eq("product_type", req.getProductType());
-        qw.eq("contract_type", req.getContractType());
-        qw.in("status", 0, 1);
-        ModelEntity model = modelMapper.selectOne(qw);
-        return model;
-    }
+	/**
+	 * 获取模型
+	 * 
+	 * @param req
+	 * @return
+	 */
+	private ModelEntity getModel(ModelReq req) {
+		QueryWrapper<ModelEntity> qw = new QueryWrapper<>();
+		qw.eq("code", req.getCode());
+		qw.eq("notary_office_id", req.getNotaryOfficeId());
+		qw.eq("product_type", req.getProductType());
+		qw.eq("contract_type", req.getContractType());
+		qw.in("status", 0, 1);
+		ModelEntity model = modelMapper.selectOne(qw);
+		return model;
+	}
 
-    /**
-     * 排序值是否已经存在
-     *
-     * @param req
-     * @return
-     */
-    private boolean isSortExist(ModelReq req) {
-        QueryWrapper<ModelEntity> qw = new QueryWrapper<>();
-        qw.ne("code", req.getCode());
-        qw.eq("notary_office_id", req.getNotaryOfficeId());
-        qw.eq("product_type", req.getProductType());
-        qw.eq("contract_type", req.getContractType());
-        qw.eq("sort", req.getSort());
-        if (req.getId() != null && req.getId() != 0) {
-            qw.ne("id", req.getId());
-        }
-        qw.in("status", 0, 1);
-        List<ModelEntity> modelList = modelMapper.selectList(qw);
-        return modelList != null && modelList.size() > 0;
-    }
+	/**
+	 * 排序值是否已经存在
+	 *
+	 * @param req
+	 * @return
+	 */
+	private boolean isSortExist(ModelReq req) {
+		QueryWrapper<ModelEntity> qw = new QueryWrapper<>();
+		qw.ne("code", req.getCode());
+		qw.eq("notary_office_id", req.getNotaryOfficeId());
+		qw.eq("product_type", req.getProductType());
+		qw.eq("contract_type", req.getContractType());
+		qw.eq("sort", req.getSort());
+		if (req.getId() != null && req.getId() != 0) {
+			qw.ne("id", req.getId());
+		}
+		qw.in("status", 0, 1);
+		List<ModelEntity> modelList = modelMapper.selectList(qw);
+		return modelList != null && modelList.size() > 0;
+	}
 
-
-    /**
-     * 修改公证文书模板
-     *
-     * @param req
-     * @return
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public AppBaseResponse update(ModelReq req) {
-        AppBaseResponse response = new AppBaseResponse();
-        if ("1,2,3,4,5,6,7,8,9".indexOf(req.getCode()) > -1 && isSortExist(req)) {
-            response.fail(ResultCode.MODEL_SORT_EXISTED);
-            return response;
-        }
-        ModelEntity model = ModelEntity.builder()
-                .id(req.getId()).code(req.getCode()).sort(req.getSort())
-                .content(req.getContent()).notaryOfficeId(req.getNotaryOfficeId()).status(req.getStatus()).contractType(req.getContractType())
-                .title(req.getTitle()).productType(req.getProductType()).build();
-        modelMapper.updateById(model);
-        if (ModelConstant.MODEL_TYPE_NOTE.equals(req.getCode())) {
-            QueryWrapper<NotaryNoteEntity> qw = new QueryWrapper<>();
-            qw.eq("model_id", req.getId());
-            notaryNoteDao.delete(qw);
-            //
-            List<NotaryNoteEntity> entityList = BeanCopyUtils.convertList2List(req.getNotaryNote(), NotaryNoteEntity.class);
-            int i = 1;
-            for (NotaryNoteEntity entity : entityList) {
-                entity.setId(null);
-                entity.setModelId(req.getId());
-                entity.setCreateTime(LocalDateTime.now());
-                entity.setSort(i++);
-                notaryNoteDao.insert(entity);
-            }
-        }
-        return response;
-    }
+	/**
+	 * 修改公证文书模板
+	 *
+	 * @param req
+	 * @return
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public AppBaseResponse update(ModelReq req) {
+		AppBaseResponse response = new AppBaseResponse();
+		if ("1,2,3,4,5,6,7,8,9".indexOf(req.getCode()) > -1 && isSortExist(req)) {
+			response.fail(ResultCode.MODEL_SORT_EXISTED);
+			return response;
+		}
+		ModelEntity model = ModelEntity.builder().id(req.getId()).code(req.getCode()).sort(req.getSort())
+				.content(req.getContent()).notaryOfficeId(req.getNotaryOfficeId()).status(req.getStatus())
+				.contractType(req.getContractType()).title(req.getTitle()).productType(req.getProductType()).build();
+		modelMapper.updateById(model);
+		if (ModelConstant.MODEL_TYPE_NOTE.equals(req.getCode())) {
+			QueryWrapper<NotaryNoteEntity> qw = new QueryWrapper<>();
+			qw.eq("model_id", req.getId());
+			notaryNoteDao.delete(qw);
+			//
+			List<NotaryNoteEntity> entityList = BeanCopyUtils.convertList2List(req.getNotaryNote(),
+					NotaryNoteEntity.class);
+			int i = 1;
+			for (NotaryNoteEntity entity : entityList) {
+				entity.setId(null);
+				entity.setModelId(req.getId());
+				entity.setCreateTime(LocalDateTime.now());
+				entity.setSort(i++);
+				notaryNoteDao.insert(entity);
+			}
+		}
+		return response;
+	}
 }

+ 88 - 64
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotarizationNoServiceImpl.java

@@ -10,89 +10,113 @@ import me.zhengjie.base.AppResultData;
 import me.zhengjie.base.util.BeanCopyUtils;
 import me.zhengjie.base.ResultCode;
 import me.zhengjie.dao.mybatis.entity.NotarizationNoEntity;
+import me.zhengjie.dao.mybatis.entity.NotaryOfficeEntity;
 import me.zhengjie.application.admin.controller.vo.NotarizationNoReq;
 import me.zhengjie.dao.mybatis.mapper.NotarizationNoMapper;
+import me.zhengjie.dao.mybatis.mapper.NotaryOfficeMapper;
 import me.zhengjie.application.admin.service.NotarizationNoService;
+import me.zhengjie.application.admin.service.NotaryOfficeService;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 公证处 服务实现类
  */
 @Service
 @Slf4j
-public class NotarizationNoServiceImpl extends ServiceImpl<NotarizationNoMapper, NotarizationNoEntity> implements NotarizationNoService {
-
-    @Autowired
-    private NotarizationNoMapper notarizationNoMapper;
+public class NotarizationNoServiceImpl extends ServiceImpl<NotarizationNoMapper, NotarizationNoEntity>
+		implements NotarizationNoService {
 
-    @Override
-    public AppBaseResponse<List<NotarizationNoReq>> query(NotarizationNoReq req){
-        AppBaseResponse<List<NotarizationNoReq>> response = new AppBaseResponse<>();
-        List<NotarizationNoReq> result = new ArrayList<>();
+	@Autowired
+	private NotarizationNoMapper notarizationNoMapper;
+	@Autowired
+	private NotaryOfficeService notaryOfficeService;
 
-        IPage<NotarizationNoEntity> page = new Page<>(req.getIndex(),req.getSize());
-        QueryWrapper<NotarizationNoEntity> qw = new QueryWrapper<>();
-        if (!StringUtils.isEmpty(req.getNotaryOfficeId())){
-            qw.eq("notary_office_id", req.getNotaryOfficeId());
-        }
-        qw.eq("no_status",1);
-        page = notarizationNoMapper.selectPage(page,qw);
-        List<NotarizationNoEntity> list = page.getRecords();
-        List<NotarizationNoReq> res = BeanCopyUtils.convertList2List(list, NotarizationNoReq.class);
-        for(NotarizationNoReq temp:res){
-            int currentNum = temp.getCurrentNum() == null ? temp.getBeginNum() - 1:temp.getCurrentNum();
-            int totalNum = temp.getEndNum() - temp.getBeginNum() + 1 ;
-            int usedNum = currentNum - temp.getBeginNum() + 1;
-            int leftNum = totalNum - usedNum;
-            temp.setTotalNum(totalNum);
-            temp.setUsedNum(usedNum);
-            temp.setLeftNum(leftNum);
-        }
-        response.setData(new AppResultData<List<NotarizationNoReq>>(res,new me.zhengjie.base.Page(req.getIndex(),req.getSize(),(int)page.getTotal())));
-        return response;
-    }
+	@Override
+	public AppBaseResponse<List<NotarizationNoReq>> query(NotarizationNoReq req) {
+		AppBaseResponse<List<NotarizationNoReq>> response = new AppBaseResponse<>();
+		IPage<NotarizationNoEntity> page = new Page<>(req.getIndex(), req.getSize());
+		QueryWrapper<NotarizationNoEntity> qw = new QueryWrapper<>();
+		if (!StringUtils.isEmpty(req.getNotaryOfficeId())) {
+			qw.eq("notary_office_id", req.getNotaryOfficeId());
+		}
+		qw.eq("no_status", 1);
+		
+		if (!StringUtils.isEmpty(req.getStartDate())) {
+			qw.ge("create_time", req.getStartDate());
+		}
+		if (!StringUtils.isEmpty(req.getEndDate())) {
+			qw.le("create_time", req.getEndDate());
+		}
+		
+		page = notarizationNoMapper.selectPage(page, qw);
+		List<NotarizationNoEntity> list = page.getRecords();
+		List<NotarizationNoReq> res = BeanCopyUtils.convertList2List(list, NotarizationNoReq.class);
+		// 增加公证处名称
+		List<NotaryOfficeEntity> notaryOffice = notaryOfficeService.list();
+		Map<Integer, String> map = new HashMap<>();
+		for (NotaryOfficeEntity entity : notaryOffice) {
+			map.put(entity.getId(), entity.getName());
+		}
+		for (NotarizationNoReq temp : res) {
+			int currentNum = temp.getCurrentNum() == null ? temp.getBeginNum() - 1 : temp.getCurrentNum();
+			int totalNum = temp.getEndNum() - temp.getBeginNum() + 1;
+			int usedNum = currentNum - temp.getBeginNum() + 1;
+			int leftNum = totalNum - usedNum;
+			temp.setTotalNum(totalNum);
+			temp.setUsedNum(usedNum);
+			temp.setLeftNum(leftNum);
+			temp.setNotaryName(map.get(temp.getNotaryOfficeId()));
+		}
+		response.setData(new AppResultData<List<NotarizationNoReq>>(res,
+				new me.zhengjie.base.Page(req.getIndex(), req.getSize(), (int) page.getTotal())));
+		return response;
+	}
 
-    @Override
-    public AppBaseResponse create(NotarizationNoReq req) {
-        AppBaseResponse response = new AppBaseResponse();
-        NotarizationNoEntity notarizationNoEntity = NotarizationNoEntity.builder().notaryOfficeId(req.getNotaryOfficeId()).currentNum(0)
-                .beginNum(req.getBeginNum()).endNum(req.getEndNum()).noStatus(1).createTime(new Date()).usedYear(req.getUsedYear()).build();
-        int insertNum = notarizationNoMapper.insert(notarizationNoEntity);
-        if (insertNum == 0){
-            response.fail(ResultCode.DATA_INSERT_ERROR);
-        }
-        return  response;
-    }
+	@Override
+	public AppBaseResponse create(NotarizationNoReq req) {
+		AppBaseResponse response = new AppBaseResponse();
+		NotarizationNoEntity notarizationNoEntity = NotarizationNoEntity.builder()
+				.notaryOfficeId(req.getNotaryOfficeId()).currentNum(0).beginNum(req.getBeginNum())
+				.endNum(req.getEndNum()).noStatus(1).createTime(new Date()).usedYear(req.getUsedYear()).build();
+		int insertNum = notarizationNoMapper.insert(notarizationNoEntity);
+		if (insertNum == 0) {
+			response.fail(ResultCode.DATA_INSERT_ERROR);
+		}
+		return response;
+	}
 
-    @Override
-    public AppBaseResponse update(NotarizationNoReq req) {
-        AppBaseResponse response = new AppBaseResponse();
-        NotarizationNoEntity entity = NotarizationNoEntity.builder().notaryOfficeId(req.getNotaryOfficeId())
-                .id(req.getId()).beginNum(req.getBeginNum())
-                .endNum(req.getEndNum()).noStatus(req.getNoStaus()).usedYear(req.getUsedYear()).build();
-        int update = notarizationNoMapper.updateById(entity);
-        if (update==0){
-            response.fail(ResultCode.DATA_UPDATE_ERROR);
-        }
-        return response;
-    }
+	@Override
+	public AppBaseResponse update(NotarizationNoReq req) {
+		AppBaseResponse response = new AppBaseResponse();
+		NotarizationNoEntity entity = NotarizationNoEntity.builder().notaryOfficeId(req.getNotaryOfficeId())
+				.id(req.getId()).beginNum(req.getBeginNum()).endNum(req.getEndNum()).noStatus(req.getNoStaus())
+				.usedYear(req.getUsedYear()).build();
+		int update = notarizationNoMapper.updateById(entity);
+		if (update == 0) {
+			response.fail(ResultCode.DATA_UPDATE_ERROR);
+		}
+		return response;
+	}
 
-    @Override
-    public AppBaseResponse unUsed(NotarizationNoReq req) {
-        AppBaseResponse response = new AppBaseResponse();
-        NotarizationNoEntity notarizationNoEntity = new NotarizationNoEntity();
-        notarizationNoEntity.setId(req.getId());
-        notarizationNoEntity.setNoStatus(0);
-        int update = notarizationNoMapper.updateById(notarizationNoEntity);
-        if (update==0){
-            response.fail(ResultCode.DATA_UPDATE_ERROR);
-        }
-        return response;
-    }
+	@Override
+	public AppBaseResponse unUsed(NotarizationNoReq req) {
+		AppBaseResponse response = new AppBaseResponse();
+		NotarizationNoEntity notarizationNoEntity = new NotarizationNoEntity();
+		notarizationNoEntity.setId(req.getId());
+		notarizationNoEntity.setNoStatus(0);
+		int update = notarizationNoMapper.updateById(notarizationNoEntity);
+		if (update == 0) {
+			response.fail(ResultCode.DATA_UPDATE_ERROR);
+		}
+		return response;
+	}
 }

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotaryOfficeServiceImpl.java

@@ -98,7 +98,7 @@ public class NotaryOfficeServiceImpl extends ServiceImpl<NotaryOfficeMapper, Not
 		String sealImg = officeQueryRsp.getSealImg();
 		if (org.apache.commons.lang3.StringUtils.isNotBlank(sealImg) && sealImg.matches("-?[0-9]+.?[0-9]*")) {
 			String filePath = fileInfoMapper.selectById(sealImg).getPath();
-			officeQueryRsp.setSealImg(FileUploadUtil.getFileUrl(filePath));
+			officeQueryRsp.setSealImgUrl(FileUploadUtil.getFileUrl(filePath));
 		 
 		} 
 		response.setData(new AppResultData<NotaryOfficeQueryRsp>(officeQueryRsp));
@@ -356,16 +356,16 @@ public class NotaryOfficeServiceImpl extends ServiceImpl<NotaryOfficeMapper, Not
 				NotaryOfficeEntity saveEntity = new NotaryOfficeEntity();
 				if (me.zhengjie.utils.StringUtils.isEmpty(entity.getAxqSealId())) {
 					// 上传公证处签章
-					byte[] b = FileUploadUtil.getByte(req.getImageId());
+					byte[] b = FileUploadUtil.getByte(req.getSealImg());
 					String sealId = cfcaCertUtil.addSeal(entity.getAxqUserId(), b);
 					saveEntity.setAxqSealId(sealId);
 				} else {
 					// 修改公证员签章
-					byte[] b = FileUploadUtil.getByte(req.getImageId());
+					byte[] b = FileUploadUtil.getByte(req.getSealImg());
 					cfcaCertUtil.updateSeal(entity.getAxqUserId(), entity.getAxqSealId(), b);
 				}
 				saveEntity.setId(req.getId());
-				saveEntity.setSealImg(req.getImageId());
+				saveEntity.setSealImg(req.getSealImg());
 				notaryOfficeMapper.updateById(saveEntity);
 			} catch (Exception e) {
 				e.printStackTrace();

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

@@ -62,7 +62,7 @@ public class OrderCochainServiceImpl extends AbstractServiceImpl<IOrderCochainDa
 
 	private static String UPLOAD_FILE_PATH;
 
-	@PostConstruct
+//	@PostConstruct
 	public void init() {
 		new Thread(new Runnable() {
 
@@ -74,11 +74,9 @@ public class OrderCochainServiceImpl extends AbstractServiceImpl<IOrderCochainDa
 					e.printStackTrace();
 				}
 				chainEvidence();
-
 			}
 		}).start();
 		// t.set
-
 	}
 
 	private void initCochainPath(String path) {
@@ -104,14 +102,14 @@ public class OrderCochainServiceImpl extends AbstractServiceImpl<IOrderCochainDa
 			// 业务编码
 			String businessNo = cochainEntity.getBusinessNo();
 			// 这里必须先判断公证书已经生成然后,再上传区块连
-			QueryWrapper<OrderFileEntity> orderFileWrapper = new QueryWrapper<>();
-			orderFileWrapper.eq("business_no", businessNo);
-			orderFileWrapper.eq("code", 10);
+//			QueryWrapper<OrderFileEntity> orderFileWrapper = new QueryWrapper<>();
+//			orderFileWrapper.eq("business_no", businessNo);
+//			orderFileWrapper.eq("code", 10);
 			// 这里处理,如果没有盖章的,就做任何处理
-			OrderFileEntity notarySigned = orderFileMapper.selectOne(orderFileWrapper);
-			if (notarySigned == null || StringUtils.isEmpty(notarySigned.getSignedPdfUrl())) {
-				continue;
-			}
+//			OrderFileEntity notarySigned = orderFileMapper.selectOne(orderFileWrapper);
+//			if (notarySigned == null || StringUtils.isEmpty(notarySigned.getSignedPdfUrl())) {
+//				continue;
+//			}
 			initCochainPath(businessNo);
 			List<File> zipList = new ArrayList<>();
 			QueryWrapper<ContractOrderEntity> orderqw = new QueryWrapper<>();
@@ -149,6 +147,7 @@ public class OrderCochainServiceImpl extends AbstractServiceImpl<IOrderCochainDa
 				// 带有盖章的pdf
 				QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
 				wrapper.eq("business_no", businessNo);
+				wrapper.notIn("code", 10);
 				// 这里处理,如果没有盖章的就把签名的pdf上传
 				List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
 				Map<String, Integer> count = new HashMap<>();

+ 9 - 2
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/SmsTemplateServiceImpl.java

@@ -184,8 +184,15 @@ public class SmsTemplateServiceImpl extends AbstractServiceImpl<ISmsTemplateDao,
 	// 4---开始公证(待公证) -- 2个公证员
 	@Override
 	public void startNotarize(String businessNo) {
-
-		sendNotary(4, businessNo, "公证员", sendSmsPhone());
+		
+		QueryWrapper<SmsSendLogEntity> smsSend = new QueryWrapper<>();
+		smsSend.eq("business_no", businessNo);
+		smsSend.eq("order_type", 4);
+		long count = sendLogMapper.selectCount(smsSend);
+		if (count == 0) {
+			sendNotary(4, businessNo, "公证员", sendSmsPhone());
+		}
+		
 	}
 
 	public Set<String> sendSmsPhone() {

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/UserDetailsServiceImpl.java

@@ -95,6 +95,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
                 jwtUserDto.setPassword(user.getPassword());
                 jwtUserDto.setNickName(user.getNickName());
                 jwtUserDto.setDept(user.getDept().getName());
+                jwtUserDto.setOrgName(user.getOrgName());
             }
             return jwtUserDto;
 //        }

+ 4 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/UserServiceImpl.java

@@ -199,6 +199,7 @@ public class UserServiceImpl implements UserService {
         JwtUserDto userDto = contextUtil.getCurrentUser();
         String maxRole = userDomain.getUserMaxRole();
         if ("超级管理员".equals(maxRole)) {
+        	   qw.eq(StringUtils.isNotBlank(userReq.getOrgId()),"org_id",userReq.getOrgId() );
         } else if ("公证处管理员".equals(maxRole) || "银行管理员".equals(maxRole)) {
             qw.eq("org_id", userDto.getUser().getOrgId());
         } else {
@@ -210,6 +211,9 @@ public class UserServiceImpl implements UserService {
         if (userReq.getEnabled() != null) {
             qw.eq("enabled", userReq.getEnabled() ? 1 : 0);
         }
+        if (userReq.getEnabled() != null) {
+            qw.eq("enabled", userReq.getEnabled() ? 1 : 0);
+        }
         if (userReq.getCreateTime() != null) {
             qw.ge("create_time", userReq.getCreateTime().get(0));
             qw.le("create_time", userReq.getCreateTime().get(1));

+ 5 - 0
eladmin-system/src/main/java/me/zhengjie/application/bank/service/UserAXQInfoService.java

@@ -1,8 +1,11 @@
 package me.zhengjie.application.bank.service;
 
+import cfca.trustsign.common.vo.cs.UploadSignInfoVO;
 import com.alibaba.fastjson.JSONArray;
 import me.zhengjie.base.ResponseDTO;
 
+import java.util.List;
+
 public interface UserAXQInfoService {
 
     ResponseDTO<?> registAXQUser(String idCard, String phone, String name);
@@ -14,4 +17,6 @@ public interface UserAXQInfoService {
     ResponseDTO<?> verifyAuthMessage(String idCard, String checkCode);
 
     ResponseDTO<?> getAuthStatus(String idCard);
+
+    void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception;
 }

+ 6 - 1
eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/BankLoginServiceImpl.java

@@ -9,6 +9,7 @@ import me.zhengjie.application.bank.service.SysUserService;
 import me.zhengjie.base.ResponseDTO;
 import me.zhengjie.base.ResultCode;
 import me.zhengjie.dao.mybatis.entity.SysUserEntity;
+import me.zhengjie.exception.AccountNoActivationException;
 import me.zhengjie.security.security.TokenProvider;
 import org.springframework.stereotype.Service;
 
@@ -32,6 +33,10 @@ public class BankLoginServiceImpl implements BankLoginService {
 		sysUser.setPassword(loginVo.getPassword());
 		sysUser = userService.login(sysUser);
 		if (sysUser != null && sysUser.getOrgId().startsWith("bank")) {
+			if (!(sysUser.getEnabled() == 1)) {
+				throw new AccountNoActivationException("账号未激活!");
+			}
+
 			String token = tokenProvider.appToken(loginVo.getPhone());
 			tokenProvider.setTokenTime(token, JSONObject.toJSONString(sysUser));
 			BankLoginVO bankLoginVO = new BankLoginVO();
@@ -42,7 +47,7 @@ public class BankLoginServiceImpl implements BankLoginService {
 		return ResponseDTO.error(ResultCode.USER_LOGIN_ERROR);
 	}
 
-	public void logout(String authToken){
+	public void logout(String authToken) {
 		tokenProvider.delToken(authToken);
 	}
 }

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/UserAXQInfoServiceImpl.java

@@ -104,7 +104,7 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 				signInfoList.add(notartyUser);
 			}
 			// 重新生成模板
-			modelSynthesizerDomain.recreateCommonDoc(businessNo);
+			modelSynthesizerDomain.recreateCommonDoc(businessNo, jsonArray);
 			// 客户经理签名信息
 			ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(businessNo);
 			SysUserEntity customer = sysUserMapper.selectById(order.getCustomerId());
@@ -166,7 +166,8 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 	 * @param businessNo
 	 * @throws Exception
 	 */
-	private void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception {
+	@Override
+	public void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception {
 		String[] codes = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 		List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListWithCodes(businessNo, codes);
 		// 取出所有的二进制流

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/ContractOrderEntity.java

@@ -141,6 +141,7 @@ public class ContractOrderEntity implements Serializable {
     @TableField("customer_id")
     private String customerId;
 
+    @QueryWapper(QueryKeyword.LIKE)
     @TableField("customer_name")
     private String customerName;
 
@@ -149,7 +150,7 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField("notary_user_id")
     private String notaryUserId;
-
+    @QueryWapper(QueryKeyword.LIKE)
     @TableField("notary_user_name")
     private String notaryUserName;
 
@@ -176,7 +177,7 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField(value = "update_time", fill = FieldFill.UPDATE)
     private Date updateTime;
-
+    @QueryWapper(QueryKeyword.LIKE)
     @TableField("consult_no")
     private String consultNo;
 

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

@@ -51,7 +51,7 @@ public class SmsTemplateEntity extends QueryEntity implements Serializable {
 	/**
 	 * 模板内容
 	 */
-	@QueryWapper(value = { QueryKeyword.LIKE }, attribute = { "startDate", "endDate" })
+	@QueryWapper(value = { QueryKeyword.LIKE })
 	@TableField("template_content")
 	private String templateContent;
 

+ 23 - 24
eladmin-system/src/main/java/me/zhengjie/domain/model/ModelSynthesizerDomain.java

@@ -1,5 +1,7 @@
 package me.zhengjie.domain.model;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.application.admin.controller.vo.NotaryNoteDto;
@@ -8,7 +10,6 @@ import me.zhengjie.base.util.*;
 import me.zhengjie.dao.mybatis.ContractOrderRepository;
 import me.zhengjie.dao.mybatis.ModelRepository;
 import me.zhengjie.dao.mybatis.OrderFileRepository;
-import me.zhengjie.dao.mybatis.UserAXQInfoRepository;
 import me.zhengjie.dao.mybatis.entity.*;
 import me.zhengjie.dao.mybatis.mapper.*;
 import me.zhengjie.domain.order.OrderConstant;
@@ -35,7 +36,6 @@ public class ModelSynthesizerDomain {
     private final CityMapper cityMapper;
     private final ProvinceMapper provinceMapper;
     private final ApplicationContextUtil contextUtil;
-    private final UserAXQInfoRepository userAXQInfoRepository;
     private final FileInfoMapper fileInfoMapper;
 
     /**
@@ -54,7 +54,7 @@ public class ModelSynthesizerDomain {
             fileEntity.setBusinessNo(businessNo);
             fileEntity.setCode(m.getCode());
             fileEntity.setSortNum(m.getSort());
-            String html = composeCommonTemplateWithData(businessNo, m.getContent(), "", false);
+            String html = composeCommonTemplateWithData(businessNo, m.getContent(), "", false, null);
             String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
             String pdfPath = FileUploadUtil.savePdf(html, businessNo);
             fileEntity.setHtmlUrl(htmlPath);
@@ -71,8 +71,9 @@ public class ModelSynthesizerDomain {
      * 重建普通公证文书
      *
      * @param businessNo
+     * @param signUser
      */
-    public void recreateCommonDoc(String businessNo) {
+    public void recreateCommonDoc(String businessNo, JSONArray signUser) {
         ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
         SysUserEntity notaryUser = sysUserMapper.selectById(contractOrderEntity.getNotaryUserId());
         List<ModelEntity> models = modelRepository.getCommonModel(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId());
@@ -80,7 +81,7 @@ public class ModelSynthesizerDomain {
             OrderFileEntity fileEntity = orderFileRepository.getOrderFileWithCode(businessNo, m.getCode());
             OrderFileEntity saveFile = new OrderFileEntity();
             saveFile.setId(fileEntity.getId());
-            String html = composeCommonTemplateWithData(businessNo, m.getContent(), notaryUser.getNickName(), true);
+            String html = composeCommonTemplateWithData(businessNo, m.getContent(), notaryUser.getNickName(), true, signUser);
             String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
             String pdfPath = FileUploadUtil.savePdf(html, businessNo);
             saveFile.setHtmlUrl(htmlPath);
@@ -251,7 +252,7 @@ public class ModelSynthesizerDomain {
     private String composeNotePartyList(String businessNo) {
         ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(businessNo);
         BankEntity bank = bankMapper.selectById(order.getBankId());
-        String lender = "贷款人:" + bank.getBankName() + ",所:" + bank.getAddress() + ",负责人:" + bank.getPrincipal() + "<br/><br/>";
+        String lender = "贷款人:" + bank.getBankName() + ",营业场所:" + bank.getAddress() + ",负责人:" + bank.getPrincipal() + "<br/><br/>";
         String template = "$Title$:$Name$,$Sex$,$Birth$出生,公民身份证号码:$IdCard$,联系电话:$Phone$<br/><br/>";
         List<Map<String, String>> userList = prepareNotePartyTemplateData(order);
         String users = lender;
@@ -428,8 +429,8 @@ public class ModelSynthesizerDomain {
      * @param content
      * @return
      */
-    private String composeCommonTemplateWithData(String businessNo, String content, String userName, boolean hasSignImg) {
-        String replaceContent = TextTempletUtil.replaceContent(content, prepareCommonTemplateData(businessNo, userName, hasSignImg));
+    private String composeCommonTemplateWithData(String businessNo, String content, String userName, boolean hasSignImg, JSONArray signUser) {
+        String replaceContent = TextTempletUtil.replaceContent(content, prepareCommonTemplateData(businessNo, userName, hasSignImg, signUser));
         String result = "";
         try {
             InputStream inputStream = ModelSynthesizerDomain.class.getClassLoader().getResourceAsStream("template/note/notary-model.html");
@@ -448,7 +449,7 @@ public class ModelSynthesizerDomain {
      * @param hasSignImg
      * @return
      */
-    private Map<String, String> prepareCommonTemplateData(String businessNo, String userName, boolean hasSignImg) {
+    private Map<String, String> prepareCommonTemplateData(String businessNo, String userName, boolean hasSignImg, JSONArray signUser) {
         ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
         //
         Map<String, String> map = new HashMap<>();
@@ -496,21 +497,19 @@ public class ModelSynthesizerDomain {
         map.put("$PBPhone$", user.getPhone());
         //
         if (hasSignImg) {
-            List<String> imgIdList = new ArrayList<>();
-            Map<String,String> imgTypeMap = new HashMap<>();
-            imgIdList.add(user.getSignImgId());
-            imgTypeMap.put(user.getSignImgId(),"customer");
+            List<FileInfoEntity> fileList = new ArrayList<>();
+            Map<String, String> imgTypeMap = new HashMap<>();
             //
-            String userSignImgId = String.valueOf(userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getIdCard()).getImgSealId());
-            imgIdList.add(userSignImgId);
-            imgTypeMap.put(userSignImgId, "user");
-            //
-            if (contractOrderEntity.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
-                userSignImgId = String.valueOf(userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getJointIdCard()).getImgSealId());
-                imgIdList.add(userSignImgId);
-                imgTypeMap.put(userSignImgId, "user");
+            for (Object object : signUser) {
+                JSONObject jsonObject = (JSONObject) object;
+                String imageId = jsonObject.getString("imageId");
+                FileInfoEntity fileInfo = fileInfoMapper.selectById(imageId);
+                fileList.add(fileInfo);
+                imgTypeMap.put(imageId, "user");
             }
-            List<FileInfoEntity> fileList = fileInfoMapper.selectBatchIds(imgIdList);
+            //
+            fileList.add(fileInfoMapper.selectById(user.getSignImgId()));
+            imgTypeMap.put(user.getSignImgId(), "customer");
             map.put("photograph", generateSignImgHtml(fileList, imgTypeMap));
         }
         // 准备公证处信息
@@ -545,9 +544,9 @@ public class ModelSynthesizerDomain {
         String signImgHtml = "";
         for (FileInfoEntity fileInfo : fileInfoList) {
             if ("customer".equals(imgTypeMap.get(String.valueOf(fileInfo.getId())))) {
-                signImgHtml += "<img style=\"width: 160px;height: 60px;margin-right: 8px;\" title=\"客户经理签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
+                signImgHtml += "<img style=\"width: 48px;height: 30px;margin-right: 8px;position:relative;top:5px;\" title=\"客户经理签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
             } else {
-                signImgHtml += "<img style=\"width: 80px;height: 40px;margin-right: 8px;\" title=\"当事人签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
+                signImgHtml += "<img style=\"width: 48px;height: 30px;margin-right: 8px;position:relative;top:5px;\" title=\"当事人签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
             }
         }
         return signImgHtml;