智慧保安后台管理-外网
Administrator
2022-06-16 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02
src/main/java/org/springblade/modules/licence/controller/LicencePaperController.java
@@ -3,16 +3,22 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.common.utils.DesensitizedUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.information.entity.Information;
import org.springblade.modules.licence.entity.LicencePaper;
import org.springblade.modules.licence.service.LicencePaperService;
import org.springblade.modules.licence.vo.LicencePaperVo;
import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
 * @author zhongrj
@@ -25,6 +31,8 @@
public class LicencePaperController {
   private final LicencePaperService licencePaperService;
   private final MyAsyncService myAsyncService;
//   /**
@@ -64,13 +72,64 @@
    */
   @PostMapping("/submit")
   public R submit(@RequestBody LicencePaper licencePaper){
      LicencePaper licencePaper1 = Objects.requireNonNull(BeanUtil.copy(licencePaper, LicencePaper.class));
      //脱敏处理
      if (null!= licencePaper.getApprovalNumber() && !licencePaper.getApprovalNumber().equals("")){
         licencePaper.setApprovalNumber(DesensitizedUtil.desensitizedSecurityNumber(licencePaper.getApprovalNumber()));
      }
      if (null!= licencePaper.getLicenceIssuingUnit() && !licencePaper.getLicenceIssuingUnit().equals("")){
         licencePaper.setLicenceIssuingUnit(DesensitizedUtil.desensitizedSecurityNumber(licencePaper.getLicenceIssuingUnit()));
      }
      if (null!= licencePaper.getRegisterCapital() && !licencePaper.getRegisterCapital().equals("")){
         licencePaper.setRegisterCapital("**");
      }
      if (null!= licencePaper.getCode() && !licencePaper.getCode().equals("")){
         licencePaper.setCode(DesensitizedUtil.desensitizedSecurityNumber(licencePaper.getCode()));
      }
      if (null==licencePaper.getId()){
         licencePaper.setCreateTime(new Date());
         licencePaper.setUpdateTime(new Date());
         licencePaperService.save(licencePaper);
         //内网同步
         String s = "insert into sys_licence_paper(" +
            "id,type,unit_name,address,legal_people,content,approval_number,licence_issuing_unit,register_capital,code," +
            "licence_issuing_time,create_user,create_time,update_time,dept_id,url) " +
            "values(" + "'" + licencePaper.getId() + "'" + "," +
            "'" + licencePaper1.getType() + "'" + "," +
            "'" + licencePaper1.getUnitName() + "'" + "," +
            "'" + licencePaper1.getLegalPeople() + "'" + "," +
            "'" + licencePaper1.getContent() + "'" + "," +
            "'" + licencePaper1.getApprovalNumber() + "'" + "," +
            "'" + licencePaper1.getLicenceIssuingUnit() + "'" + "," +
            "'" + licencePaper1.getRegisterCapital() + "'" + "," +
            "'" + licencePaper1.getCode() + "'" + "," +
            "'" + new SimpleDateFormat("yyyy-MM-dd").format(licencePaper1.getLicenceIssuingTime()) + "'" + "," +
            "'" + licencePaper1.getCreateUser() + "'" + "," +
            "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(licencePaper1.getCreateTime()) + "'" +
            "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(licencePaper1.getUpdateTime()) + "'" +
            "," + "'" + licencePaper1.getDeptId() + "'" +
            "," + "'" + licencePaper1.getUrl() + "'"
            + ")";
         myAsyncService.FTP(s);
      }else {
         licencePaper.setUpdateTime(new Date());
         licencePaperService.updateById(licencePaper);
         //内网同步
         String s1 =
            "update sys_licence_paper set unit_name = " + "'" + licencePaper1.getUnitName() + "'"
               + ",address = " + "'" + licencePaper1.getAddress() + "'"
               + ",legal_people = " + "'" + licencePaper1.getLegalPeople() + "'"
               + ",content = " + "'" + licencePaper1.getContent() + "'"
               + ",approval_number = " + "'" + licencePaper1.getApprovalNumber() + "'"
               + ",licence_issuing_unit = " + "'" + licencePaper1.getLicenceIssuingUnit() + "'"
               + ",register_capital = " + "'" + licencePaper1.getRegisterCapital() + "'"
               + ",code = " + "'" + licencePaper1.getCode() + "'"
               + ",licence_issuing_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(licencePaper1.getLicenceIssuingTime())  + "'"
               + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(licencePaper1.getUpdateTime()) + "'"
               + ",dept_id = " + "'" + licencePaper1.getDeptId() + "'"
               + ",url = " + "'" + licencePaper1.getUrl() + "'"
               + " " + "where id = " + "'" + licencePaper1.getId() + "'";
         myAsyncService.FTP(s1);
      }
      return R.data(licencePaper);
   }
@@ -145,6 +204,13 @@
    */
   @PostMapping("/remove")
   public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
      //内网删除
      List<Long> list = Func.toLongList(ids);
      list.forEach(id -> {
         //内网同步
         String s1 = "delete from sys_licence_paper where id = " + "'" + id + "'";
         myAsyncService.FTP(s1);
      });
      return R.status(licencePaperService.removeByIds(Func.toLongList(ids)));
   }