Просмотр исходного кода

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

wangxiaoming 5 лет назад
Родитель
Сommit
0ced90ae96

+ 154 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/fm/ComplaintSignclosedInfo.java

@@ -52,6 +52,24 @@ public class ComplaintSignclosedInfo implements Serializable {
 
     private Integer adminId;//登录人id
 
+    private Integer detectNumber;
+    private Integer procMethodId;//处理方式id
+    private Integer procTypeId;//处理方式类型id
+    private String procMethodName;//处理方式名称
+    private String procTypeName;//处理方式类型名
+    private String detectProduction;//生产月份
+    private String detectFuselageBarcode;//机身条码
+    private String detectPhenomenon;//工厂检测现象
+    private String detectClassification;//故障分类
+    private String detectFailureCause;//故障原因
+    private String detectResults;//判定结果
+    private String detectPoint;//故障指向
+    private String detectNalysis;//原因分析
+    private String detectContent;//维修内容(维修记录)
+    private Integer detectIsRefurbishing;//是否翻新机1是 2否
+    private String startTime;
+    private String endTime;
+
     public Integer getSignclosedId() {
         return signclosedId;
     }
@@ -307,4 +325,140 @@ public class ComplaintSignclosedInfo implements Serializable {
     public void setSignclosedStoreName(String signclosedStoreName) {
         this.signclosedStoreName = signclosedStoreName;
     }
+
+    public Integer getDetectNumber() {
+        return detectNumber;
+    }
+
+    public void setDetectNumber(Integer detectNumber) {
+        this.detectNumber = detectNumber;
+    }
+
+    public Integer getProcMethodId() {
+        return procMethodId;
+    }
+
+    public void setProcMethodId(Integer procMethodId) {
+        this.procMethodId = procMethodId;
+    }
+
+    public Integer getProcTypeId() {
+        return procTypeId;
+    }
+
+    public void setProcTypeId(Integer procTypeId) {
+        this.procTypeId = procTypeId;
+    }
+
+    public String getProcMethodName() {
+        return procMethodName;
+    }
+
+    public void setProcMethodName(String procMethodName) {
+        this.procMethodName = procMethodName;
+    }
+
+    public String getProcTypeName() {
+        return procTypeName;
+    }
+
+    public void setProcTypeName(String procTypeName) {
+        this.procTypeName = procTypeName;
+    }
+
+    public String getDetectProduction() {
+        return detectProduction;
+    }
+
+    public void setDetectProduction(String detectProduction) {
+        this.detectProduction = detectProduction;
+    }
+
+    public String getDetectFuselageBarcode() {
+        return detectFuselageBarcode;
+    }
+
+    public void setDetectFuselageBarcode(String detectFuselageBarcode) {
+        this.detectFuselageBarcode = detectFuselageBarcode;
+    }
+
+    public String getDetectPhenomenon() {
+        return detectPhenomenon;
+    }
+
+    public void setDetectPhenomenon(String detectPhenomenon) {
+        this.detectPhenomenon = detectPhenomenon;
+    }
+
+    public String getDetectClassification() {
+        return detectClassification;
+    }
+
+    public void setDetectClassification(String detectClassification) {
+        this.detectClassification = detectClassification;
+    }
+
+    public String getDetectFailureCause() {
+        return detectFailureCause;
+    }
+
+    public void setDetectFailureCause(String detectFailureCause) {
+        this.detectFailureCause = detectFailureCause;
+    }
+
+    public String getDetectResults() {
+        return detectResults;
+    }
+
+    public void setDetectResults(String detectResults) {
+        this.detectResults = detectResults;
+    }
+
+    public String getDetectPoint() {
+        return detectPoint;
+    }
+
+    public void setDetectPoint(String detectPoint) {
+        this.detectPoint = detectPoint;
+    }
+
+    public String getDetectNalysis() {
+        return detectNalysis;
+    }
+
+    public void setDetectNalysis(String detectNalysis) {
+        this.detectNalysis = detectNalysis;
+    }
+
+    public String getDetectContent() {
+        return detectContent;
+    }
+
+    public void setDetectContent(String detectContent) {
+        this.detectContent = detectContent;
+    }
+
+    public Integer getDetectIsRefurbishing() {
+        return detectIsRefurbishing;
+    }
+
+    public void setDetectIsRefurbishing(Integer detectIsRefurbishing) {
+        this.detectIsRefurbishing = detectIsRefurbishing;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
 }

+ 5 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/ComplaintDetectInfoServiceImpl.java

@@ -143,6 +143,7 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
                     }
                 }
             }catch (Exception e){
+                e.printStackTrace();
                 throw new RuntimeException("修改检测失败");
             }
         return complaintDetectInfoMapper.updateDetectById(record);
