This commit is contained in:
hejinbo
2023-11-23 17:36:11 +08:00
11 changed files with 420 additions and 118 deletions
@@ -1,5 +1,6 @@
package com.ruoyi.web.controller.wisdomarbitrate;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
@@ -89,5 +90,18 @@ public class CaseApplicationLogController {
}
return caseApplicationLogService.updateAudit(vo);
}
/**
* 查询该版本及之前版本案件进行对比
* @author wangqiong
* @date 2023/11/17
**/
@Anonymous
@PostMapping("/selectCompareCase")
public AjaxResult selectCompareCase(@RequestBody UpdateSubmitVO vo){
if(vo.getCaseId()==null || vo.getVersion()==null ){
return AjaxResult.error("参数校验错误");
}
return caseApplicationLogService.selectCompareCase(vo);
}
}
@@ -0,0 +1,49 @@
package com.ruoyi.common.utils;
import java.lang.reflect.Field;
/**
* 反射工具类
*/
public class ObjectFieldUtils {
public static String getValue(Object obj,String fieldName){
Field field=null;
try{
field=obj.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return String.valueOf(field.get(obj)==null?"":field.get(obj));
}catch (Exception e){
if(obj.getClass().getSuperclass()!=Object.class){
try{
field=obj.getClass().getSuperclass().getDeclaredField(fieldName);
field.setAccessible(true);
return String.valueOf(field.get(obj)==null?"":field.get(obj));
}catch (Exception e1){
e.printStackTrace();
}
}
e.printStackTrace();
}
return null;
}
public static void setValue(Object obj,String fieldName,Object value){
Field field=null;
try{
field=obj.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(obj,value);
}catch (Exception e){
if(obj.getClass().getSuperclass()!=Object.class){
try{
field=obj.getClass().getSuperclass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(obj,value);
}catch (Exception e1){
e.printStackTrace();
}
}
e.printStackTrace();
}
}
}
@@ -56,6 +56,18 @@ public class CaseAffiliate extends BaseEntity {
* 版本号
*/
private Integer version;
/**
* 改变的字段
*/
private String changeColumn;
public String getChangeColumn() {
return changeColumn;
}
public void setChangeColumn(String changeColumn) {
this.changeColumn = changeColumn;
}
public Long getCaseAppliLogId() {
return caseAppliLogId;
@@ -0,0 +1,34 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 案件前后对比
* @author wangqiong
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CompareCaseVO {
/**
* 该版本前的案件
*/
private CaseApplication beforeCase;
/**
* 该版本后的案件
*/
private CaseApplication afterCase;
/**
* 变化字段,多个用,拼接
*/
private String changeColumn;
}
@@ -17,7 +17,7 @@ public interface CaseAffiliateLogMapper {
void batchDeletecaseAffiliate(@Param("ids") List<Long> ids);
List<CaseAffiliate> selectCaseAffiliate(CaseAffiliate caseAffiliate);
List<CaseAffiliate> selectCaseAffiliate(@Param("caseAppliLogId") Long caseAppliLogId);
CaseAffiliate selectCaseAffiliateByIdentityType(@Param("caseAppliLogId") Long caseAppliLogId, @Param("identityType")int identityType);
int updataCaseAffiliate(CaseAffiliate caseAffiliate);
@@ -34,5 +34,5 @@ public interface CaseAffiliateMapper {
* 批量修改
* @param affiliateLogList
*/
void updataCaseAffiliateByCaseId(@Param("caseAppliId")Long caseAppliId,@Param("list") List<CaseAffiliate> affiliateLogList);
void updateCaseAffiliateByCaseId(@Param("caseAppliId")Long caseAppliId,@Param("list") List<CaseAffiliate> affiliateLogList);
}
@@ -54,4 +54,5 @@ public interface CaseApplicationLogService {
AjaxResult updateAudit(UpdateSubmitVO vo);
AjaxResult selectCompareCase(UpdateSubmitVO vo);
}
@@ -1,22 +1,30 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.UpdateSubmitStatus;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.utils.ObjectFieldUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.CompareCaseVO;
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateLogMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationLogMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.*;
import com.ruoyi.wisdomarbitrate.service.CaseApplicationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
/**
* @author wangqiong
@@ -33,6 +41,8 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
private CaseAffiliateLogMapper caseAffiliateLogMapper;
@Autowired
private CaseAffiliateMapper caseAffiliateMapper;
@Autowired
private SmsRecordMapper smsRecordMapper;
@Override
public int insert(CaseApplication caseApplicationLog) {
return caseApplicationLogMapper.insert(caseApplicationLog);
@@ -70,7 +80,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
return AjaxResult.error("案件不存在");
}
// 如果秘书没有审核,将撤销状态改为同意撤销,否则改为撤销
if(caseApplication.getUpdateSubmitStatus()!=null && caseApplication.getUpdateSubmitStatus()>UpdateSubmitStatus.REVOKE.getCode()){
if(caseApplication.getUpdateSubmitStatus()!=null && !caseApplication.getUpdateSubmitStatus().equals(UpdateSubmitStatus.AGREE.getCode())){
agreeRevoke(vo);
}else {
@@ -106,20 +116,25 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
caseApplicationLogMapper.updateStatus(vo);
// 根据caseLogId查询相关人员表
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliLogId(caseApplicationLog.getCaseLogId());
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseAffiliate);
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
caseApplicationLog.setId(caseApplicationLog.getCaseAppliId());
// 更新案件主表
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
// 更新相关人员主表
caseAffiliateMapper.updataCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
if(CollectionUtil.isNotEmpty(affiliateLogList)){
for (CaseAffiliate caseAffiliate : affiliateLogList) {
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
}
}
// caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
} else {
// 拒绝,将日志表改版本的状态改为拒绝
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode());
caseApplicationLogMapper.updateStatus(vo);
// todo 给申请人发送短信
return sendAuditMessage(vo);
// 修改案件表的版本号
// caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
@@ -139,6 +154,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
// 拒绝撤销,将日志表改版本的状态改为拒绝撤销
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE_REVOKE.getCode());
caseApplicationLogMapper.updateStatus(vo);
return sendAuditMessage(vo);
// 修改案件表的版本号
// caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
}
@@ -147,6 +163,150 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
return AjaxResult.success();
}
/**
* 给申请人发送短信
* @param vo
* @return
*/
private AjaxResult sendAuditMessage(UpdateSubmitVO vo) {
// 查询申请人
CaseApplication logCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
if(logCase == null){
return AjaxResult.success();
}
CaseAffiliate caseAffiliate = caseAffiliateLogMapper.selectCaseAffiliateByIdentityType(logCase.getCaseLogId(), 1);
if(caseAffiliate == null){
return AjaxResult.success();
}
// todo 给申请人发送短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1996949");
request.setPhone(caseAffiliate.getContactTelphone());
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), logCase.getCaseNum(),vo.getReason()});
Boolean aBoolean = SmsUtils.sendSms(request);
//保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(caseAffiliate.getCaseAppliId());
caseApplication = caseApplicationMapper.selectCaseApplication(caseApplication);
smsSendRecord.setCaseNum(caseApplication.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
// 1996949 审核案件结果通知 尊敬的{1}用户,您的{2}仲裁案件,审核未通过,理由为{3},请知晓,如非本人操作,请忽略本短信
String content = "尊敬的" + caseAffiliate.getName() + ",您的"+logCase.getCaseNum()+"仲裁案件,审核未通过,理由为"+vo.getReason()+",请知晓,如非本人操作,请忽略本短信。";
smsSendRecord.setSendContent(content);
smsSendRecord.setCreateBy(getUsername());
if (aBoolean) {
smsSendRecord.setSendStatus(1);
} else {
smsSendRecord.setSendStatus(0);
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
return AjaxResult.success();
}
@Override
public AjaxResult selectCompareCase(UpdateSubmitVO vo) {
// 查询当前版本号和上一个版本号的案件
CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
CaseApplication beforeCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() - 1);
// 查询案件关联人员
beforeCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(beforeCase.getCaseLogId()));
afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
CompareCaseVO compareCaseVO = new CompareCaseVO();
compareCaseVO.setBeforeCase(beforeCase);
compareCaseVO.setAfterCase(afterCase);
// 对比两个版本修改的字段
String[] columns = {"caseLogId","caseSubjectAmount", "caseName"};
String[] affiliateColumns = {"identityNum", "workAddress"};
StringBuilder changeColumn = new StringBuilder();
for (String column : columns) {
String beforeValue = ObjectFieldUtils.getValue(beforeCase, column);
String afterValue = ObjectFieldUtils.getValue(afterCase, column);
if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) {
changeColumn.append(column).append(",");
continue;
}
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) {
changeColumn.append(column).append(",");
continue;
}
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) {
changeColumn.append(column).append(",");
continue;
}
}
List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
Map<Integer, CaseAffiliate> beforeCaseCaseAffiliateMap = null;
if (CollectionUtil.isNotEmpty(beforeCaseCaseAffiliates)) {
// 转为map
beforeCaseCaseAffiliateMap = beforeCaseCaseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, v -> v, (n1, n2) -> n2));
}
StringBuilder affiliateChangeColumn;
// 如果上一个版本和现版本有一个为空,那么所有字段都修改
if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates == null) {
affiliateChangeColumn = new StringBuilder();
for (String column : affiliateColumns) {
affiliateChangeColumn.append(column).append(",");
}
}
else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
affiliateChangeColumn = new StringBuilder();
for (String column : affiliateColumns) {
affiliateChangeColumn.append(column).append(",");
}
} else if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates != null) {
for (CaseAffiliate afterCaseCaseAffiliate : afterCaseCaseAffiliates) {
// 找到相同身份类型的数据,进行对比
affiliateChangeColumn = new StringBuilder();
int identityType = afterCaseCaseAffiliate.getIdentityType();
if (beforeCaseCaseAffiliateMap != null && beforeCaseCaseAffiliateMap.containsKey(identityType)) {
CaseAffiliate beforeCaseCaseAffiliate = beforeCaseCaseAffiliateMap.get(identityType);
for (String column : affiliateColumns) {
String beforeValue = ObjectFieldUtils.getValue(beforeCaseCaseAffiliate, column);
String afterValue = ObjectFieldUtils.getValue(afterCaseCaseAffiliate, column);
if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) {
affiliateChangeColumn.append(column).append(",");
continue;
}
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) {
affiliateChangeColumn.append(column).append(",");
continue;
}
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) {
affiliateChangeColumn.append(column).append(",");
continue;
}
}
} else {
for (String column : affiliateColumns) {
affiliateChangeColumn.append(column).append(",");
}
}
afterCaseCaseAffiliate.setChangeColumn(affiliateChangeColumn.toString());
}
}
compareCaseVO.setChangeColumn(changeColumn.toString());
return AjaxResult.success(compareCaseVO);
}
/**
* 同意撤销
* @param vo
@@ -161,14 +321,17 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE_REVOKE.getCode());
caseApplicationLogMapper.updateStatus(vo);
// 根据caseLogId查询相关人员表
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliLogId(caseApplicationLog.getCaseLogId());
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseAffiliate);
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
caseApplicationLog.setId(caseApplicationLog.getCaseAppliId());
// 更新案件主表
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
// 更新相关人员主表
caseAffiliateMapper.updataCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
if(CollectionUtil.isNotEmpty(affiliateLogList)){
for (CaseAffiliate caseAffiliate : affiliateLogList) {
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
}
}
// caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
}
}
@@ -188,6 +188,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setDeptIds(deptIds);
}
if ("申请人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// 查询有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
@@ -263,6 +264,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setDeptIds(deptIds);
}
if ("申请人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// 查询角色有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
@@ -1084,7 +1086,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
caseApplication.setVersion(maxVersion+1);
// 将修改提交状态改为未提交
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
// 修改案件表的版本号
// caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
@@ -1233,7 +1235,16 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
public CaseApplication selectCaseApplication(CaseApplication caseApplication) {
CaseApplication caseApplicationselect=caseApplicationLogMapper.selectByCaseIdAndVersion(caseApplication.getId(),caseApplication.getVersion());
CaseApplication caseApplicationselect=new CaseApplication();
if(caseApplication.getVersion()!=null) {
caseApplicationselect=caseApplicationLogMapper.selectByCaseIdAndVersion(caseApplication.getId(),caseApplication.getVersion());
}
else {
caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
}
caseApplicationselect.setId(caseApplication.getId());
@@ -1264,9 +1275,16 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
}
caseApplicationselect.setCaseAttachList(caseAttachList);
CaseAffiliate caseAffiliateLog = new CaseAffiliate();
caseAffiliateLog.setCaseAppliLogId(caseApplicationselect.getCaseLogId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateLogMapper.selectCaseAffiliate(caseAffiliateLog);
List<CaseAffiliate> caseAffiliatListeselect;
if(caseApplication.getVersion()!=null) {
caseAffiliatListeselect = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationselect.getCaseLogId());
}else {
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(caseApplication.getId());
caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
}
if (caseAffiliatListeselect != null) {
// 查询组织机构
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
@@ -1289,7 +1307,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
;
} else if (identityType == 2) {
respondentName.append(caseAffiliateselect.getName()).append(",");
;
}
}
caseApplicationselect.setApplicantName(applicantName.toString());
@@ -120,7 +120,7 @@
application_organ_id= #{item.applicationOrganId},
application_organ_name= #{item.applicationOrganName},
name = #{name},
name = #{item.name},
identity_num = #{item.identityNum},
contact_telphone = #{item.contactTelphone},
contact_address = #{item.contactAddress},
@@ -58,7 +58,7 @@
t1.filearbitra_url,t1.lock_status,t1.version,t1.updateSubmitStatus
from(
<trim suffixOverrides="union">
<!--被申请人,仲裁员,部门长,财务,代理人案件-->
<!--申请人,被申请人,仲裁员,部门长,财务,代理人案件-->
<if test="isOtherRole!=null and isOtherRole==1">
select t.id,t.caseLogId,t.case_num ,t.case_subject_amount ,t.register_date ,t.arbitrat_method,
@@ -125,7 +125,13 @@
and
instr (t.arbitrator_id,#{userId})>0)
</if>
<!--申请人-->
<if test="applicationOrganId != null and applicationOrganId != ''">
or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1
<!--暂时改为可以查询到生成裁决书之前所有的案件状态-->
and (t.case_status &lt;= 10 or t.case_status=31))
</if>
<!--部门长-->
<if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
or (t.identity_type=1 and t.case_status in
@@ -152,61 +158,61 @@
</where>
union
</if>
<if test="applicationOrganId != null and applicationOrganId != ''">
<!-- <if test="applicationOrganId != null and applicationOrganId != ''">-->
<!--申请人案件-->
select c.id ,l.id AS caseLogId,c.case_num ,l.case_subject_amount ,c.register_date ,c.arbitrat_method ,
CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
ELSE '无审理方式'
END arbitratMethodName,
c.case_status ,
CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
when 12 then '待审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
when 31 then '待修改开庭时间'
ELSE '无案件状态'
END caseStatusName,
c.hear_date ,l.arbitrat_claims ,
l.loan_start_date ,l.loan_end_date ,l.claim_princi_owed ,l.claim_interest_owed ,l.claim_liquid_damag
,l.fee_payable ,
c.begin_video_date ,c.online_video_person ,l.contract_number ,c.create_by ,c.create_time ,
c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name
as
applicantName,
c.arbitrator_id,ca.identity_num , ca.identity_type,c.filearbitra_url,c.lock_status,l.version,l.update_submit_status as updateSubmitStatus
from case_application c
JOIN case_application_log l ON c.id = l.case_appli_id
JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1
<!-- &lt;!&ndash;申请人案件&ndash;&gt;-->
<!-- select c.id ,l.id AS caseLogId,c.case_num ,l.case_subject_amount ,c.register_date ,c.arbitrat_method ,-->
<!-- CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'-->
<!-- ELSE '无审理方式'-->
<!-- END arbitratMethodName,-->
<!-- c.case_status ,-->
<!-- CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'-->
<!-- when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'-->
<!-- when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'-->
<!-- when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'-->
<!-- when 12 then '待审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'-->
<!-- when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'-->
<!-- when 31 then '待修改开庭时间'-->
<!-- ELSE '无案件状态'-->
<!-- END caseStatusName,-->
<!-- c.hear_date ,l.arbitrat_claims ,-->
<!-- l.loan_start_date ,l.loan_end_date ,l.claim_princi_owed ,l.claim_interest_owed ,l.claim_liquid_damag-->
<!-- ,l.fee_payable ,-->
<!-- c.begin_video_date ,c.online_video_person ,l.contract_number ,c.create_by ,c.create_time ,-->
<!-- c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name-->
<!-- as-->
<!-- applicantName,-->
<!-- c.arbitrator_id,ca.identity_num , ca.identity_type,c.filearbitra_url,c.lock_status,l.version,l.update_submit_status as updateSubmitStatus-->
<!-- from case_application c-->
<!-- JOIN case_application_log l ON c.id = l.case_appli_id-->
<!-- JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1-->
<where>
(c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1
and l.version=(SELECT
max( version ) version
FROM
case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))
<if test="applicationOrganId != null and applicationOrganId != ''">
AND ca.application_organ_id = #{applicationOrganId}
</if>
<if test="caseStatus != null">
AND c.case_status = #{caseStatus}
</if>
<if test="caseNum != null and caseNum != ''">
AND c.case_num = #{caseNum}
</if>
<if test="nameId != null and nameId != ''">
AND ca.application_organ_id=#{nameId}
</if>
<!-- <where>-->
<!-- (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1-->
<!-- and l.version=(SELECT-->
<!-- max( version ) version-->
<!-- FROM-->
<!-- case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))-->
<!-- <if test="applicationOrganId != null and applicationOrganId != ''">-->
<!-- AND ca.application_organ_id = #{applicationOrganId}-->
<!-- </if>-->
<!-- <if test="caseStatus != null">-->
<!-- AND c.case_status = #{caseStatus}-->
<!-- </if>-->
<!-- <if test="caseNum != null and caseNum != ''">-->
<!-- AND c.case_num = #{caseNum}-->
<!-- </if>-->
<!-- <if test="nameId != null and nameId != ''">-->
<!-- AND ca.application_organ_id=#{nameId}-->
<!-- </if>-->
<if test="lockStatus != null">
AND c.lock_status = #{lockStatus}
</if>
</where>
union
</if>
<!-- <if test="lockStatus != null">-->
<!-- AND c.lock_status = #{lockStatus}-->
<!-- </if>-->
<!-- </where>-->
<!-- union-->
<!-- </if>-->
<!--秘书案件-->
<if test="deptIds != null and deptIds.size() > 0">
@@ -300,9 +306,15 @@
FROM
case_application_log
WHERE case_appli_id = c.id
and update_submit_status not IN ( 1, 2 ))
)
WHERE
ca.identity_type=1 and c.case_status in (1,5,11,15,16,17,31)
<if test="caseStatusList != null and caseStatusList.size() > 0">
and c.case_status in
<foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">
#{caseStatus}
</foreach>
</if>
<if test="deptIds != null and deptIds.size() > 0">
and ca.application_organ_id in
<foreach item="item" collection="deptIds" open="(" separator="," close=")">
@@ -435,7 +447,7 @@
FROM
case_application_log
WHERE
update_submit_status IN ( 1, 2 ) and c.id = l.case_appli_id)
update_submit_status IN ( 1, 2 ) and c.id = case_appli_id)
</if>
</trim>
) t1
@@ -667,13 +679,13 @@
<!-- </foreach> )-->
<!-- </if>-->
<!--申请人-->
<!-- <if test="applicationOrganId != null and applicationOrganId != ''">-->
<!-- or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1-->
<!-- &lt;!&ndash;暂时改为可以查询到生成裁决书之前所有的案件状态&ndash;&gt;-->
<!-- and (t.case_status &lt;= 10 or t.case_status=31))-->
<!-- &lt;!&ndash; and t.case_status in (0,2,17))&ndash;&gt;-->
<if test="applicationOrganId != null and applicationOrganId != ''">
or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1
<!--暂时改为可以查询到生成裁决书之前所有的案件状态-->
and (t.case_status &lt;= 10 or t.case_status=31))
<!-- and t.case_status in (0,2,17))-->
<!-- </if>-->
</if>
<!--部门长-->
<if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
or (t.identity_type=1 and t.case_status in
@@ -699,40 +711,40 @@
</where>
union
</if>
<if test="applicationOrganId != null and applicationOrganId != ''">
<!--申请人案件-->
<!-- <if test="applicationOrganId != null and applicationOrganId != ''">-->
<!-- &lt;!&ndash;申请人案件&ndash;&gt;-->
select l.case_appli_id id ,
c.case_status,ca.application_organ_id,
c.arbitrator_id,ca.identity_num , ca.identity_type
from case_application c
JOIN case_application_log l ON c.id = l.case_appli_id
JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1
<where>
(c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1
and l.version=(SELECT
max( version ) version
FROM
case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))
<if test="applicationOrganId != null and applicationOrganId != ''">
AND ca.application_organ_id = #{applicationOrganId}
</if>
<if test="caseStatus != null">
AND c.case_status = #{caseStatus}
</if>
<if test="caseNum != null and caseNum != ''">
AND c.case_num = #{caseNum}
</if>
<if test="nameId != null and nameId != ''">
AND ca.application_organ_id=#{nameId}
</if>
<!-- select l.case_appli_id id ,-->
<!-- c.case_status,ca.application_organ_id,-->
<!-- c.arbitrator_id,ca.identity_num , ca.identity_type-->
<!-- from case_application c-->
<!-- JOIN case_application_log l ON c.id = l.case_appli_id-->
<!-- JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1-->
<!-- <where>-->
<!-- (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1-->
<!-- and l.version=(SELECT-->
<!-- max( version ) version-->
<!-- FROM-->
<!-- case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))-->
<!-- <if test="applicationOrganId != null and applicationOrganId != ''">-->
<!-- AND ca.application_organ_id = #{applicationOrganId}-->
<!-- </if>-->
<!-- <if test="caseStatus != null">-->
<!-- AND c.case_status = #{caseStatus}-->
<!-- </if>-->
<!-- <if test="caseNum != null and caseNum != ''">-->
<!-- AND c.case_num = #{caseNum}-->
<!-- </if>-->
<!-- <if test="nameId != null and nameId != ''">-->
<!-- AND ca.application_organ_id=#{nameId}-->
<!-- </if>-->
<if test="lockStatus != null">
AND c.lock_status = #{lockStatus}
</if>
</where>
union
</if>
<!-- <if test="lockStatus != null">-->
<!-- AND c.lock_status = #{lockStatus}-->
<!-- </if>-->
<!-- </where>-->
<!-- union-->
<!-- </if>-->
<!--秘书案件-->
<if test="deptIds != null and deptIds.size() > 0">
@@ -742,14 +754,14 @@
FROM
case_application c
JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1
JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1,4) and l.version
JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1,2) and l.version
= (
SELECT
max( version ) version
FROM
case_application_log
WHERE case_appli_id = c.id
and update_submit_status not IN ( 1, 4 ))
)
WHERE
ca.identity_type=1 and c.case_status in (1,5,11,15,16,17,31)
<if test="deptIds != null and deptIds.size() > 0">
@@ -807,7 +819,7 @@
FROM
case_application_log
WHERE
update_submit_status IN ( 1, 4 ) and c.id = l.case_appli_id)
update_submit_status IN ( 1, 4 ) and c.id = case_appli_id)
</if>
</trim>