Browse Source

导出链接增加,分部字段

周箭河 4 years ago
parent
commit
17c91a3ead

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatDto.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.ReplacementInstrument;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import io.swagger.annotations.ApiModelProperty;
 
 import java.math.BigDecimal;
 
@@ -32,6 +33,12 @@ public class ReplacementInstrumentActivityStatDto extends ReplacementInstrumentA
 
     private BigDecimal salePrice;
 
+    @ApiModelProperty(value = "是否参与校赛")
+    private String hasYesFirstAnswer;
+
+    @ApiModelProperty(value="是否有置换乐器")
+    private String hasInstrumentsId;
+
     public String getSubjectName() {
         return subjectName;
     }
@@ -103,4 +110,20 @@ public class ReplacementInstrumentActivityStatDto extends ReplacementInstrumentA
     public void setOrganName(String organName) {
         this.organName = organName;
     }
+
+    public String getHasInstrumentsId() {
+        return hasInstrumentsId;
+    }
+
+    public void setHasInstrumentsId(String hasInstrumentsId) {
+        this.hasInstrumentsId = hasInstrumentsId;
+    }
+
+    public String getHasYesFirstAnswer() {
+        return hasYesFirstAnswer;
+    }
+
+    public void setHasYesFirstAnswer(String hasYesFirstAnswer) {
+        this.hasYesFirstAnswer = hasYesFirstAnswer;
+    }
 }

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentActivityMapper.xml

@@ -37,7 +37,7 @@
         <result property="discountPrice" column="discount_price_"/>
         <result property="depreciationPrice" column="depreciation_price_"/>
         <result property="salePrice" column="sale_price_"/>
-        <result property="mobile_no_" column="phone_"/>
+        <result property="mobileNo" column="phone_"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->

+ 16 - 3
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentActivityController.java

@@ -30,6 +30,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -89,7 +90,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     }
 
     @ApiOperation(value = "修改")
-    @GetMapping("/update")
+    @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/update')")
     public HttpResponseResult<ReplacementInstrumentActivity> update(ReplacementInstrumentActivity replacementInstrumentActivity) {
         ReplacementInstrumentActivity oldReplacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementInstrumentActivity.getId());
@@ -147,12 +148,24 @@ public class ReplacementInstrumentActivityController extends BaseController {
         if (pageList.getTotal() <= 0) {
             throw new BizException("没有可导出的记录");
         }
+        for (ReplacementInstrumentActivityStatDto row : pageList.getRows()) {
+            if (row.getQuestionResult().substring(0, 1).equals("1")) {
+                row.setHasYesFirstAnswer("是");
+            } else {
+                row.setHasYesFirstAnswer("否");
+            }
+            if(row.getHasInstrumentsId() == null){
+                row.setHasInstrumentsId("否");
+            }else {
+                row.setHasInstrumentsId("是");
+            }
+        }
 
         OutputStream outputStream = response.getOutputStream();
         HSSFWorkbook workbook = null;
         try {
-            String[] header = {"分部", "合作单位编号", "合作单位", "学员编号", "学员姓名", "联系电话", "声部", "品牌", "型号"};
-            String[] body = {"organName", "cooperationOrganId", "cooperationOrganName", "userId", "userName", "mobileNo", "subjectName", "brand", "specification"};
+            String[] header = {"分部", "合作单位编号", "合作单位", "学员编号", "学员姓名", "联系电话", "声部", "品牌", "型号", "是否参与校赛", "是否置换乐器"};
+            String[] body = {"organName", "cooperationOrganId", "cooperationOrganName", "userId", "userName", "mobileNo", "subjectName", "brand", "specification","hasYesFirstAnswer","hasInstrumentsId"};
             workbook = POIUtil.exportExcel(header, body, pageList.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=replacement-" + DateUtil.getDate(new Date()) + ".xls");