洪城义警-正式版后台
zengh
2021-11-03 ea3e9f895c76e2ea8e1df1bb512613d891c85454
src/main/java/org/springblade/modules/zc/controller/ZcController.java
@@ -29,6 +29,7 @@
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.zc.entity.Zc;
@@ -92,6 +93,10 @@
   public R<IPage<ZcVO>> page(ZcVO zc, Query query) {
      //获取部门数据
      List<DeptVo> deptVos = deptFeignApi.selDeptList();
      //获取辖区数据
      List<DeptVo> xqVos = deptFeignApi.selXQList();
      IPage<ZcVO> page = zcService.selectZcPage(Condition.getPage(query), zc);
      for (int j = 0; j < page.getRecords().size(); j++) {
         if (page.getRecords().get(j).getDeptid() != null && !page.getRecords().get(j).getDeptid().equals("")){
@@ -108,6 +113,24 @@
            }
            //封装部门名称数据
            page.getRecords().get(j).setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1));
         }
      }
      for (int j = 0; j < page.getRecords().size(); j++) {
         if (page.getRecords().get(j).getJurisdiction() != null && !page.getRecords().get(j).getJurisdiction().equals("")){
            String[] split = page.getRecords().get(j).getJurisdiction().split(",");
            List<String> list = Arrays.asList(split);
            StringBuffer deptNameBuiffer = new StringBuffer();
            //数据匹配封装
            for (String deptId:list) {
               for (DeptVo deptVo:xqVos) {
                  if (deptId.equals(deptVo.getId().toString())){
                     deptNameBuiffer.append(deptVo.getDeptName()).append(",");
                  }
               }
            }
            //封装部门名称数据
            page.getRecords().get(j).setXQName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1));
         }
      }
@@ -151,9 +174,26 @@
         user.setPhone(zc.getPhone());
         user.setDeptId(zc.getDeptid());
         user.setRoleId(zc.getParentId());
         user.setJurisdiction(zc.getJurisdiction());
         user.setExamination_type("0");
         user.setExamination_mx("正常");
         user.setCardid(zc.getCardid());
         iUserService.saveOrUpdate(user);
         String s = "insert into blade_user(id,tenant_id,account,password,name,real_name,avatar,email,phone,sex,role_id,dept_id,cardid," +
            "jurisdiction,examination_type,status,is_deleted) " +
            "values(" + "'" + user.getId() + "'" + "," + "'" + user.getTenantId() + "'" + "," + "'" + user.getAccount() + "'" + "," +
            "'" + user.getPassword() + "'" + "," + "'" + user.getName() + "'" + "," + "'" + user.getRealName() + "'" + "," + "'" + user.getAvatar() + "'" + "," +
            "'" + user.getEmail() + "'" + "," + "'" + user.getPhone() + "'" + "," + "'" + user.getSex() + "'" + "," + "'" + user.getRoleId() + "'" +
            "," + "'" + user.getDeptId() + "'" +
            "," + "'" + user.getCardid() + "'" +
            "," + "'" + user.getJurisdiction() + "'" +
            "," + "'" + user.getExamination_type() + "'" +
            "," + "'" + user.getStatus() + "'" +
            "," + "'" + user.getIsDeleted() + "'" + ")";
         System.out.println(s);
         FtpUtil.sqlFileUpload(s);
      }
      return R.status(zcService.saveOrUpdate(zc));
   }