fix:微信用户绑定公司审核流程

This commit is contained in:
lhb 2025-04-21 17:29:16 +08:00
parent 77d09ea71c
commit 8c11459e9c
7 changed files with 55 additions and 9 deletions

View File

@ -1,8 +1,6 @@
package com.evotech.hd.common.core.entity.wechat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.evotech.hd.common.core.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -68,4 +66,9 @@ public class WechatUser extends BaseEntity implements Serializable {
@Schema(description = "审核状态1-待审核2-审核成功3-审核失败")
private Integer state;
@Schema(description = "审核通过时间(即绑定公司时间)")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date bindtime;
}

View File

@ -76,6 +76,8 @@ public class CompanyServiceImpl implements CompanyService {
Map<String, String> m = new HashMap<String, String>();
m.put("ccode", one.getCcode());
m.put("cname", one.getCname());
m.put("address", one.getAddress());
m.put("phone", one.getPhone());
return new Result<Map<String, String>>().success(m);
}

View File

@ -1,5 +1,9 @@
package com.evotech.hd.cloud.service.impl;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;
@ -63,8 +67,25 @@ public class WechatUserServiceImpl implements WechatUserService {
if (!(StringUtils.hasText(wuid) || StringUtils.hasText(state))) {
return new Result<Integer>().error(CodeMsg.PARAM_IS_NULL);
}
WechatUser user = new WechatUser();
user.setState(Integer.valueOf(state));
Date currentDate = new Date();
// 创建一个SimpleDateFormat对象并设置格式
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 格式化Date对象
String formattedDate = formatter.format(currentDate);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = dateFormat.parse(formattedDate);
user.setBindtime(date);
} catch (ParseException e) {
e.printStackTrace();
}
int n = wechatUserDao.update(user, new QueryWrapper<WechatUser>().eq("wuid", wuid));
if (n == 1) {
return new Result<Integer>().success(n);

View File

@ -2,7 +2,11 @@ package com.evotech.hd.wechat.controller;
import java.util.List;
import com.evotech.hd.common.core.entity.cloud.Company;
import com.evotech.hd.wechat.service.rpc.CloudService;
import jakarta.validation.Valid;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -29,6 +33,8 @@ public class WechatUserController {
@Resource
private WechatUserService wechatUserService;
@Resource
private CloudService cloudService;
@Operation(summary = "修改")
@ -49,9 +55,10 @@ public class WechatUserController {
@Operation(summary = "小程序端-绑定公司")
@PostMapping("/bindcompany")
@ApiOperationSupport(order = 3)
public Result<Integer> bindCompany(String wuid, String code, String name) {
return wechatUserService.bindCompany(wuid, code, name);
public Result<Integer> bindCompany(String wuid, String pcode, String pname) {
return wechatUserService.bindCompany(wuid, pcode, pname);
}
@Operation(summary = "开通钱包账户")
@PostMapping("/wallet/open")
@ -82,4 +89,12 @@ public class WechatUserController {
return wechatUserService.isOpenAccount(wuid,request);
}
@Operation(summary = "小程序端-查询公司列表")
@GetMapping("/companylist")
@ApiOperationSupport(order = 8)
public Result<List<Company>> companylist( @ParameterObject BasePageRequest bpr) {
return cloudService.companylist(bpr);
}
}

View File

@ -16,7 +16,7 @@ public interface WechatUserService {
public Result<WechatUser> userByUid(String wuid);
public Result<Integer> bindCompany(String wuid, String code, String name);
public Result<Integer> bindCompany(String wuid, String pcode, String pname);
public Result<Integer> openWallet(String wuid, HttpServletRequest request);

View File

@ -65,11 +65,11 @@ public class WechatUserServiceImpl implements WechatUserService {
}
@Override
public Result<Integer> bindCompany(String wuid, String code, String name) {
public Result<Integer> bindCompany(String wuid, String pcode, String pname) {
WechatUser user = new WechatUser();
user.setType(2);
user.setPcode(code);
user.setPname(name);
user.setPcode(pcode);
user.setPname(pname);
user.setState(1);//用户刚刚申请的时候待审核状态
int n = wechatUserDao.update(user, new QueryWrapper<WechatUser>().eq("wuid", wuid));
if (n == 1) {

View File

@ -1,5 +1,6 @@
package com.evotech.hd.wechat.service.rpc;
import com.evotech.hd.common.core.entity.BasePageRequest;
import com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.cloud.*;
import com.evotech.hd.common.core.entity.cloud.request.BatterySwapResponse;
@ -96,4 +97,8 @@ public interface CloudService {
@PostMapping(value = "/wallet/updateName", consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
public Result<WechatPayAttach> updateName(@NotBlank WalletAccount wa);
@GetMapping(value = "/company/list",
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
public Result<List<Company>> companylist(@RequestParam BasePageRequest bpr);
}