cjl
2023-10-20 c7dd4a195d8d893d92c49963447cdf6486844584
Merge remote-tracking branch 'origin/wb' into cjl
7 files added
13 files modified
844 ■■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/AllocationController.java 3 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/AppAllocationController.java 63 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/AppUserController.java 98 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/entity/AppUser.java 18 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/AllocationMapper.java 5 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/AppUserMapper.java 8 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/HistorySecondCruiserMapper.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java 76 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/AllocationService.java 26 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/UserService.java 4 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java 238 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java 36 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java 1 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/UserServiceImpl.java 73 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/utils/HttpClientUtil.java 136 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/utils/WechatUtils.java 34 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/AllocationMapper.xml 1 ●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml 4 ●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/controller/PubController.java 13 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/AllocationController.java
@@ -12,6 +12,7 @@
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.vo.allocation.AllocationFindVo;
import com.moral.api.pojo.vo.allocation.AllocationPageVo;
import com.moral.api.pojo.vo.allocation.AllocationVo;
import com.moral.api.utils.BeanConverts;
@@ -197,4 +198,6 @@
        }
    }
}
screen-api/src/main/java/com/moral/api/controller/AppAllocationController.java
New file
@@ -0,0 +1,63 @@
package com.moral.api.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import javax.validation.Valid;
import com.moral.api.pojo.query.allocation.AllocationChangeCond;
import com.moral.api.pojo.query.allocation.AllocationCheckCond;
import com.moral.api.pojo.vo.allocation.AllocationFindVo;
import com.moral.api.service.AllocationService;
import com.moral.constant.ResultMessage;
@Api(tags = {"小程序立行立改"})
@RestController
@RequestMapping("allocationApp")
public class AppAllocationController {
    @Autowired
    private AllocationService allocationService;
    @GetMapping("select")
    @ApiOperation("小程序查询")
    public ResultMessage selectSmallRoutine(@RequestParam @ApiParam(value = "state",name = "状态") Integer state,
                                            @RequestParam @ApiParam(value = "startTime",name = "开始时间") String startTime,
                                            @RequestParam @ApiParam(value = "endTime",name = "结束时间") String endTime){
        List<AllocationFindVo> allocationFindVos = allocationService.selectSmallRoutine(state,startTime,endTime);
        return ResultMessage.ok(ObjectUtils.isEmpty(allocationFindVos)? "0":allocationFindVos);
    }
    @PostMapping("changeRoutine")
    @ApiOperation("小程序整改")
    public ResultMessage changeSmallRoutine(@Valid @RequestBody AllocationChangeCond changeCond){
        allocationService.changeSmallRoutine(changeCond);
        return ResultMessage.ok();
    }
    @PostMapping("checkRoutine")
    @ApiOperation("小程序审批")
    public ResultMessage checkSmallRoutine(@Valid @RequestBody AllocationCheckCond checkCond){
        allocationService.checkSmallRoutine(checkCond);
        return ResultMessage.ok();
    }
}
screen-api/src/main/java/com/moral/api/controller/AppUserController.java
New file
@@ -0,0 +1,98 @@
package com.moral.api.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.moral.api.entity.AppUser;
import com.moral.api.exception.BusinessException;
import com.moral.api.mapper.AppUserMapper;
import com.moral.api.service.UserService;
import com.moral.api.utils.WechatUtils;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
@Slf4j
@Api(tags = {"小程序用户管理"})
@RestController
@RequestMapping("/AppUser")
public class AppUserController {
    @Autowired
    private UserService userService;
    @Autowired
    private AppUserMapper appUserMapper;
    @ApiOperation(value = "登陆信息", notes = "登陆信息")
    @PostMapping("login")
    public ResultMessage login(@RequestBody Map<String, Object> parameters) {
        if (!(parameters.containsKey("account") && parameters.containsKey("password"))) {
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        Map<String, Object> result = userService.loginSmallRoutine(parameters);
        if (!result.containsKey("token")) {
            return ResultMessage.fail((int) result.get("code"), (String) result.get("msg"));
        }
        return ResultMessage.ok(result);
    }
    @PostMapping("/wx/login")
    @ApiOperation(value = "小程序登陆", notes = "小程序登陆")
    public ResultMessage userLogin(@RequestParam(value = "code", required = false) String code,
                        @RequestParam(value = "rawData", required = false) String rawData,
                        @RequestParam(value = "signature", required = false) String signature) {
        // 用户非敏感信息:rawData
        // 签名:signature
        JSONObject rawDataJson = JSON.parseObject(rawData);
        // 1.接收小程序发送的code
        // 2.开发者服务器 登录凭证校验接口 appi + appsecret + code
        JSONObject SessionKeyOpenId = WechatUtils.getSessionKeyOrOpenId(code);
        // 3.接收微信接口服务 获取返回的参数
        String openid = SessionKeyOpenId.getString("openid");
        String sessionKey = SessionKeyOpenId.getString("session_key");
        // 4.校验签名 小程序发送的签名signature与服务器端生成的签名signature2 = sha1(rawData + sessionKey)
        String signature2 = DigestUtils.sha1Hex(rawData + sessionKey);
        if (!signature.equals(signature2)) {
//            return ResultMessage.ok().message("签名校验失败");
//            return ResultMessage.ok("签名校验失败");
            throw new BusinessException("签名校验失败");
        }
        // 5.根据返回的User实体类,判断用户是否是新用户,是的话,将用户信息存到数据库;
        LambdaQueryWrapper<AppUser> lqw = Wrappers.lambdaQuery();
        lqw.eq(AppUser::getOpenId, openid);
//        User user = userService.getOne(lqw);
        AppUser user = appUserMapper.selectOne(lqw);
        if (user == null) {
            // 用户信息入库
            String nickName = rawDataJson.getString("nickName");
            String avatarUrl = rawDataJson.getString("avatarUrl");
            user = new AppUser();
            user.setOpenId(Integer.parseInt(openid));
            user.setAvatarUrl(avatarUrl);
            user.setNickName(nickName);
            appUserMapper.insert(user);
        }
        return ResultMessage.ok(user);
    }
}
screen-api/src/main/java/com/moral/api/entity/AppUser.java
New file
@@ -0,0 +1,18 @@
package com.moral.api.entity;
import lombok.Data;
import com.baomidou.mybatisplus.extension.activerecord.Model;
@Data
public class AppUser extends Model<AppUser>  {
    private Integer openId;
    private String  account;
    private String nickName;
    private String avatarUrl;
}
screen-api/src/main/java/com/moral/api/mapper/AllocationMapper.java
@@ -8,6 +8,8 @@
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.vo.allocation.AllocationFindVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -30,4 +32,7 @@
     */
    List<AllocationListExt> extList(@Param("allocation") AllocationListCond allocationListCond);
}
screen-api/src/main/java/com/moral/api/mapper/AppUserMapper.java
New file
@@ -0,0 +1,8 @@
package com.moral.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moral.api.entity.AppUser;
public interface AppUserMapper extends BaseMapper<AppUser> {
}
screen-api/src/main/java/com/moral/api/mapper/HistorySecondCruiserMapper.java
@@ -26,7 +26,7 @@
    String  getDaily(Map<String,Object> params);
    List<Double> getDust(String start,String end,String mac);
    List<String> getDust(String start,String end,String mac);
    List<Map<String,Object>> getDusts(Map<String,Object> params);
screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java
New file
@@ -0,0 +1,76 @@
package com.moral.api.pojo.vo.allocation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.moral.api.pojo.enums.AllocationApproveEnum;
import com.moral.util.DateUtils;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Allocation - 查询VO对象", description="Allocation - 查询VO对象")
public class AllocationFindVo implements Serializable {
    @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 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 Integer isApprove;
    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;
    }
}
screen-api/src/main/java/com/moral/api/service/AllocationService.java
@@ -14,6 +14,8 @@
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.vo.allocation.AllocationFindVo;
import com.moral.api.pojo.vo.allocation.AllocationPageVo;
public interface AllocationService extends IService<Allocation> {
@@ -97,4 +99,28 @@
     * @return
     */
    boolean applyFor (AllocationExtensionAddCond allocationExtensionAddCond);
    /**
     * 小程序查询
     * @param state
     * @return
     */
    List<AllocationFindVo> selectSmallRoutine(Integer state,String startTime,String endTime);
    /**
     * 小程序整改
     * @param changeCond
     */
    void changeSmallRoutine(AllocationChangeCond changeCond);
    /**
     * 小程序审批
     * @param checkCond
     */
    void checkSmallRoutine(AllocationCheckCond checkCond);
}
screen-api/src/main/java/com/moral/api/service/UserService.java
@@ -44,4 +44,8 @@
    //根据所传条件获取用户信息
    UserBO selectUserInfo(Map<String, Object> parameters);
    //小程序登陆
    Map<String, Object> loginSmallRoutine(Map<String, Object> parameters);
}
screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java
@@ -1,5 +1,6 @@
package com.moral.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.moral.api.config.Interceptor.UserHelper;
@@ -10,10 +11,9 @@
import com.moral.api.pojo.ext.allocation.AllocationExt;
import com.moral.api.pojo.ext.allocation.AllocationListExt;
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.query.PageCond;
import com.moral.api.pojo.query.allocation.*;
import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond;
import com.moral.api.pojo.vo.approvetable.ApproveTableListVo;
import com.moral.api.pojo.vo.allocation.AllocationFindVo;
import com.moral.api.pojo.vo.user.QxUser;
import com.moral.api.service.AllocationExtensionService;
import com.moral.api.service.ApproveTableService;
@@ -62,6 +62,7 @@
import com.moral.constant.RedisConstants;
import com.moral.util.DateUtils;
import com.moral.util.TokenUtils;
import com.sun.javafx.scene.control.skin.VirtualFlow;
@Service
@@ -211,32 +212,46 @@
    public Map<String, Object> selectUnitView(Map<String, Object> map) {
        QueryWrapper<Allocation> wrapper = new QueryWrapper<>();
        //获取用户信息
        Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
        Object unitId = userInfo.get("unitId");
        Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
        Integer orgId = (Integer) orgInfo.get("id");
        List<Integer> list = this.unitResult();
        if (!ObjectUtils.isEmpty(map.get("unitId"))){
            wrapper.in("unit_id",map.get("unitId").toString());
        }else {
            if (orgId!=24){
                if (ObjectUtils.isEmpty(unitId)){
            if (!ObjectUtils.isEmpty(list)){
                Integer integer = list.get(0);
                if (integer==0){
                    return null;
                }
                ResponsibilityUnit responsibilityUnit1 = responsibilityUnitMapper.selectById(Integer.parseInt(unitId.toString()));
                Integer areaCode = responsibilityUnit1.getAreaCode();
                List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitService.selectUnit(areaCode);
                if (ObjectUtils.isEmpty(responsibilityUnits)){
                    List<ResponsibilityUnit> responsibilityUnits1 = responsibilityUnitService.selectAreaUnit(areaCode);
                    Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits1.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
                    List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
                    wrapper.in("unit_id",collect1);
                }else {
                    Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
                    List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
                    wrapper.in("unit_id",collect1);
                    wrapper.in("unit_id",list);
                }
            }
        }
//        Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
//        Object unitId = userInfo.get("unitId");
//        Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
//        Integer orgId = (Integer) orgInfo.get("id");
//        if (!ObjectUtils.isEmpty(map.get("unitId"))){
//            wrapper.in("unit_id",map.get("unitId").toString());
//        }else {
//            if (orgId!=24){
//                if (ObjectUtils.isEmpty(unitId)){
//                    return null;
//                }
//                ResponsibilityUnit responsibilityUnit1 = responsibilityUnitMapper.selectById(Integer.parseInt(unitId.toString()));
//                Integer areaCode = responsibilityUnit1.getAreaCode();
//                List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitService.selectUnit(areaCode);
//                if (ObjectUtils.isEmpty(responsibilityUnits)){
//                    List<ResponsibilityUnit> responsibilityUnits1 = responsibilityUnitService.selectAreaUnit(areaCode);
//                    Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits1.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
//                    List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
//                    wrapper.in("unit_id",collect1);
//                }else {
//                    Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
//                    List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
//                    wrapper.in("unit_id",collect1);
//                }
//            }
//        }
        HashMap<String, Object> rsMap = new HashMap<>();
        ArrayList<Map<String, Object>> polluteArrayList = new ArrayList<>();
@@ -246,7 +261,7 @@
        Object number1 = map.get("number");
        String startTime=null;
        String endTime=null;
        if (!ObjectUtils.isEmpty(map.get("startTime")) || !ObjectUtils.isEmpty(map.get("startTime"))){
        if (!ObjectUtils.isEmpty(map.get("startTime")) || !ObjectUtils.isEmpty(map.get("endTime"))){
             startTime = map.get("startTime").toString();
             endTime = map.get("endTime").toString();
@@ -380,35 +395,48 @@
    public List<Map<String, Object>> unitExel(Map<String, Object> map) {
        QueryWrapper<Allocation> wrapper = new QueryWrapper<>();
        //获取用户信息
        Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
        Object unitId = userInfo.get("unitId");
        Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
        Integer orgId = (Integer) orgInfo.get("id");
        if (ObjectUtils.isEmpty(unitId)){
            return null;
        }
        if (orgId!=24){
            ResponsibilityUnit responsibilityUnit1 = responsibilityUnitMapper.selectById(Integer.parseInt(unitId.toString()));
            Integer areaCode = responsibilityUnit1.getAreaCode();
            List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitService.selectUnit(areaCode);
            if (ObjectUtils.isEmpty(responsibilityUnits)){
                List<ResponsibilityUnit> responsibilityUnits1 = responsibilityUnitService.selectAreaUnit(areaCode);
                Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits1.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
                List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
                wrapper.in("unit_id",collect1);
        List<Integer> list = this.unitResult();
        if (!ObjectUtils.isEmpty(map.get("unitId"))){
            wrapper.in("unit_id",map.get("unitId").toString());
            }else {
                Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
                List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
                wrapper.in("unit_id",collect1);
            if (!ObjectUtils.isEmpty(list)){
                Integer integer = list.get(0);
                if (integer==0){
                    return null;
                }else {
                    wrapper.in("unit_id",list);
            }
        }
        }
//        Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
//        Object unitId = userInfo.get("unitId");
//        Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
//        Integer orgId = (Integer) orgInfo.get("id");
//
//        if (ObjectUtils.isEmpty(unitId)){
//            return null;
//        }
//        if (orgId!=24){
//            ResponsibilityUnit responsibilityUnit1 = responsibilityUnitMapper.selectById(Integer.parseInt(unitId.toString()));
//            Integer areaCode = responsibilityUnit1.getAreaCode();
//            List<ResponsibilityUnit> responsibilityUnits = responsibilityUnitService.selectUnit(areaCode);
//            if (ObjectUtils.isEmpty(responsibilityUnits)){
//                List<ResponsibilityUnit> responsibilityUnits1 = responsibilityUnitService.selectAreaUnit(areaCode);
//                Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits1.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
//                List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
//                wrapper.in("unit_id",collect1);
//            }else {
//                Map<Integer, List<ResponsibilityUnit>> collect = responsibilityUnits.stream().collect(Collectors.groupingBy(o -> o.getUnitId()));
//                List<Integer> collect1 = collect.keySet().stream().collect(Collectors.toList());
//                wrapper.in("unit_id",collect1);
//            }
//        }
        ArrayList<Map<String, Object>> rsMap = new ArrayList<>();
        Object number1 = map.get("number");
        String startTime=null;
        String endTime=null;
        if (!ObjectUtils.isEmpty(map.get("startTime")) || !ObjectUtils.isEmpty(map.get("startTime"))){
        if (!ObjectUtils.isEmpty(map.get("startTime")) || !ObjectUtils.isEmpty(map.get("endTime"))){
            startTime = map.get("startTime").toString();
            endTime = map.get("endTime").toString();
@@ -609,6 +637,132 @@
    }
    @Override
    public List<AllocationFindVo> selectSmallRoutine(Integer state,String startTime,String endTime) {
        ArrayList<AllocationFindVo> allocationFindVos = new ArrayList<>();
        LambdaQueryWrapper<Allocation> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(Allocation::getEscalationTime);
        //获取用户信息
        List<Integer> list = unitResult();
        if (!ObjectUtils.isEmpty(list)){
            Integer integer = list.get(0);
            if (integer==0){
                return null;
            }else {
                wrapper.in(Allocation::getUnitId,list);
            }
        }
        Integer integer = unitAreaCode();
        //普通权限或 管理员
        if (integer==0 || integer==1){
            if (state==3){
                wrapper.in(Allocation::getState,40,50);
            }else if (state==2){
                wrapper.eq(Allocation::getState,30);
            }else if (state==1){
                wrapper.eq(Allocation::getState,20);
            }
        //区域权限
        }else if (integer==2){
            if (state==3){
                wrapper.in(Allocation::getState,40,50);
            }else if (state==2){
                wrapper.eq(Allocation::getState,20);
            }else if (state==1){
                wrapper.eq(Allocation::getState,30);
            }
        }
        if (!ObjectUtils.isEmpty(startTime) && !ObjectUtils.isEmpty(endTime)){
            wrapper.between(Allocation::getEscalationTime,startTime,endTime);
        }
        wrapper.eq(Allocation::getIsDel,0).eq(Allocation::getIsInvalid,0);
        List<Allocation> allocations = allocationMapper.selectList(wrapper);
        for (Allocation allocation : allocations) {
            AllocationFindVo allocationFindVo = new AllocationFindVo();
            BeanUtils.copyProperties(allocation,allocationFindVo);
            if (integer==0 || integer==1){
            }
            allocationFindVos.add(allocationFindVo);
        }
        List<AllocationFindVo> allocationFindVo = allocationMapper.selectSmallRoutine(state,startTime,endTime);
        return allocationFindVos;
    }
    /**
     * 小程序整改
     *
     * @param changeCond
     */
    @Override
    @Transactional
    public void changeSmallRoutine(AllocationChangeCond changeCond) {
        Integer integer = unitAreaCode();
        if (integer==2){
            throw new BusinessException("此账户只能审核,不能整改!");
        }
        AllocationExt allocationExt = oneAllocation(changeCond.getAllocationId());
        if(!AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(allocationExt.getState())) {
            throw new BusinessException("整改状态,才能提交审批!");
        }
        Allocation allocation = new Allocation();
        allocation.setAllocationId(changeCond.getAllocationId());
        allocation.setIsChange(changeCond.getIsChange());
        allocation.setChangeName(changeCond.getChangeName());
        allocation.setChangeDescribe(changeCond.getChangeDescribe());
        allocation.setState(changeCond.getState());
        allocation.setChangeTime(new Date());
        this.updateById(allocation);
        //添加流程数据
        ApproveTable approveTable = new ApproveTable();
        approveTable.setRelationId(allocation.getAllocationId());
        approveTable.setState(AllocationApproveEnum.UNDER_RECTIFICATION.value);
        approveTable.setStateName(AllocationApproveEnum.UNDER_RECTIFICATION.name);
        approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value);
        approveTableService.saveResult(approveTable);
        fileTableService.upDateResult(changeCond.getFileChangeList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_RECTIFICATION.value);
    }
    /**
     * 小程序审批
     *
     * @param checkCond
     */
    @Override
    @Transactional
    public void checkSmallRoutine(AllocationCheckCond checkCond) {
        Integer integer = unitAreaCode();
        if (integer==0){
            throw new BusinessException("此账户只能整改,不能审批!");
        }
        AllocationExt allocationExt = oneAllocation(checkCond.getAllocationId());
        if(!AllocationApproveEnum.IN_APPROVAL.value.equals(allocationExt.getState())) {
            throw new BusinessException("审批状态,才能进行审批操作!");
        }
        QxUser qxUser = UserHelper.getCurrentUser();
        Allocation allocation = new Allocation();
        allocation.setCheckScore(checkCond.getCheckScore());
        allocation.setAllocationId(checkCond.getAllocationId());
        allocation.setCheckDescribe(checkCond.getCheckDescribe());
        allocation.setCheckName(qxUser.getUserName());
        allocation.setCheckTime(new Date());
        allocation.setState(checkCond.getState());
        this.updateById(allocation);
        //添加流程数据
        ApproveTable approveTable = new ApproveTable();
        approveTable.setRelationId(allocation.getAllocationId());
        if(AllocationApproveEnum.PASS.value.equals(checkCond.getState())){
            approveTable.setState(AllocationApproveEnum.PASS.value);
            approveTable.setStateName(AllocationApproveEnum.PASS.name);
        }else {
            approveTable.setState(AllocationApproveEnum.REFUSE.value);
            approveTable.setStateName(AllocationApproveEnum.REFUSE.name);
        }
        approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value);
        approveTableService.saveResult(approveTable);
        fileTableService.upDateResult(checkCond.getFileApproveList(),checkCond.getAllocationId(), FileTableEnum.ALLOCATION_APPROVE.value);
    }
    @Override
    public List<Integer>  unitResult() {
        QxUser user = UserHelper.getCurrentUser();
        Integer unitId = Objects.nonNull(user.getUnitId())?user.getUnitId():0;
screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java
@@ -90,29 +90,25 @@
            for (TimeForm timeForm : tables) {
                String start = timeForm.getStart();
                String end = timeForm.getEnd();
                List<Double> dust = historySecondCruiserMapper.getDust(start, end, mac);
                List<String> dust = historySecondCruiserMapper.getDust(start, end, mac);
                ArrayList<Double> rsDouble = new ArrayList<>();
                for (Double aDouble : dust) {
                    double v =0.0;
                for (String s : dust) {
                    double aDouble = Double.parseDouble(s);
                    if (aDouble>=0 && aDouble<40 ){
                        v = aDouble + 170;
                        aDouble = aDouble + 170;
                    }else if (aDouble>=40 && aDouble<60){
                        aDouble = aDouble + 130;
                    }else if (aDouble>=60 && aDouble<100 ){
                        aDouble = aDouble + 110;
                    }else if (aDouble>=100 && aDouble<150){
                        aDouble = aDouble + 70;
                    }else if (aDouble>=150 && aDouble<180){
                        aDouble = aDouble + 30;
                    }else {
                        aDouble= aDouble+0;
                    }
                    if (aDouble>=40 && aDouble<60 ){
                        v = aDouble + 130;
                    }
                    if (aDouble>=60 && aDouble<100 ){
                        v = aDouble + 110;
                    }
                    if (aDouble>=100 && aDouble<150 ){
                        v = aDouble + 70;
                    }
                    if (aDouble>=150 && aDouble<180 ){
                        v = aDouble + 30;
                    }
                    if (aDouble>=180){
                        v= aDouble;
                    }
                    rsDouble.add(v);
                    rsDouble.add(aDouble);
                }
                list.addAll(rsDouble);
            }
screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java
@@ -20,6 +20,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java
@@ -234,7 +234,12 @@
                data = data + " " + sensor.getShowUnit();
                result.put(sensor.getCode(), data);
            } else {
                if (sensor.getCode().equals("a01008") ||sensor.getCode().equals("a01007")){
                result.put(sensor.getCode(), "-");
                }else {
                    result.put(sensor.getCode(), "0"+" "+sensor.getShowUnit());
                }
            }
        }
        //添加设备名称
screen-api/src/main/java/com/moral/api/service/impl/UserServiceImpl.java
@@ -80,6 +80,9 @@
    @Autowired
    private OperationLogUtils operationLogUtils;
    @Autowired
    private ResponsibilityUnitMapper responsibilityUnitMapper;
    @Value("${AES.KEY}")
    private String AESKey;
@@ -87,6 +90,72 @@
    @Override
    public UserBO selectUserInfo(Map<String, Object> parameters) {
        return userMapper.selectUserInfo(parameters);
    }
    @Override
    public Map<String, Object> loginSmallRoutine(Map<String, Object> parameters) {
        UserBO userBo = selectUserInfo(parameters);
        Map<String, Object> result = new HashMap<>();
        //校验账户
        if (userBo == null) {
            result.put("code", ResponseCodeEnum.ACCOUNT_NOT_EXIST.getCode());
            result.put("msg", ResponseCodeEnum.ACCOUNT_NOT_EXIST.getMsg());
            return result;
        }
        //校验密码
        String password = parameters.get("password").toString();
        //密码解密
        password = AESUtils.decrypt(password, AESKey);
        if (!MD5Utils.saltMD5Verify(password, userBo.getPassword())) {
            result.put("code", ResponseCodeEnum.PASSWORD_INVALID.getCode());
            result.put("msg", ResponseCodeEnum.PASSWORD_INVALID.getMsg());
            return result;
        }
        //校验是否删除
        if (Constants.DELETE.equals(userBo.getIsDelete())) {
            result.put("code", ResponseCodeEnum.ACCOUNT_IS_DELETE.getCode());
            result.put("msg", ResponseCodeEnum.ACCOUNT_IS_DELETE.getMsg());
            return result;
        }
        //校验是否过期
        if (userBo.getExpireTime() != null && userBo.getExpireTime().getTime() < System.currentTimeMillis()) {
            result.put("code", ResponseCodeEnum.ACCOUNT_IS_EXPIRE.getCode());
            result.put("msg", ResponseCodeEnum.ACCOUNT_IS_EXPIRE.getMsg());
            return result;
        }
        ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(userBo.getUnitId());
        //封装用户信息
        Map<String, Object> userInfo = new LinkedHashMap<>();
        userInfo.put("userId", userBo.getId());
        userInfo.put("account", userBo.getAccount());
        userInfo.put("userName", userBo.getUserName());
        userInfo.put("email", userBo.getEmail());
        userInfo.put("mobile", userBo.getMobile());
        userInfo.put("unitId",userBo.getUnitId());
        userInfo.put("unName",responsibilityUnit.getAreaName());
        userInfo.put("wechat", userBo.getWechat());
        userInfo.put("expireTime", DateUtils.dateToDateString(userBo.getExpireTime()));
        userInfo.put("isAdmin", userBo.getIsAdmin());
        try {
            //生成token,并存入redis
            String token = TokenUtils.getToken(userBo.getId().toString(), userInfo);
            result.put("token", token);
        } catch (Exception e) {
            log.error("token生成异常:" + e.getMessage());
            result.put("code", ResponseCodeEnum.TOKEN_CREATE_ERROR.getCode());
            result.put("msg", ResponseCodeEnum.TOKEN_CREATE_ERROR.getMsg());
            return result;
        }
        //日志
        HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
        UserLog userLog = new UserLog();
        userLog.setType(Constants.LOGIN_OPERTATE_TYPE);
        userLog.setIp(WebUtils.getIpAddr(request));
        userLog.setOperateId(userBo.getId());
        userLog.setOrganizationId(userBo.getOrganizationId());
        userLog.setContent("登陆了用户:" + userBo.getAccount());
        userLogMapper.insert(userLog);
        return result;
    }
    @Override
@@ -120,9 +189,10 @@
            result.put("msg", ResponseCodeEnum.ACCOUNT_IS_EXPIRE.getMsg());
            return result;
        }
        //封装用户信息
        Map<String, Object> userInfo = new LinkedHashMap<>();
        ResponsibilityUnit responsibilityUnit = responsibilityUnitMapper.selectById(userBo.getUnitId());
        //用户信息
        userInfo.put("userId", userBo.getId());
        userInfo.put("account", userBo.getAccount());
@@ -130,6 +200,7 @@
        userInfo.put("email", userBo.getEmail());
        userInfo.put("mobile", userBo.getMobile());
        userInfo.put("unitId",userBo.getUnitId());
        userInfo.put("unName",responsibilityUnit.getAreaName());
        userInfo.put("wechat", userBo.getWechat());
        userInfo.put("expireTime", DateUtils.dateToDateString(userBo.getExpireTime()));
        userInfo.put("isAdmin", userBo.getIsAdmin());
screen-api/src/main/java/com/moral/api/utils/HttpClientUtil.java
New file
@@ -0,0 +1,136 @@
package com.moral.api.utils;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpClientUtil {
    public static String doGet(String url, Map<String, String> param) {
        // 创建Httpclient对象
        CloseableHttpClient httpclient = HttpClients.createDefault();
        String resultString = "";
        CloseableHttpResponse response = null;
        try {
            // 创建uri
            URIBuilder builder = new URIBuilder(url);
            if (param != null) {
                for (String key : param.keySet()) {
                    builder.addParameter(key, param.get(key));
                }
            }
            URI uri = builder.build();
            // 创建http GET请求
            HttpGet httpGet = new HttpGet(uri);
            // 执行请求
            response = httpclient.execute(httpGet);
            // 判断返回状态是否为200
            if (response.getStatusLine().getStatusCode() == 200) {
                resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (response != null) {
                    response.close();
                }
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return resultString;
    }
    public static String doGet(String url) {
        return doGet(url, null);
    }
    public static String doPost(String url, Map<String, String> param) {
        // 创建Httpclient对象
        CloseableHttpClient httpClient = HttpClients.createDefault();
        CloseableHttpResponse response = null;
        String resultString = "";
        try {
            // 创建Http Post请求
            HttpPost httpPost = new HttpPost(url);
            // 创建参数列表
            if (param != null) {
                List<NameValuePair> paramList = new ArrayList<>();
                for (String key : param.keySet()) {
                    paramList.add(new BasicNameValuePair(key, param.get(key)));
                }
                // 模拟表单
                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
                httpPost.setEntity(entity);
            }
            // 执行http请求
            response = httpClient.execute(httpPost);
            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                response.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return resultString;
    }
    public static String doPost(String url) {
        return doPost(url, null);
    }
    public static String doPostJson(String url, String json) {
        // 创建Httpclient对象
        CloseableHttpClient httpClient = HttpClients.createDefault();
        CloseableHttpResponse response = null;
        String resultString = "";
        try {
            // 创建Http Post请求
            HttpPost httpPost = new HttpPost(url);
            // 创建请求内容
            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
            httpPost.setEntity(entity);
            // 执行http请求
            response = httpClient.execute(httpPost);
            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                response.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return resultString;
    }
}
screen-api/src/main/java/com/moral/api/utils/WechatUtils.java
New file
@@ -0,0 +1,34 @@
package com.moral.api.utils;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
public class WechatUtils {
    public static final String APPID = "yyyy";
    public static final String SECRET = "yyyy";
    public static JSONObject getSessionKeyOrOpenId(String code) {
        String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
        Map<String, String> requestUrlParam = new HashMap<>();
        // https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
        //小程序appId
        requestUrlParam.put("appid", APPID);
        //小程序secret
        requestUrlParam.put("secret",SECRET);
        //小程序端返回的code
        requestUrlParam.put("js_code", code);
        //默认参数
        requestUrlParam.put("grant_type", "authorization_code");
        //发送post请求读取调用微信接口获取openid用户唯一标识
        JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doPost(requestUrl, requestUrlParam));
        return jsonObject;
    }
}
screen-api/src/main/resources/mapper/AllocationMapper.xml
@@ -59,6 +59,7 @@
        </where>
    </select>
    <select id="extPage" resultType="com.moral.api.pojo.ext.allocation.AllocationPageExt">
        SELECT
        <include refid="Allocation_Column_List"/>,t1.id as applyState
screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml
@@ -50,8 +50,8 @@
          AND `time` <![CDATA[<=]]> #{time2}
    </select>
    <select id="getDust" resultType="java.lang.Double">
        select JSON_EXTRACT(value,'$.dustld')
    <select id="getDust" resultType="java.lang.String">
        select value ->>'$.dustld'
        from `history_second_cruiser`
        WHERE mac = #{mac}
          AND `time` <![CDATA[>=]]> #{start}
screen-job/src/main/java/com/moral/api/controller/PubController.java
@@ -53,6 +53,19 @@
        int i = 0;
        return new ResultMessage();
    }
    @GetMapping("insertHistoryFiveMinutely")
    @ApiOperation(value = "5分钟数据", notes = "5分钟数据")
    public ResultMessage insertHistoryFiveMinutely() {
        String format = DateUtils.yyyy_MM_dd_HH_mm_EN;
        historyFiveMinutelyService.insertHistoryFiveMinutely();
        String s ="2023-10-13 03:35";
        String s1 ="2023-10-13 03:40";
        Date start = DateUtils.getDate(s,format);
        Date end = DateUtils.getDate(s1,format);
        return new ResultMessage();
    }
    @GetMapping("FiveMinutelyTest")
    @ApiOperation(value = "5分钟数据1", notes = "5分钟数据1")
    public ResultMessage FiveMinutelyTest(String yz,String mac) {