cjl
2023-10-27 e3bac98f092a10c0e897143bece3abbcc59469f2
fix:小程序提交
3 files added
13 files modified
348 ■■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/AppAllocationController.java 32 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/AppUserController.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/exception/consumer/CruiserDataConsumer.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/exception/consumer/SecondDataConsumer.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/AllocationMapper.java 4 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/enums/FileTableEnum.java 5 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/ext/allocation/AllocationPageExt.java 4 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/query/app/AppAllocationFileCond.java 31 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/query/app/AppAllocationPageCond.java 42 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java 94 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/AllocationService.java 11 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java 70 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/SpecialDeviceServiceImpl.java 5 ●●●●● 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/resources/application-qa.yml 2 ●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/AllocationMapper.xml 31 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/AppAllocationController.java
@@ -1,6 +1,16 @@
package com.moral.api.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.moral.api.pojo.enums.AllocationApproveEnum;
import com.moral.api.pojo.enums.AppAllocationStateEnum;
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.query.app.AppAllocationFileCond;
import com.moral.api.pojo.query.app.AppAllocationPageCond;
import com.moral.api.pojo.vo.allocation.AllocationPageVo;
import com.moral.api.pojo.vo.app.AppAllocationFindVo;
import com.moral.constant.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -13,6 +23,8 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.validation.Valid;
@@ -44,6 +56,26 @@
        return ResultMessage.ok(ObjectUtils.isEmpty(allocationFindVos)? "0":allocationFindVos);
    }
    @PostMapping("/page")
    @ApiOperation("小程序分页查询")
    public ResultMessage<PageResult<AppAllocationFindVo>> page(@Valid @RequestBody AppAllocationPageCond allocationPageCond){
        Page<AllocationPageExt> allocationFindVos = allocationService.pageApp(allocationPageCond);
        PageResult<AppAllocationFindVo> result = new PageResult<>(allocationFindVos);
        result.setList(AppAllocationFindVo.convert(allocationFindVos.getRecords()));
        return ResultMessage.ok(result);
    }
    public static void main(String[] args) {
        List<String> list = Arrays.asList("aaa", "bbb","aaa");
        System.out.println("num;" + Collections.frequency(list, "aaa"));
    }
    @PostMapping("appFile")
    @ApiOperation("用户头像新增or修改")
    public ResultMessage appFile(@Valid @RequestBody AppAllocationFileCond appAllocationFileCond){
        allocationService.saveFile(appAllocationFileCond);
        return ResultMessage.ok();
    }
    @PostMapping("changeRoutine")
    @ApiOperation("小程序整改")
screen-api/src/main/java/com/moral/api/controller/AppUserController.java
@@ -55,7 +55,7 @@
    }
    @GetMapping("/wx/exit")
    @ApiOperation(value = "小程序登陆")
    @ApiOperation(value = "小程序退出")
    public ResultMessage updateUserId(@RequestParam @ApiParam(value = "userId",name = "用户主键") Integer userId) {
        userService.updateUserId(userId);
        return ResultMessage.ok();
screen-api/src/main/java/com/moral/api/exception/consumer/CruiserDataConsumer.java
@@ -34,7 +34,7 @@
@Component
/*@Component*/
@Slf4j
public class CruiserDataConsumer  implements ConsumerSeekAware {
screen-api/src/main/java/com/moral/api/exception/consumer/SecondDataConsumer.java
@@ -35,7 +35,7 @@
@Component
/*@Component*/
@Slf4j
public class SecondDataConsumer implements ConsumerSeekAware {
screen-api/src/main/java/com/moral/api/mapper/AllocationMapper.java
@@ -8,6 +8,7 @@
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.query.allocation.AllocationListCond;
import com.moral.api.pojo.query.allocation.AllocationPageCond;
import com.moral.api.pojo.query.app.AppAllocationPageCond;
import com.moral.api.pojo.vo.allocation.AllocationFindVo;
import org.apache.ibatis.annotations.Param;
@@ -25,6 +26,9 @@
    Page<AllocationPageExt> extPage(Page page, @Param("allocation") AllocationPageCond allocationPageCond);
    Page<AllocationPageExt> extAppPage(Page page, @Param("allocation") AppAllocationPageCond allocationPageCond);
    /**
     * 查询列表详情
     * @param allocationListCond
screen-api/src/main/java/com/moral/api/pojo/enums/FileTableEnum.java
@@ -37,6 +37,11 @@
     */
    ALLOCATION_EXTENSION(1251701, "延期申请"),
    /**
     * 小程序头像
     */
    APP_ALLOCATION(1202401, "app头像"),
    ;
    @EnumValue
screen-api/src/main/java/com/moral/api/pojo/ext/allocation/AllocationPageExt.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.moral.api.entity.Allocation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@@ -23,4 +24,7 @@
    private Integer applyState;
    private Integer isApprove;
    @ApiModelProperty(value = "状态名字")
    private String stateName;
}
screen-api/src/main/java/com/moral/api/pojo/query/app/AppAllocationFileCond.java
New file
@@ -0,0 +1,31 @@
package com.moral.api.pojo.query.app;
import com.moral.api.pojo.vo.file.FileVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
 * @ClassName AppAllocationFileCond
 * @Description TODO
 * @Author @cjl
 * @Date 2023-10-26 10:48
 * @Version 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="AppAllocationFileCond - App图片插入", description="AppAllocationFileCond - App图片插入")
public class AppAllocationFileCond {
    @ApiModelProperty(value = "用户id")
    private Integer userId;
    @ApiModelProperty(value = "用户头像")
    private FileVo file;
}
screen-api/src/main/java/com/moral/api/pojo/query/app/AppAllocationPageCond.java
New file
@@ -0,0 +1,42 @@
package com.moral.api.pojo.query.app;
import com.moral.api.pojo.query.PageCond;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
 * @ClassName AppAllocationPageCond
 * @Description TODO
 * @Author @cjl
 * @Date 2023-10-25 16:13
 * @Version 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="AppAllocation - App分页查询对象", description="AppAllocation - App分页查询对象")
