fixbug 收入支出调整
This commit is contained in:
@@ -115,11 +115,16 @@ public class WxSettingsController extends BaseWxController{
|
||||
*/
|
||||
@PostMapping("user/settings/expend")
|
||||
public ResponseDTO getBillExpend(HttpServletRequest request){
|
||||
double sumYearAmnt = 0;
|
||||
List<YearAmnt> billByType = accSettingService.getBillByType(getLoginUserId(request), AccSettingType.EXPEND_SETTING);
|
||||
Map<Integer,Double> result = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(billByType)){
|
||||
for (YearAmnt yearAmnt : billByType) {
|
||||
sumYearAmnt = sumYearAmnt + yearAmnt.getMoney();
|
||||
}
|
||||
result = billByType.stream().collect(Collectors.toMap(YearAmnt::getSettingId, YearAmnt::getMoney, (k1, k2) -> k1));
|
||||
}
|
||||
result.put(-1,sumYearAmnt);
|
||||
return ResponseDTO.ok().setData(result);
|
||||
}
|
||||
|
||||
@@ -130,11 +135,16 @@ public class WxSettingsController extends BaseWxController{
|
||||
*/
|
||||
@PostMapping("user/settings/income")
|
||||
public ResponseDTO getBillIncome(HttpServletRequest request){
|
||||
double sumYearAmnt = 0;
|
||||
List<YearAmnt> billByType = accSettingService.getBillByType(getLoginUserId(request), AccSettingType.INCOME_SETTING);
|
||||
Map<Integer,Double> result = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(billByType)){
|
||||
for (YearAmnt yearAmnt : billByType) {
|
||||
sumYearAmnt = sumYearAmnt + yearAmnt.getMoney();
|
||||
}
|
||||
result = billByType.stream().collect(Collectors.toMap(YearAmnt::getSettingId, YearAmnt::getMoney, (k1, k2) -> k1));
|
||||
}
|
||||
result.put(-1,sumYearAmnt);
|
||||
return ResponseDTO.ok().setData(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
<mapper namespace="com.quinn.mapper.AccSettingMapper">
|
||||
|
||||
<select id="getBillByType" resultType="com.quinn.common.wx.YearAmnt">
|
||||
select a.bill_type "settingId",sum(a.money) "money" from qn_acc_bill a,qn_acc_setting b
|
||||
where a.bill_type = b.id and a.user_id = #{userId} and b.setting_type = #{settingType}
|
||||
group by a.bill_type
|
||||
select a.money_type "settingId",sum(a.money) "money" from qn_acc_bill a,qn_acc_setting b
|
||||
where a.money_type = b.id and a.user_id = #{userId} and b.setting_type = #{settingType}
|
||||
and YEAR(a.date) = YEAR(NOW())
|
||||
group by a.money_type
|
||||
</select>
|
||||
|
||||
<update id="updateBalance">
|
||||
|
||||
Reference in New Issue
Block a user