|
@@ -15,10 +15,8 @@ import com.hssx.pcbms.service.GoodsService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.hssx.pcbms.service.MaintainRecordService;
|
|
|
import com.hssx.pcbms.service.OperateRecordService;
|
|
|
-import com.hssx.pcbms.util.HttpRespMsg;
|
|
|
-import com.hssx.pcbms.util.ListUtil;
|
|
|
-import com.hssx.pcbms.util.PageUtil;
|
|
|
-import com.hssx.pcbms.util.UploadFileToFileNameUtil;
|
|
|
+import com.hssx.pcbms.util.*;
|
|
|
+import com.sun.deploy.net.HttpResponse;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,9 +24,11 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -148,9 +148,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
String nowState = "";
|
|
|
if (no.getState() == 0) {
|
|
|
oldState = "未用";
|
|
|
- } else if (no.getState() == 1)
|
|
|
+ } else if (no.getState() == 1){
|
|
|
oldState = "在用";
|
|
|
- {
|
|
|
User usering = userMapper.selectById(no.getUserId());
|
|
|
oldState = oldState + ("(" + usering.getName() + "/" + usering.getPhone() + ")");
|
|
|
}
|
|
@@ -170,6 +169,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
operateRecord.setGoodState(goodsNo.getState());
|
|
|
operateRecord.setUserId(currentUserId);
|
|
|
operateRecord.setUserName(user.getName());
|
|
|
+ operateRecord.setModelNo(no.getModelNo());
|
|
|
operateRecordMapper.insert(operateRecord);
|
|
|
return msg;
|
|
|
}
|
|
@@ -323,9 +323,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg isMaintainRecordExcel(Goods goods) {
|
|
|
+ public HttpRespMsg handelRecordExcel(Goods goods, HttpServletResponse response) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- List<MaintainRecordVO> recordList = maintainRecordMapper.getRecordList(goods);
|
|
|
+ List<OperateRecordVO> recordList = operateRecordMapper.selectCondition(goods);
|
|
|
List<List<String>> list = new ArrayList<List<String>>();
|
|
|
//标题
|
|
|
List<String> titleList = new ArrayList<String>();
|
|
@@ -337,33 +337,60 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
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) {
|
|
|
+ for (OperateRecordVO 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(dynamic.getModelNo());
|
|
|
+ //处置人
|
|
|
+ rowList.add(dynamic.getUserName());
|
|
|
+ //处置时间
|
|
|
+ rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(dynamic.getIndate()));
|
|
|
+ //操作内容
|
|
|
+ rowList.add(dynamic.getContent());
|
|
|
+ list.add(rowList);
|
|
|
+ }
|
|
|
+ Goods newGoods = goodsMapper.selectById(goods.getId());
|
|
|
+ String fileUrl = ExcelUtil.exportGeneralExcelByTitleAndList(response, newGoods.getName()+dateSdf2.format(new Date()), list, path);
|
|
|
+ msg.data = fileUrl;
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg isMaintainExcel(Goods goods, HttpServletResponse response) {
|
|
|
+ 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("维护公司");
|
|
|
+ titleList.add("维护公司电话");
|
|
|
+ titleList.add("操作日期");
|
|
|
+ list.add(titleList);
|
|
|
+ SimpleDateFormat dateSdf2 = new SimpleDateFormat("yyyy年MM月dd+HH时mm分ss秒");
|
|
|
+ for (MaintainRecordVO dynamic : recordList) {
|
|
|
+ List<String> rowList = new ArrayList<String>();
|
|
|
+ //资产编号
|
|
|
+ rowList.add(dynamic.getModelNo());
|
|
|
+ //维护人
|
|
|
+ rowList.add(dynamic.getOperator());
|
|
|
+ //维护人号码
|
|
|
+ rowList.add(dynamic.getOperatorPhone());
|
|
|
+ //维护公司
|
|
|
+ rowList.add(dynamic.getCompany());
|
|
|
+ //维护公司电话
|
|
|
+ rowList.add(dynamic.getCompanyPhone());
|
|
|
+ //操作日期
|
|
|
rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(dynamic.getIndate())
|
|
|
);
|
|
|
list.add(rowList);
|
|
|
}
|
|
|
- return null;
|
|
|
+ Goods newGoods = goodsMapper.selectById(goods.getId());
|
|
|
+ String fileUrl = ExcelUtil.exportGeneralExcelByTitleAndList(response, newGoods.getName()+dateSdf2.format(new Date()), list, path);
|
|
|
+ msg.data = fileUrl;
|
|
|
+ return msg;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|