commit
e02fe91678
|
@ -9,6 +9,7 @@
|
||||||
<module name="Genius-user" />
|
<module name="Genius-user" />
|
||||||
<module name="Genius-project" />
|
<module name="Genius-project" />
|
||||||
<module name="Genius-gateway" />
|
<module name="Genius-gateway" />
|
||||||
|
<module name="Genius-costType" />
|
||||||
<module name="Genius-auth" />
|
<module name="Genius-auth" />
|
||||||
<module name="Genius-common" />
|
<module name="Genius-common" />
|
||||||
</profile>
|
</profile>
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
<module name="Genius-auth" options="-parameters" />
|
<module name="Genius-auth" options="-parameters" />
|
||||||
<module name="Genius-common" options="-parameters" />
|
<module name="Genius-common" options="-parameters" />
|
||||||
|
<module name="Genius-costType" options="-parameters" />
|
||||||
<module name="Genius-gateway" options="-parameters" />
|
<module name="Genius-gateway" options="-parameters" />
|
||||||
<module name="Genius-project" options="-parameters" />
|
<module name="Genius-project" options="-parameters" />
|
||||||
<module name="Genius-user" options="-parameters" />
|
<module name="Genius-user" options="-parameters" />
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<file url="file://$PROJECT_DIR$/Genius-common/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/Genius-common/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/Genius-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/Genius-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/Genius-gateway/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/Genius-gateway/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-costType/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-costType/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-project/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-project/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-user/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-user/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-user/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/Genius-modules/Genius-user/src/main/resources" charset="UTF-8" />
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/Genius-modules/Genius-costType/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -66,15 +66,15 @@ public class Project {
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty("成本类型集合")
|
@ApiModelProperty("成本类型集合")
|
||||||
@TableField("projectCostTypeList")
|
|
||||||
private List<ProjectCostType> projectCostTypeList;
|
private List<ProjectCostType> projectCostTypeList;
|
||||||
|
|
||||||
|
@ApiModelProperty("类型的数据")
|
||||||
|
private Integer type[];
|
||||||
|
|
||||||
@ApiModelProperty("总概算金额")
|
@ApiModelProperty("总概算金额")
|
||||||
@TableField("imputedAmountSum")
|
|
||||||
private Double imputedAmountSum;
|
private Double imputedAmountSum;
|
||||||
|
|
||||||
@ApiModelProperty("总估算金额")
|
@ApiModelProperty("总估算金额")
|
||||||
@TableField("estimatedAmountSum")
|
|
||||||
private Double estimatedAmountSum;
|
private Double estimatedAmountSum;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@ public class ProjectCostType {
|
||||||
@TableField("cost_type_id")
|
@TableField("cost_type_id")
|
||||||
private Integer costTypeId;
|
private Integer costTypeId;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目成本类型名称")
|
||||||
|
private String costTypeName;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty("估算金额")
|
@ApiModelProperty("估算金额")
|
||||||
@TableField("imputed_amount")
|
@TableField("imputed_amount")
|
||||||
private Double imputedAmount;
|
private Double imputedAmount;
|
||||||
|
@ -45,5 +49,15 @@ public class ProjectCostType {
|
||||||
@TableField("status")
|
@TableField("status")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty("修改人")
|
||||||
|
@TableField("update_by")
|
||||||
|
private Integer updateBy;
|
||||||
|
|
||||||
|
@ApiModelProperty("修改时间")
|
||||||
|
@TableField("update_time")
|
||||||
|
private Integer updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.bwie.common.domain.request;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: TODO
|
||||||
|
* @author: SIKADI
|
||||||
|
* @date: 2023/10/8 16:27
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class ProjectInquire {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("第几页")
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
@ApiModelProperty("每页条数")
|
||||||
|
private Integer pageSize=3;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目客户方")
|
||||||
|
private String projectClient;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目立项开始时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private Date projectCreateTimeStart;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目立项结束时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private Date projectCreateTimeEnd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>Genius-modules</artifactId>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>Genius-costType</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>Genius-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.bwie.costType;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CostTypeApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CostTypeApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.bwie.costType.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.CostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.costType.service.impl.CostTypeServiceImpl;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
public class CostTypeController {
|
||||||
|
@Autowired
|
||||||
|
private CostTypeServiceImpl costTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有成本类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("costTypeList")
|
||||||
|
public Result<List<CostType>> costTypeList(){
|
||||||
|
log.info("功能:成本类型,请求路径:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),"");
|
||||||
|
|
||||||
|
Result<List<CostType>> result = costTypeService.costTypeList();
|
||||||
|
|
||||||
|
log.info("功能:成本类型,请求路径:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.bwie.costType.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.CostType;
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.costType.service.impl.CostTypeServiceImpl;
|
||||||
|
import com.bwie.costType.service.impl.ProjectCostTypeServiceImpl;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
public class ProjectCostTypeController {
|
||||||
|
@Autowired
|
||||||
|
private ProjectCostTypeServiceImpl projectCostTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目id获取成本类型中间列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/ProjectCostTypeListById/{pid}")
|
||||||
|
public Result<List<ProjectCostType>> ProjectCostTypeListById(@PathVariable Integer pid){
|
||||||
|
log.info("功能:成根据项目id获取成本类型中间列表类型,请求路径:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),pid);
|
||||||
|
|
||||||
|
Result<List<ProjectCostType>> result = projectCostTypeService.ProjectCostTypeListById(pid);
|
||||||
|
|
||||||
|
log.info("功能:根据项目id获取成本类型中间列表,请求路径:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改估算金额
|
||||||
|
*/
|
||||||
|
@PostMapping("updateImputedAmount")
|
||||||
|
public Result updateImputedAmount(@RequestBody Project project){
|
||||||
|
log.info("功能:修改估算金额,请求路径:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),project);
|
||||||
|
|
||||||
|
Result result = projectCostTypeService.updateImputedAmount(project);
|
||||||
|
|
||||||
|
log.info("功能:修改估算金额,请求路径:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核估算金额
|
||||||
|
* @param projectCostType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("examineImputedAmount")
|
||||||
|
public Result examineImputedAmount(@RequestBody ProjectCostType projectCostType){
|
||||||
|
log.info("功能:审核估算金额,请求路径:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),projectCostType);
|
||||||
|
|
||||||
|
Result result = projectCostTypeService.examineImputedAmount(projectCostType);
|
||||||
|
|
||||||
|
log.info("功能:审核估算金额,请求路径:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.bwie.costType.mapper;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.CostType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Component
|
||||||
|
public interface CostTypeMapper {
|
||||||
|
List<CostType> costTypeList();
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.costType.mapper;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Component
|
||||||
|
public interface ProjectCostTypeMapper {
|
||||||
|
List<ProjectCostType> ProjectCostTypeListById(@Param("pid") Integer pid);
|
||||||
|
|
||||||
|
void updateImputedAmount(ProjectCostType projectCostType);
|
||||||
|
|
||||||
|
int examineImputedAmount(ProjectCostType projectCostType);
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.bwie.costType.service;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.CostType;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CostTypeService {
|
||||||
|
Result<List<CostType>> costTypeList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.costType.service;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ProjectCostTypeService {
|
||||||
|
Result<List<ProjectCostType>> ProjectCostTypeListById(Integer pid);
|
||||||
|
|
||||||
|
Result updateImputedAmount(Project project);
|
||||||
|
|
||||||
|
Result examineImputedAmount(ProjectCostType projectCostType);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.bwie.costType.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.CostType;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.costType.mapper.CostTypeMapper;
|
||||||
|
import com.bwie.costType.service.CostTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CostTypeServiceImpl implements CostTypeService {
|
||||||
|
@Autowired
|
||||||
|
private CostTypeMapper costTypeMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取成本类型列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<List<CostType>> costTypeList() {
|
||||||
|
List<CostType> list = costTypeMapper.costTypeList();
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.bwie.costType.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.costType.mapper.ProjectCostTypeMapper;
|
||||||
|
import com.bwie.costType.service.ProjectCostTypeService;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ProjectCostTypeServiceImpl implements ProjectCostTypeService {
|
||||||
|
@Autowired
|
||||||
|
private ProjectCostTypeMapper projectCostTypeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取成本类型中间列表
|
||||||
|
* @param pid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<List<ProjectCostType>> ProjectCostTypeListById(Integer pid) {
|
||||||
|
List<ProjectCostType> list = projectCostTypeMapper.ProjectCostTypeListById(pid);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改估算金额
|
||||||
|
* @param project
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result updateImputedAmount(Project project) {
|
||||||
|
List<ProjectCostType> projectCostTypeList = project.getProjectCostTypeList();
|
||||||
|
for (ProjectCostType projectCostType : projectCostTypeList) {
|
||||||
|
//先进行数据的修改
|
||||||
|
projectCostTypeMapper.updateImputedAmount(projectCostType);
|
||||||
|
//判断 如果概算金额不为空 说明已经审核过了,需要发送消息给审核人
|
||||||
|
if (projectCostType.getEstimatedAmount()!=null){
|
||||||
|
//[项目名称][类型名称]的估算类型发估算更改,金额从[原始金额]变更为[变更后金额]
|
||||||
|
String msg = project.getProjectName()+projectCostType.getCostTypeName()+
|
||||||
|
"的估算类型发生估算更改,金额从"+projectCostType.getImputedAmount()+
|
||||||
|
"变更为"+projectCostType.getEstimatedAmount();
|
||||||
|
Integer updateBy = projectCostType.getUpdateBy(); //获取当前最后修改人也就是审核人id
|
||||||
|
//异步发送消息
|
||||||
|
rabbitTemplate.convertAndSend("MSG_QUEUE",msg+"%"+updateBy,message -> {
|
||||||
|
message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核估算金额/填写概算金额
|
||||||
|
* @param projectCostType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result examineImputedAmount(ProjectCostType projectCostType) {
|
||||||
|
if (projectCostType.getEstimatedAmount().equals(projectCostType.getImputedAmount())){
|
||||||
|
projectCostType.setStatus(1);
|
||||||
|
}else {
|
||||||
|
projectCostType.setStatus(0);
|
||||||
|
}
|
||||||
|
int i = projectCostTypeMapper.examineImputedAmount(projectCostType);
|
||||||
|
return i>0?Result.success():Result.error();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9002
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-costType
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 182.254.222.21:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 182.254.222.21:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: Sha
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bwie.costType.mapper.CostTypeMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="costTypeList" resultType="com.bwie.common.domain.CostType">
|
||||||
|
select *from t_cost_type
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bwie.costType.mapper.ProjectCostTypeMapper">
|
||||||
|
<update id="updateImputedAmount">
|
||||||
|
update t_project_cost_type set imputed_amount=#{imputedAmount}
|
||||||
|
where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="examineImputedAmount">
|
||||||
|
update t_project_cost_type set
|
||||||
|
estimated_amount=#{estimatedAmount},status=#{status}
|
||||||
|
where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="ProjectCostTypeListById" resultType="com.bwie.common.domain.ProjectCostType">
|
||||||
|
select *from t_project_cost_type where project_id = #{pid}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -16,5 +16,40 @@
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>Genius-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.bwie;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println("Hello world!");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.project;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: TODO
|
||||||
|
* @author: SIKADI
|
||||||
|
* @date: 2023/10/8 16:22
|
||||||
|
**/
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableFeignClients
|
||||||
|
public class GeniusProjectApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(GeniusProjectApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.bwie.project.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.request.ProjectInquire;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.project.service.ProjectService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sikadi
|
||||||
|
* @since 2023-10-08 02:57:22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
public class ProjectController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProjectService projectService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 列表
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/8 16:37
|
||||||
|
* @param: [projectInquire]
|
||||||
|
* @return: com.bwie.common.result.Result<com.bwie.common.result.PageResult<com.bwie.common.domain.Project>>
|
||||||
|
**/
|
||||||
|
@PostMapping("/projectList")
|
||||||
|
private Result<PageResult<Project>> projectList(@RequestBody ProjectInquire projectInquire){
|
||||||
|
log.info("列表请求的值:{}", JSON.toJSONString(projectInquire));
|
||||||
|
PageResult pageResult = projectService.projectList(projectInquire);
|
||||||
|
log.info("列表响应:{}",JSON.toJSONString(pageResult.getList()));
|
||||||
|
return Result.success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 添加的功能
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/9 8:15
|
||||||
|
* @param: [project]
|
||||||
|
* @return: com.bwie.common.result.Result
|
||||||
|
**/
|
||||||
|
@PostMapping("/projectIncrease")
|
||||||
|
public Result projectIncrease(@RequestBody Project project){
|
||||||
|
log.info("添加---请求:{}",JSON.toJSONString(project));
|
||||||
|
Result result = projectService.projectIncrease(project);
|
||||||
|
log.info("添加---结果:{}",JSON.toJSONString(result.getData()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.bwie.project.feign;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.CostType;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: TODO
|
||||||
|
* @author: SIKADI
|
||||||
|
* @date: 2023/10/8 16:39
|
||||||
|
**/
|
||||||
|
@FeignClient("bwie-costType")
|
||||||
|
public interface FeignCostType {
|
||||||
|
/**
|
||||||
|
* 获取所有成本类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("costTypeList")
|
||||||
|
public Result<List<CostType>> costTypeList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目id获取成本类型中间列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/ProjectCostTypeListById/{pid}")
|
||||||
|
public Result<List<ProjectCostType>> ProjectCostTypeListById(@PathVariable Integer pid);
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.bwie.project.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.request.ProjectInquire;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sikadi
|
||||||
|
* @since 2023-10-08 02:57:22
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ProjectMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询列表
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/8 16:46
|
||||||
|
* @param: [projectInquire]
|
||||||
|
* @return: java.util.List<com.bwie.common.domain.Project>
|
||||||
|
**/
|
||||||
|
List<Project> projectList(ProjectInquire projectInquire);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 添加
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/9 10:21
|
||||||
|
* @param: [project]
|
||||||
|
* @return: int
|
||||||
|
**/
|
||||||
|
int projectIncrease(Project project);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 添加中间表
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/9 10:35
|
||||||
|
* @param: [project]
|
||||||
|
* @return: int
|
||||||
|
**/
|
||||||
|
int projectCostTypeIncrease(Project project);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bwie.project.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.request.ProjectInquire;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sikadi
|
||||||
|
* @since 2023-10-08 02:57:22
|
||||||
|
*/
|
||||||
|
public interface ProjectService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 列表
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/8 16:37
|
||||||
|
* @param: [projectInquire]
|
||||||
|
* @return: com.bwie.common.result.PageResult
|
||||||
|
**/
|
||||||
|
PageResult projectList(ProjectInquire projectInquire);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 添加
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/9 8:15
|
||||||
|
* @param: [project]
|
||||||
|
* @return: com.bwie.common.result.Result
|
||||||
|
**/
|
||||||
|
Result projectIncrease(Project project);
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.bwie.project.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Project;
|
||||||
|
import com.bwie.common.domain.ProjectCostType;
|
||||||
|
import com.bwie.common.domain.request.ProjectInquire;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.project.feign.FeignCostType;
|
||||||
|
import com.bwie.project.mapper.ProjectMapper;
|
||||||
|
import com.bwie.project.service.ProjectService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sikadi
|
||||||
|
* @since 2023-10-08 02:57:22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ProjectServiceImpl implements ProjectService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeignCostType feignCostType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 列表
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/8 16:42
|
||||||
|
* @param: [projectInquire]
|
||||||
|
* @return: com.bwie.common.result.PageResult
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public PageResult projectList(ProjectInquire projectInquire) {
|
||||||
|
// 分页
|
||||||
|
PageHelper.startPage(projectInquire.getPageNum(),projectInquire.getPageSize());
|
||||||
|
// 查询列表
|
||||||
|
List<Project> projectList = projectMapper.projectList(projectInquire);
|
||||||
|
|
||||||
|
// 查询成功时 循环获取id
|
||||||
|
projectList.forEach(item -> {
|
||||||
|
// 创建两个空的对象 分别装的是 总概算金额 总估算金额
|
||||||
|
Double imputedAmountSum = null; // 总概算金额
|
||||||
|
Double estimatedAmountSum = null; // 总估算金额
|
||||||
|
// 赋值给 中间表
|
||||||
|
Result<List<ProjectCostType>> listResult = feignCostType.ProjectCostTypeListById(item.getId());
|
||||||
|
// 循环得出值
|
||||||
|
for (ProjectCostType datum : listResult.getData()) {
|
||||||
|
imputedAmountSum += datum.getImputedAmount();
|
||||||
|
estimatedAmountSum += datum.getEstimatedAmount();
|
||||||
|
}
|
||||||
|
// 赋值
|
||||||
|
item.setImputedAmountSum(imputedAmountSum);
|
||||||
|
item.setEstimatedAmountSum(estimatedAmountSum);
|
||||||
|
});
|
||||||
|
// 取出
|
||||||
|
PageInfo<Project> projectPageInfo = new PageInfo<>(projectList);
|
||||||
|
|
||||||
|
return PageResult.toPageResult(projectPageInfo.getTotal(),projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 添加
|
||||||
|
* @author: (扭曲)(爬行)(抽搐)
|
||||||
|
* @date: 2023/10/9 8:16
|
||||||
|
* @param: [project]
|
||||||
|
* @return: com.bwie.common.result.Result
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Result projectIncrease(Project project){
|
||||||
|
// 先进行 表添加
|
||||||
|
int i = projectMapper.projectIncrease(project);
|
||||||
|
if(0==i){
|
||||||
|
return Result.error("添加失败");
|
||||||
|
}
|
||||||
|
// 再次进行添加成本类型中间表
|
||||||
|
int j = projectMapper.projectCostTypeIncrease(project);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9001
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-project
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 182.254.222.21:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 182.254.222.21:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: Sha
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bwie.project.mapper.ProjectMapper">
|
||||||
|
<select id="projectList" resultType="com.bwie.common.domain.Project">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from
|
||||||
|
t_project
|
||||||
|
<where>
|
||||||
|
<if test="projectName!=null and projectName!=''">
|
||||||
|
and project_name = #{projectName}
|
||||||
|
</if>
|
||||||
|
<if test="projectClient!=null and projectClient!=''">
|
||||||
|
and project_client like concat('%',#{projectClient},'%')
|
||||||
|
</if>
|
||||||
|
<if test="projectCreateTimeStart!=null">
|
||||||
|
and project_create_time >= #{projectCreateTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="projectCreateTimeEnd!=null">
|
||||||
|
and project_create_time <= #{projectCreateTimeEnd}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="projectIncrease" keyProperty="projectId" useGeneratedKeys="true">
|
||||||
|
insert into t_project (project_name,project_card,project_client,project_create_time,project_start_time,project_completed_time,project_leader,project_image,status)
|
||||||
|
values (#{projectName},#{projectCard},#{projectClient},now(),#{projectStartTime},#{projectCompletedTime},#{projectLeader},#{projectImage},0);
|
||||||
|
</insert>
|
||||||
|
<insert id="projectCostTypeIncrease">
|
||||||
|
insert into t_project_cost_type (project_id,cost_type_id,status)
|
||||||
|
values <foreach collection="type" separator="," item="item">
|
||||||
|
(#{id},item,0)
|
||||||
|
</foreach>;
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
|
@ -14,6 +14,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>Genius-user</module>
|
<module>Genius-user</module>
|
||||||
<module>Genius-project</module>
|
<module>Genius-project</module>
|
||||||
|
<module>Genius-costType</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue