From ae68b2ca7947571ccb75785b69f9024d9097ba00 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Mon, 1 Apr 2019 13:54:18 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=94=AF=E4=BB=98=E8=B4=A6=E5=8F=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF][=E6=96=B0=E5=A2=9E]:=E6=96=B0=E5=A2=9E=E7=94=B2?= =?UTF-8?q?=E6=96=B9=E9=93=B6=E8=A1=8C=E8=B4=A6=E5=8F=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxRentContractController.java | 40 ++++++++++++ .../V201904011301__ADD_PAYACCOUNTBILLINFO.sql | 3 + .../service/WxPayAccountBillService.java | 55 ++++++++++++++++ .../iformall/service/WxPayAccountService.java | 4 +- .../impl/WxPayAccountBillServiceImpl.java | 63 +++++++++++++++++++ 5 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V201904011301__ADD_PAYACCOUNTBILLINFO.sql create mode 100644 mallinkService/src/main/java/com/iformall/service/WxPayAccountBillService.java create mode 100644 mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java index 0b3b45b1c..5f15cabc5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java @@ -1,14 +1,18 @@ package com.iformall.controller; import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.WxBillRent; +import com.iformall.domain.po.WxPayAccountBill; import com.iformall.domain.po.WxRentContract; import com.iformall.service.WxBillRentService; +import com.iformall.service.WxPayAccountBillService; import com.iformall.service.WxRentContractService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; import java.util.Map; /** @@ -31,6 +36,9 @@ public class WxRentContractController extends BaseController { @Autowired private WxBillRentService wxBillRentService; + @Autowired + private WxPayAccountBillService payAccountBillService; + @GetMapping("list") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @@ -156,4 +164,36 @@ public class WxRentContractController extends BaseController { return wxRentContractService.updateRentContractStatus(id); } + @GetMapping("getPayAccountInfo") + @SystemControllerLog(description = "租赁合同-获取甲方账户") + public ResultData getPayAccountInfo() { + logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); + String tenantId = getTenantId(); + WxPayAccountBill payAccountBill = payAccountBillService.getByTenantId(tenantId); + Map map = new HashMap<>(); + if(StringUtils.isNotBlank(payAccountBill.getBankAccountName()) && StringUtils.isNotBlank(payAccountBill.getBankCardId())) { + map.put("bankAccountName", payAccountBill.getBankAccountName()); + map.put("bankCardId", payAccountBill.getBankCardId()); + } + return new ResultData(map); + } + + @PostMapping("savePayAccountInfo") + @SystemControllerLog(description = "租赁合同-保存甲方账户") + public ResultData savePayAccountInfo(@RequestBody WxPayAccountBill payAccountBill) { + logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); + if(StringUtils.isBlank(payAccountBill.getBankAccountName())) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "甲方银行账户名未填写"); + } + if(StringUtils.isBlank(payAccountBill.getBankCardId())) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "甲方银行账户卡号未填写"); + } + String tenantId = getTenantId(); + WxPayAccountBill payAccountBillNew = payAccountBillService.getByTenantId(tenantId); + payAccountBillNew.setBankAccountName(payAccountBill.getBankAccountName()); + payAccountBillNew.setBankCardId(payAccountBill.getBankCardId()); + payAccountBillService.saveOrUpdate(payAccountBillNew); + return new ResultData(); + } + } diff --git a/mallinkAdmin/src/main/resources/db/migration/V201904011301__ADD_PAYACCOUNTBILLINFO.sql b/mallinkAdmin/src/main/resources/db/migration/V201904011301__ADD_PAYACCOUNTBILLINFO.sql new file mode 100644 index 000000000..4602f4eaf --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201904011301__ADD_PAYACCOUNTBILLINFO.sql @@ -0,0 +1,3 @@ +ALTER TABLE `wx_pay_account_bill` +ADD COLUMN `bank_account_name` VARCHAR(50) NULL COMMENT '银行账户名' AFTER `rate`, +ADD COLUMN `bank_account_name` VARCHAR(50) NULL COMMENT '银行卡号' AFTER `bank_account_name`; diff --git a/mallinkService/src/main/java/com/iformall/service/WxPayAccountBillService.java b/mallinkService/src/main/java/com/iformall/service/WxPayAccountBillService.java new file mode 100644 index 000000000..35a423b4c --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxPayAccountBillService.java @@ -0,0 +1,55 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxPayAccountBill; + +public interface WxPayAccountBillService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param pageIndex + * @param pageSize + * @return + */ + PageInfo listAsPage(WxPayAccountBill record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxPayAccountBill getById(Long id); + + /** + * 根据tenantId获得实体 + * + * @param tenantId + * @return + */ + WxPayAccountBill getByTenantId(String tenantId); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxPayAccountBill record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java b/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java index ee0ac5f92..ffd49879b 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java @@ -9,8 +9,8 @@ public interface WxPayAccountService { * 根据实体查询分页列表 * * @param record - * @param offset - * @param limit + * @param pageIndex + * @param pageSize * @return */ PageInfo listAsPage(WxPayAccount record, Integer pageIndex, Integer pageSize); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java new file mode 100644 index 000000000..0e9f4d71e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java @@ -0,0 +1,63 @@ +package com.iformall.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.iformall.common.IdWorker; +import com.iformall.domain.po.WxPayAccountBill; +import com.iformall.mapper.WxPayAccountBillMapper; +import com.iformall.service.WxPayAccountBillService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class WxPayAccountBillServiceImpl implements WxPayAccountBillService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + WxPayAccountBillMapper wxPayAccountBillMapper; + + + @Override + public PageInfo listAsPage(WxPayAccountBill record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPayAccountBillMapper.findList(record)); + } + + @Override + public WxPayAccountBill getById(Long id) { + return wxPayAccountBillMapper.selectByPrimaryKey(id); + } + + @Override + public WxPayAccountBill getByTenantId(String tenantId) { + WxPayAccountBill payAccountBillQ = new WxPayAccountBill(); + payAccountBillQ.setTenantId(tenantId); + return wxPayAccountBillMapper.selectOne(payAccountBillQ); + } + + @Override + public void saveOrUpdate(WxPayAccountBill record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxPayAccountBillMapper.insertSelective(record); + } else { + wxPayAccountBillMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxPayAccountBillMapper.deleteByPrimaryKey(id); + } + + + + + + + + +}