瀏覽代碼

系统收费商品管理

zouxuan 4 年之前
父節點
當前提交
23766b92d0

+ 0 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java

@@ -198,10 +198,4 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
      */
     Integer getReplacementInstrumentCount(Map<String, Object> params);
 
-    /**
-     * 获取商品分部列表
-     * @param goodsIds
-     * @return
-     */
-    List<Map<Integer, String>> findGoodsOrganNames(@Param("goodsIds") List<Integer> goodsIds);
 }

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsQueryInfo.java

@@ -34,9 +34,6 @@ public class GoodsQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "教务端展示分部")
     private Integer educationShowOrganId;
 
-    @ApiModelProperty(value = "乐团展示分部")
-    private Integer musicShowOrganId;
-
     @ApiModelProperty(value = "课程收费团展示分部")
     private Integer courseFeeShowOrganId;
 
@@ -73,14 +70,6 @@ public class GoodsQueryInfo extends QueryInfo {
         this.educationShowOrganId = educationShowOrganId;
     }
 
-    public Integer getMusicShowOrganId() {
-        return musicShowOrganId;
-    }
-
-    public void setMusicShowOrganId(Integer musicShowOrganId) {
-        this.musicShowOrganId = musicShowOrganId;
-    }
-
     public Integer getCourseFeeShowOrganId() {
         return courseFeeShowOrganId;
     }

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -117,8 +117,6 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      */
     List<GoodsSellDto> queryGoodsSellDtos(String goodsId);
 
