wanghaicheng 5 năm trước cách đây
mục cha
commit
b03c05a491

+ 0 - 100
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/controller/PropertyCertificateController.java

@@ -1,100 +0,0 @@
-package cn.com.ty.lift.enterprise.custom.controller;
-
-
-import cn.com.ty.lift.enterprise.custom.dao.entity.PropertyCertificate;
-import cn.com.ty.lift.enterprise.custom.service.impl.PropertyCertificateServiceImpl;
-import cn.com.xwy.boot.web.dto.RestResponse;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-//未使用
-//未使用
-//未使用
-//未使用
-
-//@RestController
-//@RequestMapping("/property-certificate")
-@AllArgsConstructor
-/**
- * @author wang-hai-cheng
- * @date 2019/11/27
- * @description
- * 物管安全证表 前端控制器
- */
-public class PropertyCertificateController {
-    private final PropertyCertificateServiceImpl propertyCertificateService;
-
-    @GetMapping("/page")
-    /**
-     * @description id顺序+分页物管安全证列表
-     * @date 2019/11/27 11:33
-     * @param [current, size]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse page(@RequestParam Integer current,@RequestParam Integer size) {
-        Page<PropertyCertificate> page = new Page<>(current, size);
-        return RestResponse.ok(propertyCertificateService.page(page), "1","查询成功");
-    }
-
-    @GetMapping("/{id}")
-    /**
-     * @description id查询物管安全证
-     * @date 2019/11/27 12:18
-     * @param [id]
-     * @return cn.com.ty.lift.enterprise.custom.entity.PropertyCertificate
-     */
-    public RestResponse propertyCertificate(@PathVariable int id) {
-        PropertyCertificate byId = propertyCertificateService.getById(id);
-        if (null != byId) {
-            return RestResponse.ok(byId, "1","查询成功");
-        } else {
-            return RestResponse.ok(null,"9","无数据");
-        }
-    }
-
-    @PostMapping("/save")
-    /**
-     * @description 新增物管安全证
-     * @date 2019/11/27 12:21
-     * @param [propertyCertificate]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse save(@RequestBody PropertyCertificate propertyCertificate) {
-        if (propertyCertificateService.save(propertyCertificate)) {
-            return RestResponse.ok(null,"1", "保存成功");
-        } else {
-            return RestResponse.ok(null,"0","保存失败");
-        }
-    }
-
-    @PostMapping("/update")
-    /**
-     * @description 根据id更新物管安全证信息
-     * @date 2019/11/27 12:21
-     * @param [propertyCertificate]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse update(@RequestBody PropertyCertificate propertyCertificate) {
-        if (propertyCertificateService.updateById(propertyCertificate)) {
-            return RestResponse.ok(null,"1", "更新成功");
-        } else {
-            return RestResponse.ok(null,"0","更新失败");
-        }
-    }
-
-    @GetMapping("/delete")
-    /**
-     * @description 根据id删除物管安全证
-     * @date 2019/11/27 12:22
-     * @param [id]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse delete(@RequestParam int id) {
-        if (propertyCertificateService.removeById(id)) {
-            return RestResponse.ok(null, "1","删除成功");
-        } else {
-            return RestResponse.ok(null,"0","删除失败");
-        }
-    }
-}

+ 9 - 3
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/controller/PropertyCompanyController.java

@@ -7,8 +7,9 @@ import cn.com.xwy.boot.web.dto.RestResponse;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 @RestController
@@ -58,9 +59,9 @@ public class PropertyCompanyController {
      */
     public RestResponse add(@RequestBody PropertyCompany propertyCompany) {
         if (propertyCompanyService.save(propertyCompany)) {
-            return RestResponse.ok(null,"1","新增成功");
+            return RestResponse.ok(null, "1", "新增成功");
         }
-        return RestResponse.ok(null,"0","新增失败");
+        return RestResponse.ok(null, "0", "新增失败");
     }
 
     @PostMapping("/update")
@@ -98,4 +99,9 @@ public class PropertyCompanyController {
         }
         return RestResponse.ok(propertyCompanies, "1", "查询成功");
     }
+
+    @GetMapping("/export")
+    public void export(HttpServletRequest request, HttpServletResponse response) {
+        propertyCompanyService.export();
+    }
 }

+ 0 - 82
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/entity/PropertyCertificate.java

@@ -1,82 +0,0 @@
-package cn.com.ty.lift.enterprise.custom.dao.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-
-/**
- * <p>
- * 物管安全证表
- * </p>
- *
- * @author wang-hai-cheng
- * @since 2019-11-11
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-public class PropertyCertificate implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 用户id
-     */
-    @TableId(value = "user_id",type = IdType.ID_WORKER)
-    private Long userId;
-
-    /**
-     * 证书编号
-     */
-    @TableField("certificate_code")
-    private String certificateCode;
-
-    /**
-     * 档案编号
-     */
-    @TableField("archives_code")
-    private String archivesCode;
-
-    /**
-     * 发证机关
-     */
-    @TableField("issuing_authority")
-    private String issuingAuthority;
-
-    /**
-     * 有效日期
-     */
-    @TableField("active_date")
-    private LocalDate activeDate;
-
-    /**
-     * 证书图片1
-     */
-    @TableField("certificate1")
-    private String certificate1;
-
-    /**
-     * 证书图片2
-     */
-    @TableField("certificate2")
-    private String certificate2;
-
-    /**
-     * 创建时间
-     */
-    @TableField("create_time")
-    private LocalDateTime createTime;
-
-    /**
-     * 物管安全证id
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
-}

+ 0 - 15
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/mapper/PropertyCertificateMapper.java

@@ -1,15 +0,0 @@
-package cn.com.ty.lift.enterprise.custom.dao.mapper;
-
-import cn.com.ty.lift.enterprise.custom.dao.entity.PropertyCertificate;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- * 物管安全证表 Mapper 接口
- * </p>
- *
- * @author wang-hai-cheng
- * @since 2019-11-11
- */
-public interface PropertyCertificateMapper extends BaseMapper<PropertyCertificate> {
-}

+ 0 - 16
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/PropertyCertificateService.java

@@ -1,16 +0,0 @@
-package cn.com.ty.lift.enterprise.custom.service;
-
-import cn.com.ty.lift.enterprise.custom.dao.entity.PropertyCertificate;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * <p>
- * 物管安全证表 服务类
- * </p>
- *
- * @author wang-hai-cheng
- * @since 2019-11-11
- */
-public interface PropertyCertificateService extends IService<PropertyCertificate> {
-
-}

+ 0 - 22
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCertificateServiceImpl.java

@@ -1,22 +0,0 @@
-package cn.com.ty.lift.enterprise.custom.service.impl;
-
-import cn.com.ty.lift.enterprise.custom.dao.entity.PropertyCertificate;
-import cn.com.ty.lift.enterprise.custom.dao.mapper.PropertyCertificateMapper;
-import cn.com.ty.lift.enterprise.custom.service.PropertyCertificateService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * <p>
- * 物管安全证表 服务实现类
- * </p>
- *
- * @author wang-hai-cheng
- * @since 2019-11-11
- */
-@Service
-@Transactional
-public class PropertyCertificateServiceImpl extends ServiceImpl<PropertyCertificateMapper, PropertyCertificate> implements PropertyCertificateService {
-
-}

+ 24 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCompanyServiceImpl.java

@@ -6,6 +6,8 @@ import cn.com.ty.lift.enterprise.custom.dao.entity.model.PropertyCompanyReq;
 import cn.com.ty.lift.enterprise.custom.dao.mapper.PropertyCompanyMapper;
 import cn.com.ty.lift.enterprise.custom.service.PropertyCompanyService;
 import cn.com.xwy.boot.web.dto.RestResponse;
+import cn.hutool.poi.excel.ExcelUtil;
+import cn.hutool.poi.excel.ExcelWriter;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -83,4 +85,26 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         }
         return RestResponse.ok(records, "1", "查询成功");
     }
+
+    public void export() {
+        ExcelWriter writer = ExcelUtil.getWriter("客户列表.xls");
+        //设置列别名
+        paramMap.forEach(writer::addHeaderAlias);
+        writer.write(this.list(), true);
+        writer.autoSizeColumnAll();
+        writer.close();
+    }
+
+    private Map<String, String> paramMap = new HashMap<String, String>() {{
+        put("id", "客户id");
+        put("mtCompanyId", "维保公司id");
+        put("code", "编号");
+        put("name", "名称");
+        put("address", "地址");
+        put("mailingAddress", "通讯地址");
+        put("actualNum", "系统台量");
+        put("address", "项目地址");
+        put("startDate", "开始时间");
+        put("endDate", "结束时间");
+    }};
 }

+ 3 - 6
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/service/impl/QuanNewsServiceImpl.java

@@ -5,7 +5,6 @@ import cn.com.ty.lift.quan.news.dao.entity.QuanNews;
 import cn.com.ty.lift.quan.news.dao.mapper.QuanNewsMapper;
 import cn.com.ty.lift.quan.news.service.QuanNewsService;
 import cn.com.xwy.boot.web.dto.RestResponse;
-import com.aliyun.oss.model.PutObjectResult;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -85,23 +84,23 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
             //如果不是置顶新闻
             return RestResponse.ok(null, "1", "不是置顶新闻");
         }
-        byId.setTopSerial(0);
         List<QuanNews> tops = this.list(new QueryWrapper<QuanNews>().select("id", "top_serial").ne("top_serial", 0).ne("id", id));
         //如果置顶新闻为0个
         if (tops.isEmpty()) {
+            byId.setTopSerial(0);
             if (this.updateById(byId)) {
                 return RestResponse.ok(null, "1", "取消置顶成功");
             } else {
                 return RestResponse.ok(null, "0", "取消置顶失败");
             }
         }
-
         //比这个新闻排序大的都 序号-1
         tops.forEach(top -> {
             if (top.getTopSerial() > byId.getTopSerial()) {
                 top.setTopSerial(top.getTopSerial() - 1);
             }
         });
+        byId.setTopSerial(0);
         if (this.updateById(byId) && this.updateBatchById(tops)) {
             return RestResponse.ok(null, "1", "取消置顶成功");
         } else {
@@ -127,7 +126,6 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
     }
 
     public RestResponse addNew(QuanNews quanNews, MultipartFile videoFile, Integer isTop) {
-//            String title, String content, MultipartFile videoFile, Integer isTop, Long releaseId, String releaseUser
         //上传视频到Oss,获取视频地址
         //上传视频到Oss,获取视频地址
         //获取发布人名称
@@ -224,8 +222,7 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
         String fileName = IdWorker.getIdStr() + "." + substring;
         new Thread(() -> {
             try {
-                ////////////////需要判断是否成功
-                 new AliyunOSSUtil().putObject("temp15827479607", videoFile.getBytes(), fileName);
+                new AliyunOSSUtil().putObject("temp15827479607", videoFile.getBytes(), fileName);
             } catch (IOException e) {
                 e.printStackTrace();
             }