|
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.tofly.common.core.entity.ResultRespone;
|
|
|
import com.tofly.common.log.annotation.ToFlyAppLog;
|
|
|
import com.tofly.fees.common.Excel.ExcleFileUtil;
|
|
|
+import com.tofly.fees.common.enums.UserStatusEnum;
|
|
|
import com.tofly.fees.common.util.GuidGenerator;
|
|
|
import com.tofly.fees.financialmgt.mapper.SfRecMapper;
|
|
|
import com.tofly.fees.userprofilemgt.entity.DaCustomer;
|
|
@@ -42,36 +43,37 @@ import java.util.Map;
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("/api/userprofilemgt/dahlog")
|
|
|
-@Api(tags="客户档案-用户销户记录接口")
|
|
|
+@Api(tags = "客户档案-用户销户记录接口")
|
|
|
public class DahLogController {
|
|
|
|
|
|
- private final DahLogService dahLogService;
|
|
|
+ private final DahLogService dahLogService;
|
|
|
private final DaCustomerService daCustomerService;
|
|
|
|
|
|
private final DahLogMapper dahLogMapper;
|
|
|
private final SfRecMapper sfRecMapper;
|
|
|
+
|
|
|
|
|
|
- * 分页查询 dahLog 用户销户记录
|
|
|
- */
|
|
|
- @GetMapping("/page" )
|
|
|
+ * 分页查询 dahLog 用户销户记录
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
@ApiOperation(value = "分页查询")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "current", value = "当前页码", required = true, dataType = "int"),
|
|
|
@ApiImplicitParam(name = "size", value = "每页显示数据条数", required = true, dataType = "int"),
|
|
|
- @ApiImplicitParam(name = "pages", value = "共几页,输出参数", dataType = "int"),
|
|
|
- @ApiImplicitParam(name = "maxLimit", value = "每页最大显示数据", dataType = "int"),
|
|
|
- @ApiImplicitParam(name = "orders[0].asc", value = "排序,bool类型", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "pages", value = "共几页,输出参数", dataType = "int"),
|
|
|
+ @ApiImplicitParam(name = "maxLimit", value = "每页最大显示数据", dataType = "int"),
|
|
|
+ @ApiImplicitParam(name = "orders[0].asc", value = "排序,bool类型", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "orders[0].column", value = "排序,字段名", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "companyBranch", value = "公司", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "mrArea", value = "片区", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "mrBook", value = "抄表本", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "mrArea", value = "片区", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "mrBook", value = "抄表本", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "operatorDate_Start", value = "开始时间", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "operatorDate_End", value = "结束时间", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "searchText", value = "模糊查询(编号、姓名、电话、地址)", dataType = "String")
|
|
|
+ @ApiImplicitParam(name = "operatorDate_End", value = "结束时间", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "searchText", value = "模糊查询(编号、姓名、电话、地址)", dataType = "String")
|
|
|
})
|
|
|
- public ResultRespone getDahLogPage(Page page,String companyBranch,String mrArea,String mrBook,String operatorDate_Start,String operatorDate_End,String searchText) {
|
|
|
- IPage<DahLog> dahLogIPage=dahLogMapper.SelectDaxhPage(page,companyBranch, mrArea, mrBook, operatorDate_Start, operatorDate_End, searchText);
|
|
|
- return ResultRespone.success(dahLogIPage);
|
|
|
+ public ResultRespone getDahLogPage(Page page, String companyBranch, String mrArea, String mrBook, String operatorDate_Start, String operatorDate_End, String searchText) {
|
|
|
+ IPage<DahLog> dahLogIPage = dahLogMapper.SelectDaxhPage(page, companyBranch, mrArea, mrBook, operatorDate_Start, operatorDate_End, searchText);
|
|
|
+ return ResultRespone.success(dahLogIPage);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -79,16 +81,16 @@ public class DahLogController {
|
|
|
@ApiOperation(value = "export导出")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "companyBranch", value = "公司", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "mrArea", value = "片区", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "mrBook", value = "抄表本", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "mrArea", value = "片区", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "mrBook", value = "抄表本", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "operatorDate_Start", value = "开始时间", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "operatorDate_End", value = "结束时间", dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "searchText", value = "模糊查询(编号、姓名、电话、地址)", dataType = "String")
|
|
|
+ @ApiImplicitParam(name = "operatorDate_End", value = "结束时间", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "searchText", value = "模糊查询(编号、姓名、电话、地址)", dataType = "String")
|
|
|
})
|
|
|
public void export(HttpServletResponse response, String companyBranch, String mrArea, String mrBook, String operatorDate_Start, String operatorDate_End, String searchText) throws IOException {
|
|
|
QueryWrapper<DahLog> queryWrapper = SelectBtFHLog(companyBranch, mrArea, mrBook, operatorDate_Start, operatorDate_End, searchText);
|
|
|
|
|
|
- List<DahLog> list = dahLogService.list(queryWrapper);
|
|
|
+ List<DahLog> list = dahLogService.list(queryWrapper);
|
|
|
|
|
|
|
|
|
|
|
@@ -97,139 +99,142 @@ public class DahLogController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
private QueryWrapper<DahLog> SelectBtFHLog(String companyBranch, String mrArea, String mrBook, String operatorDate_Start, String operatorDate_End, String searchText) {
|
|
|
QueryWrapper<DahLog> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("1",1);
|
|
|
- if(StringUtils.isNotBlank(companyBranch)) {
|
|
|
- queryWrapper.and(i->i.eq("COMPANY_BRANCH",companyBranch));
|
|
|
+ queryWrapper.eq("1", 1);
|
|
|
+ if (StringUtils.isNotBlank(companyBranch)) {
|
|
|
+ queryWrapper.and(i -> i.eq("COMPANY_BRANCH", companyBranch));
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(mrArea)) {
|
|
|
- queryWrapper.and(i->i.eq("MR_AREA",mrArea));
|
|
|
+ if (StringUtils.isNotBlank(mrArea)) {
|
|
|
+ queryWrapper.and(i -> i.eq("MR_AREA", mrArea));
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(mrBook)) {
|
|
|
- queryWrapper.and(i->i.eq("MR_BOOK",mrBook));
|
|
|
+ if (StringUtils.isNotBlank(mrBook)) {
|
|
|
+ queryWrapper.and(i -> i.eq("MR_BOOK", mrBook));
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isNotBlank(operatorDate_Start) && StringUtils.isNotBlank(operatorDate_End)) {
|
|
|
- queryWrapper.and(i->i.apply("APPLY_DATE BETWEEN to_date({0},'yyyy-mm-dd hh24:mi:ss') AND to_date({1},'yyyy-mm-dd hh24:mi:ss')", operatorDate_Start, operatorDate_End));
|
|
|
+ if (StringUtils.isNotBlank(operatorDate_Start) && StringUtils.isNotBlank(operatorDate_End)) {
|
|
|
+ queryWrapper.and(i -> i.apply("APPLY_DATE BETWEEN to_date({0},'yyyy-mm-dd hh24:mi:ss') AND to_date({1},'yyyy-mm-dd hh24:mi:ss')", operatorDate_Start, operatorDate_End));
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(searchText))
|
|
|
- {
|
|
|
- queryWrapper.like("CUSTOMER_NO",searchText)
|
|
|
+ if (StringUtils.isNotBlank(searchText)) {
|
|
|
+ queryWrapper.like("CUSTOMER_NO", searchText)
|
|
|
.or()
|
|
|
- .like("CUSTOMER_ADDRESS",searchText)
|
|
|
+ .like("CUSTOMER_ADDRESS", searchText)
|
|
|
.or()
|
|
|
- .like("PHONE",searchText)
|
|
|
+ .like("PHONE", searchText)
|
|
|
.or()
|
|
|
- .like("CUSTOMER_NAME",searchText);
|
|
|
+ .like("CUSTOMER_NAME", searchText);
|
|
|
}
|
|
|
return queryWrapper;
|
|
|
}
|
|
|
|
|
|
|
|
|
* 通过id查询用户销户记录
|
|
|
+ *
|
|
|
* @param id id
|
|
|
* @return ResultRespone
|
|
|
*/
|
|
|
- @GetMapping("/{id}" )
|
|
|
+ @GetMapping("/{id}")
|
|
|
@ApiOperation(value = "通过ID查询")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String")
|
|
|
})
|
|
|
- public ResultRespone getById(@PathVariable("id" ) String id) {
|
|
|
- return ResultRespone.success(dahLogService.getById(id));
|
|
|
+ public ResultRespone getById(@PathVariable("id") String id) {
|
|
|
+ return ResultRespone.success(dahLogService.getById(id));
|
|
|
}
|
|
|
|
|
|
|
|
|
* 新增用户销户记录
|
|
|
+ *
|
|
|
* @param dahLog 用户销户记录
|
|
|
* @return ResultRespone
|
|
|
*/
|
|
|
- @ToFlyAppLog(title="新增用户销户记录" )
|
|
|
+ @ToFlyAppLog(title = "新增用户销户记录")
|
|
|
@ApiOperation(value = "新增用户销户记录")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "yzqf", value = "是否验证欠费(1:需验证;0:不验证)", required = false, dataType = "String")
|
|
|
+ })
|
|
|
@PostMapping
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public ResultRespone save(@RequestBody DahLog dahLog) {
|
|
|
+ public ResultRespone save(@RequestBody DahLog dahLog, @RequestParam(required = false) String yzqf) {
|
|
|
ResultRespone<Object> rest = new ResultRespone<>();
|
|
|
dahLog.setId(GuidGenerator.getGuid());
|
|
|
|
|
|
- if(StringUtils.isNotBlank(dahLog.getCustomerNo()))
|
|
|
- {
|
|
|
-
|
|
|
- Map<String,Object> map= sfRecMapper.SelectricCount(dahLog.getCustomerNo());
|
|
|
- int count=Integer.parseInt(map.get("COUNT").toString());
|
|
|
- if(count>0)
|
|
|
- {
|
|
|
- rest.setCode(-1);
|
|
|
- rest.setMessage("操作失败,用户存在欠费:"+count+"笔");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- if(dahLogService.save(dahLog))
|
|
|
- {
|
|
|
- DaCustomer daCustomer=new DaCustomer();
|
|
|
- daCustomer.setCustomerState("3");
|
|
|
- if(daCustomerService.save(daCustomer))
|
|
|
- {
|
|
|
- rest.setCode(1);
|
|
|
- rest.setMessage("操作成功");
|
|
|
- }else {
|
|
|
- rest.setCode(-1);
|
|
|
- rest.setMessage("操作失败");
|
|
|
- }
|
|
|
- }else
|
|
|
- {
|
|
|
- rest.setCode(-1);
|
|
|
- rest.setMessage("操作失败");
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
+ if (StringUtils.isNotBlank(dahLog.getCustomerNo())) {
|
|
|
+ if (yzqf.equals("1")) {
|
|
|
+
|
|
|
+ Map<String, Object> map = sfRecMapper.SelectricCount(dahLog.getCustomerNo());
|
|
|
+ int count = Integer.parseInt(map.get("COUNT").toString());
|
|
|
+ if (count > 0) {
|
|
|
+ rest.setCode(-1);
|
|
|
+ rest.setMessage("操作失败,用户存在欠费:" + count + "笔");
|
|
|
+ return rest;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dahLogService.save(dahLog)) {
|
|
|
+
|
|
|
+ DaCustomer daCustomer = new DaCustomer();
|
|
|
+ daCustomer.setCustomerNo(dahLog.getCustomerNo());
|
|
|
+ daCustomer.setCustomerState(UserStatusEnum.CloseUser.getStatusUser().toString());
|
|
|
+ if (daCustomerService.updateById(daCustomer)) {
|
|
|
+ rest.setCode(1);
|
|
|
+ rest.setMessage("操作成功");
|
|
|
+ } else {
|
|
|
+ rest.setCode(-1);
|
|
|
+ rest.setMessage("操作失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rest.setCode(-1);
|
|
|
+ rest.setMessage("操作失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
rest.setCode(-1);
|
|
|
rest.setMessage("操作失败,用户编号不能为空");
|
|
|
}
|
|
|
- return rest;
|
|
|
+ return rest;
|
|
|
}
|
|
|
|
|
|
|
|
|
* 修改用户销户记录
|
|
|
+ *
|
|
|
* @param dahLog 用户销户记录
|
|
|
* @return ResultRespone
|
|
|
*/
|
|
|
- @ToFlyAppLog(title="修改用户销户记录" )
|
|
|
+ @ToFlyAppLog(title = "修改用户销户记录")
|
|
|
@ApiOperation(value = "修改用户销户记录")
|
|
|
@PutMapping
|
|
|
public ResultRespone updateById(@RequestBody DahLog dahLog) {
|
|
|
- return ResultRespone.success(dahLogService.updateById(dahLog));
|
|
|
+ return ResultRespone.success(dahLogService.updateById(dahLog));
|
|
|
}
|
|
|
|
|
|
|
|
|
* 通过id删除用户销户记录
|
|
|
+ *
|
|
|
* @param id id
|
|
|
* @return ResultRespone
|
|
|
*/
|
|
|
- @ToFlyAppLog(title="通过id删除用户销户记录" )
|
|
|
+ @ToFlyAppLog(title = "通过id删除用户销户记录")
|
|
|
@ApiOperation(value = "通过ID删除用户销户记录")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String")
|
|
|
})
|
|
|
- @DeleteMapping("/{id}" )
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
public ResultRespone removeById(@PathVariable String id) {
|
|
|
- return ResultRespone.success(dahLogService.removeById(id));
|
|
|
+ return ResultRespone.success(dahLogService.removeById(id));
|
|
|
}
|
|
|
|
|
|
|
|
|
* 通过id批量删除用户销户记录
|
|
|
+ *
|
|
|
* @param ids id
|
|
|
* @return ResultRespone
|
|
|
*/
|
|
|
- @ToFlyAppLog(title="通过id批量删除用户销户记录" )
|
|
|
+ @ToFlyAppLog(title = "通过id批量删除用户销户记录")
|
|
|
@ApiOperation(value = "通过ID批量删除用户销户记录")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "ids", value = "批量删除,多个id以逗号隔开", required = true, dataType = "String")
|
|
|
})
|
|
|
- @DeleteMapping("/deleteByIds" )
|
|
|
+ @DeleteMapping("/deleteByIds")
|
|
|
public ResultRespone removeByIds(String ids) {
|
|
|
return ResultRespone.success(dahLogService.removeByIds(Arrays.asList(ids.split(","))));
|
|
|
}
|