|
|
@@ -11,6 +11,9 @@ import com.tofly.feesapi.common.core.dto.PageDto;
|
|
|
import com.tofly.feesapi.common.core.vo.PageResult;
|
|
|
import com.tofly.feesapi.common.exception.FeesErrorCode;
|
|
|
import com.tofly.feesapi.common.exception.FeesException;
|
|
|
+import com.tofly.feesapi.security.util.SecurityUtils;
|
|
|
+import com.tofly.feesapi.xtgl.service.ISyscommlogService;
|
|
|
+import com.tofly.feesapi.yhgl.entity.YhGroupAccounts;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
@@ -20,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -32,6 +36,9 @@ public class YhBjflFbController {
|
|
|
@Autowired
|
|
|
private YhBjflFbService yhBjflFbService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISyscommlogService syscommlogService;
|
|
|
+
|
|
|
@GetMapping("/page")
|
|
|
@ApiOperation(value = "分页查询",tags = "档案管理")
|
|
|
public ResultRespone<PageResult<YhBjflFbSelect>> getPage(@ModelAttribute PageDto pageDto, @ModelAttribute YhBjflFbFilter filter) {
|
|
|
@@ -45,6 +52,10 @@ public class YhBjflFbController {
|
|
|
if (yhBjflFbList.isEmpty()) {
|
|
|
throw new FeesException("用户表具分类(总分表、子母表)分表不能为空", FeesErrorCode.BUSINESS_ERROR);
|
|
|
}
|
|
|
+ //分表
|
|
|
+ List<String> fblist = new ArrayList<>();
|
|
|
+ //子表
|
|
|
+ List<String> zblist = new ArrayList<>();
|
|
|
for (YhBjflFb yhBjflFb : yhBjflFbList) {
|
|
|
if (StringUtil.isEmpty(yhBjflFb.getZbId())) {
|
|
|
throw new FeesException("主表ID不能为空!", FeesErrorCode.BUSINESS_ERROR);
|
|
|
@@ -80,6 +91,25 @@ public class YhBjflFbController {
|
|
|
}
|
|
|
yhBjflFb.setId(yhBjflFbService.getMaxid());
|
|
|
yhBjflFbService.save(yhBjflFb);
|
|
|
+ if (yhBjflFb.getTypeId().equals("1")) {
|
|
|
+ fblist.add(yhBjflFb.getYhbh());
|
|
|
+ } else {
|
|
|
+ zblist.add(yhBjflFb.getYhbh());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String tablename = "yh_bjfl_fb";
|
|
|
+ if (fblist.size() > 0) {
|
|
|
+ String remark = String.format("%s-添加分表户号:%s",
|
|
|
+ SecurityUtils.getUser().getRealName(),
|
|
|
+ Arrays.toString(fblist.toArray())
|
|
|
+ );
|
|
|
+ syscommlogService.LogSave(tablename, "添加分表户号", "ADD", remark, "");
|
|
|
+ }
|
|
|
+ if (zblist.size() > 0) {
|
|
|
+ String remark = String.format("%s-添加分表户号:%s",
|
|
|
+ SecurityUtils.getUser().getRealName(),
|
|
|
+ Arrays.toString(zblist.toArray()));
|
|
|
+ syscommlogService.LogSave(tablename, "添加子表户号", "ADD", remark, "");
|
|
|
}
|
|
|
return ResultRespone.success(true);
|
|
|
}
|
|
|
@@ -99,6 +129,26 @@ public class YhBjflFbController {
|
|
|
})
|
|
|
@DeleteMapping("/deleteByIds")
|
|
|
public ResultRespone<Boolean> removeByIds(String ids) {
|
|
|
+ List<YhBjflFb> yhBjflFbs = yhBjflFbService.lambdaQuery()
|
|
|
+ .in(YhBjflFb::getId, Arrays.asList(ids.split(",")))
|
|
|
+ .list();
|
|
|
+ if (yhBjflFbs.size() > 0) {
|
|
|
+ String tablename = "yh_bjfl_fb";
|
|
|
+ long count = yhBjflFbs.stream().filter(e -> e.getTypeId().equals("1")).count();
|
|
|
+ if (count > 0) {
|
|
|
+ String remark = String.format("%s-删除分表户号:%s",
|
|
|
+ SecurityUtils.getUser().getRealName(),
|
|
|
+ Arrays.toString(yhBjflFbs.stream().filter(e -> e.getTypeId().equals("1")).map(YhBjflFb::getYhbh).toArray()));
|
|
|
+ syscommlogService.LogSave(tablename, "删除分表户号", "DELETE", remark, "");
|
|
|
+ }
|
|
|
+ count = yhBjflFbs.stream().filter(e -> e.getTypeId().equals("2")).count();
|
|
|
+ if (count > 0) {
|
|
|
+ String remark = String.format("%s-删除子表户号:%s",
|
|
|
+ SecurityUtils.getUser().getRealName(),
|
|
|
+ Arrays.toString(yhBjflFbs.stream().filter(e -> e.getTypeId().equals("2")).map(YhBjflFb::getYhbh).toArray()));
|
|
|
+ syscommlogService.LogSave(tablename, "删除子表户号", "DELETE", remark, "");
|
|
|
+ }
|
|
|
+ }
|
|
|
return ResultRespone.success(yhBjflFbService.removeByIds(Arrays.asList(ids.split(","))));
|
|
|
}
|
|
|
}
|