Commit ba456af1b30483b690cc25057a633ea51e767817
1 parent
131cbd61
Exists in
master
修改每日资金汇总逻辑
Showing
9 changed files
with
323 additions
and
108 deletions
Show diff stats
backend/chkpower/src/main/java/com/hotent/chkpower/controller/WDailyFundsController.java
... | ... | @@ -27,6 +27,10 @@ import java.io.OutputStream; |
27 | 27 | import java.math.BigDecimal; |
28 | 28 | import java.math.RoundingMode; |
29 | 29 | import java.net.URLEncoder; |
30 | +import java.time.LocalDate; | |
31 | +import java.time.LocalDateTime; | |
32 | +import java.time.LocalTime; | |
33 | +import java.time.format.DateTimeFormatter; | |
30 | 34 | import java.util.*; |
31 | 35 | import java.util.stream.Collectors; |
32 | 36 | |
... | ... | @@ -75,13 +79,19 @@ public class WDailyFundsController extends BaseController<WDailyFundsManager, WD |
75 | 79 | return CommonResult.<String>ok().message(msg); |
76 | 80 | } |
77 | 81 | |
78 | - @PostMapping(value = "/updateInsp") | |
79 | - public CommonResult<String> updateInsp(@RequestBody WDailyFundsInspDto wDailyFundsInspDto) throws Exception { | |
80 | - baseService.updateInsp(wDailyFundsInspDto); | |
81 | - return CommonResult.<String>ok().message("成功"); | |
82 | - } | |
82 | +// @PostMapping(value = "/updateInsp") | |
83 | +// public CommonResult<String> updateInsp(@RequestBody WDailyFundsInspDto wDailyFundsInspDto) throws Exception { | |
84 | +// baseService.updateInsp(wDailyFundsInspDto); | |
85 | +// return CommonResult.<String>ok().message("成功"); | |
86 | +// } | |
83 | 87 | |
84 | 88 | |
89 | + /** | |
90 | + * 批量复核 | |
91 | + * @param wDailyFundsInspDto | |
92 | + * @return | |
93 | + * @throws Exception | |
94 | + */ | |
85 | 95 | @PostMapping(value = "/updateInsps") |
86 | 96 | public CommonResult<String> updateInsps(@RequestBody WDailyFundsInspDto wDailyFundsInspDto) throws Exception { |
87 | 97 | baseService.updateInsps(wDailyFundsInspDto.getwDailyFundsList()); |
... | ... | @@ -90,6 +100,18 @@ public class WDailyFundsController extends BaseController<WDailyFundsManager, WD |
90 | 100 | |
91 | 101 | |
92 | 102 | /** |
103 | + * 重新计算指定日期的汇总 | |
104 | + * @param fDate | |
105 | + * @return | |
106 | + * @throws Exception | |
107 | + */ | |
108 | + @PostMapping(value = "/updateInspsByDate") | |
109 | + public CommonResult<String> updateInspsByDate(@RequestBody Map<String, String> params) throws Exception { | |
110 | + baseService.updateInspsByDate(convertStringToLocalDateTime(params.get("fDate"))); | |
111 | + return CommonResult.<String>ok().message("成功"); | |
112 | + } | |
113 | + | |
114 | + /** | |
93 | 115 | * 按日期查询复核列表 |
94 | 116 | * |
95 | 117 | * @param date |
... | ... | @@ -307,5 +329,13 @@ public class WDailyFundsController extends BaseController<WDailyFundsManager, WD |
307 | 329 | return resultList; |
308 | 330 | } |
309 | 331 | |
332 | + //时间转换 | |
333 | + private static LocalDateTime convertStringToLocalDateTime(String dateString) { | |
334 | + String datePart = dateString.substring(0, 10); | |
335 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | |
336 | + LocalDate date = LocalDate.parse(datePart, formatter); | |
337 | + LocalDateTime dateTime = LocalDateTime.of(date, LocalTime.MIDNIGHT); | |
338 | + return dateTime; | |
339 | + } | |
310 | 340 | |
311 | 341 | } | ... | ... |
backend/chkpower/src/main/java/com/hotent/chkpower/dao/WDailyFundsDao.java
... | ... | @@ -21,11 +21,23 @@ public interface WDailyFundsDao extends BaseMapper<WDailyFunds> { |
21 | 21 | |
22 | 22 | void insertInitWDailyFunds(@Param("fDate") LocalDateTime fDate); |
23 | 23 | |
24 | + void updateInitWDailyFundByOrgsDate( | |
25 | + @Param("wCurrentList") List<HashMap<String, String>> wCurrentList, | |
26 | + @Param("fDate") LocalDateTime fDate, | |
27 | + @Param("fUpdateBy") String fUpdateBy, | |
28 | + @Param("fUpdateId") String fUpdateId, | |
29 | + @Param("fUpdateTime") LocalDateTime fUpdateTime | |
30 | + ); | |
24 | 31 | |
25 | - Integer selectWDailyFundsCount(@Param("fDate") LocalDateTime fDate); | |
32 | + void updateInitWDailyFundByDate(@Param("fDate") LocalDateTime fDate); | |
26 | 33 | |
27 | 34 | |
28 | - List<WDailyFunds> selectWDailyFundsNews(@Param("wCurrentList") List<HashMap<String,String>> wCurrentList, @Param("fDate") LocalDateTime fDate); | |
35 | + | |
36 | + | |
37 | +// Integer selectWDailyFundsCount(@Param("fDate") LocalDateTime fDate); | |
38 | + | |
39 | + | |
40 | +// List<WDailyFunds> selectWDailyFundsNews(@Param("wCurrentList") List<HashMap<String,String>> wCurrentList, @Param("fDate") LocalDateTime fDate); | |
29 | 41 | |
30 | 42 | // List<HashMap<String, String>> getDailyFundsByDateList(@Param("fOrgType") String fOrgType, @Param("fDate") String fDate); |
31 | 43 | ... | ... |
backend/chkpower/src/main/java/com/hotent/chkpower/dao/WOrgInfoDao.java
0 → 100644
backend/chkpower/src/main/java/com/hotent/chkpower/manager/WDailyFundsManager.java
... | ... | @@ -35,7 +35,7 @@ public interface WDailyFundsManager extends BaseManager<WDailyFunds> { |
35 | 35 | void editWDailyFunds(List<HashMap<String,String>> wCurrentList, LocalDateTime date); |
36 | 36 | |
37 | 37 | |
38 | - void updateInsp(WDailyFundsInspDto wDailyFundsInspDto); | |
38 | +// void updateInsp(WDailyFundsInspDto wDailyFundsInspDto); | |
39 | 39 | |
40 | 40 | |
41 | 41 | List<WDailyFunds> getDailyFundsByDateList(String orgType, String date); |
... | ... | @@ -49,4 +49,11 @@ public interface WDailyFundsManager extends BaseManager<WDailyFunds> { |
49 | 49 | void updateInsps( List<WDailyFunds> wDailyFunds); |
50 | 50 | |
51 | 51 | |
52 | + /** | |
53 | + * 更新知道日期汇总表 | |
54 | + * @param fDate | |
55 | + */ | |
56 | + void updateInspsByDate(LocalDateTime fDate); | |
57 | + | |
58 | + | |
52 | 59 | } | ... | ... |
backend/chkpower/src/main/java/com/hotent/chkpower/manager/impl/WAfterScriptManagerImpl.java
... | ... | @@ -75,7 +75,6 @@ public class WAfterScriptManagerImpl implements WAfterScriptManager { |
75 | 75 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
76 | 76 | LocalDate date = LocalDate.parse(datePart, formatter); |
77 | 77 | LocalDateTime dateTime = LocalDateTime.of(date, LocalTime.MIDNIGHT); |
78 | - System.out.println("LocalDateTime with default time: " + dateTime); | |
79 | 78 | return dateTime; |
80 | 79 | } |
81 | 80 | } | ... | ... |
backend/chkpower/src/main/java/com/hotent/chkpower/manager/impl/WDailyFundsManagerImpl.java
... | ... | @@ -2,7 +2,10 @@ package com.hotent.chkpower.manager.impl; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | +import com.hotent.base.util.BeanUtils; | |
6 | +import com.hotent.base.util.StringUtil; | |
5 | 7 | import com.hotent.chkpower.dao.WFinanceDao; |
8 | +import com.hotent.chkpower.dao.WOrgInfoDao; | |
6 | 9 | import com.hotent.chkpower.manager.WCurrentReportManager; |
7 | 10 | import com.hotent.chkpower.manager.WFinanceManager; |
8 | 11 | import com.hotent.chkpower.model.WDailyFunds; |
... | ... | @@ -11,15 +14,14 @@ import com.hotent.chkpower.manager.WDailyFundsManager; |
11 | 14 | import com.hotent.base.manager.impl.BaseManagerImpl; |
12 | 15 | import com.hotent.chkpower.model.WFinance; |
13 | 16 | import com.hotent.chkpower.dto.WDailyFundsInspDto; |
17 | +import com.hotent.chkpower.model.WOrgInfo; | |
14 | 18 | import com.hotent.runtime.script.ScriptImpl; |
15 | 19 | import org.springframework.stereotype.Service; |
16 | 20 | import org.springframework.transaction.annotation.Transactional; |
17 | 21 | |
18 | 22 | import javax.annotation.Resource; |
19 | 23 | import java.time.LocalDateTime; |
20 | -import java.util.Collections; | |
21 | -import java.util.HashMap; | |
22 | -import java.util.List; | |
24 | +import java.util.*; | |
23 | 25 | |
24 | 26 | |
25 | 27 | /** |
... | ... | @@ -39,6 +41,8 @@ public class WDailyFundsManagerImpl extends BaseManagerImpl<WDailyFundsDao, WDai |
39 | 41 | private WFinanceManager wFinanceManager; |
40 | 42 | @Resource |
41 | 43 | private WFinanceDao wFinanceDao; |
44 | + @Resource | |
45 | + private WOrgInfoDao wOrgInfoDao; | |
42 | 46 | |
43 | 47 | @Override |
44 | 48 | public WDailyFunds getDetail(String id) { |
... | ... | @@ -58,76 +62,73 @@ public class WDailyFundsManagerImpl extends BaseManagerImpl<WDailyFundsDao, WDai |
58 | 62 | |
59 | 63 | @Transactional |
60 | 64 | @Override |
61 | - public void editWDailyFunds(List<HashMap<String,String>> wCurrentList, LocalDateTime fDate) { | |
62 | - if (wCurrentList == null || wCurrentList.size() == 0) {return;} | |
63 | - //验证 | |
65 | + public void editWDailyFunds(List<HashMap<String, String>> wCurrentList, LocalDateTime fDate) { | |
66 | + if (wCurrentList == null || wCurrentList.size() == 0) { | |
67 | + return; | |
68 | + } | |
69 | + //验证 日期是否产生记录 | |
64 | 70 | verifyInitWDailyFunds(fDate); |
65 | - List<WDailyFunds> data = baseMapper.selectWDailyFundsNews(wCurrentList, fDate); | |
66 | - if (data != null && data.size() > 0){ | |
67 | - for (WDailyFunds wDailyFunds : data) { | |
68 | - LambdaUpdateWrapper<WDailyFunds> wrapper = Wrappers.lambdaUpdate(); | |
69 | - //昨日余额 | |
70 | - wrapper.set(WDailyFunds::getFYesterdayAccountBalance, wDailyFunds.getFYesterdayAccountBalance()); | |
71 | - //今日余额 | |
72 | - wrapper.set(WDailyFunds::getFTodayAccountBalance, wDailyFunds.getFTodayAccountBalance()); | |
73 | - //余额差额 | |
74 | - wrapper.set(WDailyFunds::getFAccountBalanceDifference, wDailyFunds.getFAccountBalanceDifference()); | |
75 | - //今日净现金流 | |
76 | - wrapper.set(WDailyFunds::getFTodayNetCashFlow, wDailyFunds.getFTodayNetCashFlow()); | |
77 | - //今日被冻结金额 | |
78 | - wrapper.set(WDailyFunds::getFTodayFreezeAmount, wDailyFunds.getFTodayFreezeAmount()); | |
79 | - //今日冻结上限 | |
80 | - wrapper.set(WDailyFunds::getFTodayFreezing, wDailyFunds.getFTodayFreezing()); | |
81 | - | |
82 | - //更新时间 | |
83 | - wrapper.set(WDailyFunds::getFUpdateTime, LocalDateTime.now()); | |
84 | - //更新人 | |
85 | - wrapper.set(WDailyFunds::getFUpdateBy, scriptImpl.getCurrentUserName()); | |
86 | - //更新人id | |
87 | - wrapper.set(WDailyFunds::getFUpdateId, scriptImpl.getCurrentUserId()); | |
88 | - | |
89 | - //复核状态 | |
90 | - wrapper.set(WDailyFunds::getFInspStatusName, "待复核"); | |
91 | - //复核时间 | |
92 | - wrapper.set(WDailyFunds::getFInspTime, null); | |
93 | - //复核备注 | |
94 | - wrapper.set(WDailyFunds::getFInspNotes, null); | |
95 | - //条件 | |
96 | - wrapper.eq(WDailyFunds::getId, wDailyFunds.getId()); | |
97 | - baseMapper.update(null,wrapper); | |
98 | - } | |
99 | - } | |
71 | + //验证 公司是否产生汇总 | |
72 | + verifyInitWDailyFundOrgs(wCurrentList, fDate); | |
73 | + //批量修改 | |
74 | + baseMapper.updateInitWDailyFundByOrgsDate(wCurrentList, fDate,scriptImpl.getCurrentUserName(),scriptImpl.getCurrentUserId(),LocalDateTime.now()); | |
100 | 75 | } |
101 | 76 | |
102 | - @Transactional | |
103 | - @Override | |
104 | - public void updateInsp(WDailyFundsInspDto wDailyFundsInspDto) { | |
105 | - List<WDailyFunds> wDailyFunds = wDailyFundsInspDto.getwDailyFundsList(); | |
106 | - if (wDailyFunds == null || wDailyFunds.size() == 0) {return;} | |
107 | - for (WDailyFunds wDailyFund : wDailyFunds) { | |
108 | - baseMapper.update(null,Wrappers.<WDailyFunds>lambdaUpdate() | |
109 | - .set(WDailyFunds::getFUpdateBy, scriptImpl.getCurrentUserName()) | |
110 | - .set(WDailyFunds::getFUpdateId, scriptImpl.getCurrentUserId()) | |
111 | - .set(WDailyFunds::getFInspStatusName, wDailyFundsInspDto.getfInspStatusName()) | |
112 | - .set(WDailyFunds::getFInspTime, LocalDateTime.now()) | |
113 | - .set(WDailyFunds::getFInspNotes, wDailyFundsInspDto.getfInspNotes()) | |
114 | - .eq(WDailyFunds::getId, wDailyFund.getId()) | |
115 | - ); | |
116 | - | |
117 | - | |
118 | - WFinance wFinance = new WFinance(); | |
119 | - wFinance.setFUpdateBy(scriptImpl.getCurrentUserName()); | |
120 | - wFinance.setFUpdateId(scriptImpl.getCurrentUserId()); | |
121 | - wFinance.setFInspStatusName(wDailyFundsInspDto.getfInspStatusName()); | |
122 | - wFinance.setFInspTime(LocalDateTime.now()); | |
123 | - wFinance.setFInspNotes(wDailyFundsInspDto.getfInspNotes()); | |
124 | - wFinance.setFDate(wDailyFund.getFDate()); | |
125 | - wFinance.setFOrgId(wDailyFund.getFOrgId()); | |
126 | - wFinanceDao.updateInsp(wFinance); | |
127 | - wCurrentReportManager.updateInsp(wDailyFund.getFDate(),wDailyFund.getFOrgId(),wDailyFundsInspDto.getfInspStatusName(),wDailyFundsInspDto.getfInspNotes()); | |
77 | + //验证 公司是否产生汇总 | |
78 | + private void verifyInitWDailyFundOrgs(List<HashMap<String, String>> wCurrentList, LocalDateTime fDate) { | |
79 | + for (Map map : wCurrentList) { | |
80 | + if (map.containsKey("F_org_id") && map.get("F_org_id")!=null && StringUtil.isNotEmpty(map.get("F_org_id").toString())) { | |
81 | + WOrgInfo wOrgInfo = wOrgInfoDao.selectOrgInfoByOrgid(map.get("F_org_id").toString()); | |
82 | + if (BeanUtils.isNotEmpty(wOrgInfo)) { | |
83 | + List<WDailyFunds> wDailyFunds = baseMapper.selectList(Wrappers.<WDailyFunds>lambdaQuery().eq(WDailyFunds::getFOrgId, map.get("F_org_id")).eq(WDailyFunds::getFDate, fDate)); | |
84 | + if (wDailyFunds == null || wDailyFunds.size() == 0) { | |
85 | + WDailyFunds wDailyFunds_add = new WDailyFunds(); | |
86 | + wDailyFunds_add.setFDate(fDate); | |
87 | + wDailyFunds_add.setFOrgId(wOrgInfo.getfOrgId()); | |
88 | + wDailyFunds_add.setFOrgName(wOrgInfo.getfOrgName()); | |
89 | + wDailyFunds_add.setFOrgType(wOrgInfo.getfOrgType()); | |
90 | + wDailyFunds_add.setFInspStatusName("待复核"); | |
91 | + wDailyFunds_add.setFCreateBy(scriptImpl.getCurrentUserName()); | |
92 | + wDailyFunds_add.setFCreateId(scriptImpl.getCurrentUserId()); | |
93 | + wDailyFunds_add.setFCreateTime(LocalDateTime.now()); | |
94 | + baseMapper.insert(wDailyFunds_add); | |
95 | + } | |
96 | + } | |
97 | + } | |
128 | 98 | } |
129 | 99 | } |
130 | 100 | |
101 | +// @Transactional | |
102 | +// @Override | |
103 | +// public void updateInsp(WDailyFundsInspDto wDailyFundsInspDto) { | |
104 | +// List<WDailyFunds> wDailyFunds = wDailyFundsInspDto.getwDailyFundsList(); | |
105 | +// if (wDailyFunds == null || wDailyFunds.size() == 0) { | |
106 | +// return; | |
107 | +// } | |
108 | +// for (WDailyFunds wDailyFund : wDailyFunds) { | |
109 | +// baseMapper.update(null, Wrappers.<WDailyFunds>lambdaUpdate() | |
110 | +// .set(WDailyFunds::getFUpdateBy, scriptImpl.getCurrentUserName()) | |
111 | +// .set(WDailyFunds::getFUpdateId, scriptImpl.getCurrentUserId()) | |
112 | +// .set(WDailyFunds::getFInspStatusName, wDailyFundsInspDto.getfInspStatusName()) | |
113 | +// .set(WDailyFunds::getFInspTime, LocalDateTime.now()) | |
114 | +// .set(WDailyFunds::getFInspNotes, wDailyFundsInspDto.getfInspNotes()) | |
115 | +// .eq(WDailyFunds::getId, wDailyFund.getId()) | |
116 | +// ); | |
117 | +// | |
118 | +// | |
119 | +// WFinance wFinance = new WFinance(); | |
120 | +// wFinance.setFUpdateBy(scriptImpl.getCurrentUserName()); | |
121 | +// wFinance.setFUpdateId(scriptImpl.getCurrentUserId()); | |
122 | +// wFinance.setFInspStatusName(wDailyFundsInspDto.getfInspStatusName()); | |
123 | +// wFinance.setFInspTime(LocalDateTime.now()); | |
124 | +// wFinance.setFInspNotes(wDailyFundsInspDto.getfInspNotes()); | |
125 | +// wFinance.setFDate(wDailyFund.getFDate()); | |
126 | +// wFinance.setFOrgId(wDailyFund.getFOrgId()); | |
127 | +// wFinanceDao.updateInsp(wFinance); | |
128 | +// wCurrentReportManager.updateInsp(wDailyFund.getFDate(), wDailyFund.getFOrgId(), wDailyFundsInspDto.getfInspStatusName(), wDailyFundsInspDto.getfInspNotes()); | |
129 | +// } | |
130 | +// } | |
131 | + | |
131 | 132 | @Override |
132 | 133 | public List<WDailyFunds> getDailyFundsByDateList(String orgType, String date) { |
133 | 134 | List<WDailyFunds> wDailyFunds = baseMapper.selectList(Wrappers.<WDailyFunds>lambdaQuery() |
... | ... | @@ -138,9 +139,11 @@ public class WDailyFundsManagerImpl extends BaseManagerImpl<WDailyFundsDao, WDai |
138 | 139 | return wDailyFunds; |
139 | 140 | } |
140 | 141 | |
142 | + // 验证 日期是否产生记录 | |
141 | 143 | @Override |
142 | 144 | public void verifyInitWDailyFunds(LocalDateTime fDate) { |
143 | - Integer count = baseMapper.selectWDailyFundsCount(fDate); | |
145 | +// Integer count = baseMapper.selectWDailyFundsCount(fDate); | |
146 | + Integer count = baseMapper.selectCount(Wrappers.<WDailyFunds>lambdaQuery().eq(WDailyFunds::getFDate, fDate)); | |
144 | 147 | if (count == null || count == 0) { |
145 | 148 | baseMapper.insertInitWDailyFunds(fDate); |
146 | 149 | } |
... | ... | @@ -150,7 +153,7 @@ public class WDailyFundsManagerImpl extends BaseManagerImpl<WDailyFundsDao, WDai |
150 | 153 | @Override |
151 | 154 | public void updateInsps(List<WDailyFunds> wDailyFunds) { |
152 | 155 | for (WDailyFunds wDailyFund : wDailyFunds) { |
153 | - baseMapper.update(null,Wrappers.<WDailyFunds>lambdaUpdate() | |
156 | + baseMapper.update(null, Wrappers.<WDailyFunds>lambdaUpdate() | |
154 | 157 | .set(WDailyFunds::getFUpdateBy, scriptImpl.getCurrentUserName()) |
155 | 158 | .set(WDailyFunds::getFUpdateId, scriptImpl.getCurrentUserId()) |
156 | 159 | .set(WDailyFunds::getFInspStatusName, wDailyFund.getFInspStatusName()) |
... | ... | @@ -168,8 +171,17 @@ public class WDailyFundsManagerImpl extends BaseManagerImpl<WDailyFundsDao, WDai |
168 | 171 | wFinance.setFDate(wDailyFund.getFDate()); |
169 | 172 | wFinance.setFOrgId(wDailyFund.getFOrgId()); |
170 | 173 | wFinanceDao.updateInsp(wFinance); |
171 | - wCurrentReportManager.updateInsp(wDailyFund.getFDate(),wDailyFund.getFOrgId(),wDailyFund.getFInspStatusName(),wDailyFund.getFInspNotes()); | |
174 | + wCurrentReportManager.updateInsp(wDailyFund.getFDate(), wDailyFund.getFOrgId(), wDailyFund.getFInspStatusName(), wDailyFund.getFInspNotes()); | |
172 | 175 | } |
173 | 176 | } |
174 | 177 | |
178 | + @Transactional | |
179 | + @Override | |
180 | + public void updateInspsByDate(LocalDateTime fDate) { | |
181 | + //验证 日期是否产生记录 | |
182 | + verifyInitWDailyFunds(fDate); | |
183 | + //批量重新计算 | |
184 | + baseMapper.updateInitWDailyFundByDate(fDate); | |
185 | + } | |
186 | + | |
175 | 187 | } | ... | ... |
backend/chkpower/src/main/java/com/hotent/chkpower/model/WOrgInfo.java
0 → 100644
... | ... | @@ -0,0 +1,50 @@ |
1 | +package com.hotent.chkpower.model; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.TableField; | |
4 | +import com.fasterxml.jackson.annotation.JsonProperty; | |
5 | +import io.swagger.annotations.ApiModelProperty; | |
6 | + | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +public class WOrgInfo { | |
10 | + | |
11 | + private String fOrgName; | |
12 | + | |
13 | + private String fOrgId; | |
14 | + | |
15 | + private String fOrgType; | |
16 | + | |
17 | + private BigDecimal fOrderNo; | |
18 | + | |
19 | + public String getfOrgName() { | |
20 | + return fOrgName; | |
21 | + } | |
22 | + | |
23 | + public void setfOrgName(String fOrgName) { | |
24 | + this.fOrgName = fOrgName; | |
25 | + } | |
26 | + | |
27 | + public String getfOrgId() { | |
28 | + return fOrgId; | |
29 | + } | |
30 | + | |
31 | + public void setfOrgId(String fOrgId) { | |
32 | + this.fOrgId = fOrgId; | |
33 | + } | |
34 | + | |
35 | + public String getfOrgType() { | |
36 | + return fOrgType; | |
37 | + } | |
38 | + | |
39 | + public void setfOrgType(String fOrgType) { | |
40 | + this.fOrgType = fOrgType; | |
41 | + } | |
42 | + | |
43 | + public BigDecimal getfOrderNo() { | |
44 | + return fOrderNo; | |
45 | + } | |
46 | + | |
47 | + public void setfOrderNo(BigDecimal fOrderNo) { | |
48 | + this.fOrderNo = fOrderNo; | |
49 | + } | |
50 | +} | ... | ... |
backend/chkpower/src/main/resources/mapper/WDailyFundsMapper.xml
... | ... | @@ -63,46 +63,130 @@ |
63 | 63 | |
64 | 64 | <insert id="insertInitWDailyFunds"> |
65 | 65 | INSERT into w_daily_funds(ID_,F_date,F_org_id,F_org_name,F_org_type,F_order_no,F_insp_status_name) |
66 | - SELECT REPLACE(UUID(), '-', '') as ID_,DATE_FORMAT(#{fDate,jdbcType=TIMESTAMP}, '%Y-%m-%d 00:00:00') as F_date,org.ID_ as F_org_id,org.NAME_ as F_org_name,orgParams.VALUE_ as F_org_type,org.ORDER_NO_ as F_order_no,'待复核' as F_insp_status_name | |
66 | + SELECT REPLACE(UUID(), '-', '') as ID_,#{fDate,jdbcType=TIMESTAMP} as F_date,org.ID_ as F_org_id,org.NAME_ as F_org_name,orgParams.VALUE_ as F_org_type,org.ORDER_NO_ as F_order_no,'待复核' as F_insp_status_name | |
67 | 67 | FROM uc_org org |
68 | 68 | JOIN uc_org_params orgParams on orgParams.ORG_ID_= org.ID_ |
69 | 69 | WHERE orgParams.VALUE_ !='' and orgParams.VALUE_ IS NOT NULL |
70 | 70 | </insert> |
71 | 71 | |
72 | - <select id="selectWDailyFundsCount" resultType="java.lang.Integer"> | |
73 | - SELECT COUNT(ID_) FROM w_daily_funds WHERE DATE(F_date) = DATE(#{fDate,jdbcType=TIMESTAMP}) | |
74 | - </select> | |
75 | - | |
76 | - <select id="selectWDailyFundsNews" resultType="com.hotent.chkpower.model.WDailyFunds"> | |
77 | - SELECT funds.F_date,funds.id_,funds.F_org_id,funds.F_org_name , | |
78 | - jrye.F_today_account_balance,zrye.F_yesterday_account_balance,(IFNULL(jrye.F_today_account_balance,0) - IFNULL(zrye.F_yesterday_account_balance,0)) as F_account_balance_difference | |
79 | - ,jxjl.F_today_net_cash_flow,jrye.F_today_freeze_amount,jrye.F_today_freezing | |
80 | - FROM w_daily_funds funds | |
81 | - LEFT JOIN ( | |
82 | - SELECT F_org_id,SUM(F_account_balance) AS F_today_account_balance,SUM(F_freeze_amount) as F_today_freeze_amount,SUM(F_freezing) AS F_today_freezing | |
83 | - FROM w_current | |
84 | - WHERE DATE(F_date) =DATE(#{fDate,jdbcType=TIMESTAMP}) | |
85 | - GROUP BY F_org_id | |
86 | - ) jrye on jrye.F_org_id = funds.F_org_id | |
87 | - LEFT JOIN ( | |
88 | - SELECT F_org_id,SUM(F_account_balance) AS F_yesterday_account_balance | |
89 | - FROM w_current | |
90 | - WHERE DATE(F_date) =(SELECT DATE_SUB(DATE(#{fDate,jdbcType=TIMESTAMP}), INTERVAL 1 DAY)) | |
91 | - GROUP BY F_org_id | |
92 | - ) zrye on zrye.F_org_id = funds.F_org_id | |
93 | - LEFT JOIN ( | |
94 | - SELECT F_org_id, SUM(F_total_net_cash_flow) as F_today_net_cash_flow | |
95 | - FROM w_finance WHERE DATE(F_date) =DATE(#{fDate,jdbcType=TIMESTAMP}) | |
96 | - GROUP BY F_org_id | |
97 | - ) jxjl on jxjl.F_org_id = funds.F_org_id | |
98 | - WHERE DATE(funds.F_date) =DATE(#{fDate,jdbcType=TIMESTAMP}) | |
72 | + <update id="updateInitWDailyFundByOrgsDate"> | |
73 | + UPDATE w_daily_funds funds SET | |
74 | + F_yesterday_account_balance =( | |
75 | + SELECT SUM(c.F_account_balance) | |
76 | + FROM w_current c | |
77 | + WHERE F_date =(SELECT DATE_SUB(funds.F_date, INTERVAL 1 DAY)) | |
78 | + AND c.F_org_id = funds.F_org_id | |
79 | + ), | |
80 | + F_today_account_balance =( | |
81 | + SELECT SUM(c.F_account_balance) | |
82 | + FROM w_current c | |
83 | + WHERE c.F_date =funds.F_date | |
84 | + AND c.F_org_id = funds.F_org_id | |
85 | + ), | |
86 | + F_today_net_cash_flow= ( | |
87 | + SELECT SUM(c.F_total_net_cash_flow) * 10000 | |
88 | + FROM w_finance c | |
89 | + WHERE c.F_date = funds.F_date | |
90 | + AND c.F_org_id = funds.F_org_id | |
91 | + ), | |
92 | + F_today_freeze_amount=( | |
93 | + SELECT SUM(c.F_freeze_amount) | |
94 | + FROM w_current c | |
95 | + WHERE c.F_date = funds.F_date | |
96 | + AND c.F_org_id = funds.F_org_id | |
97 | + ), | |
98 | + F_today_freezing=( | |
99 | + SELECT SUM(c.F_freezing) | |
100 | + FROM w_current c | |
101 | + WHERE c.F_date = funds.F_date | |
102 | + AND c.F_org_id = funds.F_org_id | |
103 | + ), | |
104 | + F_account_balance_difference = (IFNULL(funds.F_today_account_balance,0)- IFNULL(funds.F_yesterday_account_balance,0)), | |
105 | + F_update_by = #{fUpdateBy,jdbcType=VARCHAR}, | |
106 | + F_update_id = #{fUpdateId,jdbcType=VARCHAR}, | |
107 | + F_update_time = #{fUpdateTime,jdbcType=TIMESTAMP}, | |
108 | + f_insp_status_name = '待复核', | |
109 | + f_insp_time = null, | |
110 | + f_insp_notes = null | |
111 | + WHERE funds.F_date = #{fDate,jdbcType=TIMESTAMP} | |
99 | 112 | <if test="wCurrentList != null and wCurrentList.size() > 0"> |
100 | 113 | and funds.F_org_id in |
101 | 114 | <foreach collection="wCurrentList" separator="," item="item" open="(" close=")"> |
102 | 115 | #{item.F_org_id} |
103 | 116 | </foreach> |
104 | 117 | </if> |
105 | - </select> | |
118 | + </update> | |
119 | + | |
120 | + <update id="updateInitWDailyFundByDate"> | |
121 | + UPDATE w_daily_funds funds SET | |
122 | + F_yesterday_account_balance =( | |
123 | + SELECT SUM(c.F_account_balance) | |
124 | + FROM w_current c | |
125 | + WHERE F_date =(SELECT DATE_SUB(funds.F_date, INTERVAL 1 DAY)) | |
126 | + AND c.F_org_id = funds.F_org_id | |
127 | + ), | |
128 | + F_today_account_balance =( | |
129 | + SELECT SUM(c.F_account_balance) | |
130 | + FROM w_current c | |
131 | + WHERE c.F_date =funds.F_date | |
132 | + AND c.F_org_id = funds.F_org_id | |
133 | + ), | |
134 | + F_today_net_cash_flow= ( | |
135 | + SELECT SUM(c.F_total_net_cash_flow) * 10000 | |
136 | + FROM w_finance c | |
137 | + WHERE c.F_date = funds.F_date | |
138 | + AND c.F_org_id = funds.F_org_id | |
139 | + ), | |
140 | + F_today_freeze_amount=( | |
141 | + SELECT SUM(c.F_freeze_amount) | |
142 | + FROM w_current c | |
143 | + WHERE c.F_date = funds.F_date | |
144 | + AND c.F_org_id = funds.F_org_id | |
145 | + ), | |
146 | + F_today_freezing=( | |
147 | + SELECT SUM(c.F_freezing) | |
148 | + FROM w_current c | |
149 | + WHERE c.F_date = funds.F_date | |
150 | + AND c.F_org_id = funds.F_org_id | |
151 | + ), | |
152 | + F_account_balance_difference = (IFNULL(funds.F_today_account_balance,0)- IFNULL(funds.F_yesterday_account_balance,0)) | |
153 | + WHERE funds.F_date = #{fDate,jdbcType=TIMESTAMP} | |
154 | + </update> | |
155 | + | |
156 | + <!-- <select id="selectWDailyFundsCount" resultType="java.lang.Integer">--> | |
157 | +<!-- SELECT COUNT(ID_) FROM w_daily_funds WHERE DATE(F_date) = DATE(#{fDate,jdbcType=TIMESTAMP})--> | |
158 | +<!-- </select>--> | |
159 | + | |
160 | +<!-- <select id="selectWDailyFundsNews" resultType="com.hotent.chkpower.model.WDailyFunds">--> | |
161 | +<!-- SELECT funds.F_date,funds.id_,funds.F_org_id,funds.F_org_name ,--> | |
162 | +<!-- jrye.F_today_account_balance,zrye.F_yesterday_account_balance,(IFNULL(jrye.F_today_account_balance,0) - IFNULL(zrye.F_yesterday_account_balance,0)) as F_account_balance_difference--> | |
163 | +<!-- ,jxjl.F_today_net_cash_flow,jrye.F_today_freeze_amount,jrye.F_today_freezing--> | |
164 | +<!-- FROM w_daily_funds funds--> | |
165 | +<!-- LEFT JOIN (--> | |
166 | +<!-- SELECT F_org_id,SUM(F_account_balance) AS F_today_account_balance,SUM(F_freeze_amount) as F_today_freeze_amount,SUM(F_freezing) AS F_today_freezing--> | |
167 | +<!-- FROM w_current--> | |
168 | +<!-- WHERE DATE(F_date) =DATE(#{fDate,jdbcType=TIMESTAMP})--> | |
169 | +<!-- GROUP BY F_org_id--> | |
170 | +<!-- ) jrye on jrye.F_org_id = funds.F_org_id--> | |
171 | +<!-- LEFT JOIN (--> | |
172 | +<!-- SELECT F_org_id,SUM(F_account_balance) AS F_yesterday_account_balance--> | |
173 | +<!-- FROM w_current--> | |
174 | +<!-- WHERE DATE(F_date) =(SELECT DATE_SUB(DATE(#{fDate,jdbcType=TIMESTAMP}), INTERVAL 1 DAY))--> | |
175 | +<!-- GROUP BY F_org_id--> | |
176 | +<!-- ) zrye on zrye.F_org_id = funds.F_org_id--> | |
177 | +<!-- LEFT JOIN (--> | |
178 | +<!-- SELECT F_org_id, SUM(F_total_net_cash_flow) as F_today_net_cash_flow--> | |
179 | +<!-- FROM w_finance WHERE DATE(F_date) =DATE(#{fDate,jdbcType=TIMESTAMP})--> | |
180 | +<!-- GROUP BY F_org_id--> | |
181 | +<!-- ) jxjl on jxjl.F_org_id = funds.F_org_id--> | |
182 | +<!-- WHERE DATE(funds.F_date) =DATE(#{fDate,jdbcType=TIMESTAMP})--> | |
183 | +<!-- <if test="wCurrentList != null and wCurrentList.size() > 0">--> | |
184 | +<!-- and funds.F_org_id in--> | |
185 | +<!-- <foreach collection="wCurrentList" separator="," item="item" open="(" close=")">--> | |
186 | +<!-- #{item.F_org_id}--> | |
187 | +<!-- </foreach>--> | |
188 | +<!-- </if>--> | |
189 | +<!-- </select>--> | |
106 | 190 | |
107 | 191 | <!-- <select id="getDailyFundsByDateList" resultType="java.util.HashMap">--> |
108 | 192 | <!-- SELECT * FROM w_daily_funds--> | ... | ... |
backend/chkpower/src/main/resources/mapper/WOrgInfoMapper.xml
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="com.hotent.chkpower.dao.WOrgInfoDao"> | |
4 | + | |
5 | + <select id="selectOrgInfoByOrgid" resultType="com.hotent.chkpower.model.WOrgInfo"> | |
6 | + SELECT org.ID_ as fOrgId,org.NAME_ as fOrgName,orgParams.VALUE_ as fOrgType,org.ORDER_NO_ as fOrderNo | |
7 | + FROM uc_org org | |
8 | + JOIN uc_org_params orgParams on orgParams.ORG_ID_= org.ID_ | |
9 | + WHERE orgParams.VALUE_ !='' and orgParams.VALUE_ IS NOT NULL | |
10 | + AND org.ID_=#{fOrgId} | |
11 | + </select> | |
12 | +</mapper> | ... | ... |