fix:公司审核流程及解绑
This commit is contained in:
parent
8c11459e9c
commit
93e47c4233
@ -71,4 +71,7 @@ public class WechatUser extends BaseEntity implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bindtime;
|
||||
|
||||
@Schema(description = "审核失败原因")
|
||||
private String reason;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class WechatUserController {
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "pc-微信用户-关联公司")
|
||||
@Operation(summary = "pc-微信用户-绑定关联公司")
|
||||
@PostMapping("/companyrelation")
|
||||
public Result<Integer> companyRelation(String wuid, String pcode, String pname) {
|
||||
return wechatUserService.companyRelation(wuid, pcode, pname);
|
||||
@ -50,8 +50,14 @@ public class WechatUserController {
|
||||
|
||||
@Operation(summary = "处理待审核数据")
|
||||
@PostMapping("/alterState")
|
||||
public Result<Integer> alterState(String wuid, String state) {
|
||||
return wechatUserService.alterState(wuid, state);
|
||||
public Result<Integer> alterState(String wuid, String state, String reason) {
|
||||
return wechatUserService.alterState(wuid, state,reason);
|
||||
}
|
||||
|
||||
@Operation(summary = "pc-微信用户-解绑关联公司")
|
||||
@PostMapping("/companyunbind")
|
||||
public Result<Integer> companyunbind(String wuid, String pcode) {
|
||||
return wechatUserService.companyunbind(wuid, pcode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,4 +33,9 @@ public class PageListWechatUserRequest extends BasePageRequest {
|
||||
@Schema(description = "父账户编码")
|
||||
private String pcode;
|
||||
|
||||
@Schema(description = "父账户名称")
|
||||
private String pname;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String state;
|
||||
}
|
||||
|
||||
@ -17,5 +17,7 @@ public interface WechatUserService {
|
||||
|
||||
public WechatUser selectUcode(String phone, String uname);
|
||||
|
||||
public Result<Integer> alterState(String wuid, String state);
|
||||
public Result<Integer> alterState(String wuid, String state,String reason);
|
||||
|
||||
public Result<Integer> companyunbind(String wuid, String pcode);
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@ -38,7 +39,11 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
.eq(plwur.getType() != null, "type", plwur.getType())
|
||||
.eq(StringUtils.hasText(plwur.getNickName()), "nick_name", plwur.getNickName())
|
||||
.eq(StringUtils.hasText(plwur.getName()), "name", plwur.getName())
|
||||
|
||||
.like(StringUtils.hasText(plwur.getPname()), "pname", plwur.getPname())
|
||||
.eq(StringUtils.hasText(plwur.getPcode()), "pcode", plwur.getPcode())
|
||||
|
||||
.eq(StringUtils.hasText(plwur.getState()), "state", plwur.getState())
|
||||
.orderByDesc("pk_id"));
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<WechatUser>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
@ -63,13 +68,14 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> alterState(String wuid, String state) {
|
||||
public Result<Integer> alterState(String wuid, String state, String reason) {
|
||||
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));
|
||||
user.setReason(reason);
|
||||
|
||||
Date currentDate = new Date();
|
||||
// 创建一个SimpleDateFormat对象,并设置格式
|
||||
@ -102,6 +108,7 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
WechatUser user = new WechatUser();
|
||||
user.setPcode(pcode);
|
||||
user.setPname(pname);
|
||||
user.setState(2);
|
||||
int n = wechatUserDao.update(user, new QueryWrapper<WechatUser>().eq("wuid", wuid));
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
@ -118,5 +125,26 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
.eq("name", uname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> companyunbind(String wuid, String pcode) {
|
||||
if (!(StringUtils.hasText(pcode))) {
|
||||
return new Result<Integer>().error(CodeMsg.PARAM_IS_NULL);
|
||||
}
|
||||
|
||||
// 这种方式实际上是通过UpdateWrapper来构建更新条件,然后执行更新操作
|
||||
UpdateWrapper<WechatUser> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.set("state", null) // 将name字段设置为null
|
||||
.set("pcode", null).set("pname", null)
|
||||
.eq("wuid", wuid); // 根据id来更新
|
||||
|
||||
int n = wechatUserDao.update(null, updateWrapper); // 注意这里的第一个参数是null,因为没有指定更新的实体属性值,因为我们只想设置某些字段为null
|
||||
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
|
||||
return new Result<Integer>().error("解绑公司信息出错!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user