Commit 843a5372 authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents 06f29a5e 9518bd36
......@@ -64,4 +64,7 @@ public class RepaymentDto extends BaseDto {
@ApiModelProperty(value = "定时发送状态")
private Integer cronSendState;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -7,8 +7,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.sql.Date;
import java.time.LocalDate;
import java.util.Date;
/**
*
......@@ -94,4 +94,10 @@ public class Repayment extends BaseEntity {
*/
@TableField("message_commit_time")
private Date messageCommitTime;
/**
* 消息确认时间
*/
@TableField("create_time")
private Date createTime;
}
......@@ -27,7 +27,7 @@
and repay_state = #{repayState}
</if>
</where>
order by rec_date DESC,sequence_nbr DESC
order by create_time DESC,sequence_nbr DESC
</select>
<select id="getPrivilegeCompanyByOrgCode"
......
......@@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
......@@ -82,6 +83,7 @@ public class CommonServiceImpl {
private Resource urlInfo;
@Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl;
private static final String regionRedis = "app_region_redis";
@Autowired
RedisUtils redisUtil;
......@@ -524,14 +526,13 @@ public class CommonServiceImpl {
redisUtils.set(redisKey, MapBuilder.<String, Object>create()
.put("value", current).build());
String powerStationInstanceId = powerStationMapper.getInstanceIdByhouseId(peasantHouseholdId);
String basicGridInstanceId = basicGridAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
String financingInstanceId = financingAuditingMapper.getInstanceIdByhouseId(peasantHouseholdId);
List<LinkedHashMap> powerStationWorkLog = new ArrayList<>();
List<ConstructionRecords> workOrderStationWorkLog = new ArrayList<>();
List<ConstructionGirdRecords> basicGridWorkLog = new ArrayList<>();
List<LinkedHashMap> financingWorkLog = new ArrayList<>();
List<ConstructionAcceptanceRecords> accptWorkLog = new ArrayList<>();
workOrderStationWorkLog = this.getConstructionRecords(peasantHouseholdId);
workOrderStationWorkLog = this.getConstructionRecords(returnDto.getPowerStationEngineeringInfo().getWorkOrderPowerStationId(),returnDto.getPowerStationEngineeringInfo().getWorkOrderId());
accptWorkLog = this.getConstructionRecordsAcc(peasantHouseholdId);
basicGridWorkLog = this.getConstructionRecordsBasic(peasantHouseholdId);
......@@ -643,10 +644,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyInformation(),"基本信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -654,10 +658,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getSurveyDetails(),"勘察信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -665,10 +672,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getDesignInformation(),"设计信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -676,10 +686,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getCommercial(),"商务信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -687,10 +700,12 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getInformation(),"资料归档附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -698,10 +713,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getPowerStationConstructionData(),"施工信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -709,10 +727,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersCon,"施工信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -720,10 +741,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getHygfOnGrid(),"并网信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -731,10 +755,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrders,"并网信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -742,10 +769,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(returnDto.getWorkOrder(),"派工单信息附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -753,10 +783,13 @@ public class CommonServiceImpl {
futures.add(executorService.submit(() -> {
try {
downloadAndZipImages(areaOrdersAcc,"验收信息整改单附件",tempDir,urlPath);
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
if (!finalRedisKey.contains(",")){
Map<String, Object> map = (Map<String, Object>) redisUtils.get(finalRedisKey);
Integer currentNum = (Integer) map.get("value")+7;
redisUtils.set(finalRedisKey, MapBuilder.<String, Object>create()
.put("value", currentNum).build());
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -1296,8 +1329,10 @@ public class CommonServiceImpl {
private static void createZipFile(Path folderPath, String zipFilePath, HttpServletResponse response) {
try (ServletOutputStream out = response.getOutputStream();
ZipOutputStream zos = new ZipOutputStream(out)) {
addFolderToZip(zipFilePath, folderPath, zos);
// 计算ZIP文件的总大小
long totalSize = getTotalFileSize(folderPath);
response.setContentLengthLong((int) totalSize);
addFolderToZip(zipFilePath, folderPath, zos,response);
} catch (IOException e) {
e.printStackTrace();
}
......@@ -1325,14 +1360,26 @@ public class CommonServiceImpl {
}
}
private static long getTotalFileSize(Path folderPath) throws IOException {
// 获取文件夹内所有文件的总大小
return Files.walk(folderPath)
.filter(Files::isRegularFile)
.mapToLong(path -> {
try {
return Files.size(path);
} catch (IOException e) {
e.printStackTrace();
return 0;
}
})
.sum();
}
private static void addFolderToZip(String relativePath, Path folderPath, ZipOutputStream zos, HttpServletResponse response) throws IOException {
private static void addFolderToZip(String relativePath, Path folderPath, ZipOutputStream zos) throws IOException {
if (!Files.exists(folderPath)) {
return;
}
try {
// FileOutputStream fout = new FileOutputStream(relativePath);
File folder = new File(relativePath);
addFilesToZip(folder, zos, folder.getName());
zos.close();
......@@ -1360,8 +1407,8 @@ public class CommonServiceImpl {
// });
}
private static void cleanup(Path tempDir) {
@Async
void cleanup(Path tempDir) {
try {
Files.walk(tempDir).sorted(Comparator.reverseOrder()).forEach(path -> {
try {
......@@ -1471,7 +1518,7 @@ public class CommonServiceImpl {
headerFont.setBold(true); // 加粗字体
headerFont.setFontHeightInPoints((short) 12); // 字体大小
headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
headerStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle.setAlignment(HorizontalAlignment.CENTER); // 居中对齐
headerStyle.setFont(headerFont); // 设置字体样式
......@@ -1722,10 +1769,11 @@ public class CommonServiceImpl {
}
List<ConstructionRecords> getConstructionRecords (String peasantHouseholdId) {
List<ConstructionRecords> getConstructionRecords (Long workOrderPowerStationId,Long workOrderId) {
// 施工自审操作记录
LambdaQueryWrapper<ConstructionRecords> up5 = new LambdaQueryWrapper<ConstructionRecords>();
up5.eq(ConstructionRecords::getPeasantHouseholdId, peasantHouseholdId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.orderByAsc(ConstructionRecords::getRecDate);
return constructionRecordsMapper.selectList(up5);
}
......@@ -1733,7 +1781,7 @@ public class CommonServiceImpl {
List<ConstructionGirdRecords> getConstructionRecordsBasic (String peasantHouseholdId) {
// 施工自审操作记录
LambdaQueryWrapper<ConstructionGirdRecords> up5 = new LambdaQueryWrapper<ConstructionGirdRecords>();
up5.eq(ConstructionGirdRecords::getPeasantHouseholdId, peasantHouseholdId);
up5.eq(ConstructionGirdRecords::getWorkOrderPowerStationId, peasantHouseholdId);
up5.orderByAsc(ConstructionGirdRecords::getRecDate);
return constructionGirdRecordsMapper.selectList(up5);
}
......
......@@ -262,6 +262,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
repayment.setInterest(Double.valueOf(interest));
repayment.setPrincipal(Double.valueOf(principal));
repayment.setLoanPeriod(loanPeriod);
repayment.setCreateTime(new Date());
repaymentList.add(repayment);
}
try {
......@@ -373,9 +374,12 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
@Transactional(rollbackFor = Exception.class)
public void addOrUpdate(RepaymentDto model) {
model.setCronSendState(RepaymentCronSendStateEnum.SEND.getCode());
model.setMessageState(RepaymentMessageStateEnum.UN_CONFIRM.getCode());
model.setRepayState(RepaymentRepayStateEnum.UN_REPAY.getCode());
if(Objects.isNull(model.getSequenceNbr())){
model.setCronSendState(RepaymentCronSendStateEnum.SEND.getCode());
model.setMessageState(RepaymentMessageStateEnum.UN_CONFIRM.getCode());
model.setRepayState(RepaymentRepayStateEnum.UN_REPAY.getCode());
model.setCreateTime(new Date());
}
PrivilegeCompany privilegeCompany = repaymentMapper.getPrivilegeCompanyByOrgCode(model.getRegionalCompaniesCode());
if (Objects.nonNull(privilegeCompany)) {
model.setCompanyId(privilegeCompany.getSequenceNbr());
......
......@@ -88,4 +88,4 @@ feign.okhttp.enabled= true
workflow.feign.name=AMOS-API-WORKFLOW-CZ
repaymentCron=0 0 1 * * ?
urlHttp=http://47.92.234.253:8088
\ No newline at end of file
urlHttp=http://47.92.234.253:9000
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment