|
@@ -0,0 +1,212 @@
|
|
|
+package com.gree.mall.manager.controller.settle.repair;
|
|
|
+
|
|
|
+import cn.hutool.core.lang.TypeReference;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.gree.mall.manager.annotation.ZfireList;
|
|
|
+import com.gree.mall.manager.bean.material.base.WebsitNormChargeVO;
|
|
|
+import com.gree.mall.manager.bean.settle.repair.DailyBankAccountBean;
|
|
|
+import com.gree.mall.manager.bean.settle.repair.DailyBankAccountVO;
|
|
|
+import com.gree.mall.manager.constant.Constant;
|
|
|
+import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
+import com.gree.mall.manager.helper.ResponseHelper;
|
|
|
+import com.gree.mall.manager.logic.settle.repair.RepairSettleAccountLogic;
|
|
|
+import com.gree.mall.manager.plus.entity.SettleDailyBankAccount;
|
|
|
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
+import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.integration.redis.util.RedisLockRegistry;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.concurrent.locks.Lock;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@Api(value = "银行卡API", tags = {"银行卡API"})
|
|
|
+@RequestMapping(value = "/daily/bank", produces = "application/json; charset=utf-8")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class BankAccountController {
|
|
|
+
|
|
|
+ private final RepairSettleAccountLogic repairSettleAccountLogic;
|
|
|
+ private final RedisLockRegistry redisLockRegistry;
|
|
|
+
|
|
|
+ @ZfireList
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ApiOperation(value = "列表")
|
|
|
+ public ResponseHelper<IPage<DailyBankAccountVO>> page(
|
|
|
+ @RequestBody ZfireParamBean zfireParamBean
|
|
|
+ ) {
|
|
|
+ IPage<DailyBankAccountVO> page = repairSettleAccountLogic.page(zfireParamBean);
|
|
|
+ return ResponseHelper.success(page, new TypeReference<DailyBankAccountVO>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/list/export")
|
|
|
+ @ApiOperation("导出")
|
|
|
+ public void listExport(
|
|
|
+ @RequestBody ZfireParamBean zfireParamBean,
|
|
|
+ HttpServletRequest request,
|
|
|
+ HttpServletResponse response
|
|
|
+ ) throws Exception {
|
|
|
+ //2.查询要导出的内容
|
|
|
+ IPage<DailyBankAccountVO> page = repairSettleAccountLogic.page(zfireParamBean);
|
|
|
+ //3.导出
|
|
|
+ FieldUtils.exportData(page.getRecords(), zfireParamBean.getExportFields(), request, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/detail")
|
|
|
+ @ApiOperation("详情")
|
|
|
+ public ResponseHelper<SettleDailyBankAccount> detail(
|
|
|
+ @ApiParam(required = true) @RequestParam String id
|
|
|
+ ) {
|
|
|
+ SettleDailyBankAccount detail = repairSettleAccountLogic.detail(id);
|
|
|
+ return ResponseHelper.success(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ApiOperation(value = "新增")
|
|
|
+ public ResponseHelper add(
|
|
|
+ @RequestBody SettleDailyBankAccount dailyBankAccount
|
|
|
+ ) throws InterruptedException {
|
|
|
+ Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_DAILY_BANKACCOUNT + dailyBankAccount.getIdcard() + dailyBankAccount.getBankAccount());
|
|
|
+ if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
|
|
|
+ throw new RemoteServiceException("请勿频繁操作,稍后再试");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ repairSettleAccountLogic.add(dailyBankAccount);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ } finally {
|
|
|
+ obtain.unlock();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation(value = "银行卡信息-修改")
|
|
|
+ public ResponseHelper update(
|
|
|
+ @RequestBody SettleDailyBankAccount dailyBankAccount
|
|
|
+ ) throws InterruptedException {
|
|
|
+ Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_DAILY_BANKACCOUNT + dailyBankAccount.getIdcard() + dailyBankAccount.getBankAccount());
|
|
|
+ if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
|
|
|
+ throw new RemoteServiceException("请勿频繁操作,稍后再试");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ repairSettleAccountLogic.update(dailyBankAccount);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ } finally {
|
|
|
+ obtain.unlock();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @ApiOperation(value = "银行卡信息-删除")
|
|
|
+ public ResponseHelper getAccountBalance(
|
|
|
+ @ApiParam(required = true, value = "id") @RequestParam(required = true) Integer id
|
|
|
+ ) {
|
|
|
+ repairSettleAccountLogic.delete(id);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+//
|
|
|
+// @GetMapping("/transfer/list")
|
|
|
+// @ApiOperation(value = "转帐记录列表")
|
|
|
+// public ResponseHelper<IPage<DailyBankTransferRecord>> transferList(
|
|
|
+// @ApiParam(required = false, value = "服务人员编号") @RequestParam(required = false) String workerNumber,
|
|
|
+// @ApiParam(required = false, value = "批次号") @RequestParam(required = false) String batchNo,
|
|
|
+// @ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startTime,
|
|
|
+// @ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String endTime,
|
|
|
+// @ApiParam(required = true, value = "页号") @RequestParam(required = true) Integer pageNo,
|
|
|
+// @ApiParam(required = true, value = "页大小") @RequestParam(required = true) Integer pageSize,
|
|
|
+// HttpServletRequest request
|
|
|
+// ) {
|
|
|
+// IPage<DailyBankTransferRecord> list = repairSettleAccountLogic.transferList(workerNumber, startTime, endTime, batchNo, pageNo, pageSize);
|
|
|
+// return ResponseHelper.success(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @GetMapping("/company/account/list")
|
|
|
+// @ApiOperation(value = "公司卡号余额列表")
|
|
|
+// public ResponseHelper<IPage<DailyBankCardBalance>> companyAccountList(
|
|
|
+// @ApiParam(required = true, value = "页号") @RequestParam(required = true) Integer pageNo,
|
|
|
+// @ApiParam(required = true, value = "页大小") @RequestParam(required = true) Integer pageSize
|
|
|
+// ) {
|
|
|
+// IPage<DailyBankCardBalance> list = repairSettleAccountLogic.companyAccountList(pageNo, pageSize);
|
|
|
+// return ResponseHelper.success(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @GetMapping("/send/msg")
|
|
|
+// @ApiOperation(value = "查询余额/(发放工资)发送验证码")
|
|
|
+// public ResponseHelper sendMsg(
|
|
|
+// @ApiParam(required = true, value = "手机号") @RequestParam(required = true) String mobile,
|
|
|
+// @ApiParam(required = false, value = "类型 发放:issue , 余额:balance") @RequestParam(required = false) String type
|
|
|
+// ) throws Exception {
|
|
|
+// repairSettleAccountLogic.sendMsg(mobile,type);
|
|
|
+// return ResponseHelper.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// @GetMapping("/company/account/balance")
|
|
|
+// @ApiOperation(value = "查询公司卡余额")
|
|
|
+// public ResponseHelper<DailyBankCardBalance> selBankCardBalance(
|
|
|
+// @ApiParam(required = true, value = "id") @RequestParam(required = true) Integer id,
|
|
|
+// @ApiParam(required = true, value = "手机号") @RequestParam(required = true) String mobile,
|
|
|
+// @ApiParam(required = true, value = "验证码") @RequestParam(required = true) String code
|
|
|
+// ) throws Exception {
|
|
|
+// DailyBankCardBalance bean = repairSettleAccountLogic.selBankCardBalance(id,mobile,code);
|
|
|
+// return ResponseHelper.success(bean);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/template/download")
|
|
|
+// @ApiOperation("下载银行账户模板")
|
|
|
+// public void downloadTemplate(HttpServletResponse response) throws IOException {
|
|
|
+// String fileName = "银行账户模板.xlsx";
|
|
|
+// CommonUtils.downloadFile(fileName,response);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @PostMapping("/template/import")
|
|
|
+// @ApiOperation("导入银行账户")
|
|
|
+// public ResponseHelper importData(MultipartFile file) throws IOException {
|
|
|
+// repairSettleAccountLogic.importData(file);
|
|
|
+// return ResponseHelper.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// DailyTransferLogic dailyTransferLogic;
|
|
|
+//
|
|
|
+// @GetMapping("/excute")
|
|
|
+// @ApiOperation("查询转账结果")
|
|
|
+// public ResponseHelper excute(){
|
|
|
+// dailyTransferLogic.excute();
|
|
|
+// return ResponseHelper.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/template/export")
|
|
|
+// @ApiOperation("银行账号信息-导出")
|
|
|
+// public void exportRepairLevel(
|
|
|
+// @ApiParam(required = false, value = "服务人员编号") @RequestParam(required = false) String workerNumber,
|
|
|
+// @ApiParam(required = false, value = "服务人员名称") @RequestParam(required = false) String workerName,
|
|
|
+// @ApiParam(required = false, value = "所属网点编号") @RequestParam(required = false) String websitNumber,
|
|
|
+// @ApiParam(required = false, value = "身份证") @RequestParam(required = false) String idcard,
|
|
|
+// @ApiParam(required = false, value = "手机号") @RequestParam(required = false) String mobile,
|
|
|
+// HttpServletRequest request,
|
|
|
+// HttpServletResponse response
|
|
|
+// ) throws Exception {
|
|
|
+// IPage<DailyBankAccountBean> list = repairSettleAccountLogic.list(workerNumber, workerName, websitNumber, idcard, mobile, 1, -1);
|
|
|
+// ExcelData excelData = repairSettleAccountLogic.exportData(list.getRecords());
|
|
|
+// ExcelUtils.exportExcel(request,response,"银行账号信息.xlsx",excelData);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+}
|