customized settle aba file download

master
yixian 4 years ago
parent f548bb7ce3
commit 06f5ed53e6

@ -45,7 +45,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.http.util.TextUtils;
import org.apache.ibatis.annotations.Mapper;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ -56,6 +56,8 @@ public interface CleanService {
void settlementAba(Date date, HttpServletResponse response) throws IOException;
void getCustomizedSettleABA(int logId, HttpServletResponse response);
void getSettlementFilesForBatch(String batchId, HttpServletResponse resp) throws IOException;
List<JSONObject> getCleanLogs(ClearingLogQuery query, JSONObject manager);

@ -104,7 +104,7 @@ import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.chec
*/
@Service
public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware {
private Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private SettlementSupport settlementSupport;
@Resource
@ -114,6 +114,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Resource
private ClearingDetailMapper clearingDetailMapper;
@Resource
private CustomizedSettleLogMapper customizedSettleLogMapper;
@Resource
private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper;
@Resource
private TaskManualSettleMapper taskManualSettleMapper;
@ -665,6 +667,33 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
}
@Override
public void getCustomizedSettleABA(int logId, HttpServletResponse response) {
JSONObject log = customizedSettleLogMapper.find(logId);
if (log == null) {
throw new NotFoundException("Settle log not found");
}
String bank = log.getString("settle_bank");
BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group"));
JSONObject settle = new JSONObject();
settle.put("settle_bank", bank);
settle.put("clearing_amount", log.getBigDecimal("amount"));
settle.put("client_id", log.getIntValue("client_id"));
settle.put("bsb_no", log.getString("bsb_no"));
settle.put("account_no", log.getString("account_no"));
settle.put("account_name", log.getString("account_name"));
settle.put("client_moniker", log.getString("client_moniker"));
ABAFile file = generateSettleAbaFile(bank, group, new Date(), Collections.singletonList(settle));
response.setContentType("application/octet-stream;");
response.addHeader("Content-Disposition", "attachment; filename=" + file.filename());
try (OutputStream ous = response.getOutputStream()) {
ous.write(file.output(1));
ous.flush();
} catch (IOException e) {
throw new ServerErrorException("Output failed", e);
}
}
@Override
public void getSettlementFilesForBatch(String batchId, HttpServletResponse resp) throws IOException {
int clearingId = Integer.parseInt(batchId);
@ -1667,7 +1696,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
taskManualSettleMapper.rollbackExecutedTask(clearingId);
clearingDetailMapper.deleteSettleLogs(clearingId);
clearingLogMapper.deleteSettleLogs(clearingId);
}finally {
} finally {
locker.unlock("settle_task");
}
}
@ -1731,7 +1760,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
public TransactionStatus getTransactionStatus(String transactionId) {
TransactionStatus transactionStatus = transactionMapper.getTransactionStatusById(transactionId);
if (transactionStatus == null) {
throw new ParamInvalidException("date","The transaction was not found");
throw new ParamInvalidException("date", "The transaction was not found");
}
return transactionStatus.toSet();
}

@ -30,8 +30,8 @@ import java.util.List;
@RestController
@ManagerMapping(value = "/sys/settlement", role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}, method = RequestMethod.GET)
public class SettlementDevController {
private DateFormat monthFormat = new SimpleDateFormat("yyyyMM");
private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
private final DateFormat monthFormat = new SimpleDateFormat("yyyyMM");
private final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@Resource
private CleanService cleanService;
@ -170,6 +170,11 @@ public class SettlementDevController {
}
}
@GetMapping("/customized_settle/{logId}/aba_file")
public void getCustomizedSettleABAFile(@PathVariable int logId,HttpServletResponse response){
cleanService.getCustomizedSettleABA(logId, response);
}
@GetMapping("/settle_batches/{batchId}/settle_files")
public void getSettlementFilesForBatch(@PathVariable String batchId, HttpServletResponse resp) throws IOException {
cleanService.getSettlementFilesForBatch(batchId, resp);

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.mappers.log;
import com.alibaba.fastjson.JSONObject;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
@AutoMapper(tablename = "log_settle_customized", pkName = "log_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface CustomizedSettleLogMapper {
@AutoSql(SqlType.SELECT)
JSONObject find(@Param("log_id") int logId);
}

@ -0,0 +1,11 @@
package au.com.royalpay.payment.manage.valid;
import org.junit.jupiter.api.Test;
import org.springframework.web.util.UriComponentsBuilder;
public class TestUri {
@Test
void test(){
UriComponentsBuilder.fromHttpUrl("https://shop-1587029219413.rpaygroup.com/#/payment/result?url=https://shop-au.rpaygroup.com/geekforbest/v1/shop/payment/orders/9296a2ea-4f8f-4701-b9ae-e49718387417/transactions/d1878f49-2039-45ce-9458-667e6272d511");
}
}
Loading…
Cancel
Save