|
@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
@@ -65,7 +66,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
new SqlField("pi", ProductInfo::getCode),
|
|
|
new SqlField("pi", ProductInfo::getCustomCode)
|
|
|
);
|
|
|
- wrapper.eq("json_unquote(victoriatourist_json ->'$.lifeCycle')", dto.getLifeCycle());
|
|
|
+ //计算并根据生命周期过滤
|
|
|
+ wrapper.eq("IF(DATEDIFF(now(),json_unquote( victoriatourist_json -> '$.growUpDay' ))> 0,3,IF(DATEDIFF(now(), json_unquote(victoriatourist_json -> '$.newProductsDay' ))> 0, 2, 1 ))", dto.getLifeCycle());
|
|
|
Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
|
|
|
List<ProductInfoVo> records = page.getRecords();
|
|
@@ -133,8 +135,13 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
json.put("deptName", sysDeptMap.get(json.getLong("deptId")));
|
|
|
+
|
|
|
+ //生命周期计算(在sql里面计算了) 当前时间-创建时间=的天数>growUpDay成熟期,>newProductsDay就是成长期,要不然就是新品期
|
|
|
+ json.put("lifeCycle", record.getLifeCycle());
|
|
|
+
|
|
|
record.setVictoriatouristJson(json.toJSONString());
|
|
|
}
|
|
|
+
|
|
|
return page;
|
|
|
}
|
|
|
|