|
@@ -2,10 +2,12 @@ package com.gree.mall.manager.logic.settle.repair;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
import com.gree.mall.manager.bean.settle.repair.DailyBankAccountVO;
|
|
|
+import com.gree.mall.manager.bean.settle.repair.cmc.BankCardInfoBean;
|
|
|
import com.gree.mall.manager.commonmapper.CommonMapper;
|
|
|
import com.gree.mall.manager.constant.Constant;
|
|
|
import com.gree.mall.manager.enums.ExamineStatusEnum;
|
|
@@ -13,15 +15,11 @@ import com.gree.mall.manager.enums.UserTypeEnum;
|
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
import com.gree.mall.manager.logic.common.SMSLogic;
|
|
|
-import com.gree.mall.manager.plus.entity.AdminWebsit;
|
|
|
-import com.gree.mall.manager.plus.entity.SettleDailyBankAccount;
|
|
|
-import com.gree.mall.manager.plus.entity.User;
|
|
|
-import com.gree.mall.manager.plus.entity.WebsitUser;
|
|
|
-import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
|
-import com.gree.mall.manager.plus.service.SettleDailyBankAccountService;
|
|
|
-import com.gree.mall.manager.plus.service.UserService;
|
|
|
-import com.gree.mall.manager.plus.service.WebsitUserService;
|
|
|
+import com.gree.mall.manager.logic.settle.repair.cmc.CmcBankLogic;
|
|
|
+import com.gree.mall.manager.plus.entity.*;
|
|
|
+import com.gree.mall.manager.plus.service.*;
|
|
|
import com.gree.mall.manager.utils.CommonUtils;
|
|
|
+import com.gree.mall.manager.utils.RedisUtil;
|
|
|
import com.gree.mall.manager.utils.excel.ExcelUtils;
|
|
|
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
@@ -30,9 +28,12 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
@@ -49,6 +50,10 @@ public class RepairSettleAccountLogic {
|
|
|
private final WebsitUserService websitUserService;
|
|
|
private final AdminWebsitService adminWebsitService;
|
|
|
private final SMSLogic smsLogic;
|
|
|
+ private final SettleDailyBankTransferRecordService settleDailyBankTransferRecordService;
|
|
|
+ private final SettleDailyBankCardBalanceService settleDailyBankCardBalanceService;
|
|
|
+ private final RedisUtil redisUtil;
|
|
|
+ private final CmcBankLogic cmcBankLogic;
|
|
|
|
|
|
public IPage<DailyBankAccountVO> page(ZfireParamBean zfireParamBean) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
@@ -256,15 +261,81 @@ public class RepairSettleAccountLogic {
|
|
|
settleDailyBankAccountService.saveBatch(importList);
|
|
|
}
|
|
|
|
|
|
- public void sendMsg(String mobile, String type) throws Exception {
|
|
|
+ public void sendMsg(String mobile, String type) throws Exception {
|
|
|
if (!Validator.isMobile(mobile)) {
|
|
|
throw new RemoteServiceException("手机号格式不正确。");
|
|
|
}
|
|
|
|
|
|
String sendType = Constant.RedisPrefix.BALANCE_SEL_MOBILE_SMS;
|
|
|
- if(type != null && type.equals("issue")){
|
|
|
+ if (type != null && type.equals("issue")) {
|
|
|
sendType = Constant.RedisPrefix.ISSUE_SAL_MOBILE_SMS;
|
|
|
}
|
|
|
smsLogic.sendSms(sendType, mobile, "BALANCE_SEL", Constant.SMS_EXPIRE);
|
|
|
}
|
|
|
+
|
|
|
+ public IPage<SettleDailyBankTransferRecord> transferList(String workerNumber, String startTime, String endTime, String batchNo, Integer pageNo, Integer pageSize) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+
|
|
|
+ return settleDailyBankTransferRecordService.lambdaQuery()
|
|
|
+ .in(CollectionUtil.isNotEmpty(adminUser.getCompanyWechatIds()), SettleDailyBankTransferRecord::getCompanyWechatId, adminUser.getCompanyWechatIds())
|
|
|
+ .between(StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime), SettleDailyBankTransferRecord::getCreateTime, startTime, endTime)
|
|
|
+ .eq(StringUtils.isNotEmpty(batchNo), SettleDailyBankTransferRecord::getIssueBatchNo, batchNo)
|
|
|
+
|
|
|
+ .orderByDesc(SettleDailyBankTransferRecord::getCreateTime)
|
|
|
+ .page(new Page<>(pageNo, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+ public IPage<SettleDailyBankCardBalance> companyAccountList(Integer pageNo, Integer pageSize) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ return settleDailyBankCardBalanceService.lambdaQuery()
|
|
|
+ .in(CollectionUtil.isNotEmpty(adminUser.getCompanyWechatIds()), SettleDailyBankCardBalance::getCompanyWechatId, adminUser.getCompanyWechatIds())
|
|
|
+ .orderByDesc(SettleDailyBankCardBalance::getCreateTime)
|
|
|
+ .page(new Page<>(pageNo, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 查询银行卡余额
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public SettleDailyBankCardBalance selBankCardBalance(Integer id ,String mobile,String code) throws Exception {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+
|
|
|
+ if (adminUser.getType() == 2) {
|
|
|
+ throw new RemoteServiceException("平台账号禁止操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ Object validMessageCode = redisUtil.get(Constant.RedisPrefix.BALANCE_SEL_MOBILE_SMS + mobile);
|
|
|
+ if(validMessageCode == null || code == null){
|
|
|
+ throw new RemoteServiceException("请先发送验证码");
|
|
|
+ }
|
|
|
+ if (!code.equals(validMessageCode.toString())){
|
|
|
+ throw new RemoteServiceException("短信验证码输入错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ SettleDailyBankCardBalance bankCardBalance = settleDailyBankCardBalanceService.getById(id);
|
|
|
+ if(bankCardBalance == null){
|
|
|
+ throw new RemoteServiceException("公司信息不存在");
|
|
|
+ }
|
|
|
+ List<BankCardInfoBean> list = new ArrayList<>();
|
|
|
+ BankCardInfoBean bankCardInfoBean = new BankCardInfoBean();
|
|
|
+ bankCardInfoBean.setAuthType("1");
|
|
|
+ bankCardInfoBean.setBankAccount(bankCardBalance.getBankCardId());
|
|
|
+ bankCardInfoBean.setBankOrgCode(bankCardBalance.getOpenBankOrgId());
|
|
|
+ list.add(bankCardInfoBean);
|
|
|
+ Map<String,Object> response = cmcBankLogic.getAccountBalance(list,bankCardBalance.getSummaryNumber());
|
|
|
+ JSONObject head = JSONObject.parseObject(response.get("head").toString());
|
|
|
+
|
|
|
+ if(head != null && head.get("resultcode").equals("SUC0000")){
|
|
|
+ Map<String,Map<String,Object>> body = (Map<String, Map<String, Object>>) response.get("body");
|
|
|
+ List<Map<String,Object>> ntqadinfz = (List<Map<String,Object>>) body.get("ntqadinfz");
|
|
|
+ bankCardBalance.setBalanceAmount(new BigDecimal(ntqadinfz.get(0).get("avlblv").toString()));
|
|
|
+ bankCardBalance.setUpdateTime(new Date());
|
|
|
+ bankCardBalance.updateById();
|
|
|
+ }else {
|
|
|
+ throw new RemoteServiceException("查询失败" + response.get("errtxt"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return bankCardBalance;
|
|
|
+ }
|
|
|
+
|
|
|
}
|