@@ -206,6 +207,7 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
                 }
             }
         }catch (Exception e){
+            e.printStackTrace();
             throw new RuntimeException("修改检测维修内容失败");
         }
         return complaintDetectInfoMapper.updateDetectById(record);
@@ -376,7 +378,7 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
             if(complaintDetectInfo.getDetectSource() == 2){//手动添加需要给业务员发送短信
                 //发送短信通知维修检测人员
                 if(record.getDetectState() == 30 || record.getDetectState() == 34|| record.getDetectState() == 38 || record.getDetectState() == 37){
-                    if(complaintDetectInfo.getDetectTel() != null && !complaintDetectInfo.getDetectTel().equals("")){
+                    if(complaintDetectInfo.getDetectTel() != null && !complaintDetectInfo.getDetectTel().equals("") && complaintDetectInfo.getSalesmanAdminId() != null){
                         String text = MessageFormat.format(SmsConfig.NOTIFY_SALESMAN, complaintDetectInfo.getDetectName()+complaintDetectInfo.getDetectTel(), ResultInfo.DETECT_MSG+complaintDetectInfo.getDetectId());
                         Admin admin = new Admin();
                         admin.setAdminId(complaintDetectInfo.getSalesmanAdminId());
@@ -388,6 +390,7 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
 
             }
         }catch (Exception e){
+            e.printStackTrace();
             throw new RuntimeException("完成检测失败");
         }
         return 1;
@@ -562,6 +565,7 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
              return true;
             }
         }catch (Exception e){
+            e.printStackTrace();
             throw new RuntimeException("确认处理失败");
         }
         return false;

+ 24 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/complaintSignclosedInfoMapper.xml

@@ -138,7 +138,20 @@
     qd.describe_title customerIdDescribe,
     li.logistics_name signclosedLogisticsName,
     cs.signclosed_company_id signclosedCompanyId,
-    si.store_name signclosedStoreName
+    si.store_name signclosedStoreName,
+    cd.detect_number detectNumber,
+    cpm.proc_method_name procMethodName,
+    cpt.proc_type_name procTypeName,
+    cd.detect_production detectProduction,
+    cd.detect_fuselage_barcode detectFuselageBarcode,
+    cd.detect_phenomenon detectPhenomenon,
+    cd.detect_classification detectClassification,
+    cd.detect_failure_cause detectFailureCause,
+    cd.detect_results detectResults,
+    cd.detect_point detectPoint,
+    cd.detect_nalysis detectNalysis,
+    cd.detect_content detectContent,
+    cd.detect_is_refurbishing detectIsRefurbishing
     FROM
     tb_rst_complaint_signclosed cs
     LEFT JOIN tb_rst_address_province ap ON cs.signclosed_addr_provinces = ap.province_id
@@ -147,6 +160,10 @@
     LEFT JOIN tb_rst_cm_question_describe qd on cs.signclosed_customer_id = qd.customer_id
     LEFT JOIN tb_rst_logistics_info li on cs.signclosed_logistics = li.logistics_rst_code
     LEFT JOIN tb_rst_store_info si on cs.signclosed_store_id = si.store_id
+    LEFT JOIN tb_rst_complaint_detect cd on cs.signclosed_id = cd.signclosed_id
+    LEFT JOIN tb_rst_cm_relation cr ON cs.signclosed_customer_id = cr.customer_id
+    LEFT JOIN tb_rst_cm_proc_method cpm ON cr.proc_method_id = cpm.proc_method_id
+    LEFT JOIN tb_rst_cm_proc_type cpt ON cpm.proc_type_id = cpt.proc_type_id
 
     <where>
       <if test="signclosedSendName != null and signclosedSendName != ''" >
@@ -170,6 +187,12 @@
       <if test="signclosedDate != null and signclosedDate != ''" >
         AND cs.signclosed_date = #{signclosedDate}
       </if>
+      <if test="startTime != null and startTime != ''" >
+        AND cs.signclosed_date &gt; #{startTime}
+      </if>
+      <if test="endTime != null and endTime != ''" >
+        AND cs.signclosed_date &lt; #{endTime}
+      </if>
     </where>
     order by cs.signclosed_create_time DESC
   </select>

