智慧保安后台管理项目备份
tangzy
2021-08-31 4ecf2dbe2c255c3b556ff4bfb49b4e2e8285bd17
src/main/java/org/springblade/modules/permit/controller/PermitController.java
@@ -33,12 +33,14 @@
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.information.entity.Information;
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.permit.entity.Permit;
import org.springblade.modules.permit.service.IPermitService;
import org.springblade.modules.permit.vo.PermitVO;
import org.springblade.modules.punish.entity.Punish;
import org.springblade.modules.resource.service.IAttachService;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
@@ -47,6 +49,7 @@
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@@ -69,6 +72,7 @@
   private final IDeptService iDeptService;
   private final IInformationService informationService;
   private final IUserService userService;
   private final IAttachService attachService;
   /**
    * 详情
    */
@@ -142,11 +146,25 @@
         information.setContacts(permit.getContacts());
         information.setContactscell(permit.getContactscell());
         Dept dept = new Dept();
         Long i = 1413470343230877697L;
         dept.setParentId(i);
         //本市公司
         if (permit.getPtype().equals("0")){
            Long i = 1413470343230877697L;
            dept.setParentId(i);
            dept.setAncestors("0,1413470343230877697");
         }
         //培训公司
         else if (permit.getPtype().equals("1")){
            Long i = 1418458374477549569L;
            dept.setParentId(i);
            dept.setAncestors("0,1418458374477549569");
         }
         else{
            Long i = 1420222961377357825L;
            dept.setParentId(i);
            dept.setAncestors("0,1420222961377357825");
         }
         dept.setTenantId("000000");
         dept.setDeptName(information.getEnterprisename());
         dept.setAncestors("0,1413470343230877697");
         dept.setDeptCategory(1);
         if (iDeptService.submit(dept)) {
            CacheUtil.clear(SYS_CACHE);
@@ -163,6 +181,16 @@
         String initPassword = ParamCache.getValue(DEFAULT_PARAM_PASSWORD);
         user.setPassword(initPassword);
         userService.saveOrUpdate(user);
         //把附件添加单位id
         attachService.updat(information.getDepartmentid(),permit.getCardid());
         String s1 = "update sys_permit set type = " + "'" + 0 + "'" +",approve = " + "'" + permit.getApprove() + "'"+
               " " +"where id = " + "'" + permit.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
      }
      else {
         String s1 = "update sys_permit set type = " + "'" + 1 + "'" +",approve = " + "'" + permit.getApprove() + "'"+
            " " +"where id = " + "'" + permit.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
      }
      return R.status(permitService.updateById(permit));
   }