张天森
2022-10-18 15162727d8be8c25491722e70a422f6a3f1563fb
三说会堂事件操作权限处理
6个文件已修改
1个文件已添加
164 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/IndexApi.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/ComSanshuoExpert.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComSanShuoExpertService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/util/ExcelListener.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/IndexApi.java
@@ -15,10 +15,7 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -35,6 +32,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.multipart.MultipartFile;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -89,4 +87,5 @@
    public R communityList(){
        return userService.communityList(this.getLoginUserInfo().getAccount(),this.getUserId());
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java
@@ -1,6 +1,7 @@
package com.panzhihua.service_community.api;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoExpertDTO;
@@ -8,18 +9,22 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.ExcelUtils;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.service_community.entity.ComEvent;
import com.panzhihua.service_community.entity.ComSanshuoExpert;
import com.panzhihua.service_community.service.ComSanShuoExpertService;
import com.panzhihua.service_community.service.IComEventService;
import com.panzhihua.service_community.util.ExcelListener;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.xml.crypto.Data;
import java.io.IOException;
import java.util.Date;
import java.util.List;
@@ -159,7 +164,13 @@
     * 导入专家信息
     * */
    @PostMapping("/importExpert")
    public R importExpert(){
    public R importExpert(MultipartFile multipartFile){
        try {
            ExcelListener listener=new ExcelListener(comSanShuoExpertService);
            EasyExcel.read(multipartFile.getInputStream(),ComSanshuoExpert.class,listener).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return R.ok();
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/ComSanshuoExpert.java
@@ -1,5 +1,6 @@
package com.panzhihua.service_community.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -28,26 +29,31 @@
    /**
     * 专家级别(1三说会堂2行业分中心3街道4社区)
     */
    @ExcelProperty("level")
    private Integer level;
    /**
     * 所属社区id
     */
    @ExcelProperty("communityId")
    private Long communityId;
    /**
     * 工作时间
     */
    @ExcelProperty("workTime")
    private String workTime;
    /**
     * 擅长解决时间类型
     */
    @ExcelProperty("goodAt")
    private String goodAt;
    /**
     * 姓名
     */
    @ExcelProperty("name")
    private String name;
    /**
@@ -58,6 +64,7 @@
    /**
     * 手机号
     */
    @ExcelProperty("phone")
    private String phone;
    /**
@@ -121,6 +128,7 @@
    private Integer count;
    @TableField(exist = false)
    private BigDecimal rate;
    private Integer added;
    @TableField(exist = false)
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComSanShuoExpertService.java
@@ -45,4 +45,9 @@
     * 专家风采列表
     * */
    R expertShowList(Integer level, Long id);
    /**
     * Excel添加专家
     * */
    void insertExpert(ComSanshuoExpert comSanshuoExpert);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java
@@ -4,6 +4,7 @@
import cn.hutool.core.util.NumberUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -21,12 +22,14 @@
import com.panzhihua.service_community.entity.ComEvent;
import com.panzhihua.service_community.entity.ComSanshuoEvent;
import com.panzhihua.service_community.entity.ComSanshuoExpert;
import com.panzhihua.service_community.entity.ComSanshuoIndustryCenter;
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.model.dos.ComStreetDO;
import com.panzhihua.service_community.service.ComActService;
import com.panzhihua.service_community.service.ComSanShuoExpertService;
import com.panzhihua.service_community.service.ComStreetService;
import com.panzhihua.service_community.util.MyAESUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +43,7 @@
import static java.util.Objects.nonNull;
@Service
@Slf4j
public class ComSanShuoExpertServiceImpl  extends ServiceImpl<ComSanshuoExpertDao, ComSanshuoExpert> implements ComSanShuoExpertService {
    @Resource
@@ -247,7 +251,7 @@
                ExpertRangeVO vo=new ExpertRangeVO();
                vo.setLevel(2);
                vo.setName("行业分中心");
                vo.setId(loginUserInfo.getCommunityId());
                vo.setId(comSanshuoIndustryCenterDao.selectOne(new QueryWrapper<ComSanshuoIndustryCenter>().lambda().eq(ComSanshuoIndustryCenter::getAccount, loginUserInfo.getAccount())).getId());
                list.add(vo);
                return R.ok(list);
            }else if (nonNull(loginUserInfo.getUserType())){
@@ -344,5 +348,54 @@
        return R.ok(comSanshuoExperts);
    }
    @Override
    public void insertExpert(ComSanshuoExpert expert) {
//            if (nonNull(comSanshuoExpertDTO.getUnit())){
//                String id = comSanshuoExpertDTO.getUnit();
//                String[] split = id.split(",");
//                expert.setUnitId(split[split.length-1]);
//            }
            expert.setId(Snowflake.getId());
            expert.setCreateTime(new Date());
            if (expert.getLevel()==2){
                expert.setIndustryCenterId(Long.parseLong(expert.getUnitId()));
                expert.setUnit(comSanshuoIndustryCenterDao.selectById(expert.getUnitId()).getName()+"调解站");
            }else if(expert.getLevel()==3){
                expert.setStreetId(Long.parseLong(expert.getUnitId()));
                expert.setUnit(comStreetDAO.selectById(expert.getUnitId()).getName()+"调解站");
            }else if(expert.getLevel()==4){
                expert.setCommunityId(Long.parseLong(expert.getUnitId()));
                expert.setUnit(comActDAO.selectById(expert.getUnitId()).getName()+"调解站");
            }
            expert.setStatus(1);
            expert.setDelFlag(1);
            expert.setCreateBy("admin");
            expert.setCreateTime(new Date());
            expert.setAdded(0);
            expert.setPassword("Huacheng@123");
            expert.setAccount(PinyinUtil.getPinyin(expert.getName(),""));
            int insert = comSanshuoExpertDao.insert(expert);
            if (insert>0){
                log.info(expert.getName()+"添加完成");
            }
//            if (insert>0){
//                try {
//                    comSanshuoExpertDTO.setPassword(comSanshuoExpertDTO.getPassword());
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//                //生成后台账号
//                AdministratorsUserVO user=new AdministratorsUserVO();
//                user.setUserId(Snowflake.getId());
//                user.setAccount(comSanshuoExpertDTO.getAccount());
//                user.setPassword(comSanshuoExpertDTO.getPassword());
//                user.setName(comSanshuoExpertDTO.getName());
//                user.setType(11);
//                user.setImageUrl(comSanshuoExpertDTO.getAvatar());
//                user.setPhone(comSanshuoExpertDTO.getPhone());
//                userService.sanShuoAddUser(user);
//            }
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/util/ExcelListener.java
New file
@@ -0,0 +1,54 @@
package com.panzhihua.service_community.util;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.CellExtra;
import com.alibaba.excel.read.listener.ReadListener;
import com.panzhihua.service_community.entity.ComSanshuoExpert;
import com.panzhihua.service_community.service.ComSanShuoExpertService;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
@Slf4j
public class ExcelListener implements ReadListener<ComSanshuoExpert> {
    private ComSanShuoExpertService comSanShuoExpertService;
    /**
     * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来
     */
    public ExcelListener (ComSanShuoExpertService comSanShuoExpertService){
        this.comSanShuoExpertService=comSanShuoExpertService;
    }
    @Override
    public void onException(Exception e, AnalysisContext analysisContext) throws Exception {
    }
    @Override
    public void invokeHead(Map<Integer, CellData> map, AnalysisContext analysisContext) {
    }
    @Override
    public void invoke(ComSanshuoExpert comSanshuoExpert, AnalysisContext analysisContext) {
        log.info("插入一条数据"+comSanshuoExpert);
        comSanShuoExpertService.insertExpert(comSanshuoExpert);
    }
    @Override
    public void extra(CellExtra cellExtra, AnalysisContext analysisContext) {
    }
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
    }
    @Override
    public boolean hasNext(AnalysisContext analysisContext) {
        return false;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml
@@ -237,7 +237,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -262,7 +262,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -286,7 +286,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -310,7 +310,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -334,7 +334,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -358,7 +358,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -381,7 +381,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -405,7 +405,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -430,7 +430,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -456,7 +456,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
@@ -482,7 +482,7 @@
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type=2 OR current_process_type=5
            AND current_process_type in(2,5)
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>