public class AppAllocationPageCond {
    @ApiModelProperty(value = "状态,0全部 1代办2待处理,已完成")
    private Integer state;
    @ApiModelProperty(value = "开始时间")
    private String startTime;
    @ApiModelProperty(value = "结束时间")
    private String endTime;
    @ApiModelProperty(value = "分页参数")
    private PageCond page;
    @ApiModelProperty(value = "状态list")
    private List<Integer> stateList;
    @ApiModelProperty(value = "单位list")
    private List<Integer> unitList;
}
screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java
New file
@@ -0,0 +1,94 @@
package com.moral.api.pojo.vo.app;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.moral.api.pojo.enums.AllocationApproveEnum;
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.vo.allocation.AllocationPageVo;
import com.moral.api.utils.BeanConverts;
import com.moral.util.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @ClassName AppAllocationFindVo
 * @Description TODO
 * @Author @cjl
 * @Date 2023-10-26 10:28
 * @Version 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="AppAllocation - 查询VO对象", description="AppAllocation - 查询VO对象")
public class AppAllocationFindVo {
    @ApiModelProperty(value = "主键id")
    private Integer allocationId;
    @ApiModelProperty(value = "交办单号")
    private String allocationNum;
    @ApiModelProperty(value = "上报时间")
    @JsonFormat(pattern="yyyy-MM-dd")
    private Date escalationTime;
    @ApiModelProperty(value = "责任单位id")
    private Integer unitId;
    @ApiModelProperty(value = "污染分类id")
    private Integer polluteType;
    @ApiModelProperty(value = "整改类型id")
    private Integer changeType;
    @ApiModelProperty(value = "污染位置")
    private String pollutePosition;
    @ApiModelProperty(value = "期限天数")
    private Integer changeDay;
    @ApiModelProperty(value = "剩余天数")
    private Integer residueDay;
    @ApiModelProperty(value = "上报单位id")
    private Integer escalationUnitId;
    @ApiModelProperty(value = "上报人")
    private String escalationName;
    @ApiModelProperty(value = "排查方式id")
    private Integer investigationType;
    @ApiModelProperty(value = "状态")
    private Integer state;
    @ApiModelProperty(value = "是否作废")
    private Integer isInvalid;
    @ApiModelProperty(value = "状态名字")
    private String stateName;
    public Integer getResidueDay() {
        int day = this.changeDay;
        if(AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(state)){
            Date date = new Date();
            int days = DateUtils.getDays(escalationTime, date);
            return day-days;
        }
        return day;
    }
    public static AppAllocationFindVo convert(AllocationPageExt allocationPageExt) {
        AppAllocationFindVo allocationPageVo = BeanConverts.convert(allocationPageExt, AppAllocationFindVo.class);
        return allocationPageVo;
    }
    public static List<AppAllocationFindVo> convert(List<AllocationPageExt> allocationPageExtList) {
        return allocationPageExtList.stream().map(AppAllocationFindVo::convert).collect(Collectors.toList());
    }
}
screen-api/src/main/java/com/moral/api/service/AllocationService.java
@@ -14,8 +14,11 @@
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;
public interface AllocationService extends IService<Allocation> {
@@ -107,6 +110,14 @@
     */
    List<AllocationFindVo> selectSmallRoutine(Integer state,String startTime,String endTime);
    /**
     * 小程序分页
     * @param allocationPageCond
     * @return
     */
    Page<AllocationPageExt> pageApp(AppAllocationPageCond allocationPageCond);
    boolean saveFile(AppAllocationFileCond appAllocationFileCond);
    /**
     * 小程序整改
screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java
@@ -20,7 +20,10 @@
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.query.allocation.*;
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.app.AppAllocationFindVo;
import com.moral.api.pojo.vo.user.QxUser;
import com.moral.api.service.*;
import com.moral.constant.Constants;
@@ -687,6 +690,73 @@
        return allocationFindVos;
    }
    @Override
    public Page<AllocationPageExt> pageApp(AppAllocationPageCond allocationPageCond) {
        List<Integer> listUnit = unitResult();
        Integer integer = unitAreaCode();
        allocationPageCond.setUnitList(listUnit);
        allocationPageCond.setStateList(stateAllocationList(allocationPageCond.getState(),integer));
        Page<AllocationPageExt> extAppPage = this.baseMapper.extAppPage(allocationPageCond.getPage().convertPage(),allocationPageCond);
        extAppPage.getRecords().forEach(it->{
            Integer state = it.getState();
            if (state.equals(AllocationApproveEnum.DRAFT.value)||state.equals(AllocationApproveEnum.UNDER_RECTIFICATION.value)){
                if(integer==0||integer==1){
                    it.setStateName(AppAllocationStateEnum.TO_BE_PROCESSED.name);
                }else if(integer==2){
                    it.setStateName(AppAllocationStateEnum.TO_BE_COMPLETED.name);
                }
            }else if(state.equals(AllocationApproveEnum.IN_APPROVAL.value)){
                if(integer==2||integer==1){
                    it.setStateName(AppAllocationStateEnum.TO_BE_PROCESSED.name);
                }else if(integer==0){
                    it.setStateName(AppAllocationStateEnum.TO_BE_COMPLETED.name);
                }
            }else{
                it.setStateName(AppAllocationStateEnum.COMPLETED.name);
            }
        });
        return extAppPage;
    }
    @Override
    @Transactional
    public boolean saveFile(AppAllocationFileCond appAllocationFileCond) {
        fileTableService.upDateResult(Arrays.asList(appAllocationFileCond.getFile()),appAllocationFileCond.getUserId(), FileTableEnum.APP_ALLOCATION.value);
        return true;
    }
    private List<Integer> stateAllocationList(Integer type, Integer integer){
        List<Integer> integerList = new ArrayList<>();
        // type 0 全部 1待办 2待处理 3 已完成
        if(integer.equals(0)){
            if(type.equals(1)){
                integerList.add(AllocationApproveEnum.UNDER_RECTIFICATION.value);
                integerList.add(AllocationApproveEnum.DRAFT.value);
            }else if(type.equals(2)){
                integerList.add(AllocationApproveEnum.IN_APPROVAL.value);
            }
        }else if(integer.equals(2)){
            if(type.equals(1)){
                integerList.add(AllocationApproveEnum.IN_APPROVAL.value);
            }else if(type.equals(2)){
                integerList.add(AllocationApproveEnum.UNDER_RECTIFICATION.value);
                integerList.add(AllocationApproveEnum.DRAFT.value);
            }
        }else if(integer.equals(1)){
            if(type.equals(1)){
                integerList.add(AllocationApproveEnum.IN_APPROVAL.value);
                integerList.add(AllocationApproveEnum.UNDER_RECTIFICATION.value);
                integerList.add(AllocationApproveEnum.DRAFT.value);
            }
        }
        if(type.equals(3)){
            integerList.add(AllocationApproveEnum.PASS.value);
            integerList.add(AllocationApproveEnum.REFUSE.value);
        }
        return integerList;
    }
    /**
     * 小程序整改
     *
screen-api/src/main/java/com/moral/api/service/impl/SpecialDeviceServiceImpl.java
@@ -110,9 +110,10 @@
        orgIds.add(orgId);
        integerList.addAll(orgIds);
        QueryWrapper<SpecialDeviceHistory> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("mac", "name")
        queryWrapper.select("DISTINCT mac, name").lambda();
                //.eq("special_type", Constants.SPECIAL_DEVICE_CRUISER)
                .eq("is_delete", Constants.NOT_DELETE)
        queryWrapper.eq("is_delete", Constants.NOT_DELETE)
                .in("organization_id", integerList);
        return specialDeviceHistoryService.listMaps(queryWrapper);
    }
screen-api/src/main/java/com/moral/api/service/impl/UserServiceImpl.java
@@ -11,6 +11,9 @@
import com.moral.api.entity.*;
import com.moral.api.mapper.*;
import com.moral.api.pojo.bo.UserBO;
import com.moral.api.pojo.enums.FileTableEnum;
import com.moral.api.pojo.vo.file.FileVo;
import com.moral.api.service.FileTableService;
import com.moral.api.service.UserService;
import com.moral.api.utils.OperationLogUtils;
import com.moral.api.utils.WechatUtils;
@@ -18,6 +21,7 @@
import com.moral.constant.ResponseCodeEnum;
import com.moral.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -53,6 +57,9 @@
    @Autowired
    private UserLogMapper userLogMapper;
    @Autowired
    private FileTableService fileTableService;
    @Autowired
    private OperationLogUtils operationLogUtils;
@@ -115,6 +122,8 @@
            result.put("unitId",userBo.getUnitId());
            result.put("userId", userBo.getId());
            result.put("account", userBo.getAccount());
            List<FileVo> listFile =  fileTableService.list(userBo.getId(), FileTableEnum.APP_ALLOCATION.value);
            result.put("file", CollectionUtils.isNotEmpty(listFile)?listFile.get(0):new FileVo());
            result.put("unName",Objects.nonNull(responsibilityUnit)&&Objects.nonNull(responsibilityUnit.getAreaName())?responsibilityUnit.getAreaName():"未选择责任单位");
        } catch (Exception e) {
            log.error("token生成异常:" + e.getMessage());
@@ -183,6 +192,8 @@
            result.put("token", token);
            result.put("userName", user.getUserName());
            result.put("unitId",user.getUnitId());
            List<FileVo> listFile =  fileTableService.list(user.getId(), FileTableEnum.APP_ALLOCATION.value);
            result.put("file", CollectionUtils.isNotEmpty(listFile)?listFile.get(0):new FileVo());
            result.put("userId", user.getId());
            result.put("account", user.getAccount());
            result.put("unName",Objects.nonNull(responsibilityUnit)&&Objects.nonNull(responsibilityUnit.getAreaName())?responsibilityUnit.getAreaName():"未选择责任单位");
screen-api/src/main/resources/application-qa.yml
@@ -141,4 +141,4 @@
    foh3wi2ooghiCh5
file:
  path: E:/upload
  path: /data/upload/
screen-api/src/main/resources/mapper/AllocationMapper.xml
@@ -95,7 +95,7 @@
                and allocation.allocation_num LIKE CONCAT('%',#{allocation.allocationNum},'%')
            </if>
            <if test="allocation.unitList != null and allocation.unitList.size !=0">
                and allocation.unit_id in
                and allocation.state in
                <foreach collection="allocation.unitList" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
@@ -104,4 +104,33 @@
        </where>
        order by allocation.escalation_time desc,allocation.allocation_id desc
    </select>
    <select id="extAppPage" resultType="com.moral.api.pojo.ext.allocation.AllocationPageExt">
        SELECT
        <include refid="Allocation_Column_List"/>
        FROM allocation allocation
        <where>
        1 = 1 and allocation.is_del = 0
            <if test="allocation.startTime != null and allocation.startTime != '' ">
                and date(allocation.escalation_time) <![CDATA[>=]]> #{allocation.startTime}
            </if>
            <if test="allocation.endTime != null and allocation.endTime !='' ">
                and date(allocation.escalation_time) <![CDATA[<=]]>  #{allocation.endTime}
            </if>
            <if test="allocation.stateList != null and allocation.stateList.size !=0">
                and allocation.state in
                <foreach collection="allocation.stateList" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
            <if test="allocation.unitList != null and allocation.unitList.size !=0">
                and allocation.unit_id in
                <foreach collection="allocation.unitList" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
        </where>
        order by allocation.escalation_time desc,allocation.allocation_id desc
    </select>
</mapper>