|
@@ -215,46 +215,33 @@ public class ChuanyunProjectScheduledTask {
|
|
@Scheduled(fixedDelay = 3600000L)
|
|
@Scheduled(fixedDelay = 3600000L)
|
|
private void projectHour() {
|
|
private void projectHour() {
|
|
List<ChuanyunProjectCostDO> list1 = chuanyunProjectCostDao.getProjectCost();
|
|
List<ChuanyunProjectCostDO> list1 = chuanyunProjectCostDao.getProjectCost();
|
|
-// deleteExamineStatus(ChuanyunProjectTotalCostDO.SCHEMA_CODE,"F0000006");
|
|
|
|
- chuanyunProjectCostDao.deleteAllByStatus("2");
|
|
|
|
|
|
+
|
|
list1.forEach(chuanyunProjectCostDO -> {
|
|
list1.forEach(chuanyunProjectCostDO -> {
|
|
- //获取项目实施费用
|
|
|
|
- ChuanyunReimbursementAmountDO chuanyunReimbursementAmountDO = chuanyunReimbursementAmountDao.getAmount(chuanyunProjectCostDO.getProjectId());
|
|
|
|
- //人力成本
|
|
|
|
- ChuanyunMonthLaborCostDO chuanyunMonthLaborCostDO = chuanyunMonthLaborCostDao.getTotalCost(chuanyunProjectCostDO.getProjectId());
|
|
|
|
//更新数据库
|
|
//更新数据库
|
|
- ChuanyunProjectCostDO projectCostDO = new ChuanyunProjectCostDO();
|
|
|
|
- if (chuanyunMonthLaborCostDO!=null){
|
|
|
|
- projectCostDO.setCost(chuanyunMonthLaborCostDO.getAmount());
|
|
|
|
- }
|
|
|
|
- projectCostDO.setProjectType(chuanyunProjectCostDO.getProjectType());
|
|
|
|
- projectCostDO.setProjectId(chuanyunProjectCostDO.getProjectId());
|
|
|
|
- projectCostDO.setTotalHour(chuanyunProjectCostDO.getTotalHour());
|
|
|
|
- projectCostDO.setStatus(chuanyunProjectCostDO.getStatus());
|
|
|
|
- projectCostDO.setPersonDays(chuanyunProjectCostDO.getPersonDays());
|
|
|
|
- if (chuanyunReimbursementAmountDO !=null) {
|
|
|
|
- projectCostDO.setAmount(chuanyunReimbursementAmountDO.getTotalAmount());
|
|
|
|
- }
|
|
|
|
- ChuanyunProjectCostDO oldProjectDO = chuanyunProjectCostDao.findByProjectId(chuanyunProjectCostDO.getProjectId());
|
|
|
|
|
|
+ BigDecimal standard = new BigDecimal(8);
|
|
|
|
+ chuanyunProjectCostDO.setPersonDays(chuanyunProjectCostDO.getTotalHour().divide(standard,2,RoundingMode.HALF_UP));
|
|
|
|
+ ChuanyunProjectCostDO oldProjectDO = chuanyunProjectCostDao.findByProjectIdAndProjectTypeAndStatus(chuanyunProjectCostDO.getProjectId(),chuanyunProjectCostDO.getProjectType(),chuanyunProjectCostDO.getStatus());
|
|
if (oldProjectDO !=null) {
|
|
if (oldProjectDO !=null) {
|
|
chuanyunProjectCostDao.delete(oldProjectDO);
|
|
chuanyunProjectCostDao.delete(oldProjectDO);
|
|
}
|
|
}
|
|
- chuanyunProjectCostDao.save(projectCostDO);
|
|
|
|
|
|
+ chuanyunProjectCostDao.save(chuanyunProjectCostDO);
|
|
|
|
+ //搜索是否有审批中的数据
|
|
|
|
+ ChuanyunProjectCostDO processDO = chuanyunProjectCostDao.getProcessProjectCost(chuanyunProjectCostDO.getProjectId(),chuanyunProjectCostDO.getProjectType());
|
|
|
|
+ if (processDO==null){
|
|
|
|
+ chuanyunProjectCostDao.deleteByProjectIdAndProjectTypeAndStatus(chuanyunProjectCostDO.getProjectId(),chuanyunProjectCostDO.getProjectType(),"2");
|
|
|
|
+ deleteExamineStatus(ChuanyunProjectTotalCostDO.SCHEMA_CODE,"F0000006","F0000001",chuanyunProjectCostDO.getProjectId(),"","","","","","","","","F0000004",chuanyunProjectCostDO.getProjectType());
|
|
|
|
+ }
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- ChuanyunProjectTotalCostDTO chuanyunProjectTotalCostDTO = new ChuanyunProjectTotalCostDTO();
|
|
|
|
|
|
+ ProjectTotalCostDTO chuanyunProjectTotalCostDTO = new ProjectTotalCostDTO();
|
|
chuanyunProjectTotalCostDTO.setProjectType(chuanyunProjectCostDO.getProjectType());
|
|
chuanyunProjectTotalCostDTO.setProjectType(chuanyunProjectCostDO.getProjectType());
|
|
chuanyunProjectTotalCostDTO.setProjectId(chuanyunProjectCostDO.getProjectId());
|
|
chuanyunProjectTotalCostDTO.setProjectId(chuanyunProjectCostDO.getProjectId());
|
|
- if (chuanyunMonthLaborCostDO!=null){
|
|
|
|
- chuanyunProjectTotalCostDTO.setCost(chuanyunMonthLaborCostDO.getAmount());
|
|
|
|
- }
|
|
|
|
chuanyunProjectTotalCostDTO.setStatus(chuanyunProjectCostDO.getStatus());
|
|
chuanyunProjectTotalCostDTO.setStatus(chuanyunProjectCostDO.getStatus());
|
|
chuanyunProjectTotalCostDTO.setWorkHour(chuanyunProjectCostDO.getTotalHour());
|
|
chuanyunProjectTotalCostDTO.setWorkHour(chuanyunProjectCostDO.getTotalHour());
|
|
chuanyunProjectTotalCostDTO.setPersonDays(chuanyunProjectCostDO.getPersonDays());
|
|
chuanyunProjectTotalCostDTO.setPersonDays(chuanyunProjectCostDO.getPersonDays());
|
|
- if (chuanyunReimbursementAmountDO !=null) {
|
|
|
|
- chuanyunProjectTotalCostDTO.setAmount(chuanyunReimbursementAmountDO.getTotalAmount());
|
|
|
|
- }
|
|
|
|
List<String> matchers = new ArrayList<>();
|
|
List<String> matchers = new ArrayList<>();
|
|
matchers.add("F0000001_2,"+chuanyunProjectCostDO.getProjectId());
|
|
matchers.add("F0000001_2,"+chuanyunProjectCostDO.getProjectId());
|
|
|
|
+ matchers.add("F0000004_2,"+chuanyunProjectCostDO.getProjectType());
|
|
matchers.add("F0000006_2,"+chuanyunProjectCostDO.getStatus());
|
|
matchers.add("F0000006_2,"+chuanyunProjectCostDO.getStatus());
|
|
var filter= Filter.instance(0,1,true,"And",matchers);
|
|
var filter= Filter.instance(0,1,true,"And",matchers);
|
|
var chuanyunFindAllResponse=chuanYunManager.findAll(ChuanyunProjectTotalCostDO.SCHEMA_CODE,filter);
|
|
var chuanyunFindAllResponse=chuanYunManager.findAll(ChuanyunProjectTotalCostDO.SCHEMA_CODE,filter);
|
|
@@ -383,6 +370,50 @@ public class ChuanyunProjectScheduledTask {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 删除状态为审核中数据
|
|
|
|
+ * @param schemaCode
|
|
|
|
+ * @param
|
|
|
|
+ */
|
|
|
|
+ public void deleteExamineStatus(String schemaCode,String statusCode,String projectCode,String projectId,String userCode,String userId,String yearCode,String year,String monthCode,String month,String weekCode,String week,String typeCode,String projectType) {
|
|
|
|
+ try {
|
|
|
|
+ List<String> matchers = new ArrayList<>();
|
|
|
|
+ matchers.add(statusCode+"_2,"+"2");
|
|
|
|
+ matchers.add(projectCode+"_2,"+projectId);
|
|
|
|
+ if (!StringUtils.isEmpty(userId)){
|
|
|
|
+ matchers.add(userCode+"_2,"+userId);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(year)){
|
|
|
|
+ matchers.add(yearCode+"_2,"+year);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(month)){
|
|
|
|
+ matchers.add(monthCode+"_2,"+month);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(week)){
|
|
|
|
+ matchers.add(weekCode+"_2,"+week);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(projectType)){
|
|
|
|
+ matchers.add(typeCode+"_2,"+projectType);
|
|
|
|
+ }
|
|
|
|
+ var filter= Filter.instance(0,Integer.MAX_VALUE,true,"And",matchers);
|
|
|
|
+ var chuanyunFindAllResponse=chuanYunManager.findAll(schemaCode,filter);
|
|
|
|
+ if (chuanyunFindAllResponse.getReturnData()!=null){
|
|
|
|
+ List<ChuanyunCommonDO> result=objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>(){});
|
|
|
|
+ result.forEach(basicDO -> {
|
|
|
|
+ ChuanyunSaveDTO chuanyunSaveDTO = chuanYunManager.delete(schemaCode,basicDO.getObjectId());
|
|
|
|
+ if(chuanyunSaveDTO.getSuccessful()){
|
|
|
|
+// log.info("删除状态为审核中数据成功");
|
|
|
|
+ }else{
|
|
|
|
+ log.warn("删除状态为审核中数据失败");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Data
|
|
@Data
|
|
static
|
|
static
|
|
class ChuanyunProjectMemberCostDTO {
|
|
class ChuanyunProjectMemberCostDTO {
|
|
@@ -436,7 +467,7 @@ public class ChuanyunProjectScheduledTask {
|
|
*/
|
|
*/
|
|
@Data
|
|
@Data
|
|
static
|
|
static
|
|
- class ChuanyunProjectTotalCostDTO{
|
|
|
|
|
|
+ class ProjectTotalCostDTO{
|
|
|
|
|
|
/**
|
|
/**
|
|
* 项目ID
|
|
* 项目ID
|
|
@@ -457,12 +488,6 @@ public class ChuanyunProjectScheduledTask {
|
|
private BigDecimal workHour;
|
|
private BigDecimal workHour;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 成本
|
|
|
|
- */
|
|
|
|
- @JsonProperty("F0000002")
|
|
|
|
- private BigDecimal cost;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 总人天
|
|
* 总人天
|
|
*/
|
|
*/
|
|
@JsonProperty("F0000005")
|
|
@JsonProperty("F0000005")
|
|
@@ -474,8 +499,6 @@ public class ChuanyunProjectScheduledTask {
|
|
@JsonProperty("F0000006")
|
|
@JsonProperty("F0000006")
|
|
private String status;
|
|
private String status;
|
|
|
|
|
|
- @JsonProperty("F0000007")
|
|
|
|
- private BigDecimal amount;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Data
|
|
@Data
|