分销员
This commit is contained in:
parent
523e4237e8
commit
dbf8616495
|
@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
|
import com.sqx.modules.app.service.UserService;
|
||||||
import com.sqx.modules.bl.commission.fxy.dao.FxyApplyDao;
|
import com.sqx.modules.bl.commission.fxy.dao.FxyApplyDao;
|
||||||
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
||||||
import com.sqx.modules.bl.commission.fxy.service.FxyApplyService;
|
import com.sqx.modules.bl.commission.fxy.service.FxyApplyService;
|
||||||
import com.sqx.modules.sys.entity.SysUserEntity;
|
import com.sqx.modules.sys.entity.SysUserEntity;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -17,6 +20,9 @@ import java.util.Date;
|
||||||
@Service
|
@Service
|
||||||
public class FxyApplyServiceImpl extends ServiceImpl<FxyApplyDao, FxyApply> implements FxyApplyService {
|
public class FxyApplyServiceImpl extends ServiceImpl<FxyApplyDao, FxyApply> implements FxyApplyService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result findPage(FxyApply fxyApply){
|
public Result findPage(FxyApply fxyApply){
|
||||||
Page<FxyApply> pages=new Page<>(fxyApply.getPage(),fxyApply.getLimit());
|
Page<FxyApply> pages=new Page<>(fxyApply.getPage(),fxyApply.getLimit());
|
||||||
|
@ -45,6 +51,13 @@ public class FxyApplyServiceImpl extends ServiceImpl<FxyApplyDao, FxyApply> impl
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
fxyApply.setApproveTime(sdf.format(new Date()));
|
fxyApply.setApproveTime(sdf.format(new Date()));
|
||||||
fxyApply.setApproveUser(((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUserId());
|
fxyApply.setApproveUser(((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUserId());
|
||||||
|
UserEntity userEntity = userService.selectUserById(fxyApply.getUserId());
|
||||||
|
if(fxyApply.getStatus().equals(1)){
|
||||||
|
userEntity.setBlIsFxy(1);
|
||||||
|
}else{
|
||||||
|
userEntity.setBlIsFxy(0);
|
||||||
|
}
|
||||||
|
userService.updateById(userEntity);
|
||||||
return baseMapper.approve(fxyApply);
|
return baseMapper.approve(fxyApply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,18 @@ public class AppJjrController {
|
||||||
@GetMapping("/apply")
|
@GetMapping("/apply")
|
||||||
@ApiOperation("申请经纪人")
|
@ApiOperation("申请经纪人")
|
||||||
public Result apply(@RequestAttribute Long userId, String name, String phone, String remarks){
|
public Result apply(@RequestAttribute Long userId, String name, String phone, String remarks){
|
||||||
|
JjrApply entity = applyService.findByUserId(userId);
|
||||||
|
if(entity!=null){
|
||||||
|
if(entity.getStatus().equals(0)){
|
||||||
|
return Result.success("申请审批中");
|
||||||
|
}
|
||||||
|
if(entity.getStatus().equals(1)){
|
||||||
|
return Result.success("申请审批通过,请重新登录");
|
||||||
|
}
|
||||||
|
if(entity.getStatus().equals(2)){
|
||||||
|
return Result.success("申请审批被驳回,驳回原因如下:"+entity.getOpinion());
|
||||||
|
}
|
||||||
|
}
|
||||||
JjrApply jjrApply = new JjrApply();
|
JjrApply jjrApply = new JjrApply();
|
||||||
jjrApply.setUserId(userId);
|
jjrApply.setUserId(userId);
|
||||||
jjrApply.setName(name);
|
jjrApply.setName(name);
|
||||||
|
|
|
@ -65,12 +65,12 @@ public class JjrApplyServiceImpl extends ServiceImpl<JjrApplyDao, JjrApply> impl
|
||||||
jjrApply.setApproveTime(sdf.format(new Date()));
|
jjrApply.setApproveTime(sdf.format(new Date()));
|
||||||
jjrApply.setApproveUser(((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUserId());
|
jjrApply.setApproveUser(((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUserId());
|
||||||
UserEntity userEntity = userService.selectUserById(jjrApply.getUserId());
|
UserEntity userEntity = userService.selectUserById(jjrApply.getUserId());
|
||||||
userService.updateById(userEntity);
|
|
||||||
if(jjrApply.getStatus().equals(1)){
|
if(jjrApply.getStatus().equals(1)){
|
||||||
userEntity.setBlIsJjr(1);
|
userEntity.setBlIsJjr(1);
|
||||||
}else{
|
}else{
|
||||||
userEntity.setBlIsJjr(0);
|
userEntity.setBlIsJjr(0);
|
||||||
}
|
}
|
||||||
|
userService.updateById(userEntity);
|
||||||
baseMapper.approve(jjrApply);
|
baseMapper.approve(jjrApply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findByUserId" resultType="com.sqx.modules.bl.commission.jjr.entity.JjrApply">
|
<select id="findByUserId" resultType="com.sqx.modules.bl.commission.jjr.entity.JjrApply">
|
||||||
select a.id,a.user_id,a.name,a.phone,a.remarks,a.create_time,a.status,a.opinion
|
select a.*
|
||||||
from bl_fxy_apply a
|
from bl_fxy_apply a
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
limit 1
|
limit 1
|
||||||
|
|
Loading…
Reference in New Issue