浏览代码

商品导出新增字段

zouxuan 1 年之前
父节点
当前提交
32c638c649

+ 2 - 1
mec-application/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -524,9 +524,10 @@ public class ExportController extends BaseController {
         List<Goods> rows = goodsService.exportGoods(queryInfo);
         OutputStream outputStream = response.getOutputStream();
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "分部成本", "商品编号", "货号", "品牌", "商品名称",
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员展示分部","教务展示分部","课程收费团展示分部","会员团展示分部", "免费团展示分部","乐器置换展示分部", "分部成本", "商品编号", "货号", "品牌", "商品名称",
                     "是否组合商品", "商品类型", "商品分类", "具体型号", "内部库存", "税务库存", "库存类型", "市场价(元)",
                     "零售价(元)", "商品团购价(元)", "商品描述", "商品详情", "是否上下架","子商品编号","子商品名称","子商品成本","子商品货号"}, new String[]{
+                    "studentShowOrganName","educationShowOrganName","courseFeeShowOrganName","memberFeeShowOrganName","freeFeeShowOrganName","replacementShowOrganName",
                     "organName", "organCostPrice", "id", "sn", "brand", "name",
                     "complementGoodsIdList == null || complementGoodsIdList == '' ? '否':'是'",
                     "type.desc", "goodsCategoryName", "specification", "stockCount", "taxStockCount", "stockType.msg", "marketPrice",

+ 72 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.SellOrder;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.GoodsQuery;
@@ -78,6 +79,77 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		if (CollectionUtils.isEmpty(rows)) {
 			throw new BizException("没有查询到商品信息");
 		}
+		List<Organization> all = organizationDao.findAll(null);
+		Map<Integer, String> organizationMap = all.stream().collect(Collectors.toMap(Organization::getId, Organization::getName));
+		for (Goods goods : rows) {
+			if(StringUtils.isNotEmpty(goods.getStudentShowOrganId())){
+				String[] split = goods.getStudentShowOrganId().split(",");
+				StringBuffer sb = new StringBuffer();
+				for (String s : split) {
+					if(sb.length() > 0){
+						sb.append(",");
+					}
+					sb.append(organizationMap.get(Integer.valueOf(s)));
+				}
+				goods.setStudentShowOrganName(sb.toString());
+			}
+			if(StringUtils.isNotEmpty(goods.getEducationShowOrganId())){
+				String[] split = goods.getEducationShowOrganId().split(",");
+				StringBuffer sb = new StringBuffer();
+				for (String s : split) {
+					if(sb.length() > 0){
+						sb.append(",");
+					}
+					sb.append(organizationMap.get(Integer.valueOf(s)));
+				}
+				goods.setEducationShowOrganName(sb.toString());
+			}
+			if(StringUtils.isNotEmpty(goods.getReplacementShowOrganId())){
+				String[] split = goods.getReplacementShowOrganId().split(",");
+				StringBuffer sb = new StringBuffer();
+				for (String s : split) {
+					if(sb.length() > 0){
+						sb.append(",");
+					}
+					sb.append(organizationMap.get(Integer.valueOf(s)));
+				}
+				goods.setReplacementShowOrganName(sb.toString());
+			}
+			if(StringUtils.isNotEmpty(goods.getCourseFeeShowOrganId())){
+				String[] split = goods.getCourseFeeShowOrganId().split(",");
+				StringBuffer sb = new StringBuffer();
+				for (String s : split) {
+					if(sb.length() > 0){
+						sb.append(",");
+					}
+					sb.append(organizationMap.get(Integer.valueOf(s)));
+				}
+				goods.setCourseFeeShowOrganName(sb.toString());
+			}
+			if(StringUtils.isNotEmpty(goods.getMemberFeeShowOrganId())){
+				String[] split = goods.getMemberFeeShowOrganId().split(",");
+				StringBuffer sb = new StringBuffer();
+				for (String s : split) {
+					if(sb.length() > 0){
+						sb.append(",");
+					}
+					sb.append(organizationMap.get(Integer.valueOf(s)));
+				}
+				goods.setMemberFeeShowOrganName(sb.toString());
+			}
+			if(StringUtils.isNotEmpty(goods.getFreeFeeShowOrganId())){
+				String[] split = goods.getFreeFeeShowOrganId().split(",");
+				StringBuffer sb = new StringBuffer();
+				for (String s : split) {
+					if(sb.length() > 0){
+						sb.append(",");
+					}
+					sb.append(organizationMap.get(Integer.valueOf(s)));
+				}
+				goods.setFreeFeeShowOrganName(sb.toString());
+			}
+
+		}
 		return rows;
 	}
 

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

@@ -562,6 +562,7 @@
         LEFT JOIN goods_category gc ON g.goods_category_id_ = gc.id_
         left join goods gs ON FIND_IN_SET(gs.id_,g.complement_goods_id_list_)
         <include refid="queryGoodsPageSql"/>
+        GROUP BY g.id_
         ORDER BY g.id_ DESC
     </select>