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

master
dalong306 3 years ago
commit 27b2927266

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

@ -514,7 +514,7 @@ public class ManageAppServiceImp implements ManageAppService {
String nationCode = phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone");
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) {
e.printStackTrace();
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,
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("padding", log.getBooleanValue("editable")));
JSONObject result = PageListUtils.buildPageListResult(logs);
if (appQueryBean.getPage() == 1 && !logs.isEmpty()) {
JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id"));
if (clearingLog.getBooleanValue("editable")) {
result.put("padding", true);
logs.get(0).put("padding", true);
}
}
result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable")));
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 phoneNumber = phone.getString("contact_phone");
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) {
logger.error(e.getMessage(), e);
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 phoneNumber = client.getString("contact_phone");
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) {
logger.error(e.getMessage(), e);
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.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);
@ -1649,20 +1678,27 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
if (!log.getBooleanValue("editable")) {
throw new ForbiddenException("Settlement log has been sent and unable to edit");
}
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId);
List<JSONObject> detailsWithDistributedSurcharge = details.stream().filter(detail -> detail.getBigDecimal("distributed_surcharge").compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (!detailsWithDistributedSurcharge.isEmpty()) {
for (JSONObject detail : detailsWithDistributedSurcharge) {
releaseDistributedSurcharge(detail);
if (!locker.lock("settle_task", 3600_000)) {
throw new ServerErrorException("Settle Task Running!");
}
try {
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId);
List<JSONObject> detailsWithDistributedSurcharge = details.stream().filter(detail -> detail.getBigDecimal("distributed_surcharge").compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
if (!detailsWithDistributedSurcharge.isEmpty()) {
for (JSONObject detail : detailsWithDistributedSurcharge) {
releaseDistributedSurcharge(detail);
}
}
transactionMapper.deleteSettlementTransaction(clearingId);
transactionMapper.removeSettleRemark(clearingId);
preSettleTaskMapper.resetClearStatus(clearingId);
clearingDetailAnalysisMapper.clearAnalysis(clearingId);
taskManualSettleMapper.rollbackExecutedTask(clearingId);
clearingDetailMapper.deleteSettleLogs(clearingId);
clearingLogMapper.deleteSettleLogs(clearingId);
} finally {
locker.unlock("settle_task");
}
transactionMapper.deleteSettlementTransaction(clearingId);
transactionMapper.removeSettleRemark(clearingId);
preSettleTaskMapper.resetClearStatus(clearingId);
clearingDetailAnalysisMapper.clearAnalysis(clearingId);
taskManualSettleMapper.rollbackExecutedTask(clearingId);
clearingDetailMapper.deleteSettleLogs(clearingId);
clearingLogMapper.deleteSettleLogs(clearingId);
}
@Override
@ -1724,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);
}

@ -4119,20 +4119,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
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);
if (query.getPage() == 1) {
if (!logs.isEmpty()) {
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"));
}
}
}
}
result.put("padding", logs.stream().anyMatch(log->log.getBooleanValue("editable")));
logger.info("##editable{}", result.getBooleanValue("padding"));
return result;
}

@ -571,7 +571,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
});
break;
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;
}
stringRedisTemplate.boundValueOps(getResetClientAccountKey(accountId)).set(codeKeyValue, 5, TimeUnit.MINUTES);
@ -607,7 +607,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
});
break;
case "phone":
smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("phone"), Locale.CHINESE, new AuthCodeMessage("密码重置服务",codeKeyValue,5));
smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("phone"), Locale.CHINESE, new AuthCodeMessage("密码重置服务", codeKeyValue,5));
break;
}
stringRedisTemplate.boundValueOps(getResetManagerAccountKey(managerId)).set(codeKeyValue, 5, TimeUnit.MINUTES);

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

@ -6,7 +6,7 @@ import java.util.Locale;
public class AuthCodeMessageTemplate implements DaasMessageTemplate {
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 AuthCodeMessage register;

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

@ -1425,21 +1425,10 @@ public class TradeLogServiceImpl implements TradeLogService {
}
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
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));
if (query.getPage() == 1) {
if (!logs.isEmpty()) {
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"));
}
}
}
}
result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable")));
logger.info("##editable{}", result.getBooleanValue("padding"));
return result;
}

@ -91,11 +91,13 @@
<select id="listClientSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
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
FROM log_clearing_detail
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,
c.editable
FROM log_clearing_detail cd
inner join log_clearing c on c.clearing_id=cd.clearing_id
<where>
<if test="client_ids!=null">
AND client_id IN
AND cd.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
@ -103,8 +105,8 @@
<if test="client_ids==null and client_id !=null">
and client_id=#{client_id}
</if>
<if test="begin!=null">and report_date &gt;= #{begin}</if>
<if test="end!=null">and report_date &lt;= #{end}</if>
<if test="begin!=null">and cd.report_date &gt;= #{begin}</if>
<if test="end!=null">and cd.report_date &lt;= #{end}</if>
</where>
</select>
<select id="batchReport" resultType="com.alibaba.fastjson.JSONObject">

@ -577,7 +577,7 @@
AND date(r.expiry_time) >= DATE(t.clearing_time)
AND date(r.active_time) &lt;= DATE(t.clearing_time)) rate,
t.clearing_order clear_detail_id,
lc.balance_group
lc.balance_group, lc.editable
FROM pmt_transactions t
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

@ -0,0 +1 @@
917c6c95c3328f8103f6a57e05cecf58

@ -231,7 +231,7 @@
<tr ng-repeat="log in settlementLogs">
<td>
{{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>
</span>
</td>

@ -284,7 +284,7 @@
<tr ng-repeat="log in settlementLogs">
<td>
{{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>
<span ng-if="log.balance_group=='RPAY_SVC_CARD'">Card Payment</span>

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

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

Loading…
Cancel
Save