<!--审核表单-->
<script type="text/html" id="accountTerrace-tpl-isAudit">
<form id="accountTerrace-form-isAudit" lay-filter="accountTerrace-form-isAudit" class="layui-form model-form">
<input name="id" type="hidden" />
<div class="layui-form-item">
<div class="layui-input-block">
<label class="layui-form-label">收单账号</label>
<label class="layui-form-label" id="alipayAccount"></label>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">审核结果</label>
<div class="layui-input-block">
<input name="isAuditing" value=0 type="radio" title="待审核" lay-filter="isAuditing" />
<input name="isAuditing" value=1 type="radio" title="审核通过" lay-filter="isAuditing" checked/>
<input name="isAuditing" value=2 type="radio" title="审核不通过" lay-filter="isAuditing"/>
</div>
</div>
<div class="layui-form-item model-form-footer" style="text-align: center;">
<button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
<button class="layui-btn" lay-filter="accountTerrace-form-submit-isAudit" lay-submit>保存</button>
</div>
</form>
</script>
<!-- 表格操作列 -->
<script type="text/html" id="accountTerrace-table-bar">
{{# if(d.isAuditing == 0||d.isAuditing == 2){ }}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="audit">审核</a>
{{# } else { }}
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{{# } }}
</script>
// 工具条点击事件
table.on('tool(accountTerrace-table)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') { //修改
showEditModel(data);
}else if (obj.event === 'del') { //删除
doDelete(obj);
}else if (obj.event === 'audit') { //审核
doAudit(data);
}
});
//审核
var doAudit = function (data) {
layer.open({
type: 1,
title: '审核',
area: '450px',
offset: '120px',
content: $('#accountTerrace-tpl-isAudit').html(),
success: function () {
$('input[name="isAuditing"]:checked').val();
$("#alipayAccount").text(data.alipayAccount);
$('#accountTerrace-form-isAudit')[0].reset();
$('#accountTerrace-form-isAudit').attr('method', 'POST');
if (data) {
form.val('accountTerrace-form-isAudit', data);
}
}
});
};
// 审核表单提交事件
form.on('submit(accountTerrace-form-submit-isAudit)', function (data) {
layer.load(2);
debugger
//使用map传值
var isAuditing = $('input[name="isAuditing"]:checked').val();
var alipayAccount=$('#alipayAccount').text();
var dataMap = new Map();
dataMap.set('isAuditing',isAuditing);
dataMap.set('alipayAccount',alipayAccount);
dataMap.set('id',data.field.id);
//msp转object
let obj= Object.create(null);
for (let[k,v] of dataMap) {
obj[k] = v;
}
//object转json
admin.req('api-wallet/accountterrace/updateIsAuditing', JSON.stringify(obj), function (data) {
layer.closeAll('loading');
if (data.code == 0) {
layer.msg(data.msg, {icon: 1, time: 2000});
table.reload('accountTerrace-table');
layer.closeAll('page');
} else {
layer.msg(data.msg, {icon: 2, time: 2000});
}
}, $('#accountTerrace-form-isAudit').attr('method'));
return false;
});
/**
* 审核
*
* @param params
* @return
* @throws
* @author
*/
@ApiOperation("审核")
@PostMapping("/updateIsAuditing")
@ApiImplicitParams({
@ApiImplicitParam(name = "isAuditing", value = "审核状态:0待审核,1审核通过,2审核不通过", required = true, dataType = "Integer") })
@PreAuthorize("hasAnyAuthority('doyenLabels:labels:updateIsAuditing')")
@LogAnnotation(module = "doyen-center", recordRequestParam = false)
public Result updateStatus(@RequestBody Map<String, Object> params, HttpServletRequest request)
throws ControllerException {
try {
accountTerraceService.updateIsAuditing(params, request);
return Result.succeed("操作成功");
} catch (Exception e) {
throw new ControllerException(e);
}
}
/**
* 审核
* @return
* @throws ServiceException
*/
Result updateIsAuditing(Map<String, Object> params, HttpServletRequest request)throws ServiceException;
/**
* 审核
*
* @param params
* @param request
* @return
* @throws ServiceException
*/
@Override
public Result updateIsAuditing(Map<String, Object> params, HttpServletRequest request) throws ServiceException {
try {
Long id = MapUtils.getLong(params, "id");
Integer isAuditing = MapUtils.getInteger(params, "isAuditing");
String alipayAccount=MapUtils.getString(params, "alipayAccount");
// 根据支付宝账号查询
AccountTerrace accountTerrace = accountTerraceDao.queryByAlipayAccount(alipayAccount);
if (accountTerrace == null) {
return Result.failed("不存在");
}
// 设置状态
accountTerrace.setIsAuditing(isAuditing);
// 审核人ip
accountTerrace.setAuditingIp(IPUtils.getRemoteIp(request));
// 时间
accountTerrace.setAuditingTime(new Date());
// 修改
int count = accountTerraceDao.update(accountTerrace);
return count > 0 ? Result.succeed(accountTerrace, "审核成功") : Result.failed("审核失败");
} catch (Exception e) {
// TODO Auto-generated catch block
throw new ServiceException(e);
}
}
AccountTerrace queryByAlipayAccount(String alipayAccount);
int update(AccountTerrace accountTerrace);
个人博客:码农日志 (lixiaofang.top)http://lixiaofang.top/
|