|  | @@ -16,6 +16,7 @@ import me.zhengjie.exception.BadRequestException;
 | 
	
		
			
				|  |  |  import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
 | 
	
		
			
				|  |  |  import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
 | 
	
		
			
				|  |  |  import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcQueryCriteria;
 | 
	
		
			
				|  |  | +import me.zhengjie.modules.dm.foodCate.domain.DmFoodCate;
 | 
	
		
			
				|  |  |  import me.zhengjie.modules.dm.foodCate.repository.DmFoodCateRepository;
 | 
	
		
			
				|  |  |  import me.zhengjie.modules.dm.foodPj.domain.DmFoodPj;
 | 
	
		
			
				|  |  |  import me.zhengjie.modules.dm.foodPj.service.DmFoodPjService;
 | 
	
	
		
			
				|  | @@ -41,9 +42,7 @@ import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  | -import java.util.HashMap;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @RestController
 | 
	
		
			
				|  |  |  @RequiredArgsConstructor
 | 
	
	
		
			
				|  | @@ -97,6 +96,8 @@ public class OpenApiController {
 | 
	
		
			
				|  |  |      @ApiOperation("新增菜品评价")
 | 
	
		
			
				|  |  |      public BaseResponse<Object> createFoodPj(@RequestBody QueryPageParams<DmFoodPj> resources){
 | 
	
		
			
				|  |  |          SecurityUtils.CheckApiAuth(resources);
 | 
	
		
			
				|  |  | +         Optional<DmFoodCate> byId = dmFoodCateRepository.findById(resources.getQuery().getFoodType().getId());
 | 
	
		
			
				|  |  | +         resources.getQuery().setFoodType(byId.get());
 | 
	
		
			
				|  |  |          return new BaseResponse<>(dmFoodPjService.createApp(resources.getQuery()));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -171,6 +172,14 @@ public class OpenApiController {
 | 
	
		
			
				|  |  |      public BaseResponse<Object> appCountData(@RequestBody QueryPageParams<String> criteria){
 | 
	
		
			
				|  |  |          SecurityUtils.CheckApiAuth(criteria);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        /**
 | 
	
		
			
				|  |  | +         * 声明一个map返回参数
 | 
	
		
			
				|  |  | +         */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Map<String,Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          /**
 | 
	
		
			
				|  |  |           * 查询今日购餐总额(元)
 | 
	
		
			
				|  |  |           */
 | 
	
	
		
			
				|  | @@ -187,10 +196,12 @@ public class OpenApiController {
 | 
	
		
			
				|  |  |           * 统计综合服务评分
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          Map<String, Object> dmServicePjByNow = dmServicePjRepository.getDmServicePjByNow();
 | 
	
		
			
				|  |  | -        dmServicePjByNow.put("dmServicePjContentByNow",dmServicePjContentByNow);
 | 
	
		
			
				|  |  | -        dmServicePjByNow.put("person",person);
 | 
	
		
			
				|  |  | -        dmServicePjByNow.put("money",bigDecimal.toString());
 | 
	
		
			
				|  |  | -        return new BaseResponse<>(dmServicePjByNow);
 | 
	
		
			
				|  |  | +        map.put("person",person);
 | 
	
		
			
				|  |  | +        map.put("money",bigDecimal.toString());
 | 
	
		
			
				|  |  | +        jsonObject.put("dmServicePjByNow",dmServicePjByNow);
 | 
	
		
			
				|  |  | +        jsonObject.put("dmServicePjContentByNow",dmServicePjContentByNow);
 | 
	
		
			
				|  |  | +        map.put("content",jsonObject);
 | 
	
		
			
				|  |  | +        return new BaseResponse<>(map);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @AnonymousPostMapping(value = "/AppDayFoodData")
 | 
	
	
		
			
				|  | @@ -204,21 +215,49 @@ public class OpenApiController {
 | 
	
		
			
				|  |  |           * data { 菜品名称,菜品单价,供应数量 }
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |           List<Map<String, Object>> maps = dmFoodCateRepository.foodApp();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          /**
 | 
	
		
			
				|  |  | -         * 声明一个json对象用来存储菜品统计信息
 | 
	
		
			
				|  |  | +         * list 接收
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  | -        JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  | +        List<JSONObject> jsonObjectList = new ArrayList<>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          /**
 | 
	
		
			
				|  |  |           * 使用forEach之后 里面的变量必须要用原子类
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          maps.forEach(item->{
 | 
	
		
			
				|  |  | -//            item.get("")
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -         });
 | 
	
		
			
				|  |  | +            /**
 | 
	
		
			
				|  |  | +             * 声明一个json对象用来存储菜品统计信息
 | 
	
		
			
				|  |  | +             */
 | 
	
		
			
				|  |  | +            JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  | +            Map<String,Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +            JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  | +            /**
 | 
	
		
			
				|  |  | +             * 根据商品id查询今日消费了多少当前商品
 | 
	
		
			
				|  |  | +             */
 | 
	
		
			
				|  |  | +             Object cate_id = item.get("cate_id");
 | 
	
		
			
				|  |  | +            /**
 | 
	
		
			
				|  |  | +             * grade 评价平均值  code_num 评价参与人数 food_num 商品消费了多少
 | 
	
		
			
				|  |  | +             */
 | 
	
		
			
				|  |  | +            Map<String,Object> cate = dmOrderRecordRepository.selectOrderSumByCateId(cate_id == null?null:cate_id.toString());
 | 
	
		
			
				|  |  | +            /**
 | 
	
		
			
				|  |  | +             * 查询评价详情列表
 | 
	
		
			
				|  |  | +             */
 | 
	
		
			
				|  |  | +            List<Map<String,Object>> dmFoodPjs = dmFoodPjService.findByFoodCode(cate_id.toString());
 | 
	
		
			
				|  |  | +            //供应总数
 | 
	
		
			
				|  |  | +            map.put("foodSum",item.get("no").toString());
 | 
	
		
			
				|  |  | +            //剩余数量
 | 
	
		
			
				|  |  | +            map.put("foodResidue",Integer.valueOf(item.get("no").toString())-Integer.valueOf(cate.get("food_num").toString()) <=0? 0:Integer.valueOf(item.get("no").toString())-Integer.valueOf(cate.get("food_num").toString()));
 | 
	
		
			
				|  |  | +            //商品单价
 | 
	
		
			
				|  |  | +            map.put("foodPrice",item.get("price"));
 | 
	
		
			
				|  |  | +            jsonObject.put("foodName",item.get("name"));
 | 
	
		
			
				|  |  | +            jsonObject.put("foodPrice",item.get("price"));
 | 
	
		
			
				|  |  | +            jsonObject.put("content",map);
 | 
	
		
			
				|  |  | +            object.put("cate",cate);
 | 
	
		
			
				|  |  | +            object.put("dmFoodPjs",dmFoodPjs);
 | 
	
		
			
				|  |  | +            map.put("object",object);
 | 
	
		
			
				|  |  | +            jsonObjectList.add(jsonObject);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return new BaseResponse<>(maps);
 | 
	
		
			
				|  |  | +        return new BaseResponse<>(jsonObjectList);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |