5 年之前
父节点
当前提交
109c879fee

+ 16 - 0
pcbms/src/main/java/com/hssx/pcbms/controller/GoodsController.java

@@ -282,6 +282,22 @@ public class GoodsController {
         HttpRespMsg msg = goodsService.isMaintainRecord(goods,page);
         return msg;
     }
+    /**
+     * 维护资产记录的excel导出
+     * 参数:
+     * id:资产id
+     *
+     * @return
+     */
+    @ApiOperation(value = "维护资产记录的excel导出", notes = "维护资产记录的excel导出方法")
+    @RequestMapping("/isMaintainRecordExcel")
+    @ResponseBody
+    public HttpRespMsg isMaintainRecordExcel(Goods goods) {
+        HttpRespMsg msg = goodsService.isMaintainRecordExcel(goods);
+        return msg;
+    }
+
+
 
 }
 

+ 31 - 1
pcbms/src/main/java/com/hssx/pcbms/entity/Goods.java

@@ -12,7 +12,7 @@ import java.io.Serializable;
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-10-29
+ * @since 2019-11-05
  */
 public class Goods extends Model<Goods> {
 
@@ -90,6 +90,18 @@ public class Goods extends Model<Goods> {
     @TableField("creator_id")
     private Integer creatorId;
 
+    /**
+     * 用于比较的部门代码
+     */
+    @TableField("division_code")
+    private String divisionCode;
+
+    /**
+     * 用于比较的前缀代码
+     */
+    @TableField("suffix_code")
+    private String suffixCode;
+
 
     public Integer getId() {
         return id;
@@ -187,6 +199,22 @@ public class Goods extends Model<Goods> {
         this.creatorId = creatorId;
     }
 
+    public String getDivisionCode() {
+        return divisionCode;
+    }
+
+    public void setDivisionCode(String divisionCode) {
+        this.divisionCode = divisionCode;
+    }
+
+    public String getSuffixCode() {
+        return suffixCode;
+    }
+
+    public void setSuffixCode(String suffixCode) {
+        this.suffixCode = suffixCode;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -207,6 +235,8 @@ public class Goods extends Model<Goods> {
         ", nextIndate=" + nextIndate +
         ", isDelete=" + isDelete +
         ", creatorId=" + creatorId +
+        ", divisionCode=" + divisionCode +
+        ", suffixCode=" + suffixCode +
         "}";
     }
 }

+ 10 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/vo/GoodsVO.java

@@ -1,5 +1,6 @@
 package com.hssx.pcbms.entity.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.hssx.pcbms.entity.Goods;
 import com.hssx.pcbms.entity.GoodsNo;
 import lombok.Data;
@@ -17,6 +18,15 @@ public class GoodsVO extends Goods {
     private Integer number = 0;//数量
     private String deptStr;//部门编号
     private String goodStr;//产品编号
+    /**
+     * 用于比较的部门代码
+     */
+    private String divisionCode;
+
+    /**
+     * 用于比较的前缀代码
+     */
+    private String suffixCode;
     private List<GoodsNo> goodsNos;
     private List<GoodsNoVO> goodsNosVO;
     private Integer userId;

+ 2 - 0
pcbms/src/main/java/com/hssx/pcbms/service/GoodsService.java

@@ -49,4 +49,6 @@ public interface GoodsService extends IService<Goods> {
     HttpRespMsg isMaintainRecord(Goods goods,PageUtil page);
 
     HttpRespMsg myList(PageUtil page, String keyName, Integer uid);
+
+    HttpRespMsg isMaintainRecordExcel(Goods goods);
 }

+ 47 - 1
pcbms/src/main/java/com/hssx/pcbms/service/impl/GoodsServiceImpl.java

@@ -26,6 +26,8 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -198,7 +200,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
     @Override
     public HttpRespMsg goodsNoAdd(GoodsNo goodsNo,Integer count) {
         HttpRespMsg msg = new HttpRespMsg();
-        GoodsNo oldGoodsNo = goodsNoMapper.selectOne(new QueryWrapper<GoodsNo>().eq("good_id", goodsNo.getGoodsId()).orderByDesc("id").last("limit 1"));
+        GoodsNo oldGoodsNo = goodsNoMapper.selectOne(new QueryWrapper<GoodsNo>().eq("goods_id", goodsNo.getGoodsId()).orderByDesc("id").last("limit 1"));
         String prefix = oldGoodsNo.getModelNo().substring(0,oldGoodsNo.getModelNo().length()-4);
         Integer start = Integer.parseInt(oldGoodsNo.getModelNo().substring(oldGoodsNo.getModelNo().length()-4));
         List<GoodsNo> goodsNoList = new ArrayList<>();
@@ -292,6 +294,50 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return msg;
     }
 
+    @Override
+    public HttpRespMsg isMaintainRecordExcel(Goods goods) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<MaintainRecordVO> recordList = maintainRecordMapper.getRecordList(goods);
+        List<List<String>> list = new ArrayList<List<String>>();
+        //标题
+        List<String> titleList = new ArrayList<String>();
+        titleList.add("资产编号");
+        titleList.add("处置人");
+        titleList.add("处置时间");
+        titleList.add("操作内容");
+        list.add(titleList);
+        SimpleDateFormat dateSdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat dateSdf = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat dateSdf2 = new SimpleDateFormat("yyyy年MM月dd+HH时mm分ss秒");
+        for (MaintainRecordVO dynamic : recordList) {
+            List<String> rowList = new ArrayList<String>();
+            //资产编号
+//            rowList.add(dynamic.getFileName());
+//            //操作者名字
+//            rowList.add(dynamic.getOperatorName());
+//            //文件类型
+//            if (dynamic.getBelongType() == 0) {
+//                rowList.add("模具文档");
+//            } else if (dynamic.getBelongType() == 1) {
+//                rowList.add("零件文档");
+//            } else if (dynamic.getBelongType() == 2) {
+//                rowList.add("试模验收");
+//            } else if (dynamic.getBelongType() == 3) {
+//                rowList.add("保养方案");
+//            } else if (dynamic.getBelongType() == 4) {
+//                rowList.add("模具更新");
+//            } else if (dynamic.getBelongType() == 5) {
+//                rowList.add("模具报废");
+//            }
+            //下载时间
+
+            rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(dynamic.getIndate())
+            );
+            list.add(rowList);
+        }
+        return null;
+    }
+
     public static void main(String[] args) {
 //        String format = String.format("%04d", 0);
 //        System.out.println(format);

+ 1 - 1
pcbms/src/main/java/com/hssx/pcbms/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("permission");
+        strategy.setInclude("goods");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 21 - 16
pcbms/src/main/resources/mapper/GoodsMapper.xml

@@ -4,26 +4,27 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.Goods">
-        <id column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="tag_id" property="tagId"/>
-        <result column="model_number" property="modelNumber"/>
-        <result column="unit" property="unit"/>
-        <result column="address" property="address"/>
-        <result column="factory" property="factory"/>
-        <result column="pic" property="pic"/>
-        <result column="service_life" property="serviceLife"/>
-        <result column="next_indate" property="nextIndate"/>
-        <result column="is_delete" property="isDelete"/>
-        <result column="creator_id" property="creatorId"/>
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="tag_id" property="tagId" />
+        <result column="model_number" property="modelNumber" />
+        <result column="unit" property="unit" />
+        <result column="address" property="address" />
+        <result column="factory" property="factory" />
+        <result column="pic" property="pic" />
+        <result column="service_life" property="serviceLife" />
+        <result column="next_indate" property="nextIndate" />
+        <result column="is_delete" property="isDelete" />
+        <result column="creator_id" property="creatorId" />
+        <result column="division_code" property="divisionCode" />
+        <result column="suffix_code" property="suffixCode" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, tag_id, model_number, unit, address, factory, pic, service_life, next_indate, is_delete, creator_id
+        id, name, tag_id, model_number, unit, address, factory, pic, service_life, next_indate, is_delete, creator_id, division_code, suffix_code
     </sql>
 
-    <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapVO" type="com.hssx.pcbms.entity.vo.GoodsVO">
         <id column="id" property="id"/>
         <result column="name" property="name"/>
@@ -51,6 +52,8 @@
         <result column="pic" property="pic"/>
         <result column="service_life" property="serviceLife"/>
         <result column="next_indate" property="nextIndate"/>
+        <result column="divisioncode" property="divisionCode"/>
+        <result column="suffixcode" property="suffixCode"/>
         <collection property="goodsNos" ofType="com.hssx.pcbms.entity.GoodsNo">
             <id column="nid" property="id"/>
             <result column="model_no" property="modelNo"/>
@@ -76,6 +79,8 @@
         <result column="pic" property="pic"/>
         <result column="service_life" property="serviceLife"/>
         <result column="next_indate" property="nextIndate"/>
+        <result column="divisioncode" property="divisionCode"/>
+        <result column="suffixcode" property="suffixCode"/>
         <collection property="goodsNosVO" ofType="com.hssx.pcbms.entity.vo.GoodsNoVO">
             <id column="nid" property="id"/>
             <result column="model_no" property="modelNo"/>
@@ -115,7 +120,7 @@
     </select>
     <select id="getDetail" resultMap="BaseResultMapDetail">
         select
-        g.id, g.name, g.tag_id, g.model_number, g.unit,g.address, g.factory, g.pic, g.service_life, g.next_indate,
+        g.id, g.name, g.tag_id, g.model_number, g.unit,g.address, g.factory, g.pic, g.service_life, g.next_indate,g.division_code divisioncode,g.suffix_code suffixcode,
         g.is_delete,gn.id nid,
         gn.model_no, gn.division_code, gn.suffix_code, gn.state, gn.indate, gn.goods_id, gn.user_id,u.name username,gn.is_maintain,u.phone
         from
@@ -132,7 +137,7 @@
 
     <select id="selectMyList" resultMap="BaseResultMapMyList">
         select
-        g.id, g.name, g.tag_id, g.model_number, g.unit,g.address, g.factory, g.pic, g.service_life, g.next_indate,
+        g.id, g.name, g.tag_id, g.model_number, g.unit,g.address, g.factory, g.pic, g.service_life, g.next_indate,g.division_code divisioncode,g.suffix_code suffixcode,
         g.is_delete,gn.id nid,
         gn.model_no, gn.division_code, gn.suffix_code, gn.state, gn.indate, gn.goods_id, gn.user_id,u.name username,gn.is_maintain,u.phone
         from

+ 1 - 0
pcbms/src/main/resources/mapper/MaintainRecordMapper.xml

@@ -38,5 +38,6 @@
         left join goods_no gn
         on mr.goods_no_id = gn.id
         where gn.goods_id = #{goods.id,jdbcType=INTEGER}
+        order by mr.indate desc
     </select>
 </mapper>