-    PageInfo<Goods> queryGoodsPage(GoodsQueryInfo queryInfo);
-
     /**
      * 获取商品包含分部名称
      * @param goodsId

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

@@ -674,20 +674,6 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		return goodsDao.queryGoodsSellDtos(goodsId);
 	}
 
-    @Override
-    public PageInfo<Goods> queryGoodsPage(GoodsQueryInfo queryInfo) {
-		PageInfo<Goods> goodsPageInfo = this.queryPage(queryInfo);
-//		List<Goods> rows = goodsPageInfo.getRows();
-//		if(rows != null && rows.size() > 0){
-//			List<Integer> goodsIds = rows.stream().map(e -> e.getId()).collect(Collectors.toList());
-//			Map<Integer,String> goodsNameMap = MapUtil.convertMybatisMap(goodsDao.findGoodsOrganNames(goodsIds));
-//			for (Goods row : rows) {
-//				row.setOrganName(goodsNameMap.get(row.getId()));
-//			}
-//		}
-		return goodsPageInfo;
-    }
-
 	@Override
 	public Goods getDetail(Integer goodsId) {
 		return goodsDao.getDetail(goodsId);

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

@@ -380,7 +380,8 @@
         LEFT JOIN goods g ON sgm.goods_category_id_ = g.goods_category_id_
         WHERE sgm.subject_id_ = #{subjectId} AND g.type_ = #{type} and g.status_ != 0
         <if test="organId != null">
-            AND FIND_IN_SET(#{organId},g.organ_id_list_)
+            AND FIND_IN_SET (#{organId},CONCAT_WS(",",replacement_show_organ_id_,member_fee_show_organ_id_,
+            course_fee_show_organ_id_,education_show_organ_id_,student_show_organ_id_))
         </if>
     </select>
 
@@ -508,15 +509,6 @@
         <include refid="replacementQuerySql"/>
         <include refid="global.limit"/>
     </select>
-    <select id="findGoodsOrganNames" resultType="java.util.Map">
-        SELECT g.id_ 'key',GROUP_CONCAT(DISTINCT o.name_) 'value' FROM goods g
-        LEFT JOIN organization o ON FIND_IN_SET(o.id_,g.organ_id_list_)
-        WHERE g.id_ IN
-        <foreach collection="goodsIds" open="(" close=")" item="organId" separator=",">
-            #{organId}
-        </foreach>
-        GROUP BY g.id_
-    </select>
 
     <sql id="replacementQuerySql">
         <where>

+ 6 - 13
mec-web/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -124,7 +124,6 @@ public class GoodsController extends BaseController {
         Employee employee = employeeDao.get(sysUser.getId());
         if (queryInfo.getStudentShowOrganId() == null &&
                 queryInfo.getEducationShowOrganId() == null &&
-                queryInfo.getMusicShowOrganId() == null &&
                 queryInfo.getCourseFeeShowOrganId() == null &&
                 queryInfo.getMemberFeeShowOrganId() == null &&
                 queryInfo.getReplacementShowOrganId() == null) {
@@ -133,26 +132,23 @@ public class GoodsController extends BaseController {
             return failed("用户所在分部异常");
         }else {
             Set<Integer> list = Arrays.stream(employee.getOrganIdList().split(",")).map(s -> Integer.valueOf(s)).collect(Collectors.toSet());
-            if(!list.contains(queryInfo.getStudentShowOrganId())){
+            if(queryInfo.getStudentShowOrganId() != null && !list.contains(queryInfo.getStudentShowOrganId())){
                 return failed("非法请求");
             }
-            if(!list.contains(queryInfo.getEducationShowOrganId())){
+            if(queryInfo.getEducationShowOrganId() != null && !list.contains(queryInfo.getEducationShowOrganId())){
                 return failed("非法请求");
             }
-            if(!list.contains(queryInfo.getMusicShowOrganId())){
+            if(queryInfo.getCourseFeeShowOrganId() != null && !list.contains(queryInfo.getCourseFeeShowOrganId())){
                 return failed("非法请求");
             }
-            if(!list.contains(queryInfo.getCourseFeeShowOrganId())){
+            if(queryInfo.getMemberFeeShowOrganId() != null && !list.contains(queryInfo.getMemberFeeShowOrganId())){
                 return failed("非法请求");
             }
-            if(!list.contains(queryInfo.getMemberFeeShowOrganId())){
-                return failed("非法请求");
-            }
-            if(!list.contains(queryInfo.getReplacementShowOrganId())){
+            if(queryInfo.getReplacementShowOrganId() != null && !list.contains(queryInfo.getReplacementShowOrganId())){
                 return failed("非法请求");
             }
         }
-        return succeed(goodsService.queryGoodsPage(queryInfo));
+        return succeed(goodsService.queryPage(queryInfo));
     }
 
     @ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")
@@ -162,9 +158,6 @@ public class GoodsController extends BaseController {
             @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "type", value = "INSTRUMENT 乐器, ACCESSORIES 教辅", required = true, dataType = "String")})
     public Object findGoodsBySubId(Integer subjectId,String type,Integer organId){
-        if(organId == null){
-            throw new BizException("请选择用户分部");
-        }
         return succeed(goodsService.findGoodsBySubId(subjectId,type,organId));
     }
 }

+ 31 - 8
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

@@ -24,10 +24,9 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+
+import java.util.*;
+import java.util.stream.Collectors;
 
 @RequestMapping("eduRepair")
 @Api(tags = "教务维修服务")
@@ -188,13 +187,37 @@ public class EduRepairController extends BaseController {
     @ApiOperation(value = "分页查询商品(教材、辅件)列表")
     @GetMapping("/queryGoodsPage")
     public Object queryPage(GoodsQueryInfo queryInfo){
-        if(queryInfo.getStudentShowOrganId() == null &&
+        queryInfo.setOrganId(null);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (queryInfo.getStudentShowOrganId() == null &&
                 queryInfo.getEducationShowOrganId() == null &&
-                queryInfo.getMusicShowOrganId() == null &&
                 queryInfo.getCourseFeeShowOrganId() == null &&
                 queryInfo.getMemberFeeShowOrganId() == null &&
-                queryInfo.getReplacementShowOrganId() == null){
-            throw new BizException("请选择商品分部");
+                queryInfo.getReplacementShowOrganId() == null) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+            return failed("用户所在分部异常");
+        }else {
+            Set<Integer> list = Arrays.stream(employee.getOrganIdList().split(",")).map(s -> Integer.valueOf(s)).collect(Collectors.toSet());
+            if(queryInfo.getStudentShowOrganId() != null && !list.contains(queryInfo.getStudentShowOrganId())){
+                return failed("非法请求");
+            }
+            if(queryInfo.getEducationShowOrganId() != null && !list.contains(queryInfo.getEducationShowOrganId())){
+                return failed("非法请求");
+            }
+            if(queryInfo.getCourseFeeShowOrganId() != null && !list.contains(queryInfo.getCourseFeeShowOrganId())){
+                return failed("非法请求");
+            }
+            if(queryInfo.getMemberFeeShowOrganId() != null && !list.contains(queryInfo.getMemberFeeShowOrganId())){
+                return failed("非法请求");
+            }
+            if(queryInfo.getReplacementShowOrganId() != null && !list.contains(queryInfo.getReplacementShowOrganId())){
+                return failed("非法请求");
+            }
         }
         return succeed(goodsService.queryPage(queryInfo));
     }