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

master
dalong306 3 years ago
commit 27b2927266

@ -5,15 +5,16 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>2.2.30</version> <version>2.2.31</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.3.87-SNAPSHOT</version> <version>2.3.88</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version> <jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>
<yixsoft-batis.version>1.0.12</yixsoft-batis.version> <yixsoft-batis.version>1.0.12</yixsoft-batis.version>
<mysql.version>8.0.20</mysql.version>
</properties> </properties>
<dependencies> <dependencies>

@ -514,7 +514,7 @@ public class ManageAppServiceImp implements ManageAppService {
String nationCode = phone.getString("nation_code"); String nationCode = phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone"); String phoneNumber = phone.getString("contact_phone");
try { try {
smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("绑定手机号", codeKeyValue, 5)); smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("Binding mobile number", codeKeyValue, 5));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new ServerErrorException("Phone number is wrong.Please try again."); throw new ServerErrorException("Phone number is wrong.Please try again.");

@ -851,14 +851,9 @@ public class RetailAppServiceImp implements RetailAppService {
PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params, PageList<JSONObject> logs = clearingDetailMapper.listClientSettlementLog(params,
new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc"))); new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc")));
logs.forEach(log -> log.put("total_charge", log.getBigDecimal("total_charge").add(log.getBigDecimal("tax_amount")))); logs.forEach(log -> log.put("total_charge", log.getBigDecimal("total_charge").add(log.getBigDecimal("tax_amount"))));
logs.forEach(log -> log.put("padding", log.getBooleanValue("editable")));
JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject result = PageListUtils.buildPageListResult(logs);
if (appQueryBean.getPage() == 1 && !logs.isEmpty()) { result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable")));
JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id"));
if (clearingLog.getBooleanValue("editable")) {
result.put("padding", true);
logs.get(0).put("padding", true);
}
}
return result; return result;
} }
@ -2236,7 +2231,7 @@ public class RetailAppServiceImp implements RetailAppService {
String nationCode = phone.getString("nation_code").contains("+") ? phone.getString("nation_code").substring(1) : phone.getString("nation_code"); String nationCode = phone.getString("nation_code").contains("+") ? phone.getString("nation_code").substring(1) : phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone"); String phoneNumber = phone.getString("contact_phone");
try { try {
smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("绑定手机号", codeKeyValue, 1)); smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("Binding mobile number", codeKeyValue, 1));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
throw new BadRequestException("Phone number is wrong.Please try again."); throw new BadRequestException("Phone number is wrong.Please try again.");
@ -2256,7 +2251,7 @@ public class RetailAppServiceImp implements RetailAppService {
String nationCode = client.getString("nation_code").contains("+") ? client.getString("nation_code").substring(1) : client.getString("nation_code"); String nationCode = client.getString("nation_code").contains("+") ? client.getString("nation_code").substring(1) : client.getString("nation_code");
String phoneNumber = client.getString("contact_phone"); String phoneNumber = client.getString("contact_phone");
try { try {
smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("解綁绑定手机号", codeKeyValue, 1)); smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("Unbind mobile number", codeKeyValue, 1));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
throw new BadRequestException("Phone number is wrong.Please try again."); throw new BadRequestException("Phone number is wrong.Please try again.");

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

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

@ -104,7 +104,7 @@ import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.chec
*/ */
@Service @Service
public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware { public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware {
private Logger logger = LoggerFactory.getLogger(getClass()); private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private SettlementSupport settlementSupport; private SettlementSupport settlementSupport;
@Resource @Resource
@ -114,6 +114,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Resource @Resource
private ClearingDetailMapper clearingDetailMapper; private ClearingDetailMapper clearingDetailMapper;
@Resource @Resource
private CustomizedSettleLogMapper customizedSettleLogMapper;
@Resource
private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper; private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper;
@Resource @Resource
private TaskManualSettleMapper taskManualSettleMapper; 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 @Override
public void getSettlementFilesForBatch(String batchId, HttpServletResponse resp) throws IOException { public void getSettlementFilesForBatch(String batchId, HttpServletResponse resp) throws IOException {
int clearingId = Integer.parseInt(batchId); int clearingId = Integer.parseInt(batchId);
@ -1649,6 +1678,10 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
if (!log.getBooleanValue("editable")) { if (!log.getBooleanValue("editable")) {
throw new ForbiddenException("Settlement log has been sent and unable to edit"); throw new ForbiddenException("Settlement log has been sent and unable to edit");
} }
if (!locker.lock("settle_task", 3600_000)) {
throw new ServerErrorException("Settle Task Running!");
}
try {
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId); List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId);
List<JSONObject> detailsWithDistributedSurcharge = details.stream().filter(detail -> detail.getBigDecimal("distributed_surcharge").compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); List<JSONObject> detailsWithDistributedSurcharge = details.stream().filter(detail -> detail.getBigDecimal("distributed_surcharge").compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (!detailsWithDistributedSurcharge.isEmpty()) { if (!detailsWithDistributedSurcharge.isEmpty()) {
@ -1663,6 +1696,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
taskManualSettleMapper.rollbackExecutedTask(clearingId); taskManualSettleMapper.rollbackExecutedTask(clearingId);
clearingDetailMapper.deleteSettleLogs(clearingId); clearingDetailMapper.deleteSettleLogs(clearingId);
clearingLogMapper.deleteSettleLogs(clearingId); clearingLogMapper.deleteSettleLogs(clearingId);
} finally {
locker.unlock("settle_task");
}
} }
@Override @Override

@ -30,8 +30,8 @@ import java.util.List;
@RestController @RestController
@ManagerMapping(value = "/sys/settlement", role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}, method = RequestMethod.GET) @ManagerMapping(value = "/sys/settlement", role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}, method = RequestMethod.GET)
public class SettlementDevController { public class SettlementDevController {
private DateFormat monthFormat = new SimpleDateFormat("yyyyMM"); private final DateFormat monthFormat = new SimpleDateFormat("yyyyMM");
private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); private final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@Resource @Resource
private CleanService cleanService; 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") @GetMapping("/settle_batches/{batchId}/settle_files")
public void getSettlementFilesForBatch(@PathVariable String batchId, HttpServletResponse resp) throws IOException { public void getSettlementFilesForBatch(@PathVariable String batchId, HttpServletResponse resp) throws IOException {
cleanService.getSettlementFilesForBatch(batchId, resp); 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);
}

@ -4119,20 +4119,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params, PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
logs.forEach(log -> log.put("padding", log.getBooleanValue("editable")));
JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject result = PageListUtils.buildPageListResult(logs);
if (query.getPage() == 1) { result.put("padding", logs.stream().anyMatch(log->log.getBooleanValue("editable")));
if (!logs.isEmpty()) { logger.info("##editable{}", result.getBooleanValue("padding"));
JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clear_detail_id"));
if (clearingDetail != null) {
JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id"));
if (clearingLog.getBooleanValue("editable")) {
result.put("padding", true);
logs.get(0).put("padding", true);
logger.info("##editable{}", clearingLog.getBooleanValue("editable"));
}
}
}
}
return result; return result;
} }

@ -571,7 +571,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
}); });
break; break;
case "phone": case "phone":
smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("contact_phone"), Locale.ENGLISH, new AuthCodeMessage("密码重置服务", codeKeyValue, 5)); smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("contact_phone"), Locale.ENGLISH, new AuthCodeMessage("Reset password", codeKeyValue, 5));
break; break;
} }
stringRedisTemplate.boundValueOps(getResetClientAccountKey(accountId)).set(codeKeyValue, 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(getResetClientAccountKey(accountId)).set(codeKeyValue, 5, TimeUnit.MINUTES);

@ -7,7 +7,6 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.github.qcloudsms.SmsSingleSender; import com.github.qcloudsms.SmsSingleSender;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Locale; import java.util.Locale;

@ -6,7 +6,7 @@ import java.util.Locale;
public class AuthCodeMessageTemplate implements DaasMessageTemplate { public class AuthCodeMessageTemplate implements DaasMessageTemplate {
private static final String CN_TPL = "您正在申请%s验证码为%s%s分钟内有效请勿向任何人提供此验证码"; private static final String CN_TPL = "您正在申请%s验证码为%s%s分钟内有效请勿向任何人提供此验证码";
private static final String EN_TPL = "Your %s secret code is %svalid for %s minutes). Do not provide this to anyone."; private static final String EN_TPL = "%s secret code is %s (valid in %s min).No reveal to others";
private final Locale locale; private final Locale locale;
private final AuthCodeMessage register; private final AuthCodeMessage register;

@ -1,7 +1,5 @@
package au.com.royalpay.payment.manage.support.sms.daas; package au.com.royalpay.payment.manage.support.sms.daas;
import org.springframework.util.MultiValueMap;
public interface DaasMessageTemplate { public interface DaasMessageTemplate {
String getMessage(); String getMessage();

@ -1425,21 +1425,10 @@ public class TradeLogServiceImpl implements TradeLogService {
} }
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params, PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
logs.forEach(log -> log.put("padding", log.getBooleanValue("editable")));
result.putAll(PageListUtils.buildPageListResult(logs)); result.putAll(PageListUtils.buildPageListResult(logs));
if (query.getPage() == 1) { result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable")));
if (!logs.isEmpty()) { logger.info("##editable{}", result.getBooleanValue("padding"));
JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clear_detail_id"));
if (clearingDetail != null) {
JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id"));
if (clearingLog.getBooleanValue("editable")) {
result.put("padding", true);
logs.get(0).put("padding", true);
logger.info("##editable{}", clearingLog.getBooleanValue("editable"));
}
}
}
}
return result; return result;
} }

@ -91,11 +91,13 @@
<select id="listClientSettlementLog" resultType="com.alibaba.fastjson.JSONObject"> <select id="listClientSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
select select
*,DATE_FORMAT(report_date,'%y-%m-%d')clear_date,DATE_FORMAT(settle_date_from,'%m-%d')settle_from,DATE_FORMAT(settle_date_to,'%m-%d')settle_to cd.*,DATE_FORMAT(cd.report_date,'%y-%m-%d')clear_date,DATE_FORMAT(cd.settle_date_from,'%m-%d')settle_from,DATE_FORMAT(cd.settle_date_to,'%m-%d')settle_to,
FROM log_clearing_detail c.editable
FROM log_clearing_detail cd
inner join log_clearing c on c.clearing_id=cd.clearing_id
<where> <where>
<if test="client_ids!=null"> <if test="client_ids!=null">
AND client_id IN AND cd.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id"> <foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id} #{client_id}
</foreach> </foreach>
@ -103,8 +105,8 @@
<if test="client_ids==null and client_id !=null"> <if test="client_ids==null and client_id !=null">
and client_id=#{client_id} and client_id=#{client_id}
</if> </if>
<if test="begin!=null">and report_date &gt;= #{begin}</if> <if test="begin!=null">and cd.report_date &gt;= #{begin}</if>
<if test="end!=null">and report_date &lt;= #{end}</if> <if test="end!=null">and cd.report_date &lt;= #{end}</if>
</where> </where>
</select> </select>
<select id="batchReport" resultType="com.alibaba.fastjson.JSONObject"> <select id="batchReport" resultType="com.alibaba.fastjson.JSONObject">

@ -577,7 +577,7 @@
AND date(r.expiry_time) >= DATE(t.clearing_time) AND date(r.expiry_time) >= DATE(t.clearing_time)
AND date(r.active_time) &lt;= DATE(t.clearing_time)) rate, AND date(r.active_time) &lt;= DATE(t.clearing_time)) rate,
t.clearing_order clear_detail_id, t.clearing_order clear_detail_id,
lc.balance_group lc.balance_group, lc.editable
FROM pmt_transactions t FROM pmt_transactions t
left join log_clearing_detail cd on cd.clear_detail_id=t.clearing_order left join log_clearing_detail cd on cd.clear_detail_id=t.clearing_order
left join log_clearing lc on cd.clearing_id = lc.clearing_id left join log_clearing lc on cd.clearing_id = lc.clearing_id

@ -0,0 +1 @@
917c6c95c3328f8103f6a57e05cecf58

@ -231,7 +231,7 @@
<tr ng-repeat="log in settlementLogs"> <tr ng-repeat="log in settlementLogs">
<td> <td>
{{log.report_date|limitTo:10}} {{log.report_date|limitTo:10}}
&nbsp;<span ng-if="$index==0&&padding" class="text-red"> &nbsp;<span ng-if="log.padding" class="text-red">
<i class="glyphicon glyphicon-time" uib-tooltip="清算正在执行中,以最终结果为准"></i> <i class="glyphicon glyphicon-time" uib-tooltip="清算正在执行中,以最终结果为准"></i>
</span> </span>
</td> </td>

@ -284,7 +284,7 @@
<tr ng-repeat="log in settlementLogs"> <tr ng-repeat="log in settlementLogs">
<td> <td>
{{log.clearing_time|limitTo:10}} {{log.clearing_time|limitTo:10}}
&nbsp;<span ng-if="$index==0&&padding" class="text-red"><i class="glyphicon glyphicon-time" uib-tooltip="清算正在执行中,以最终结果为准"></i></span> &nbsp;<span ng-if="log.padding" class="text-red"><i class="glyphicon glyphicon-time" uib-tooltip="清算正在执行中,以最终结果为准"></i></span>
</td> </td>
<td> <td>
<span ng-if="log.balance_group=='RPAY_SVC_CARD'">Card Payment</span> <span ng-if="log.balance_group=='RPAY_SVC_CARD'">Card Payment</span>

@ -25,7 +25,8 @@ $(function () {
if (msg.success) { if (msg.success) {
location.href = './result' location.href = './result'
} else { } else {
$errorMsgBox.text('[' + evt.errCode + ']' + evt.errMsg).show(); ctrl.pending = false;
$errorMsgBox.text('[' + msg.errCode + ']' + msg.errMsg).show();
} }
$('.threeds-container').addClass('hide'); $('.threeds-container').addClass('hide');
} }

@ -6,8 +6,6 @@ import org.junit.jupiter.api.Test;
import java.util.Locale; import java.util.Locale;
import static org.junit.jupiter.api.Assertions.*;
class SmsSenderDaasImplTest { class SmsSenderDaasImplTest {
private SmsSender sender; private SmsSender sender;

Loading…
Cancel
Save