package com.szwl.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.szwl.model.bo.R; import com.szwl.model.bo.ResponseModel; import com.szwl.model.entity.TAdmin; import com.szwl.model.entity.TJoinpayMchCheck; import com.szwl.model.entity.TShandeMch; import com.szwl.model.entity.TShandeMchCheck; import com.szwl.service.TAdminService; import com.szwl.service.TShandeMchCheckService; import com.szwl.service.TShandeMchService; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.List; /** *

* 杉德支付收款信息变动审核表 前端控制器 *

* * @author wuhs * @since 2022-04-29 */ @RestController @RequestMapping("/tShandeMchCheck") public class TShandeMchCheckController { @Autowired TShandeMchCheckService tShandeMchCheckService; @Autowired TShandeMchService tShandeMchService; @Autowired TAdminService adminService; @ApiOperation(value = "商家查找杉德收款账户在审核信息") @PostMapping("/getOne") public ResponseModel findById(Long id, String username) { TAdmin admin = adminService.getById(id); if(!admin.getUsername().equals(username)){ return R.fail("username不符合!"); } LambdaQueryWrapper query = Wrappers.lambdaQuery(); query.eq(TShandeMchCheck::getAdminId,id); query.eq(TShandeMchCheck::getCheckType,"0"); List list = tShandeMchCheckService.list(query); if(list.size()>0){ return R.ok(list.get(list.size()-1)); }else { return R.fail("没有审核信息"); } } @ApiOperation(value = "撤销申请") @PostMapping("/update") public ResponseModel update(Long id) { LambdaQueryWrapper query = Wrappers.lambdaQuery(); query.eq(TShandeMchCheck::getId,id); List list = tShandeMchCheckService.list(query); if(list.size()>0){ TShandeMchCheck tShandeMchCheck = list.get(0); tShandeMchCheck.setType("2"); tShandeMchCheck.setModifyDate(new Date()); tShandeMchCheckService.updateById(tShandeMchCheck); return R.ok(); }else { return R.fail("撤销失败"); } } @ApiOperation(value = "平台查找杉德收款账户在审核信息") @PostMapping("/getList") public ResponseModel getList(String username, String type) { LambdaQueryWrapper query = Wrappers.lambdaQuery(); if(StringUtils.isNotEmpty(username)){ LambdaQueryWrapper query1 = Wrappers.lambdaQuery(); query1.eq(TAdmin::getUsername,username); List list1 = adminService.list(query1); if(list1.size()>0){ query.eq(TShandeMchCheck::getAdminId,list1.get(0).getId()); } } if(StringUtils.isNotEmpty(type)){ query.eq(TShandeMchCheck::getType,type); } List list = tShandeMchCheckService.list(query); if(list.size()>0){ return R.ok(list); }else { return R.fail("没有审核信息"); } } @ApiOperation(value = "平台审核是否通过") @PostMapping("/shenhe") public ResponseModel shenhe(Long id,String type) { if(type.equals("0")){ //通过 TShandeMchCheck shandeMchCheck = tShandeMchCheckService.getById(id); LambdaQueryWrapper query = Wrappers.lambdaQuery(); query.eq(TShandeMch::getAdminId,shandeMchCheck.getAdminId()); List list = tShandeMchService.list(query); if(list.size()>0){ TShandeMch mch = list.get(0); mch.setModifyDate(new Date()); mch.setBankName(shandeMchCheck.getBankName()); mch.setType(shandeMchCheck.getType()); mch.setBankNo(shandeMchCheck.getBankNo()); //企业 if(shandeMchCheck.getType().equals("0")){ mch.setBankChannelNo(shandeMchCheck.getBankChannelNo()); mch.setBankChannelName(shandeMchCheck.getBankChannelName()); } //个人 if(shandeMchCheck.getType().equals("1")){ mch.setBankChannelNo(null); mch.setBankChannelName(null); } tShandeMchService.updateById(mch); shandeMchCheck.setCheckType("1"); shandeMchCheck.setModifyDate(new Date()); tShandeMchCheckService.updateById(shandeMchCheck); } }else { //拒绝 TShandeMchCheck tShandeMchCheck = tShandeMchCheckService.getById(id); tShandeMchCheck.setModifyDate(new Date()); tShandeMchCheck.setCheckType("3"); tShandeMchCheckService.updateById(tShandeMchCheck); } return R.ok(); } }