| package com.xzx.gc.user.controller;  | 
|   | 
| import cn.hutool.core.date.DateUtil;  | 
| import com.fasterxml.jackson.databind.DeserializationFeature;  | 
| import com.fasterxml.jackson.databind.ObjectMapper;  | 
| import com.xzx.gc.common.constant.CommonEnum;  | 
| import com.xzx.gc.common.constant.Constants;  | 
| import com.xzx.gc.common.dto.log.OperationAppLog;  | 
| import com.xzx.gc.common.request.BaseController;  | 
| import com.xzx.gc.entity.CoreUser;  | 
| import com.xzx.gc.entity.PartnerBank;  | 
| import com.xzx.gc.entity.XzxPartnerBank;  | 
| import com.xzx.gc.model.JsonResult;  | 
| import com.xzx.gc.model.admin.XzxPartnerBankModel;  | 
| import com.xzx.gc.user.service.PartnerBankService;  | 
| import com.xzx.gc.util.BeanUtils;  | 
| import com.xzx.gc.util.SessionUtil;  | 
| import io.swagger.annotations.Api;  | 
| import io.swagger.annotations.ApiImplicitParam;  | 
| import io.swagger.annotations.ApiImplicitParams;  | 
| import io.swagger.annotations.ApiOperation;  | 
| import org.springframework.beans.factory.annotation.Autowired;  | 
| import org.springframework.web.bind.annotation.PostMapping;  | 
| import org.springframework.web.bind.annotation.RequestBody;  | 
| import org.springframework.web.bind.annotation.ResponseBody;  | 
| import org.springframework.web.bind.annotation.RestController;  | 
|   | 
| import javax.servlet.http.HttpServletRequest;  | 
| import java.util.Date;  | 
| import java.util.List;  | 
|   | 
| @RestController  | 
| @Api(tags = {"合伙人银行账户管理"})  | 
| public class PartnerBankController extends BaseController {  | 
|   | 
|       | 
|     @Autowired  | 
|     private SessionUtil sessionUtil;  | 
|       | 
|     @Autowired  | 
|     private PartnerBankService partnerBankService;  | 
|       | 
|     @PostMapping( "/admin/front/partnerBank/deleteBankCard.json")  | 
|     @ApiOperation(value="删除合伙人银行账户信息", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name ="id", value = "银行卡Id主键", required = true, dataType = "int")  | 
|     })  | 
|     public JsonResult<String> deleteBankCard(@RequestBody XzxPartnerBankModel model,HttpServletRequest request){  | 
|         CoreUser user = sessionUtil.getCurrentUser();  | 
|         if(user.getId()==1){  | 
|             return JsonResult.failMessage("超管不能删除合伙人银行账户信息!");  | 
|         }  | 
|         ObjectMapper objectMapper = new ObjectMapper();  | 
|         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);  | 
|         PartnerBank bank = BeanUtils.copy(model, PartnerBank.class);  | 
|         bank = partnerBankService.queryById(bank.getId());  | 
|         bank.setDelFlag("1");  | 
|         bank.setUpdateTime(DateUtil.now());  | 
|   | 
|         if(!partnerBankService.update(bank)){  | 
|             return JsonResult.failMessage("删除失败");  | 
|         }else{  | 
|             OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))  | 
|                     .methodName(Constants.ORDER_MODUL_NAME).operateAction("删除合伙人银行账户信息-"+model.getId()).build();  | 
|             mqUtil.sendApp(build);  | 
|             return  JsonResult.success("删除成功");  | 
|         }  | 
|   | 
|     }  | 
|   | 
|     @PostMapping( "/admin/front/partnerBank/updateBankCard.json")  | 
|     @ApiOperation(value="修改合伙人银行账户信息", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name ="id", value = "银行卡Id主键", required = true, dataType = "int"),  | 
|             @ApiImplicitParam(paramType="query", name ="bankNo", value = "银行账号", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "bankName", value = "银行名称", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "openName", value = "开户人名称", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "idCard", value = "证件号码", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "mobilePhone", value = "预留手机号", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "partnerId", value = "合伙人Id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<String> updateBankCard(@RequestBody XzxPartnerBankModel model,HttpServletRequest request){  | 
|         CoreUser user = sessionUtil.getCurrentUser();  | 
|         if(user.getId()==1){  | 
|             return JsonResult.failMessage("超管不能修改合伙人银行账户信息!");  | 
|         }  | 
|         ObjectMapper objectMapper = new ObjectMapper();  | 
|         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);  | 
|         PartnerBank bank = BeanUtils.copy(model, PartnerBank.class);  | 
|         bank.setDelFlag("0");  | 
|         bank.setUpdateTime(DateUtil.now());  | 
|         //CoreUser user = sessionUtil.getCurrentUser();  | 
|         bank.setPartnerId(user.getId()+"");  | 
|         //银行账号相同,直接返回失败  | 
|         String oldBankNo =partnerBankService.queryByBankNo(bank.getBankNo(),model.getId()+"");  | 
|         if(null!=oldBankNo&&!"".equals(oldBankNo)){  | 
|             return JsonResult.failMessage("银行账号不能相同!");  | 
|         }else{  | 
|             if(!partnerBankService.update(bank)){  | 
|                 return JsonResult.failMessage("修改失败");  | 
|             }else{  | 
|                 OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))  | 
|                         .methodName(Constants.ORDER_MODUL_NAME).operateAction("修改合伙人银行账户信息-"+model.getId()).build();  | 
|                 mqUtil.sendApp(build);  | 
|                 return  JsonResult.success("修改成功");  | 
|             }  | 
|         }  | 
|     }  | 
|   | 
|     @PostMapping( "/admin/front/partnerBank/addBankCard.json")  | 
|     @ApiOperation(value="添加合伙人银行账户信息", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name ="bankNo", value = "银行账号", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "bankName", value = "银行名称", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "openName", value = "开户人名称", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "idCard", value = "证件号码", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "mobilePhone", value = "预留手机号", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "partnerId", value = "合伙人Id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<String> addBankCard(@RequestBody XzxPartnerBankModel model,HttpServletRequest request){  | 
|         CoreUser user = sessionUtil.getCurrentUser();  | 
|         if(user.getId()==1){  | 
|             return JsonResult.failMessage("超管不能添加合伙人银行账户信息!");  | 
|         }  | 
|         ObjectMapper objectMapper = new ObjectMapper();  | 
|         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);  | 
|         PartnerBank bank = BeanUtils.copy(model, PartnerBank.class);  | 
|         bank.setDelFlag("0");  | 
|         bank.setCreateTime(DateUtil.now());  | 
|         //CoreUser user = sessionUtil.getCurrentUser();  | 
|         bank.setPartnerId(user.getId()+"");  | 
|         //银行账号相同,直接返回失败  | 
|         String oldBankNo =partnerBankService.queryByBankNo(bank.getBankNo(),null);  | 
|         if(null!=oldBankNo&&!"".equals(oldBankNo)){  | 
|             return JsonResult.failMessage("银行账号不能相同!");  | 
|         }else{  | 
|             if(!partnerBankService.save(bank)){  | 
|                 return JsonResult.failMessage("保存失败");  | 
|             }else{  | 
|                 OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))  | 
|                         .methodName(Constants.ORDER_MODUL_NAME).operateAction("添加合伙人银行账户信息-"+model.getPartnerId()).build();  | 
|                 mqUtil.sendApp(build);  | 
|                 return  JsonResult.success("保存成功");  | 
|             }  | 
|         }  | 
|     }  | 
|   | 
|   | 
|     @PostMapping( "/admin/front/partnerBank/queryBankCard.json")  | 
|     @ApiOperation(value="查询银行账户信息", notes="test: 仅0有正确返回")  | 
|     public JsonResult<List<XzxPartnerBankModel>> queryBankCard(@RequestBody XzxPartnerBankModel model){  | 
|         List<XzxPartnerBankModel> list = partnerBankService.queryByBankList();  | 
|         return JsonResult.success(list);  | 
|     }  | 
|   | 
|   | 
|     @PostMapping( "/admin/front/partnerBank/queryBankCardById.json")  | 
|     @ApiOperation(value="查询审批信息", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name ="payOrderId", value = "提现申请id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<XzxPartnerBankModel> queryBankCardById(@RequestBody XzxPartnerBankModel model){  | 
|         XzxPartnerBankModel obj = partnerBankService.queryBankCardById(model);  | 
|         return JsonResult.success(obj);  | 
|     }  | 
| }  |