查询师傅银行卡信息时要带上deptId

This commit is contained in:
Hawking 2023-05-17 15:18:56 +08:00
parent 40e5098a7e
commit d00aaea21c
8 changed files with 22 additions and 18 deletions

View File

@ -83,7 +83,7 @@ public class WorkerBankController extends BaseController {
if (!AdapayStatusEnum.succeeded.code.equals(result2.get("status"))) { if (!AdapayStatusEnum.succeeded.code.equals(result2.get("status"))) {
if ("account_exists".equals(result2.get("error_code"))) { if ("account_exists".equals(result2.get("error_code"))) {
logger.info("用户[memberId={}]结算账户已存在 跳过", memberId); logger.info("用户[memberId={}]结算账户已存在 跳过", memberId);
continue;
} else { } else {
logger.error("创建结算账户失败[{}]", JSON.toJSONString(result2)); logger.error("创建结算账户失败[{}]", JSON.toJSONString(result2));
return AjaxResult.error("个人信息与银行卡不匹配或不支持信用卡绑定"); return AjaxResult.error("个人信息与银行卡不匹配或不支持信用卡绑定");
@ -159,7 +159,7 @@ public class WorkerBankController extends BaseController {
@ResponseBody @ResponseBody
public AjaxResult getByWorkerId(@RequestBody WorkerBindBankCardRequest request) { public AjaxResult getByWorkerId(@RequestBody WorkerBindBankCardRequest request) {
try { try {
return AjaxResult.success(workerBankService.getByWorkerId(request.getWorkerId())); return AjaxResult.success(workerBankService.getByWorkerId(request.getWorkerId(), request.getDeptId()));
} catch (Exception e) { } catch (Exception e) {
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));

View File

@ -6,11 +6,8 @@ import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.core.page.TableDataInfo;
import com.ghy.common.enums.BusinessType; import com.ghy.common.enums.BusinessType;
import com.ghy.common.enums.WorkerCertifyStatus; import com.ghy.common.enums.WorkerCertifyStatus;
import com.ghy.common.enums.WorkerStatus;
import com.ghy.common.json.JSONObject;
import com.ghy.common.utils.ExceptionUtil; import com.ghy.common.utils.ExceptionUtil;
import com.ghy.common.utils.ObjectUtils; import com.ghy.common.utils.ObjectUtils;
import com.ghy.common.utils.StringUtils;
import com.ghy.common.utils.poi.ExcelUtil; import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.DeptGoodsCategory;
import com.ghy.goods.service.DeptGoodsCategoryService; import com.ghy.goods.service.DeptGoodsCategoryService;
@ -30,7 +27,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -217,7 +213,7 @@ public class WorkerCertificationController extends BaseController
@PostMapping("/changeStatus") @PostMapping("/changeStatus")
@ResponseBody @ResponseBody
public AjaxResult changeStatus(String ids,Integer status){ public AjaxResult changeStatus(String ids,Integer status, Long deptId){
try { try {
int result = workerCertificationService.changeStatus(ids, status); int result = workerCertificationService.changeStatus(ids, status);
if(result > 0){ if(result > 0){
@ -225,7 +221,7 @@ public class WorkerCertificationController extends BaseController
for (String id : idArray){ for (String id : idArray){
WorkerCertification workerCertification = workerCertificationService.selectWorkerCertificationByWorkerCertificationId(id); WorkerCertification workerCertification = workerCertificationService.selectWorkerCertificationByWorkerCertificationId(id);
// 是否绑定了银行卡 // 是否绑定了银行卡
WorkerBank workerBank = workerBankService.getByWorkerId(workerCertification.getWorkerId()); WorkerBank workerBank = workerBankService.getByWorkerId(workerCertification.getWorkerId(), deptId);
// 没有绑定了银行卡的用户 // 没有绑定了银行卡的用户
if(ObjectUtils.isEmpty(workerBank)){ if(ObjectUtils.isEmpty(workerBank)){
return AjaxResult.success("操作成功!"); return AjaxResult.success("操作成功!");

View File

@ -256,7 +256,11 @@ public class OrderMasterServiceImpl implements OrderMasterService {
// 罚金分给平台账户 // 罚金分给平台账户
memberMap.merge("0", fineMoney, BigDecimal::add); memberMap.merge("0", fineMoney, BigDecimal::add);
memberMap.put(AdapayUtils.getWorkerMemberId(orderMaster.getWorkerId(), orderMaster.getDeptId()), bigWorkerAmt.subtract(fineMoney)); // 大师傅服务金额减去罚金后剩下的钱 如果小于等于0元 就不用分账给大师傅了
BigDecimal bigWorkerAmtSubtractFine = bigWorkerAmt.subtract(fineMoney);
if (BigDecimal.ZERO.compareTo(bigWorkerAmtSubtractFine) < 0) {
memberMap.put(AdapayUtils.getWorkerMemberId(orderMaster.getWorkerId(), orderMaster.getDeptId()), bigWorkerAmtSubtractFine);
}
confirmAmt = confirmAmt.add(bigWorkerAmt); confirmAmt = confirmAmt.add(bigWorkerAmt);
// 分账账户 // 分账账户

View File

@ -21,9 +21,10 @@ public interface WorkerBankMapper {
/** /**
* @param workerId 师傅id * @param workerId 师傅id
* @param deptId 公司ID
* @return 师傅银行卡对象 * @return 师傅银行卡对象
*/ */
WorkerBank getByWorkerId(Long workerId); WorkerBank getByWorkerId(@Param("workerId") Long workerId, @Param("deptId") Long deptId);
/** /**
* @param ids 师傅ids * @param ids 师傅ids

View File

@ -8,6 +8,8 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class WorkerBindBankCardRequest { public class WorkerBindBankCardRequest {
private Long deptId;
/** /**
* 师傅ID * 师傅ID
*/ */

View File

@ -20,9 +20,10 @@ public interface WorkerBankService {
/** /**
* @param workerId 师傅id * @param workerId 师傅id
* @param deptId 公司ID
* @return 师傅银行卡对象 * @return 师傅银行卡对象
*/ */
WorkerBank getByWorkerId(Long workerId); WorkerBank getByWorkerId(Long workerId, Long deptId);
WorkerBank getByMemberId(String memberId); WorkerBank getByMemberId(String memberId);

View File

@ -27,8 +27,11 @@ public class WorkerBankServiceImpl implements WorkerBankService {
} }
@Override @Override
public WorkerBank getByWorkerId(Long workerId) { public WorkerBank getByWorkerId(Long workerId, Long deptId) {
return workerBankMapper.getByWorkerId(workerId); if (workerId == null || deptId == null) {
return null;
}
return workerBankMapper.getByWorkerId(workerId, deptId);
} }
@Override @Override

View File

@ -66,11 +66,8 @@
<select id="getByWorkerId" parameterType="Long" resultMap="WorkerBankResult"> <select id="getByWorkerId" parameterType="Long" resultMap="WorkerBankResult">
SELECT * SELECT *
FROM worker_bank FROM worker_bank
<where> WHERE worker_id = #{workerId}
<if test="workerId != null and workerId != 0"> AND dept_id = #{deptId}
and worker_id = #{workerId}
</if>
</where>
</select> </select>
<select id="getByMemberId" parameterType="String" resultMap="WorkerBankResult"> <select id="getByMemberId" parameterType="String" resultMap="WorkerBankResult">