|
|
@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
@ -119,8 +120,8 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String getNewCaseCode(String caseOwnOrgCode, Date date) { |
|
|
|
public String getNewCaseCode(String caseOwnOrgCode, LocalDate date) { |
|
|
|
String prefix = CommonConstants.CODE_PREFIX_CASE + caseOwnOrgCode + DateUtil.format(date, "yyyyMM"); |
|
|
|
String prefix = CommonConstants.CODE_PREFIX_CASE + caseOwnOrgCode + date.format(DateTimeFormatter.ofPattern("yyyyMM")); |
|
|
|
|
|
|
|
|
|
|
|
int newCount = 1; |
|
|
|
int newCount = 1; |
|
|
|
|
|
|
|
|
|
|
@ -203,10 +204,10 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent |
|
|
|
public CaseEvent dealDataToCaseEvent(EntrustDataVo entrustDataVo) { |
|
|
|
public CaseEvent dealDataToCaseEvent(EntrustDataVo entrustDataVo) { |
|
|
|
CaseEvent caseEvent = new CaseEvent(); |
|
|
|
CaseEvent caseEvent = new CaseEvent(); |
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime happenTime = null; |
|
|
|
LocalDate happenTime = null; |
|
|
|
if (StrUtil.isNotBlank(entrustDataVo.getSubmitTime())) { |
|
|
|
if (StrUtil.isNotBlank(entrustDataVo.getSubmitTime())) { |
|
|
|
happenTime = LocalDateTime.parse(entrustDataVo.getSubmitTime(), |
|
|
|
happenTime = LocalDate.parse(entrustDataVo.getSubmitTime(), |
|
|
|
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new RuntimeException("案发时间未填"); |
|
|
|
throw new RuntimeException("案发时间未填"); |
|
|
|
} |
|
|
|
} |
|
|
@ -224,9 +225,9 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent |
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(caseEvent.getCaseNo())) { |
|
|
|
if (StrUtil.isBlank(caseEvent.getCaseNo())) { |
|
|
|
// 如果没有提供案件编码, 生成一个
|
|
|
|
// 如果没有提供案件编码, 生成一个
|
|
|
|
Date happenTime1 = Date.from(caseEvent.getHappenTime().atZone(ZoneId.systemDefault()).toInstant()); |
|
|
|
// Date happenTime1 = Date.from(caseEvent.getHappenTime().atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
if (StrUtil.isNotBlank(caseEvent.getCaseOwnOrgId())) { |
|
|
|
if (StrUtil.isNotBlank(caseEvent.getCaseOwnOrgId())) { |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(caseEvent.getCaseOwnOrgId(), happenTime1)); |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(caseEvent.getCaseOwnOrgId(), caseEvent.getHappenTime())); |
|
|
|
} else if (StrUtil.isNotBlank(entrustDataVo.getEntrustOrganization())) { |
|
|
|
} else if (StrUtil.isNotBlank(entrustDataVo.getEntrustOrganization())) { |
|
|
|
SysOrg sysOrg = new SysOrg(); |
|
|
|
SysOrg sysOrg = new SysOrg(); |
|
|
|
System.out.println("---------------------------------------" + entrustDataVo.getEntrustOrganization()); |
|
|
|
System.out.println("---------------------------------------" + entrustDataVo.getEntrustOrganization()); |
|
|
@ -234,9 +235,9 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent |
|
|
|
R<List<SysOrg>> listR = remoteOrgService.innerGetOrgList(sysOrg); |
|
|
|
R<List<SysOrg>> listR = remoteOrgService.innerGetOrgList(sysOrg); |
|
|
|
if (listR.getCode() == CommonConstants.SUCCESS) { |
|
|
|
if (listR.getCode() == CommonConstants.SUCCESS) { |
|
|
|
if (listR.getData().size() > 0) { |
|
|
|
if (listR.getData().size() > 0) { |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(listR.getData().get(0).getOrgCode(), happenTime1)); |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(listR.getData().get(0).getOrgCode(), caseEvent.getHappenTime())); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(entrustDataVo.getCityCode(), happenTime1)); |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(entrustDataVo.getCityCode(), caseEvent.getHappenTime())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -244,7 +245,7 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent |
|
|
|
|
|
|
|
|
|
|
|
// 如果还是案件编号还是空,则使用市的编码生成编号
|
|
|
|
// 如果还是案件编号还是空,则使用市的编码生成编号
|
|
|
|
if (StrUtil.isBlank(caseEvent.getCaseNo())) { |
|
|
|
if (StrUtil.isBlank(caseEvent.getCaseNo())) { |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(entrustDataVo.getCityCode(), happenTime1)); |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(entrustDataVo.getCityCode(), caseEvent.getHappenTime())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -277,9 +278,9 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent |
|
|
|
R r = remoteOrgService.getById(caseEvent.getCaseOwnOrgId()); |
|
|
|
R r = remoteOrgService.getById(caseEvent.getCaseOwnOrgId()); |
|
|
|
if (r.getCode() == CommonConstants.SUCCESS) { |
|
|
|
if (r.getCode() == CommonConstants.SUCCESS) { |
|
|
|
caseOwnOrg = (SysOrg) r.getData(); |
|
|
|
caseOwnOrg = (SysOrg) r.getData(); |
|
|
|
Date happenTime = Date.from(caseEvent.getHappenTime().atZone(ZoneId.systemDefault()).toInstant()); |
|
|
|
// Date happenTime = Date.from(caseEvent.getHappenTime().atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
; |
|
|
|
|
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(caseOwnOrg.getOrgCode(), happenTime)); |
|
|
|
caseEvent.setCaseNo(this.getNewCaseCode(caseOwnOrg.getOrgCode(), caseEvent.getHappenTime())); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new RuntimeException(String.format("没有找到 orgId 为 %s 的机构, 请确认案件所属机构(CaseOwnOrg)的正确性!", caseEvent.getCaseOwnOrgId())); |
|
|
|
throw new RuntimeException(String.format("没有找到 orgId 为 %s 的机构, 请确认案件所属机构(CaseOwnOrg)的正确性!", caseEvent.getCaseOwnOrgId())); |
|
|
|
} |
|
|
|
} |
|
|
|