sgj
3 小时以前 3a5e49666af1da441633b0a9bae4c3c2b18974b3
质押合同添加业务经理绑定,H5相关逻辑完善
已修改15个文件
597 ■■■■■ 文件已修改
fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/PledgeContractService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SnapReplyService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SysUserService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContractPR.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-view/src/main/java/models/core.model.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/java/com/fzzy/appwx/controller/WeChatController.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/java/com/fzzy/appwx/manager/WeChatManager.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/templates/wx/bind.html 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/templates/wx/home.html 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/templates/wx/unbind.html 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/templates/wx/warn-detail.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/PledgeContract.java
@@ -57,6 +57,10 @@
    @TableField("pledge_bank")
    private String pledgeBank;
    @Column(name = "pledge_bank_user", columnDefinition = "varchar(40) COMMENT '质押银行业务员'")
    @TableField("pledge_bank_user")
    private String pledgeBankUser;
    //质押公司
    @Column(name = "pledge_company", columnDefinition = "varchar(40) COMMENT '质押公司'")
    @TableField("pledge_company")
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
@@ -10,6 +10,7 @@
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@@ -42,26 +43,31 @@
        //获取当前登录人
        SysUser user = ContextUtil.getLoginUser();
        if (Constant.USER_TYPE_10.equals(user.getUserType())) {
            //监管用户,直接查询组织下所有库区
            return this.listDept(null,user.getCompanyId(),null);
        }
        if (Constant.USER_TYPE_20.equals(user.getUserType())) {
            //银行用户,根据合同查询银行下所有库区
            return this.getDeptByBank(user.getUserData());
        }
        if (Constant.USER_TYPE_30.equals(user.getUserType())) {
            //库区用户
            String deptId = user.getDeptId() + "";
            if(ContextUtil.isDepotUser(deptId)){
                //查询用户所属库区
                return this.listDept(deptId,null,null);
            }else {
                //查询用户所属公司下所有库区
                return this.listDept(null,null, deptId);
            }
        }
        return this.listDept(null,user.getCompanyId(),null);
       if(null != user){
           if (Constant.USER_TYPE_10.equals(user.getUserType())) {
               //监管用户,直接查询组织下所有库区
               return this.listDept(null,user.getCompanyId(),null);
           }
           if (Constant.USER_TYPE_20.equals(user.getUserType())) {
               //银行用户,根据合同查询银行下所有库区
               return this.getDeptByBank(user.getUserData());
           }
           if (Constant.USER_TYPE_30.equals(user.getUserType())) {
               //库区用户
               String deptId = user.getDeptId() + "";
               if(ContextUtil.isDepotUser(deptId)){
                   //查询用户所属库区
                   return this.listDept(deptId,null,null);
               }else {
                   //查询用户所属公司下所有库区
                   return this.listDept(null,null, deptId);
               }
           }
           return this.listDept(null,user.getCompanyId(),null);
       }
        return this.listDept(null,ContextUtil.getCompanyId(),null);
    }
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/PledgeContractService.java
@@ -12,6 +12,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -51,6 +52,18 @@
        return pledgeContractMapper.selectList(queryWrapper);
    }
    public List<PledgeContract> getDateByUser(String userId) {
        if(StringUtils.isBlank(userId)){
            return new ArrayList<PledgeContract>();
        }
        QueryWrapper<PledgeContract> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company_id", ContextUtil.getCompanyId());
        queryWrapper.eq("pledge_bank_user", userId);
        return pledgeContractMapper.selectList(queryWrapper);
    }
    /**
     * 根据条件查询
     * @param id
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SnapReplyService.java
@@ -32,8 +32,9 @@
     */
    public void listPage(Page<SnapReply> page, IgdsBaseParam param) {
        QueryWrapper<SnapReply> queryWrapper = new QueryWrapper<>();
        param.setCompanyId(ContextUtil.getCompanyId());
        if (StringUtils.isBlank(param.getCompanyId())) {
            param.setCompanyId(ContextUtil.getCompanyId());
        }
        queryWrapper.eq("company_id", param.getCompanyId());
        //库区检索
@@ -51,6 +52,31 @@
        snapReplyMapper.selectPage(page, queryWrapper);
    }
    public void listPageByListDept(Page<SnapReply> page, IgdsBaseParam param, List<String> listDept) {
        if( listDept == null || listDept.isEmpty()){
            return;
        }
        QueryWrapper<SnapReply> queryWrapper = new QueryWrapper<>();
        if (StringUtils.isBlank(param.getCompanyId())) {
            param.setCompanyId(ContextUtil.getCompanyId());
        }
        queryWrapper.eq("company_id", param.getCompanyId());
        //库区检索
        if (!listDept.isEmpty()) {
            queryWrapper.in("dept_id", listDept);
        }
        //是否处理检索
        if (StringUtils.isNotBlank(param.getKey())) {
            queryWrapper.eq("is_handle", param.getKey());
        }
        queryWrapper.orderByDesc("create_time");
        queryWrapper.orderByDesc("id");
        snapReplyMapper.selectPage(page, queryWrapper);
    }
    /**
     * 查询所有数据
     *
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SysUserService.java
@@ -75,4 +75,15 @@
        return userMapper.selectUserList(param);
    }
    public  List<SysUser> getBindBankUserList(String bankId) {
        SysUser param = new SysUser();
        param.setCompanyId(ContextUtil.getCompanyId());
        param.setUserType(Constant.USER_TYPE_20);
        if( StringUtils.isNotBlank(bankId)){
            param.setUserData(bankId);
        }
        return userMapper.selectUserList(param);
    }
}
fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContract.view.xml
@@ -38,6 +38,12 @@
      <Property name="dataType">[dtPledgeContractDepot]</Property>
      <Property name="loadMode">manual</Property>
    </DataSet>
    <DataSet id="dsBankUser">
      <Property name="dataProvider">pledgeContractPR#getBankUserList</Property>
      <Property name="userData">业务经理下拉列表</Property>
      <Property name="loadMode">manual</Property>
      <Property name="dataType">[dtSysUser]</Property>
    </DataSet>
    <Container>
      <Property name="className">c-param</Property>
      <AutoForm>
@@ -305,6 +311,12 @@
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">pledgeBankUser</Property>
              <Property name="property">pledgeBankUser</Property>
              <Property name="trigger">dsBankUserDropDown</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">pledgeCompany</Property>
              <Property name="property">pledgeCompany</Property>
              <Editor/>
@@ -475,5 +487,30 @@
      </Children>
      <Tools/>
    </Dialog>
    <DataSetDropDown id="dsBankUserDropDown">
      <ClientEvent name="onOpen">&#xD;
var entity = view.get(&quot;#dsMain.data:#&quot;);&#xD;
if(!entity){&#xD;
  $alert(&quot;请先选择所属库区&quot;);&#xD;
}else{&#xD;
  var pledgeBank = entity.get(&quot;pledgeBank&quot;);&#xD;
  if(!pledgeBank){&#xD;
     $alert(&quot;请先选择质押银行&quot;);&#xD;
  }else{&#xD;
     view.get(&quot;#dsBankUser&quot;).set(&quot;parameter&quot;,entity.get(&quot;pledgeBank&quot;)).flushAsync();&#xD;
  }
}</ClientEvent>
      <Property name="dataSet">dsBankUser</Property>
      <Property name="height">450</Property>
      <Property name="autoOpen">true</Property>
      <Property name="assignmentMap">pledgeBankUser=userId</Property>
      <Property name="width">400</Property>
      <DataColumn>
        <Property name="align">center</Property>
        <Property name="name">userName</Property>
        <Property name="property">userName</Property>
        <Editor/>
      </DataColumn>
    </DataSetDropDown>
  </View>
</ViewConfig>
fzzy-igdss-view/src/main/java/com/fzzy/igds/PledgeContractPR.java
@@ -13,6 +13,7 @@
import com.fzzy.igds.service.DepotService;
import com.fzzy.igds.service.PledgeContractDepotService;
import com.fzzy.igds.service.PledgeContractService;
import com.fzzy.igds.service.SysUserService;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -35,6 +36,8 @@
    @Resource
    private PledgeContractDepotService pledgeContractDepotService;
    @Resource
    private SysUserService sysUserService;
    @Resource
    private DepotService depotService;
@@ -186,4 +189,17 @@
        }
        return result;
    }
    /** 获取质押银行业务经理数据
     * pledgeContractPR#getBankUserList
     *
     * @return
     */
    @DataProvider
    public List<SysUser> getBankUserList(String parentId) {
        if (com.ruoyi.common.utils.StringUtils.isNotEmpty(parentId)) {
            return sysUserService.getBindBankUserList(parentId);
        }
        return sysUserService.getBindBankUserList(null);
    }
}
fzzy-igdss-view/src/main/java/models/core.model.xml
@@ -1100,6 +1100,14 @@
        <Property name="valueProperty">name</Property>
      </Property>
    </PropertyDef>
    <PropertyDef name="pledgeBankUser">
      <Property name="label">银行业务经理</Property>
      <Property name="mapping">
        <Property name="mapValues">${dorado.getDataProvider(&quot;pledgeContractPR#getBankUserList&quot;).getResult()}</Property>
        <Property name="keyProperty">userId</Property>
        <Property name="valueProperty">userName</Property>
      </Property>
    </PropertyDef>
    <PropertyDef name="pledgeCompany">
      <Property></Property>
      <Property name="label">质押公司</Property>
@@ -2091,9 +2099,13 @@
    </PropertyDef>
    <PropertyDef name="userName">
      <Property></Property>
      <Property name="label">用户名称</Property>
    </PropertyDef>
    <PropertyDef name="userType">
      <Property></Property>
    </PropertyDef>
    <PropertyDef name="userData">
      <Property name="label">所属银行</Property>
    </PropertyDef>
  </DataType>
</Model>
fzzy-igdss-web/src/main/java/com/fzzy/appwx/controller/WeChatController.java
@@ -5,8 +5,10 @@
import com.fzzy.appwx.constant.WeChatConst;
import com.fzzy.appwx.manager.WeChatManager;
import com.fzzy.appwx.param.WeChatBaseParam;
import com.fzzy.group.manager.GroupManager;
import com.fzzy.igds.data.ConfigData;
import com.fzzy.igds.data.PageResponse;
import com.fzzy.igds.domain.Dept;
import com.fzzy.igds.domain.SnapReply;
import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
@@ -16,7 +18,8 @@
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.net.URLEncoder;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Slf4j
@Controller
@@ -27,6 +30,8 @@
    private ConfigData configData;
    @Resource
    private WeChatManager weChatManager;
    @Resource
    private GroupManager groupManager;
    /**
@@ -46,13 +51,13 @@
            tag = "home";
        }
        String newUrl = WeChatConst.USER_AUTH_UPR
                .replace("APPID", configData.getWxAppId())
                .replace("REDIRECT_URI", URLEncoder.encode(url, "UTF-8"))
                .replace("STATE", tag);
        return "redirect:" + newUrl;
//        return "redirect:" + url + "?state=" + tag;
//        String newUrl = WeChatConst.USER_AUTH_UPR
//                .replace("APPID", configData.getWxAppId())
//                .replace("REDIRECT_URI", URLEncoder.encode(url, "UTF-8"))
//                .replace("STATE", tag);
//
//        return "redirect:" + newUrl;
        return "redirect:" + url + "?state=" + tag;
    }
@@ -100,21 +105,31 @@
            mv.addObject("userName", userName);
        }
        mv.setViewName("/wx/" + state);
        //验证码类型
        if("bind".equals( state) || "unbind".equals( state)){
            mv.addObject("captchaType", "math");
        }
////        //测试代码开启
//        String openid = "testOpenId";
//        mv.addObject("openid", openid);
//        SysUser user = weChatManager.getUser(openid);
//        if (StringUtils.isEmpty(userName)) {
//            if (user != null) {
//                userName = user.getUserName();
//            }
//        }
//
//        if (StringUtils.isNotEmpty(userName)) {
//            mv.addObject("userName", userName);
//        }
////        //测试代码结束
        //查询库区信息
        List<Dept> deptList = groupManager.getDeptList();
        mv.addObject("deptList", deptList);
//        //测试代码开启
        String openid = "testOpenId";
        mv.addObject("openid", openid);
        SysUser user = weChatManager.getUser(openid);
        if (StringUtils.isEmpty(userName)) {
            if (user != null) {
                userName = user.getUserName();
            }
        }
        if (StringUtils.isNotEmpty(userName)) {
            mv.addObject("userName", userName);
        }
//        //测试代码结束
        return mv;
    }
@@ -143,8 +158,8 @@
     */
    @PostMapping(value = "/bandOpenId")
    @ResponseBody
    public PageResponse<String> bandOpenId(  @RequestBody WeChatBaseParam param) {
        return weChatManager.bandOpenId(param);
    public PageResponse<String> bandOpenId(HttpServletRequest httpRequest,  @RequestBody WeChatBaseParam param) {
        return weChatManager.bandOpenId(httpRequest,param);
    }
    /**
@@ -156,11 +171,14 @@
     */
    @PostMapping(value = "/unBandOpenId")
    @ResponseBody
    public PageResponse<String> unBandOpenId(  @RequestBody WeChatBaseParam param) {
        return weChatManager.unBandOpenId(param);
    public PageResponse<String> unBandOpenId( HttpServletRequest httpRequest, @RequestBody WeChatBaseParam param) {
        //在这里调用验证码校验
        return weChatManager.unBandOpenId(httpRequest,param);
    }
    /**
     * 获取出入库告警批复分页数据
     *
fzzy-igdss-web/src/main/java/com/fzzy/appwx/manager/WeChatManager.java
@@ -7,26 +7,42 @@
import com.fzzy.igds.constant.RespCodeEnum;
import com.fzzy.igds.data.IgdsBaseParam;
import com.fzzy.igds.data.PageResponse;
import com.fzzy.igds.domain.PledgeContract;
import com.fzzy.igds.domain.PledgeContractDepot;
import com.fzzy.igds.domain.SnapReply;
import com.fzzy.igds.service.PledgeContractDepotService;
import com.fzzy.igds.service.PledgeContractService;
import com.fzzy.igds.service.SnapReplyService;
import com.google.code.kaptcha.Constants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.service.ISysUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class WeChatManager {
    @Autowired
    @Resource
    private WeChatUtil weChatUtil;
    @Autowired
    private ISysUserService sysUserService;
    @Resource
    private SnapReplyService snapReplyService;
    @Resource
    private PledgeContractService pledgeContractService;
    @Resource
    private PledgeContractDepotService pledgeContractDepotService;
    public String getOpenid(String code) {
@@ -69,8 +85,25 @@
        return new PageResponse(RespCodeEnum.CODE_0000.getCode(), "查询成功", user);
    }
    //校验验证码
    public boolean validateResponse(HttpServletRequest request, String validateCode) {
        // ① 从Session获取生成的验证码
        Object obj = ShiroUtils.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
        String code = String.valueOf(obj != null ? obj : "");
        // ② 立即清除Session中的验证码(防止重复使用)
        request.getSession().removeAttribute(Constants.KAPTCHA_SESSION_KEY);
        // ③ 比对用户输入和正确答案(忽略大小写)
        if (StringUtils.isEmpty(validateCode) || !validateCode.equalsIgnoreCase(code)) {
            return false;
        }
        return true;
    }
    //绑定openId
    public PageResponse<String> bandOpenId(WeChatBaseParam param) {
    public PageResponse<String> bandOpenId(HttpServletRequest httpRequest,WeChatBaseParam param) {
        //判断参数
        if (null == param || StringUtils.isEmpty(param.getOpenid())) {
@@ -81,22 +114,15 @@
            return new PageResponse<String>(RespCodeEnum.CODE_1007.getCode(), "手机号为空,请填写");
        }
//        if (StringUtils.isEmpty(param.getMsgCode())) {
//            return new PageResponse<String>(RespCodeEnum.CODE_1007.getCode(), "验证码不能为空");
//
//        }
//
//        String code = (String) redisService.getCacheObject(WeChatConst.WX_MOBILE_CODE + param.getMobile());
//        if(StringUtils.isEmpty(code)){
//            res.put("code","1007");
//            res.put("msg","验证码已失效,请重新获取");
//            return res;
//        }
//        if(! code.equals(param.getMsgCode())){
//            res.put("code","1007");
//            res.put("msg","验证码错误");
//            return res;
//        }
        if (StringUtils.isEmpty(param.getMsgCode())) {
            return new PageResponse<String>(RespCodeEnum.CODE_1007.getCode(), "验证码不能为空");
        }
        //验证码验证
        boolean validateResponse = validateResponse(httpRequest, param.getMsgCode());
        if (!validateResponse) {
            return new PageResponse<String>(RespCodeEnum.CODE_1007.getCode(), "验证码错误");
        }
        //根据手机号查看用户是否是系统用户
        SysUser user = sysUserService.selectUserByPhoneNumber(param.getMobile());
@@ -110,13 +136,13 @@
//        redisService.deleteObject(WeChatConst.WX_MOBILE_CODE + param.getMobile());
        return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), "请求成功");
        return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), "绑定成功");
    }
    //解绑openId
    public PageResponse<String> unBandOpenId(WeChatBaseParam param) {
    public PageResponse<String> unBandOpenId(HttpServletRequest httpRequest,WeChatBaseParam param) {
        //判断参数
        if (null == param || StringUtils.isEmpty(param.getOpenid())) {
@@ -130,20 +156,11 @@
            return new PageResponse<String>(RespCodeEnum.CODE_1007.getCode(), "验证码不能为空");
        }
//        String code = (String) redisService.getCacheObject(WeChatConst.WX_MOBILE_CODE + param.getMobile());
//        if(StringUtils.isEmpty(code)){
//            res.put("code","1007");
//            res.put("msg","验证码已失效,请重新获取");
//            return res;
//
//        }
//        if(! code.equals(param.getMsgCode())){
//            res.put("code","1007");
//            res.put("msg","验证码错误");
//            return res;
//        }
        //验证码验证
        boolean validateResponse = validateResponse(httpRequest, param.getMsgCode());
        if (!validateResponse) {
            return new PageResponse<String>(RespCodeEnum.CODE_1007.getCode(), "验证码错误");
        }
        //根据手机号查询用户是否已经绑定
        SysUser user = sysUserService.selectUserByPhoneNumber(param.getMobile());
        if (user == null || StringUtils.isEmpty(user.getPhonenumber())) {
@@ -153,8 +170,6 @@
        user.setOpenId("");
        sysUserService.updateUserInfo(user);
//        redisService.deleteObject(WeChatConst.WX_MOBILE_CODE + param.getMobile());
        return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), "请求成功");
@@ -179,14 +194,35 @@
            return new PageResponse<Page<SnapReply>>(RespCodeEnum.CODE_1006.getCode(), "尚未绑定服务,请先绑定!");
        }
        //获取业务经理绑定的质押合同
        List<PledgeContract> dateByUser = pledgeContractService.getDateByUser(String.valueOf(user.getUserId()));
        if (dateByUser == null || dateByUser.isEmpty()) {
            //返回空数据
            return new PageResponse<Page<SnapReply>>(RespCodeEnum.CODE_0000.getCode(), "请求成功", new Page<>(param.getPageNo(), param.getPageSize()));
        }
        List<PledgeContractDepot> pledgeContractDepots = new ArrayList<>() ;
        for (PledgeContract pledgeContract : dateByUser) {
            String id = pledgeContract.getId();
            IgdsBaseParam depotPParam = new IgdsBaseParam();
            depotPParam.setParentId(id);
            List<PledgeContractDepot> pledgeContractDepots1 = pledgeContractDepotService.listAll(depotPParam);
            pledgeContractDepots.addAll(pledgeContractDepots1);
        }
        if(pledgeContractDepots.isEmpty()){
            //返回空数据
            return new PageResponse<Page<SnapReply>>(RespCodeEnum.CODE_0000.getCode(), "请求成功", new Page<>(param.getPageNo(), param.getPageSize()));
        }
        // 获取pledgeContractDepots中去重后的库区IDList
        List<String> deptIdList = pledgeContractDepots.stream().map(PledgeContractDepot::getPledgeDept).distinct().collect(Collectors.toList());
        //分页拼接
        Page<SnapReply> page = new Page<>(param.getPageNo(), param.getPageSize());
        //查询参数组装
        IgdsBaseParam queryParam = new IgdsBaseParam();
        queryParam.setDeptId(String.valueOf(user.getDeptId()));
        queryParam.setCompanyId(user.getCompanyId());
        queryParam.setKey(Constant.YN_N);
        snapReplyService.listPage(page, queryParam);
        snapReplyService.listPageByListDept(page, queryParam,deptIdList);
        return new PageResponse<Page<SnapReply>>(RespCodeEnum.CODE_0000.getCode(), "请求成功", page);
    }
fzzy-igdss-web/src/main/resources/templates/wx/bind.html
@@ -10,35 +10,43 @@
        .mui-content {
            margin: 0 6px;
        }
        .mui-content-padded {
            margin: 10px;
            width: 96%;
            margin: auto;
            margin-top: 8px;
        }
        .mui-radio {
            float: left;
        }
        .mui-radio.mui-left input[type=radio] {
            left: 1px;
        }
        .mui-checkbox.mui-left label, .mui-radio.mui-left label {
            padding-right: 20px;
            padding-left: 35px;
        }
        .mui-btn-block {
            width: 96%;
            margin: auto;
            margin-top: 10px;
            padding: 8px 0;
        }
        .mui-input-row label ~ input {
            float: left;
            width: 50%;
        }
        .mui-input-row label {
            width: 27%;
        }
        .btn {
            margin-top: 4px;
            margin-right: 2px;
@@ -47,8 +55,14 @@
            color: #fff;
            padding: 5px 5px;
        }
        .ts {
            margin-top: 10px;
        }
        .login-yzm-btn {
            width: 80px;
            height: 38px;
        }
    </style>
</head>
@@ -62,10 +76,14 @@
            </div>
            <div class="mui-input-row">
                <label>验证码</label>
                <input id="code" style="width: 45%;" type="text" class="mui-input-clear" placeholder="5分钟内有效">
                <div id="count">
                    <button type="button" class="btn" onclick="getCheck()">获取验证码</button>
                </div>
                <input id="code" style="width: 45%;" type="text" class="mui-input-clear" placeholder="在此输入验证码">
            </div>
            <div class="mui-input-row" style="height: 60px">
                <label >点击更换验证码</label>
                <a href="javascript:void(0);" title="点击更换验证码" class="login-yzm-btn">
                    <img class="imgcode"
                         th:src="@{/captcha/captchaImage(type=${captchaType})}"/>
                </a>
            </div>
        </form>
    </div>
@@ -75,96 +93,51 @@
<script th:src="@{/wx/wx-common.js}"></script>
<script th:src="@{/ajax/libs/mui/js/mui.js}"></script>
<script th:inline="javascript">
    var openid = [[${openid}]];  //用户的openid
    var c = 60; //获取验证码后的倒计时
    var captchaType = [[${captchaType}]];  //验证码类型
    mui.init();
    //获取验证码
    function getCheck() {
        var phone = document.getElementById("phone").value;
        if (phone == null || phone.trim() == '') {
            mui.alert("手机号不能为空!", '提示', ["确定"], function() {}, "div");
            return;
        }
        var flag = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phone);
        if (!flag) {
            mui.alert("手机号格式不正确!", '提示', ["确定"], function() {}, "div");
            return;
        }
        //请求参数
        var data = JSON.stringify({
            "data": {
                "openid": openid,
                "mobile": phone
            }
        });
        $.ajax({
            type: "POST",
            url: "../wx/gateway",
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            data: data,
            success: function (result) {
                if (result.code == "0000") {
                    mui.toast("校验码已发送!");
                    //倒计时计数
                    count();
                } else {
                    mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
                }
            }
        });
    }
    function count() {
        $("#count").html('');
        $("#count").addClass("ts");
        var interval = setInterval(function () {//定义定时器
            if (c == 0) {
                clearInterval(interval);//清除定时器
                $("#count").removeClass("ts");
                $("#count").html('<button type="button" class="btn" onclick="getCheck()">获取验证码</button>');
                c = 60;
            } else {
                $("#count").html(c + 's后重试');
                c--;
            }
        }, 1000);
    }
    $('.imgcode').click(function () {
        var url = "../captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
        $(".imgcode").attr("src", url);
    });
    //绑定提交
    function binding() {
        var phone = document.getElementById("phone").value;
        if (phone == null || phone.trim() == '') {
            mui.alert("手机号不能为空!", '提示', ["确定"], function() {}, "div");
            mui.alert("手机号不能为空!", '提示', ["确定"], function () {
            }, "div");
            return;
        }
        var flag = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phone);
        if (!flag) {
            mui.alert("手机号格式不正确!", '提示', ["确定"], function() {}, "div");
            mui.alert("手机号格式不正确!", '提示', ["确定"], function () {
            }, "div");
            return;
        }
        var code = document.getElementById("code").value;
        // if (code == null || code.trim() == '') {
        //     mui.alert("验证码不能为空!", '提示', ["确定"], function() {}, "div");
        //     return;
        // }
        if (code == null || code.trim() == '') {
            mui.alert("验证码不能为空!", '提示', ["确定"], function() {}, "div");
            return;
        }
        var data = {
            "openid": openid,
            "mobile": phone,
            "msgCode": code
        };
        wxCommon.postJson("../wx/bandOpenId", data,function (result) {
        wxCommon.postJson("../wx/bandOpenId", data, function (result) {
            if (result.code == "0000") {
                mui.toast("绑定成功!");
            } else {
                mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
                mui.alert(result.msg, '提示', ["确定"], function () {
                }, "div");
            }
        });
    }
</script>
</body>
</html>
fzzy-igdss-web/src/main/resources/templates/wx/home.html
@@ -171,6 +171,13 @@
    $(function () {
        window.addEventListener('pageshow', function(event) {
            // 如果页面是从缓存中恢复的(包括后退),则重新加载
            if (event.persisted || performance.getEntriesByType('navigation')[0]?.type === 'back_forward') {
                location.reload();
            }
        });
        if (loginType == "WECHAT") {
            $("#bind").css("display", "");
            $("#unbind").css("display", "");
fzzy-igdss-web/src/main/resources/templates/wx/unbind.html
@@ -10,32 +10,39 @@
        .mui-content {
            margin: 0 6px;
        }
        .mui-content-padded {
            margin: 10px;
            width: 96%;
            margin: auto;
            margin-top: 8px;
        }
        .mui-radio.mui-left input[type=radio] {
            left: 1px;
        }
        .mui-checkbox.mui-left label, .mui-radio.mui-left label {
            padding-right: 20px;
            padding-left: 35px;
        }
        .mui-btn-block {
            width: 96%;
            margin: auto;
            margin-top: 10px;
            padding: 8px 0;
        }
        .mui-input-row label ~ input {
            float: left;
            width: 50%;
        }
        .mui-input-row label {
            width: 27%;
        }
        .btn {
            margin-top: 4px;
            margin-right: 2px;
@@ -44,8 +51,14 @@
            color: #fff;
            padding: 5px 5px;
        }
        .ts {
            margin-top: 10px;
        }
        .login-yzm-btn {
            width: 80px;
            height: 38px;
        }
    </style>
</head>
@@ -59,10 +72,14 @@
            </div>
            <div class="mui-input-row">
                <label>验证码</label>
                <input id="code" style="width: 45%;" type="text" class="mui-input-clear" placeholder="5分钟内有效">
                <div id="count">
                    <button type="button" class="btn" onclick="getCheck()">获取验证码</button>
                </div>
                <input id="code" style="width: 45%;" type="text" class="mui-input-clear" placeholder="在此输入验证码">
            </div>
            <div class="mui-input-row" style="height: 60px">
                <label>点击更换验证码</label>
                <a href="javascript:void(0);" title="点击更换验证码" class="login-yzm-btn">
                    <img class="imgcode"
                         th:src="@{/captcha/captchaImage(type=${captchaType})}"/>
                </a>
            </div>
        </form>
    </div>
@@ -74,97 +91,49 @@
<script th:inline="javascript">
    var openid = [[${openid}]];  //用户的openid
    var c = 60; //获取验证码后的倒计时
    var captchaType = [[${captchaType}]];  //验证码类型
    mui.init();
    //获取验证码
    function getCheck() {
        var phone = document.getElementById("phone").value;
        if (phone == null || phone.trim() == '') {
            mui.alert("手机号不能为空", '提示', ["确定"], function() {}, "div");
            return;
        }
        var flag = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phone);
        if (!flag) {
            mui.alert("手机号格式不正确", '提示', ["确定"], function() {}, "div");
            return;
        }
    $('.imgcode').click(function () {
        var url = "../captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
        $(".imgcode").attr("src", url);
    });
        //请求参数
        var data = JSON.stringify({
            "interfaceId": "app_1004",
            "sign": "01",
            "outId": "01-01",
            "reqDateTime": new Date(),
            "data": {
                "openid": openid,
                "mobile": phone
            }
        });
        $.ajax({
            type: "POST",
            url: "../wx/gateway",
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            data: data,
            success: function (result) {
                if (result.code == "0000") {
                    mui.toast("校验码已发送");
                    //倒计时计数
                    count();
                } else {
                    mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
                }
            }
        });
    }
    //倒计时计数
    function count() {
        $("#count").html('');
        $("#count").addClass("ts");
        var interval = setInterval(function () {//定义定时器
            if (c == 0) {
                clearInterval(interval);//清除定时器
                $("#count").removeClass("ts");
                $("#count").html('<button type="button" class="btn" onclick="getCheck()">获取验证码</button>');
                c = 60;
            } else {
                $("#count").html(c + 's后重试');
                c--;
            }
        }, 1000);
    }
    //绑定提交
    function unBinding() {
        var phone = document.getElementById("phone").value;
        if (phone == null || phone.trim() == '') {
            mui.alert("手机号不能为空!", '提示', ["确定"], function() {}, "div");
            mui.alert("手机号不能为空!", '提示', ["确定"], function () {
            }, "div");
            return;
        }
        var flag = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phone);
        if (!flag) {
            mui.alert("手机号格式不正确!", '提示', ["确定"], function() {}, "div");
            mui.alert("手机号格式不正确!", '提示', ["确定"], function () {
            }, "div");
            return;
        }
        var code = document.getElementById("code").value;
        // if (code == null || code.trim() == '') {
        //     mui.alert("验证码不能为空!", '提示', ["确定"], function() {}, "div");
        //     return;
        // }
        if (code == null || code.trim() == '') {
            mui.alert("验证码不能为空!", '提示', ["确定"], function () {
            }, "div");
            return;
        }
        var data = {
            "openid": openid,
            "mobile": phone,
            "msgCode": code
        };
        wxCommon.postJson("../wx/unBandOpenId", data,function (result) {
        wxCommon.postJson("../wx/unBandOpenId", data, function (result) {
            if (result.code == "0000") {
                mui.toast("解绑成功!");
            } else {
                mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
                mui.alert(result.msg, '提示', ["确定"], function () {
                }, "div");
            }
        });
    }
fzzy-igdss-web/src/main/resources/templates/wx/warn-detail.html
@@ -127,9 +127,17 @@
<script th:inline="javascript">
    var warnId = [[${id}]];  //设备id
    var companyId = [[${companyId}]];  //组织编码
    var deptList = [[${deptList}]];
    var userName = [[${userName}]];    //当前操作人账号
    var loginType = [[${loginType}]];  //登录方式
    var deptListMap = {};
    $(function () {
        //所有库区
        if (deptList) {
            for (var i = 0; i < deptList.length; i++) {
                deptListMap[deptList[i].id] = deptList[i];
            }
        }
        mui.init();
        try {
            getDeviceList();
@@ -158,11 +166,11 @@
    //初始化页面数据
    function initData(data) {
        var deptName = deptListMap[data.deptId] ? deptListMap[data.deptId].kqmc : data.deptId;
        var html1 = '';
        var html2 = '';
        html1 += '<h4 class="mui-ellipsis">' + data.id;
        html1 += '<span class="first">' + data.deptId + '</span></h4>';
        html1 += '<h4 class="mui-ellipsis">' +deptName;
        html1 += '<h5 class="mui-ellipsis">' + data.createTime + '</h5>';
        html1 += '<p>' + data.content + '</p>';
fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html
@@ -73,6 +73,7 @@
<script th:src="@{/ajax/libs/mui/js/mui.js}"></script>
<script th:inline="javascript">
    var loginType = [[${loginType}]];  //登录方式
    var deptList = [[${deptList}]];
    var userName = [[${userName}]];
    openid = [[${openid}]];  //用户的openid
    SERVE_URL = location.href.split("/wx/")[0];  //服务域名
@@ -81,7 +82,15 @@
    var total;
    var pageCount;  //总页码数
    var warnList;  //每页数据
    var deptListMap = {};
    $(function () {
        //所有库区
        if (deptList) {
            for (var i = 0; i < deptList.length; i++) {
                deptListMap[deptList[i].id] = deptList[i];
            }
        }
        // 监听页面显示事件(微信 H5 环境)
        window.addEventListener('pageshow', function() {
            if (localStorage.getItem('needRefresh') === 'true') {
@@ -139,12 +148,14 @@
        mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageNo>=pageCount));
        var table = document.body.querySelector('.mui-table-view');
        for (var i = 0; i < warnList.length; i++) {
            var deptName = deptListMap[warnList[i].deptId] ? deptListMap[warnList[i].deptId].kqmc : warnList[i].deptId;
            console.log(deptListMap);
            var li = document.createElement('li');
            li.className = 'mui-table-view-cell';
            var html = '';
            html += '<div onclick="toWarnDetail(\'' + warnList[i].id +'\',\'' + warnList[i].companyId + '\')" class="mui-table">';
            html += '<div class="mui-table-cell mui-col-xs-10"><h4 class="mui-ellipsis">' + warnList[i].id;
            html += '</span></h4><h5>所属库区:<span>' + warnList[i].deptId;
            html += '</span></h4><h5>所属库区:<span>' + deptName;
            html += '</span></h5><h5>警告时间:<span>' + warnList[i].createTime;
            html += '</span></h5><p class="mui-h6 mui-ellipsis">警告说明:' +warnList[i].content;
            li.innerHTML = html;