Forráskód Böngészése

健康小屋- 冻结状态处理

huangzhiyong 6 éve
szülő
commit
30e0b76354

+ 1 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/LoginController.java

@ -169,6 +169,7 @@ public class LoginController extends EnvelopRestEndpoint {
            @ApiParam(name = "userCode", value = "用户code", required = true) @RequestParam(required = true, name = "userCode") String userCode) {
        try {
            //修改用户状态  离线
            loginService.logout(request,userCode);
            return success("登出成功");
        } catch (Exception e) {
            e.printStackTrace();

+ 25 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/dfs/FastDFSController.java

@ -16,7 +16,9 @@ import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -41,6 +43,13 @@ public class FastDFSController extends EnvelopRestEndpoint {
    @Value("${img.path}")
    private String img_path;
    private final ResourceLoader resourceLoader;
    @Autowired
    public FastDFSController(ResourceLoader resourceLoader) {
        this.resourceLoader = resourceLoader;
    }
    /**
     * 文件上传 - 返回相关索引信息
     *
@ -262,5 +271,21 @@ public class FastDFSController extends EnvelopRestEndpoint {
        return path1;
    }
    /**
     * 显示单张图片
     * @return
     */
    @RequestMapping("show")
    public ResponseEntity showPhotos(String fileName){
        try {
            // 由于是读取本机的文件,file是一定要加上的, path是在application配置文件中的路径
            return ResponseEntity.ok(resourceLoader.getResource("file:" + img_path + fileName));
        } catch (Exception e) {
            return ResponseEntity.notFound().build();
        }
    }
}

+ 4 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/user/NavigationServiceEvaluationController.java

@ -52,7 +52,7 @@ public class NavigationServiceEvaluationController extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建/更新(id存在)服务评价")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.CREATE)
    public ObjEnvelop<NavigationServiceEvaluation> createNavigationServiceEvaluation(
    public Envelop createNavigationServiceEvaluation(
            @ApiParam(name = "navigationServiceEvaluation", value = "服务评价JSON结构")
            @RequestBody NavigationServiceEvaluation navigationServiceEvaluation) throws IOException {
        //判断该导航记录是否已经评价
@ -62,6 +62,9 @@ public class NavigationServiceEvaluationController extends EnvelopRestEndpoint {
            navi.setRemark(navigationServiceEvaluation.getRemark());
            navigationServiceEvaluation = navigationServiceEvaluationService.save(navi);
        } else {
            if (navigationServiceEvaluation.getFacilitieCode() == null ){
                return failed("设施编码未找到");
            }
            navigationServiceEvaluation = navigationServiceEvaluationService.save(navigationServiceEvaluation);
        }

+ 6 - 2
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/user/UserController.java

@ -104,18 +104,22 @@ public class UserController extends EnvelopRestEndpoint {
    }
    @PostMapping("/updateUserActivated")
    @ApiOperation(value = "更改用户状态")
    @ApiOperation(value = "更改用户状态(冻结用户无法修改状态)")
    public Envelop updateUserStatus(
            @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = true, name = "userId") String userId,
            @ApiParam(name = "status", value = "用户状态(0:冻结,1:在线,2:离线)", required = true) @RequestParam(required = true, name = "status") Integer status,
            @ApiParam(name = "operator", value = "操作者ID", required = true) @RequestParam(required = true, name = "operator") String operator) {
        try {
            User user = userService.findById(userId);
            if (user!=null && HouseUserContant.activated_lock.equals(user.getActivated())) {
               return failed("用户已冻结");
            }
            userService.updateStatus(userId, operator, status, null);
        } catch (ManageException e) {
            return failed(e.getMessage());
        }
        return success("冻结成功");
        return success("更改用户状态成功");
    }
    @PostMapping("/freezeUser")

+ 3 - 3
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityService.java

@ -284,7 +284,7 @@ public class FacilityService extends BaseJpaService<Facility, FacilityDao> {
    /**
     *  //TODO 临时方法
     *  //TODO 临时方法 - 不规则导入模板
     * 批量导入设施的集合
     *
     * @param facilities 设施列表
@ -337,9 +337,9 @@ public class FacilityService extends BaseJpaService<Facility, FacilityDao> {
                        relation.setServiceCode(facilityServer.getCode());
                        relation.setServiceName(facilityServer.getName());
                        relation.setServiceName(facilityServer.getName());
                        relations.add(relation);
                        facilityServerRelationDao.save(relations);
                    }
                    facilityServerRelationDao.save(relations);
//                    facilityServerRelationDao.save(relations);
                }
                corrects.add(facility);
            }

+ 14 - 8
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/user/LoginService.java

@ -161,12 +161,11 @@ public class LoginService  extends BaseJpaService {
     * 登出
     *
     * @param loginCode
     * @param password
     * @return
     * @throws Exception
     */
    @Transactional(noRollbackForClassName = "ManageException")
    public User logout(HttpServletRequest request, String loginCode, String password) throws ManageException {
    public User logout(HttpServletRequest request, String loginCode) throws ManageException {
        //判断登陆信息是否正确
        User user = userService.findByCode(loginCode);
        if (user == null) {
@ -174,16 +173,14 @@ public class LoginService  extends BaseJpaService {
            String message = "账号不存在";
            throw new ManageException(message);
        }
        if (!user.getPassword().equals(MD5.GetMD5Code(password + user.getSalt()))) {
            //保存登陆信息
            String message = "密码错误";
            throw new ManageException(message);
        }
        request.getSession().removeAttribute(LoginInfo.IS_LOGIN);
        request.getSession().removeAttribute(LoginInfo.TOKEN);
        request.getSession().removeAttribute(LoginInfo.LOGIN_NAME);
        request.getSession().removeAttribute(LoginInfo.USER_ID);
        user.setActivated(HouseUserContant.activated_offline);
        if (!HouseUserContant.activated_lock.equals(user.getActivated())){
            user.setActivated(HouseUserContant.activated_offline);
        }
        user= userService.saveOrUpdate(user, "systemLogin");
        return user;
    }
@ -346,6 +343,11 @@ public class LoginService  extends BaseJpaService {
            String message = "账号不存在";
            throw new ManageException(message);
        }
        if (HouseUserContant.activated_lock.equals(user.getActivated())) {
            throw new ManageException("该用户已被冻结!");
        }
        if (!user.getPassword().equals(MD5.GetMD5Code(password + user.getSalt()))) {
            String message = "密码错误";
            throw new ManageException(message);
@ -379,6 +381,10 @@ public class LoginService  extends BaseJpaService {
            user.setUserType(LoginInfo.USER_TYPE_PATIENT);
        }
        if (HouseUserContant.activated_lock.equals(user.getActivated())) {
            throw new ManageException("该用户已被冻结!");
        }
        // 更新身份证验证字段
        user.setRealnameAuthentication(UserConstant.AUTHORIZED);
        user.setName(name);

+ 5 - 2
svr/svr-healthy-house/src/main/resources/application.yml

@ -103,7 +103,8 @@ fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
img:
  path: /data/upload/img
---
spring:
  profiles: jwprod
@ -118,4 +119,6 @@ spring:
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
  smsUrl: http://svr-base:10020/sms_gateway/send
img:
  path: /data/upload/img