Commit 9f689033 authored by Fuzy's avatar Fuzy

修正

parent 53c01f53
...@@ -57,7 +57,7 @@ public class WagesConversionController extends BaseController { ...@@ -57,7 +57,7 @@ public class WagesConversionController extends BaseController {
} }
@RequestMapping("/recentFormulas") @RequestMapping("/recentFormulas")
public AjaxResult recentFormulas(){ public AjaxResult recentFormulas(@RequestBody String mineId){
return new AjaxResult(200, "成功", wagesConversionService.recentFormulas()); return new AjaxResult(200, "成功", wagesConversionService.recentFormulas(mineId));
} }
} }
...@@ -23,5 +23,5 @@ public interface WagesConversionMapper { ...@@ -23,5 +23,5 @@ public interface WagesConversionMapper {
void deleteFromConversionToDate(@Param("date") String yearMonth); void deleteFromConversionToDate(@Param("date") String yearMonth);
List<WagesConversionDataVO> selectWagesValueAndDate(); List<WagesConversionDataVO> selectWagesValueAndDate(@Param("id") String mineId);
} }
...@@ -19,5 +19,5 @@ public interface WagesConversionService { ...@@ -19,5 +19,5 @@ public interface WagesConversionService {
WagesConversionData selectWagesConversionDataById(int id); WagesConversionData selectWagesConversionDataById(int id);
Object recentFormulas(); Object recentFormulas(String mineId);
} }
...@@ -51,8 +51,8 @@ public class WagesConversionServiceImpl implements WagesConversionService { ...@@ -51,8 +51,8 @@ public class WagesConversionServiceImpl implements WagesConversionService {
} }
@Override @Override
public Object recentFormulas() { public Object recentFormulas(String mineId) {
List<WagesConversionDataVO> list = wagesConversionMapper.selectWagesValueAndDate(); List<WagesConversionDataVO> list = wagesConversionMapper.selectWagesValueAndDate(mineId);
list.removeAll(Collections.singleton(null)); list.removeAll(Collections.singleton(null));
boolean b1 = list.parallelStream().anyMatch(v -> v.getYearMonth() == null || v.getYearMonth().indexOf("-") <= 0); boolean b1 = list.parallelStream().anyMatch(v -> v.getYearMonth() == null || v.getYearMonth().indexOf("-") <= 0);
if (b1) return "数据库中数据存在日期错误"; if (b1) return "数据库中数据存在日期错误";
...@@ -63,10 +63,11 @@ public class WagesConversionServiceImpl implements WagesConversionService { ...@@ -63,10 +63,11 @@ public class WagesConversionServiceImpl implements WagesConversionService {
} else { } else {
return "数据库中没有数据"; return "数据库中没有数据";
} }
if (collect != null) { if (collect.size() != 0) {
collect = collect.parallelStream().sorted((a, b) -> Integer.parseInt(b.getYearMonth().split("-")[1]) - Integer.parseInt(a.getYearMonth().split("-")[1])).collect(Collectors.toList()); collect = collect.parallelStream().sorted((a, b) -> Integer.parseInt(b.getYearMonth().split("-")[1]) - Integer.parseInt(a.getYearMonth().split("-")[1])).collect(Collectors.toList());
}
return collect.get(0).getValue(); return collect.get(0).getValue();
} }
return "数据库中数据错误";
}
} }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</select> </select>
<select id="selectWagesValueAndDate" resultType="com.ruoyi.system.model.wages.vo.WagesConversionDataVO"> <select id="selectWagesValueAndDate" resultType="com.ruoyi.system.model.wages.vo.WagesConversionDataVO">
select wage_month as yearMonth, value as value select wage_month as yearMonth, value as value
from wages_conversion_data; from wages_conversion_data where mine_id = #{id};
</select> </select>
<update id="update"> <update id="update">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment