|
@@ -6,6 +6,7 @@ package com.tofly.fees.userprofilemgt.controller;
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.util.ListUtils;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -37,7 +38,10 @@ import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.tofly.fees.common.ControllerConstants.*;
|
|
|
+import static com.tofly.fees.common.ControllerConstants.PAGE_NUMBER_PARA_NAME;
|
|
|
import static com.tofly.fees.common.util.copyPropertiesUtils.copyProperties;
|
|
|
|
|
|
|
|
@@ -774,4 +778,73 @@ public class DaCustomerController {
|
|
|
HashMap<String, Object> obj = daCustomerService.selCustomerAcc(customerNo);
|
|
|
return ResultRespone.success(obj);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取用户批量档案信息")
|
|
|
+ @GetMapping("/getCusDaPrice")
|
|
|
+ public ResultRespone getCusDaPrice(@ApiParam(value = "searchText", required = true)
|
|
|
+ @RequestParam(value = "searchText") String searchText,
|
|
|
+ @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
|
|
|
+ @RequestParam(value = PAGE_SIZE_PARA_NAME) int pageSize,
|
|
|
+ @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
|
|
|
+ @RequestParam(value = PAGE_NUMBER_PARA_NAME) int page
|
|
|
+ ) {
|
|
|
+
|
|
|
+ Page<HashMap<String, Object>> pg = new Page<HashMap<String, Object>>(page, pageSize);
|
|
|
+ Page<List<HashMap<String, Object>>> newPage = daCustomerService.selCusPriceInfo(pg, searchText);
|
|
|
+
|
|
|
+ CollectionData<List<HashMap<String, Object>>> m = new CollectionData<>(newPage.getRecords().stream().collect(Collectors.toList())
|
|
|
+ , newPage.getTotal());
|
|
|
+
|
|
|
+ return ResultRespone.success(m);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "批量设置用户水价信息")
|
|
|
+ @PostMapping("/updateSetCusDaPrice")
|
|
|
+ @Transactional
|
|
|
+ public ResultRespone updateSetCusDaPrice(@ApiParam(value = "customer_no(,号分割)", required = true) @RequestParam(value = "customer_no") String yhbhs,
|
|
|
+ @ApiParam(value = "pricecode", required = true) @RequestParam(value = "pricecode") String pricecode,
|
|
|
+ @ApiParam(value = "pricecode1", required = false) @RequestParam(value = "pricecode1") String pricecode1,
|
|
|
+ @ApiParam(value = "pricecode2", required = false) @RequestParam(value = "pricecode2") String pricecode2
|
|
|
+ ) {
|
|
|
+
|
|
|
+
|
|
|
+ String[] yhbhArr = yhbhs.split(",");
|
|
|
+ if (yhbhArr == null) {
|
|
|
+ return ResultRespone.failed("用户编号为Null");
|
|
|
+ }
|
|
|
+
|
|
|
+ int sucessCode = 0;
|
|
|
+ int failCode = 0;
|
|
|
+
|
|
|
+ for (String yhbh : yhbhArr) {
|
|
|
+ QueryWrapper<DaMeter> wapper = new QueryWrapper<>();
|
|
|
+ wapper.eq("customer_no", yhbh);
|
|
|
+ DaMeter meter = daMeterService.getOne(wapper);
|
|
|
+ if (meter != null) {
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(pricecode)) {
|
|
|
+ meter.setPriceCode(pricecode);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(pricecode1)) {
|
|
|
+ meter.setPriceCode1(pricecode1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(pricecode2)) {
|
|
|
+ meter.setPriceCode2(pricecode2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean isSave = daMeterService.update(meter, wapper);
|
|
|
+ if (isSave) {
|
|
|
+ sucessCode += 1;
|
|
|
+ } else {
|
|
|
+ failCode += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String msg = String.format("批量设置成功[%s]条,失败[%s]条", sucessCode, failCode);
|
|
|
+ return ResultRespone.success(1,msg);
|
|
|
+ }
|
|
|
+
|
|
|
}
|