智慧保安后台管理-外网-验收版本
tangzy
2021-12-04 ebb5012dc221db17bfad74c3bdfd91d46aa29c03
src/main/java/org/springblade/modules/revoke/controller/RevokeController.java
@@ -27,17 +27,19 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.revoke.entity.Revoke;
import org.springblade.modules.revoke.service.IRevokeService;
import org.springblade.modules.revoke.vo.RevokeVO;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
/**
 *  控制器
 * 控制器
 *
 * @author BladeX
 * @since 2021-07-12
@@ -68,6 +70,7 @@
   @ApiOperationSupport(order = 2)
   @ApiOperation(value = "分页", notes = "传入revoke")
   public R<IPage<Revoke>> list(Revoke revoke, Query query) {
      revoke.setStorage("1");
      IPage<Revoke> pages = revokeService.page(Condition.getPage(query), Condition.getQueryWrapper(revoke));
      return R.data(pages);
   }
@@ -91,35 +94,52 @@
   @ApiOperation(value = "新增", notes = "传入revoke")
   public R save(@Valid @RequestBody Revoke revoke) {
      String cardid = revoke.getCardid();
      Map map = revokeService.selectIn(cardid);
      if (map!=null){
      String type = revoke.getPtype();
      Map map = revokeService.selectIn(cardid,type);
      if (map != null) {
         String id = map.get("id").toString();
         revokeService.removeByIds(Func.toLongList(id));
      }
      revoke.setStorage("1");
      revoke.setType("2");
      revoke.setPtype("6");
      revoke.setPermitime(new Date());
      return R.status(revokeService.save(revoke));
      revokeService.save(revoke);
//      String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(revoke.getEstablishtime());
//      String pertime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(revoke.getPermitime());
//      String s = "insert into sys_revoke(id,creditCode,enterpriseName,representative,establishTime," +
//         "registeredCapital,organizationCode,registrationNumber,identificationNumber,enterprises," +
//         "address,business,region,registration,industry,type,permitime,deptid,ptype,representativecell,contacts,contactscell,reason,jurisdiction,cardid)" +
//         "values(" + "'" + revoke.getId() + "'" + "," + "'" + revoke.getCreditcode() + "'" + "," + "'" + revoke.getEnterprisename() + "'" + "," + "'"
//         + revoke.getRepresentative() + "'" + "," +
//         "'" + formatStr + "'" + "," + "'" + revoke.getRegisteredcapital() + "'" + "," + "'"
//         + revoke.getOrganizationcode() + "'" + "," + "'" + revoke.getRegistrationnumber() + "'" + "," +
//         "'" + revoke.getIdentificationnumber() + "'" + "," + "'" + revoke.getEnterprises() + "'" + "," + "'" +
//         revoke.getAddress() + "'" + "," + "'" + revoke.getBusiness() + "'" + "," + "'" +
//         revoke.getRegion() + "'" + "," + "'" + revoke.getRegistration() + "'" + "," + "'" + revoke.getIndustry() + "'" + "," + "'"
//         + revoke.getType() + "'" + "," +
//         "'" + pertime + "'" + "," + "'" + revoke.getDeptid() + "'" + "," + "'" + revoke.getPtype() + "'" + "," +
//         "'" + revoke.getRepresentativecell() + "'" + "," + "'" + revoke.getContacts() + "'" + "," + "'" + revoke.getContactscell() + "'" + "," +
//         "'" + revoke.getReason() + "'" + "," + "'" + revoke.getJurisdiction() + "'" +"," + "'" + revoke.getCardid() + "'"+ ")";
//      FtpUtil.sqlFileUpload(s);
      return R.success("成功");
   }
   /**
    *暂存
    * 暂存
    */
   @PostMapping("/revokesave")
   @ApiOperationSupport(order = 4)
   @ApiOperation(value = "新增", notes = "传入revoke")
   public R revokesave(@Valid @RequestBody Revoke revoke) {
      String cardid = revoke.getCardid();
      Map map = revokeService.selectIn(cardid);
      if (map!=null){
      String type = revoke.getPtype();
      Map map = revokeService.selectIn(cardid,type);
      if (map != null) {
         revoke.setStorage("0");
         revokeService.updateById(revoke);
      }
      else {
      } else {
         revoke.setStorage("0");
         revoke.setType("2");
         revoke.setPtype("6");
         revoke.setPermitime(new Date());
         revokeService.save(revoke);
      }
@@ -158,8 +178,8 @@
   }
   @PostMapping("/selectIn")
   public R selectIn(String cardid) {
      Map map = revokeService.selectIn(cardid);
   public R selectIn(String cardid,String type) {
      Map map = revokeService.selectIn(cardid,type);
      return R.data(map);
   }