Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

周箭河 4 gadi atpakaļ
vecāks
revīzija
99edb38ea9

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -262,6 +262,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 				Goods goods = null;
 				try {
 					goods = JSONObject.parseObject(objectMap.toJSONString(),Goods.class);
+					goods.setSn(StringUtils.trim(goods.getSn()));
 					goodsList.add(goods);
 				} catch (Exception ex) {
 					throw new BizException("导入数据出错", ex);
@@ -330,7 +331,6 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			goodsDao.batchInsert(newGoods);
 		}
 
-		String batchNo = idGeneratorService.generatorId("payment") + "";
 		Map<String, Integer> existsSnIdMap = existsGoods.stream().collect(Collectors.toMap(Goods::getSn, g -> g.getId()));
 		Map<String, Integer> newSnIdMap = newGoods.stream().collect(Collectors.toMap(Goods::getSn, g -> g.getId(), (v1, v2)->v1));
 		existsSnIdMap.putAll(newSnIdMap);
@@ -346,6 +346,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			gp.setStockCount(goods.getStockCount());
 			gp.setTaxStockCount(goods.getTaxStockCount());
 			gp.setOperatorId(operatorId);
+			String batchNo = idGeneratorService.generatorId("payment") + "";
 			gp.setBatchNo(batchNo);
 			goodsProcurements.add(gp);
 		}

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -106,8 +106,8 @@
 	    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
 	        UPDATE music_group_payment_calender
 	        <set>
-                <if test="paymentPattern != null">
-                    payment_pattern_ = #{paymentPattern},
+                <if test="item.paymentPattern != null">
+                    payment_pattern_ = #{item.paymentPattern},
                 </if>
 	            <if test="item.type != null">
 	                type_ = #{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},

+ 61 - 0
mec-student/src/main/java/com/ym/mec/student/controller/GoodsController.java

@@ -0,0 +1,61 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.GoodsCategory;
+import com.ym.mec.biz.service.GoodsCategoryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.biz.dal.page.GoodsQueryInfo;
+import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.common.controller.BaseController;
+
+import java.util.Objects;
+
+@RequestMapping("goods")
+@Api(tags = "商品(教材、辅件)服务")
+@RestController
+public class GoodsController extends BaseController {
+
+    @Autowired
+    private GoodsService goodsService;
+    @Autowired
+    private GoodsCategoryService goodsCategoryService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation(value = "根据商品(教材、辅件)编号查询商品(教材、辅件)")
+    @GetMapping("/get/{id}")
+    public Object get(@ApiParam(value = "商品(教材、辅件)编号", required = true) @PathVariable("id") Integer id){
+        Goods goods = goodsService.get(id);
+        GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
+        if(Objects.nonNull(goodsCategory)){
+            goods.setGoodsCategoryName(goodsCategory.getName());
+        }
+        return succeed(goods);
+    }
+
+    @ApiOperation(value = "分页查询商品(教材、辅件)列表")
+    @GetMapping("/queryPage")
+    public Object queryPage(GoodsQueryInfo queryInfo){
+        return succeed(goodsService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")
+    @GetMapping("/queryGoodsBySubId")
+    @ApiImplicitParams({ @ApiImplicitParam(name = "subjectId", value = "科目编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "type", value = "INSTRUMENT 乐器, ACCESSORIES 教辅", required = true, dataType = "String")})
+    public Object findGoodsBySubId(Integer subjectId,String type){
+        return succeed(goodsService.findGoodsBySubId(subjectId,type));
+    }
+}

+ 19 - 18
mec-student/src/main/java/com/ym/mec/student/controller/RepairController.java

@@ -1,6 +1,20 @@
 package com.ym.mec.student.controller;
 
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
@@ -13,22 +27,15 @@ import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
-import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.service.GoodsCategoryService;
+import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.StudentGoodsSellService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentRepairService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-
 @RequestMapping("repair")
 @Api(tags = "学生维修服务")
 @RestController
@@ -139,12 +146,6 @@ public class RepairController extends BaseController {
         return succeed(goodsService.queryPage(queryInfo));
     }
 
-    @ApiOperation(value = "根据商品(教材、辅件)编号查询商品(教材、辅件)")
-    @GetMapping("/get/{id}")
-    public Object get(@ApiParam(value = "商品(教材、辅件)编号", required = true) @PathVariable("id") Integer id){
-        return succeed(goodsService.get(id));
-    }
-
     @ApiOperation(value = "分页查询商品分类列表")
     @GetMapping("/queryGoodsCategoryPage")
     public Object queryGoodsCategoryPage(GoodsCategoryQueryInfo queryInfo) {

+ 11 - 1
mec-web/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -2,7 +2,9 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.GoodsCategory;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
+import com.ym.mec.biz.service.GoodsCategoryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -10,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
 import java.util.Date;
+import java.util.Objects;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -29,6 +32,8 @@ public class GoodsController extends BaseController {
     @Autowired
     private GoodsService goodsService;
     @Autowired
+    private GoodsCategoryService goodsCategoryService;
+    @Autowired
     private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "新增商品(教材、辅件)")
@@ -90,7 +95,12 @@ public class GoodsController extends BaseController {
     @ApiOperation(value = "根据商品(教材、辅件)编号查询商品(教材、辅件)")
     @GetMapping("/get/{id}")
     public Object get(@ApiParam(value = "商品(教材、辅件)编号", required = true) @PathVariable("id") Integer id){
-        return succeed(goodsService.get(id));
+        Goods goods = goodsService.get(id);
+        GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
+        if(Objects.nonNull(goodsCategory)){
+            goods.setGoodsCategoryName(goodsCategory.getName());
+        }
+        return succeed(goods);
     }
 
     @ApiOperation(value = "分页查询商品(教材、辅件)列表")