|
@@ -33,9 +33,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -51,199 +49,16 @@ import java.util.stream.Collectors;
|
|
|
public class ProjectPushListController extends JeecgController<ProjectPushList, IProjectPushListService> {
|
|
|
@Autowired
|
|
|
private IProjectPushListService projectPushListService;
|
|
|
- @Autowired
|
|
|
- private IProjectPushSetService projectPushSetService;
|
|
|
- @Autowired
|
|
|
- private IProjectCostService costService;
|
|
|
- @Autowired
|
|
|
- private ISysUserDepartService userDepartService;
|
|
|
- @Autowired
|
|
|
- private IKyTaskInfoService kyTaskInfoService;
|
|
|
- @Autowired
|
|
|
- private ISysUserService sysUserService;
|
|
|
- @Autowired
|
|
|
- private ISysDepartService departService;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
- * 项目成本——寻找并新增推送
|
|
|
+ * 项目成本——查找并更新推送
|
|
|
*/
|
|
|
- @AutoLog(value = "项目成本——寻找并新增推送")
|
|
|
- @ApiOperation(value="项目成本——寻找并新增推送", notes="项目成本——寻找并新增推送")
|
|
|
+ @AutoLog(value = "项目成本——查找并更新推送")
|
|
|
+ @ApiOperation(value="项目成本——查找并更新推送", notes="项目成本——查找并更新推送")
|
|
|
@PostMapping(value = "/addAll")
|
|
|
public Result<String> addAll() {
|
|
|
- projectPushListService.truncateTable();
|
|
|
-
|
|
|
- QueryWrapper<ProjectPushSet> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("cost_type","0");// 0材料费
|
|
|
- List<ProjectPushSet> list1 = projectPushSetService.list(queryWrapper);
|
|
|
- queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("cost_type","1");// 1外协费
|
|
|
- List<ProjectPushSet> list2 = projectPushSetService.list(queryWrapper);
|
|
|
- queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("cost_type","2");// 2人工费
|
|
|
- List<ProjectPushSet> list3 = projectPushSetService.list(queryWrapper);
|
|
|
- //3合同额
|
|
|
- queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("cost_type","3");
|
|
|
- List<ProjectPushSet> list4 = projectPushSetService.list(queryWrapper);
|
|
|
- //4收款额
|
|
|
- queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("cost_type","5");
|
|
|
- List<ProjectPushSet> list5 = projectPushSetService.list(queryWrapper);
|
|
|
-
|
|
|
- List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
|
|
|
-
|
|
|
- // 0材料费
|
|
|
- if(list1!=null && !list1.isEmpty()){
|
|
|
- QueryWrapper<ProjectCost> projectCostQueryWrapper;
|
|
|
- for(ProjectPushSet set : list1){
|
|
|
- String stage = set.getStage();
|
|
|
- projectCostQueryWrapper = new QueryWrapper<>();
|
|
|
- projectCostQueryWrapper.eq("clf",new BigDecimal(0));
|
|
|
- projectCostQueryWrapper.eq("cost_percent",stage);
|
|
|
- List<ProjectCost> projectCostList1 = costService.list(projectCostQueryWrapper);
|
|
|
-
|
|
|
- List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
|
|
|
- List<UserNameIDVO> userNameIdList = projectPushListService.userNamesByRoleIds(roleIds);
|
|
|
-
|
|
|
- for (UserNameIDVO vo: userNameIdList){
|
|
|
- //根据用户id查其所属部门的部门编码
|
|
|
- List<String> sysOrgCodeList = projectPushListService.selectDeptCodeByUserId(vo.getUserId());
|
|
|
- String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
|
|
|
-
|
|
|
- for (ProjectCost cost:projectCostList1){
|
|
|
- ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
|
|
|
- cost.getTaskno(),cost.getTaskname(),set.getId(), vo.getUsername(), set.getContent(),sysOrgCodes);
|
|
|
- pushList.add(push);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 1外协费
|
|
|
- if(list2!=null && !list2.isEmpty()){
|
|
|
- QueryWrapper<ProjectCost> projectCostQueryWrapper;
|
|
|
- for(ProjectPushSet set : list2){
|
|
|
- String stage = set.getStage();
|
|
|
- projectCostQueryWrapper = new QueryWrapper<>();
|
|
|
- projectCostQueryWrapper.eq("wxf",new BigDecimal(0));
|
|
|
- projectCostQueryWrapper.eq("cost_percent",stage);
|
|
|
- List<ProjectCost> projectCostList1 = costService.list(projectCostQueryWrapper);
|
|
|
-
|
|
|
- List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
|
|
|
- List<UserNameIDVO> userNameIdList = projectPushListService.userNamesByRoleIds(roleIds);
|
|
|
-
|
|
|
- for (UserNameIDVO vo: userNameIdList){
|
|
|
- //根据用户id查其所属部门的部门编码
|
|
|
- List<String> sysOrgCodeList = projectPushListService.selectDeptCodeByUserId(vo.getUserId());
|
|
|
- String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
|
|
|
-
|
|
|
- for (ProjectCost cost:projectCostList1){
|
|
|
- ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
|
|
|
- cost.getTaskno(),cost.getTaskname(),set.getId(), vo.getUsername(), set.getContent(),sysOrgCodes);
|
|
|
- pushList.add(push);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 2人工费(工资及劳务费)
|
|
|
- if(list3!=null && !list3.isEmpty()){
|
|
|
- QueryWrapper<ProjectCost> projectCostQueryWrapper;
|
|
|
- for(ProjectPushSet set : list3){
|
|
|
- String stage = set.getStage();
|
|
|
- projectCostQueryWrapper = new QueryWrapper<>();
|
|
|
- projectCostQueryWrapper.eq("gzjlwf",new BigDecimal(0));
|
|
|
- projectCostQueryWrapper.eq("cost_percent",stage);
|
|
|
- List<ProjectCost> projectCostList1 = costService.list(projectCostQueryWrapper);
|
|
|
- List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
|
|
|
- List<UserNameIDVO> userNameIdList = projectPushListService.userNamesByRoleIds(roleIds);
|
|
|
-
|
|
|
- for (UserNameIDVO vo: userNameIdList){
|
|
|
- //根据用户id查其所属部门的部门编码
|
|
|
- List<String> sysOrgCodeList = projectPushListService.selectDeptCodeByUserId(vo.getUserId());
|
|
|
- String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
|
|
|
-
|
|
|
- for (ProjectCost cost:projectCostList1){
|
|
|
- ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
|
|
|
- cost.getTaskno(),cost.getTaskname(),set.getId(), vo.getUsername(), set.getContent(),sysOrgCodes);
|
|
|
- pushList.add(push);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //3合同额
|
|
|
- if(list4!=null && !list4.isEmpty()){
|
|
|
- QueryWrapper<ProjectCost> projectCostQueryWrapper;
|
|
|
- for(ProjectPushSet set : list4){
|
|
|
- String stage = set.getStage();
|
|
|
- projectCostQueryWrapper = new QueryWrapper<>();
|
|
|
- projectCostQueryWrapper.eq("contractfpe",new BigDecimal(0));
|
|
|
- projectCostQueryWrapper.eq("cost_percent",stage);
|
|
|
- List<ProjectCost> projectCostList1 = costService.list(projectCostQueryWrapper);
|
|
|
-
|
|
|
- for (ProjectCost cost:projectCostList1){
|
|
|
- String taskno = cost.getTaskno();
|
|
|
- String orgcode = null;
|
|
|
- String username = null;
|
|
|
- if(taskno!=null){
|
|
|
- QueryWrapper<KyTaskInfo> taskInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- taskInfoQueryWrapper.eq("taskno",cost.getTaskno());
|
|
|
- KyTaskInfo kyTaskInfo = kyTaskInfoService.getOne(taskInfoQueryWrapper);
|
|
|
- if(kyTaskInfo!=null){
|
|
|
- if(kyTaskInfo.getJycsid()!=null){//下达部门id
|
|
|
- SysDepart sysDepart = departService.getById(kyTaskInfo.getJycsid());
|
|
|
- if(sysDepart!=null) orgcode = sysDepart.getOrgCode();
|
|
|
- }
|
|
|
- if(kyTaskInfo.getBusinessman()!=null){
|
|
|
- QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("realname",kyTaskInfo.getBusinessman());
|
|
|
- SysUser user = sysUserService.getOne(wrapper);
|
|
|
- if(user!=null) username=user.getUsername();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
|
|
|
- cost.getTaskno(),cost.getTaskname(),set.getId(), username, set.getContent(),orgcode);
|
|
|
- pushList.add(push);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //4收款额
|
|
|
- if(list5!=null && !list5.isEmpty()){
|
|
|
- QueryWrapper<ProjectCost> projectCostQueryWrapper;for(ProjectPushSet set : list5){
|
|
|
- String stage = set.getStage();
|
|
|
- projectCostQueryWrapper = new QueryWrapper<>();
|
|
|
- projectCostQueryWrapper.eq("taskmoney",new BigDecimal(0));
|
|
|
- projectCostQueryWrapper.eq("cost_percent",stage);
|
|
|
- List<ProjectCost> projectCostList1 = costService.list(projectCostQueryWrapper);
|
|
|
-
|
|
|
- for (ProjectCost cost:projectCostList1){
|
|
|
- String taskno = cost.getTaskno();
|
|
|
- String orgcode = null;
|
|
|
- String username = null;
|
|
|
- if(taskno!=null){
|
|
|
- QueryWrapper<KyTaskInfo> taskInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- taskInfoQueryWrapper.eq("taskno",cost.getTaskno());
|
|
|
- KyTaskInfo kyTaskInfo = kyTaskInfoService.getOne(taskInfoQueryWrapper);
|
|
|
- if(kyTaskInfo!=null){
|
|
|
- if(kyTaskInfo.getJycsid()!=null){//下达部门id
|
|
|
- SysDepart sysDepart = departService.getById(kyTaskInfo.getJycsid());
|
|
|
- if(sysDepart!=null) orgcode = sysDepart.getOrgCode();
|
|
|
- }
|
|
|
- if(kyTaskInfo.getBusinessman()!=null){
|
|
|
- QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("realname",kyTaskInfo.getBusinessman());
|
|
|
- SysUser user = sysUserService.getOne(wrapper);
|
|
|
- if(user!=null) username=user.getUsername();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
|
|
|
- cost.getTaskno(),cost.getTaskname(),set.getId(), username, set.getContent(),orgcode);
|
|
|
- pushList.add(push);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- projectPushListService.saveBatch(pushList);
|
|
|
- return Result.OK("添加成功!");
|
|
|
+ return projectPushListService.addAll();
|
|
|
}
|
|
|
|
|
|
|