cjl
2023-11-10 0920f23406e52e4c7149515797a317c836c9e065
Merge remote-tracking branch 'origin/dev' into cjl
1 files added
5 files modified
98 ■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/AppAllocationController.java 3 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAuthority.java 13 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/AllocationService.java 13 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java 56 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/UserServiceImpl.java 11 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/vo/WxMssVo.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/AppAllocationController.java
@@ -6,6 +6,7 @@
import com.moral.api.pojo.query.app.AppAllocationFileCond;
import com.moral.api.pojo.query.app.AppAllocationPageCond;
import com.moral.api.pojo.vo.app.AppAllocationFindVo;
import com.moral.api.pojo.vo.app.AppAuthority;
import com.moral.constant.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -93,7 +94,7 @@
    @ApiOperation(value = "分享权限")
    public  ResultMessage  authority(@RequestParam @ApiParam(value = "allocationNum",name = "单号") String allocationNum,
                                     @RequestParam @ApiParam(value = "userId",name = "用户Id") Integer userId){
        boolean authority = allocationService.authority(allocationNum,userId);
        AppAuthority authority = allocationService.authority(allocationNum, userId);
        return ResultMessage.ok(authority);
    }
screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAuthority.java
New file
@@ -0,0 +1,13 @@
package com.moral.api.pojo.vo.app;
import lombok.Data;
@Data
public class AppAuthority {
    //权限标识
    private  Integer code;
    //状态名字
    private  String  name;
}
screen-api/src/main/java/com/moral/api/service/AllocationService.java
@@ -12,13 +12,11 @@
import com.moral.api.pojo.ext.allocation.AllocationListExt;
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.query.allocation.*;
import com.moral.api.pojo.dto.allocation.AllocationUnitDto;
import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond;
import com.moral.api.pojo.query.app.AppAllocationFileCond;
import com.moral.api.pojo.query.app.AppAllocationPageCond;
import com.moral.api.pojo.vo.allocation.AllocationFindVo;
import com.moral.api.pojo.vo.allocation.AllocationPageVo;
import com.moral.api.pojo.vo.app.AppAllocationFindVo;
import com.moral.api.pojo.vo.app.AppAuthority;
public interface AllocationService extends IService<Allocation> {
@@ -133,8 +131,13 @@
     */
    void checkSmallRoutine(AllocationCheckCond checkCond);
    boolean authority(String allocationNum,Integer userId);
    /**
     * 分享权限 1 可以看可以写  2.可以看不能写 3.都不能
     * @param allocationNum
     * @param userId
     * @return
     */
    AppAuthority authority(String allocationNum, Integer userId);
}
screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java
@@ -25,6 +25,7 @@
import com.moral.api.pojo.query.app.AppAllocationPageCond;
import com.moral.api.pojo.vo.allocation.AllocationFindVo;
import com.moral.api.pojo.vo.app.AppAllocationFindVo;
import com.moral.api.pojo.vo.app.AppAuthority;
import com.moral.api.pojo.vo.user.QxUser;
import com.moral.api.service.*;
import com.moral.constant.Constants;
@@ -845,30 +846,61 @@
    }
    @Override
    public boolean authority(String allocationNum,Integer userId) {
    public AppAuthority authority(String allocationNum,Integer userId) {
        //返回数据
        AppAuthority appAuthority = new AppAuthority();
        //获取用户信息
        QxUser user = UserHelper.getCurrentUser();
        List<Integer> userList = responsibilityUnitMapper.selectCodeList(SysDictTypeEnum.SYS_JBD.getValue(),user.getUserId());
        if(CollectionUtils.isNotEmpty(userList)){
            return true;
        }
        if(Objects.nonNull(user.getUnitId())&&user.getUnitId()!=0){
        //获取交办单信息
            LambdaQueryWrapper<Allocation> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(Allocation::getAllocationNum,allocationNum);
            wrapper.eq(Allocation::getIsDel,0);
            wrapper.eq(Allocation::getIsInvalid,0);
            Allocation allocation = allocationMapper.selectOne(wrapper);
            if (allocation.getUnitId().equals(user.getUnitId())){
                return true;
        List<Integer> userList = responsibilityUnitMapper.selectCodeList(SysDictTypeEnum.SYS_JBD.getValue(),user.getUserId());
        if(CollectionUtils.isNotEmpty(userList)){
            //可以看,可以填
            appAuthority.setCode(1);
            appAuthority.setName(AppAllocationStateEnum.COMPLETED.name);
            return appAuthority;
            }
        if(Objects.nonNull(user.getUnitId())&&user.getUnitId()!=0){
            String code = responsibilityUnitMapper.selectAreaCode(user.getUnitId());
            if (code.length() > 6) {
                return false;
            if (code.length() > 6 && allocation.getUnitId().equals(user.getUnitId())) {
                if (allocation.getState().equals(AllocationApproveEnum.UNDER_RECTIFICATION.value)){
                    appAuthority.setCode(1);
                    appAuthority.setName(AppAllocationStateEnum.TO_BE_PROCESSED.name);
                    return appAuthority;
                }else if (allocation.getState().equals(AllocationApproveEnum.IN_APPROVAL.value)){
                    appAuthority.setCode(2);
                    appAuthority.setName(AppAllocationStateEnum.TO_BE_COMPLETED.name);
                    return appAuthority;
            } else {
                return true;
                    appAuthority.setCode(1);
                    appAuthority.setName(AppAllocationStateEnum.COMPLETED.name);
                    return appAuthority;
                }
            } else if (code.length() <= 6){
                if (allocation.getState().equals(AllocationApproveEnum.IN_APPROVAL.value)){
                    appAuthority.setCode(1);
                    appAuthority.setName(AppAllocationStateEnum.TO_BE_PROCESSED.name);
                    return appAuthority;
                }else if (allocation.getState().equals(AllocationApproveEnum.UNDER_RECTIFICATION.value)){
                    appAuthority.setCode(2);
                    appAuthority.setName(AppAllocationStateEnum.TO_BE_COMPLETED.name);
                    return appAuthority;
                }else {
                    appAuthority.setCode(1);
                    appAuthority.setName(AppAllocationStateEnum.COMPLETED.name);
                    return appAuthority;
            }
        }
        return false;
        }
        //不能看,不能填
        appAuthority.setCode(3);
        appAuthority.setName("没有权限");
        return appAuthority;
    }
    @Override
screen-api/src/main/java/com/moral/api/service/impl/UserServiceImpl.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.api.config.Interceptor.UserHelper;
import com.moral.api.entity.*;
import com.moral.api.mapper.*;
import com.moral.api.pojo.bo.UserBO;
@@ -17,6 +18,7 @@
import com.moral.api.pojo.enums.SysDictTypeEnum;
import com.moral.api.pojo.vo.file.FileVo;
import com.moral.api.pojo.vo.user.QxUser;
import com.moral.api.service.FileTableService;
import com.moral.api.service.ResponsibilityUnitService;
import com.moral.api.service.UserService;
@@ -247,7 +249,7 @@
    @Override
    @Async
    public void pushOneUser(Allocation appAllocationPushUserCond) {
        QxUser currentUser = UserHelper.getCurrentUser();
        ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(appAllocationPushUserCond.getUnitId());
        Integer areaCode = responsibilityUnit.getAreaCode();
@@ -273,6 +275,9 @@
        String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + WechatUtils.getAccessToken();
        //发送消息
        for (User user : users) {
            if (user.getId().equals(currentUser.getUserId())){
                continue;
            }
            RestTemplate restTemplate = new RestTemplate();
            //拼接推送的模版
            WxMssVo wxMssVo = new WxMssVo();
@@ -280,7 +285,7 @@
            wxMssVo.setTemplate_id("YNqUZ1MgMvwY3G-NENVbcmIBR5dUotSdnwcz96CWrho");//订阅消息模板id
            wxMssVo.setLang("zh_CN");
            wxMssVo.setMiniprogramState("formal");
//        wxMssVo.setPage("pages/index/index");
            wxMssVo.setPage("pages/index/index");
            Map<String, Object> m = new HashMap<>();
            HashMap<String, Object> map1 = new HashMap<>();
            HashMap<String, Object> map2 = new HashMap<>();
@@ -298,7 +303,7 @@
            ResponseEntity<String> responseEntity =
                    restTemplate.postForEntity(url, wxMssVo, String.class);
            String body = responseEntity.getBody();
            log.info("信息:"+body+"账号:"+user.getUserName());
            log.info("信息:"+body+"账号:"+user.getAccount());
        }
    }
screen-api/src/main/java/com/moral/api/vo/WxMssVo.java
@@ -8,7 +8,7 @@
public class WxMssVo {
    private String touser;//用户openid
    private String template_id;//订阅消息模版id
//    private String page = "pages/index/index";//默认跳到小程序首页
    private String page = "pages/index/index";//默认跳到小程序首页
    private Object data;//推送文字
    private  String miniprogramState;
    private  String lang;