+ 179 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminSignclosedController.java

@@ -20,6 +20,7 @@ import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.tools.ResponseJson;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
+import org.apache.poi.hssf.usermodel.*;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -28,7 +29,10 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
+import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -504,5 +508,180 @@ public class AdminSignclosedController {
         return msg;
     }
 
+    /**
+     * 进入导出签收页面
+     */
+    @RequestMapping(value = "/to_download_signclose")
+    public ModelAndView toDownloadDetection(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("cm/signclosed/download_signclosed");
+        return mv;
+    }
+
+    /**
+     * 导出签收信息
+     * @param request
+     * @param res
+     * @param signclosedInfo
+     * @throws Exception
+     */
+    @RequestMapping("/download_signclosed")
+    public void downloadDetection(HttpServletRequest request,HttpServletResponse res
+            , ComplaintSignclosedInfo signclosedInfo) throws Exception{
+        //根据id查询订单数据
+
+        List<ComplaintSignclosedInfo> signclosedList = complaintSignclosedInfoService.listSignclosed(signclosedInfo);
+        /*if (detectList == null || detectList.size() == 0) {
+            return;
+        }*/
+        String[] cells = {
+                "序号","维修编号","产品名称","生产月份","机身条码","是否少件",
+                "退货地区","返厂日期","售后处理类型","工厂检测现象","是否翻新机","故障原因","判断结果","故障指向","原因分析","维修内容"
+        };
+        exportExcel2(request,res,cells,signclosedList);
+    }
+    /**
+     * 导出订单Excel并下载
+     * @param request
+     * @param res
+     * @param cells
+     * @param signclosedList
+     * @throws Exception
+     */
+    public void exportExcel2(HttpServletRequest request,HttpServletResponse res,
+                             String[] cells,List<ComplaintSignclosedInfo> signclosedList) throws Exception {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        //创建一个workbook,对应一个Excel文件
+        HSSFWorkbook wb = new HSSFWorkbook();
+        //在workbook中添加一个sheet,对应Excel中的一个sheet
+        HSSFSheet sheet = wb.createSheet("导出签收");
+        //在sheet中添加表头第0行,老版本poi对excel行数列数有限制short
+        HSSFRow row = sheet.createRow((int) 0);
+        //创建单元格,设置值表头,设置表头居中
+        HSSFCellStyle style = wb.createCellStyle();
+        //居中格式
+        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        //设置表头
+
+        if (cells == null || cells.length == 0) {
+            return;
+        }
+        //循环设置表头
+        HSSFCell cell = null;
+        for (int i = 0;i < cells.length;i++) {
+            String name = cells[i];
+            cell = row.createCell(i);
+            cell.setCellValue(name);
+            cell.setCellStyle(style);
+        }
+        for (int i = 0; i < signclosedList.size(); i++) {
+            row = sheet.createRow((int) i + 1);
+            ComplaintSignclosedInfo info = signclosedList.get(i);
+            String detectFilmType = "";
+
+
+            String signclosedIsWhetherLess = "";
+            if(info.getSignclosedIsWhetherLess() != null){
+                switch (info.getSignclosedIsWhetherLess()) {
+                    case 1:signclosedIsWhetherLess = "是";break;
+                    case 2:signclosedIsWhetherLess = "否";break;
+                }
+            }
+            String detectIsRefurbishing = "";
+            if(info.getDetectIsRefurbishing() != null){
+                switch (info.getDetectIsRefurbishing()) {
+                    case 1:detectIsRefurbishing = "是";break;
+                    case 2:detectIsRefurbishing = "否";break;
+                }
+            }
+            String productName = "";
+            String productColor = "";
+            if(info.getSignclosedProductInfoList().size() > 0){
+                for (SignclosedProductInfo productInfo : info.getSignclosedProductInfoList()){
+                    productName  = productName+productInfo.getProductName()+"("+productInfo.getColorName()+")" + "*" + productInfo.getProductNum();
+                }
+            }
+            // 创建单元格,设置值
+            row.createCell(0).setCellValue(info.getSignclosedId());
+            if(info.getDetectNumber() == null){
+                row.createCell(1).setCellValue("");
+            }else{
+                row.createCell(1).setCellValue(info.getDetectNumber());
+            }
+            row.createCell(2).setCellValue(productName);
+            row.createCell(3).setCellValue(info.getDetectProduction()==null?"":info.getDetectProduction());
+            row.createCell(4).setCellValue(info.getDetectFuselageBarcode()==null?"":info.getDetectProduction());
+            row.createCell(5).setCellValue(signclosedIsWhetherLess);
+            StringBuffer area = new StringBuffer(" ");
+            if(info.getSignclosedAddrProvincesName() == null || info.getSignclosedAddrProvincesName().equals("")){
+                area.append("");
+            }else{
+                area.append(info.getSignclosedAddrProvincesName());
+            }
+            if(info.getSignclosedAddrCityName() == null || info.getSignclosedAddrCityName().equals("")){
+                area.append("");
+            }else{
+                area.append("-"+info.getSignclosedAddrCityName());
+            }
+            row.createCell(6).setCellValue(area.toString());
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            if(info.getSignclosedDate()==null){
+                row.createCell(7).setCellValue( "");
+            }else{
+                row.createCell(7).setCellValue(sdf.format(info.getSignclosedDate()));
+            }
+            row.createCell(8).setCellValue(info.getProcMethodName()==null?"":info.getProcMethodName());
+            row.createCell(9).setCellValue(info.getDetectPhenomenon()==null?"":info.getDetectPhenomenon());
+            row.createCell(10).setCellValue(detectIsRefurbishing);
+            row.createCell(11).setCellValue(info.getDetectFailureCause()==null?"":info.getDetectFailureCause());
+            row.createCell(12).setCellValue(info.getDetectResults()==null?"":info.getDetectResults());
+            row.createCell(13).setCellValue(info.getDetectPoint()==null?"":info.getDetectPoint());
+            row.createCell(14).setCellValue(info.getDetectNalysis()==null?"":info.getDetectNalysis());
+            row.createCell(15).setCellValue(info.getDetectContent()==null?"":info.getDetectContent());
+        }
+        //下载导出订单Excel
+        downloadOrderExcel(res,wb);
+    }
+
+
+    /**
+     * 下载导出订单Excel
+     * @param res
+     * @param wb
+     * @throws Exception
+     */
+    public void downloadOrderExcel(HttpServletResponse res, HSSFWorkbook wb) throws Exception{
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        String fileName = format.format(new Date()) + "签收报表";
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        wb.write(os);
+        byte[] content = os.toByteArray();
+        InputStream is = new ByteArrayInputStream(content);
+        // 设置response参数,可以打开下载页面
+        res.reset();
+        res.setContentType("application/vnd.ms-excel;charset=utf-8");
+        res.setHeader("Content-Disposition", "attachment;filename="
+                + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
+        ServletOutputStream out = res.getOutputStream();
+        BufferedInputStream bis = null;
+        BufferedOutputStream bos = null;
+        try {
+            bis = new BufferedInputStream(is);
+            bos = new BufferedOutputStream(out);
+            byte[] buff = new byte[2048];
+            int bytesRead;
+            // Simple read/write loop.
+            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
+                bos.write(buff, 0, bytesRead);
+            }
+        } catch (Exception e) {
+            // TODO: handle exception
+            e.printStackTrace();
+        } finally {
+            if (bis != null)
+                bis.close();
+            if (bos != null)
+                bos.close();
+        }
+    }
 }
 

Разница между файлами не показана из-за своего большого размера
+ 73 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/signclosed/download_signclosed.ftl


+ 1 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/signclosed/signclosed_list.ftl

@@ -42,6 +42,7 @@
     <div class="text-c">
         <form name="form1" action="${path}/admin/signclosed/select_signclosed_list" method="post">
             <button type="button" style="cursor:pointer;float: left;" class="my-btn-search" onclick="add_signclosed('${path}/admin/signclosed/to_add_signclosed');">新建签收</button>
+            <button type="button" style="cursor:pointer;float: left;margin-right: 15px;" class="my-btn-search" onclick="add_remark('签收下载','${path}/admin/signclosed/to_download_signclose','570','450');">签收下载</button>
             <select class="my-select" name="signclosedIsReceiving" id="signclosedIsReceiving" style="height: 29px;width: 132px;margin-bottom: 10px;">
                 <option value="">签收状态</option>
                 <option value="1" <#if signclosedIsReceiving??><#if signclosedIsReceiving == 1 >selected="selected"</#if></#if>>待签收</option>