@@ -1,7 +1,6 @@ | |||
package cn.com.taiji.core.entity.user; | |||
import cn.com.taiji.common.entity.StringPropertyUUIDEntity; | |||
import cn.com.taiji.core.entity.dict.basic.IdType; | |||
import cn.com.taiji.core.entity.dict.user.CensorStatus; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
@@ -36,6 +35,8 @@ public class ChangeMobileCensor extends StringPropertyUUIDEntity { | |||
private String staffOpenId;//审核员工号 | |||
@Column(name = "STAFF_NAME") | |||
private String staffName;//审核员工名称 | |||
@Column(name = "REMARK") | |||
private String remark;//审核描述 | |||
@Column(name = "INSERT_TIME") | |||
private LocalDateTime insertTime = LocalDateTime.now(); | |||
@Column(name = "UPDATE_TIME") |
@@ -37,7 +37,7 @@ public class ChangeMobileCensorRequest extends JpaDateTimePageableDataRequest<Ch | |||
@Override | |||
public HqlBuilder toSelectHql(){ | |||
HqlBuilder hql = new HqlBuilder("from ChangeMobileCensor where 1=1 "); | |||
hql.append(" and newMobile like :newMobile", leftLike(newMobile)); | |||
hql.append(" and newMobile like :newMobile", like(newMobile)); | |||
hql.append(" and censorStatus = :censorStatus", censorStatus); | |||
hql.append(" and insertTime >= :startTime", startTime); | |||
hql.append(" and insertTime <= :endTime", endTime); |
@@ -28,11 +28,11 @@ public class UploadDeptRequestDTO extends AbstractStaffBizRequestDTO { | |||
private String id; | |||
@ApiModelProperty(value = "退费类型,PROVINCE_REFUND_TYPE") | |||
@NotBlank(message = "退费类型不能为空") | |||
@NotNull(message = "退费类型不能为空") | |||
private Integer refundType; | |||
@ApiModelProperty(value = "审核意见") | |||
@NotNull(message = "审核意见不能为空") | |||
@NotBlank(message = "审核意见不能为空") | |||
private String checkRemark; | |||
@ApiModelProperty(value = "实际退费金额") |
@@ -125,4 +125,12 @@ public class StaffController extends MyValidController { | |||
manager.changePassword(dto); | |||
return ApiResponse.success().setMessage("修改密码成功,请重新登录!"); | |||
} | |||
@ApiOperation(value = "员工账号下黑") | |||
@PostMapping(value = "/black") | |||
public ApiResponse<String> black(@RequestBody StaffBlackRequestDTO reqDto) throws ManagerException { | |||
String staffId = manager.black(reqDto); | |||
return ApiResponse.of(staffId).setMessage("状态变更成功"); | |||
} | |||
} |
@@ -16,7 +16,10 @@ public class ChangeMobileCensorRequestDTO extends AbstractStaffBizRequestDTO { | |||
@NotBlank(message = "id不能为空") | |||
private String id; | |||
@NotNull(message = "审核状态") | |||
@NotNull(message = "审核状态不能为空") | |||
private CensorStatus censorStatus; | |||
@NotBlank(message = "审核描述不能为空") | |||
private String remark; | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.userw.dto.system; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class StaffBlackRequestDTO extends AbstractBizRequestDTO { | |||
@NotBlank(message = "id不能为空") | |||
private String id;// 员工id | |||
@NotNull(message = "员工状态不能为空,1-启用,2-停用(下黑也传2)") | |||
private Integer status;// 员工状态 | |||
@NotBlank(message = "变更原因不能为空") | |||
private String remark;// 变更原因 | |||
} |
@@ -55,10 +55,14 @@ public class ChangeMobileCensorManagerImpl extends AbstractUserwManager implemen | |||
mobileCensor.setStaffName(staff.getStaffName()); | |||
LocalDateTime now = LocalDateTime.now(); | |||
mobileCensor.setCensorStatus(dto.getCensorStatus()); | |||
mobileCensor.setRemark(dto.getRemark()); | |||
mobileCensor.setUpdateTime(now); | |||
repo.merge(mobileCensor); | |||
if (CensorStatus.SUCCESS.equals(mobileCensor.getCensorStatus())) { | |||
AccountInfo accountInfo = accountInfoRepo.findByIdNumAndIdType(mobileCensor.getIdNum(), IdType.findByCode(mobileCensor.getIdType())); | |||
if (accountInfo == null){ | |||
throw new ManagerException("未获取到申请人的账号信息"); | |||
} | |||
accountInfo.setUpdateTime(now); | |||
accountInfo.setMobile(mobileCensor.getNewMobile()); | |||
accountInfoRepo.merge(accountInfo); |
@@ -91,4 +91,6 @@ public interface StaffManager { | |||
StaffListResponseDTO staffList(StaffListRequestDTO dto); | |||
void changePassword(ChangePasswordRequestDTO dto) throws ManagerException; | |||
String black(StaffBlackRequestDTO reqDto) throws ManagerException; | |||
} |
@@ -40,6 +40,7 @@ import com.alibaba.excel.EasyExcel; | |||
import com.google.common.collect.Lists; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.util.StringUtils; | |||
import java.io.*; | |||
@@ -215,6 +216,41 @@ public class StaffManagerImpl extends AbstractUserwManager implements StaffManag | |||
return staff.getId(); | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public String black(StaffBlackRequestDTO dto) throws ManagerException { | |||
String openId = findOpenIdByToken(dto.getAccessToken()); | |||
//不允许查询普通用户专属用员工(对前端无感) | |||
if (commonStaffId.equals(dto.getId())) { | |||
throw new ManagerException("该员工不存在"); | |||
} | |||
Staff staff = staffRepo.findById(dto.getId()).orElse(null); | |||
if (staff == null) { | |||
throw new ManagerException("员工不存在!"); | |||
} | |||
//状态一样则忽略本次操作 | |||
if (staff.getStatus().equals(dto.getStatus())) { | |||
return staff.getId(); | |||
} | |||
StaffStatus staffStatus = StaffStatus.findByCode(dto.getStatus()); | |||
if (staffStatus == null) { | |||
throw new ManagerException("该员工状态不存在,请传入有效值"); | |||
} | |||
staff.setStatus(dto.getStatus()); | |||
staff.setUpdateTime(LocalDateTime.now()); | |||
staff.setUpdateOpenId(openId); | |||
staffRepo.save(staff); | |||
//创建员工黑名单 | |||
createStaffBlack(staff); | |||
//删除openId缓存 | |||
deleteTokenByOpenId(staff.getOpenId()); | |||
saveStaffChangeLog(staff.getStaffId(), dto.getRemark(), openId, StaffChangeType.STATUS); | |||
return staff.getId(); | |||
} | |||
private void createStaffBlack(Staff staff) { | |||
} | |||
@Override | |||
public Pagination changeLogPage(StaffChangeLogPageRequestDTO dto) { |