| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.security.utils.DictUtils; |
| | |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Hashtable; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 钣金计划管理Service业务层处理 |
| | |
| | | |
| | | @Autowired |
| | | private ApsPartPlanTempMapper apsPartPlanTempMapper; |
| | | |
| | | @Autowired |
| | | private ApsPlatePlanTempMapper apsPlatePlanTempMapper; |
| | | |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 查询钣金计划管理 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean setSubPlansToRedis() { |
| | | try { |
| | | Set<String> keys = redisTemplate.keys("PLATE_SUB_PLAN:*"); |
| | | if (keys != null && !keys.isEmpty()) { |
| | | redisTemplate.delete(keys); |
| | | } |
| | | List<JSONObject> subPlans = apsPlatePlanMapper.selectApsSubPlatePlan(); |
| | | // ApsPlatePlan a = JSONObject.parseObject(String.valueOf(subPlans.get(0)), ApsPlatePlan.class); |
| | | Map<String, List<JSONObject>> groupByItemNumber = subPlans.stream().collect(Collectors.groupingBy(obj -> obj.getString("itemNumber"))); |
| | | Map<String, Object> bulkData = new HashMap<>(); |
| | | for (Map.Entry<String, List<JSONObject>> entry : groupByItemNumber.entrySet()) { |
| | | String key = entry.getKey(); |
| | | List<JSONObject> value = entry.getValue(); |
| | | bulkData.put("PLATE_SUB_PLAN:"+key, value); |
| | | } |
| | | redisTemplate.opsForValue().multiSet(bulkData); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | } |