Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

xs 5 gadi atpakaļ
vecāks
revīzija
96337c7835

+ 8 - 7
src/main/java/com/jeeplus/modules/sg/overheadline/service/OverheadLineService.java

@@ -71,23 +71,24 @@ public class OverheadLineService {
    }
 
 
-    @Transactional
+    @Transactional(readOnly = false)
     public void updataDate(JkxlDetailFee jkxlDetailFee){
         overheadLineMapper.updateDate(jkxlDetailFee);
     }
 
-    @Transactional
+    @Transactional(readOnly = false)
    public void saveProject(WbsProject wbsProject){
        overheadLineMapper.saveProject(wbsProject);
    }
 
+    @Transactional(readOnly = false)
    public void save(MultipartFile file,double sl,String name,String id) throws IOException, InvalidFormatException {
-       WbsProject wbsProject = new WbsProject();
-       wbsProject.setId(id);
-       wbsProject.setName(name);
-       wbsProject.setCreateDate(new Date());
+//       WbsProject wbsProject = new WbsProject();
+//       wbsProject.setId(id);
+//       wbsProject.setName(name);
+//       wbsProject.setCreateDate(new Date());
        //保存项目
-       overheadLineMapper.saveProject(wbsProject);
+//       overheadLineMapper.saveProject(wbsProject);
        //获取调差系数
        double[] tcRate = new double[3];
        tcRate[0] = ruleRatioService.getValueByName(BashInfo.RATIO_RGTC).getValue()/100;

+ 55 - 0
src/main/java/com/jeeplus/modules/sg/project/entity/WbsItem.java

@@ -0,0 +1,55 @@
+package com.jeeplus.modules.sg.project.entity;
+
+import com.jeeplus.core.persistence.DataEntity;
+
+public class WbsItem extends DataEntity<WbsItem> {
+    private String id; //项目ID
+    private String unit; //施工单位
+    private String itemName; //项目名称
+    private String projectId; //工程ID
+    private String parentNode; //父节点
+    private String type; //项目类型
+
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public String getItemName() {
+        return itemName;
+    }
+
+    public void setItemName(String itemName) {
+        this.itemName = itemName;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getParentNode() {
+        return parentNode;
+    }
+
+    public void setParentNode(String parentNode) {
+        this.parentNode = parentNode;
+    }
+}

+ 33 - 0
src/main/java/com/jeeplus/modules/sg/project/entity/WbsProject.java

@@ -0,0 +1,33 @@
+package com.jeeplus.modules.sg.project.entity;
+
+import com.jeeplus.core.persistence.DataEntity;
+
+public class WbsProject extends DataEntity<WbsProject> {
+    private String projectName;//工程名称
+    private int number;  //项目数量
+    private String parentNode; //父节点
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public int getNumber() {
+        return number;
+    }
+
+    public void setNumber(int number) {
+        this.number = number;
+    }
+
+    public String getParentNode() {
+        return parentNode;
+    }
+
+    public void setParentNode(String parentNode) {
+        this.parentNode = parentNode;
+    }
+}

+ 13 - 0
src/main/java/com/jeeplus/modules/sg/project/mapper/ItemMapper.java

@@ -0,0 +1,13 @@
+package com.jeeplus.modules.sg.project.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.project.entity.WbsItem;
+import com.jeeplus.modules.sg.project.entity.WbsProject;
+
+
+@MyBatisMapper
+public interface ItemMapper extends BaseMapper<WbsItem> {
+
+
+}

+ 13 - 0
src/main/java/com/jeeplus/modules/sg/project/mapper/ProjectMapper.java

@@ -0,0 +1,13 @@
+package com.jeeplus.modules.sg.project.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.project.entity.WbsProject;
+
+
+
+@MyBatisMapper
+public interface ProjectMapper extends BaseMapper<WbsProject> {
+
+
+}

+ 139 - 0
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ItemMapper.xml

@@ -0,0 +1,139 @@
+<?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.jeeplus.modules.sg.item.entity.WbsItem">
+    
+	<sql id="infoColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.item_name AS "itemName",
+		a.unit AS "unit",
+	    a.project_id AS "projectId",
+		a.parent_node AS "parentNode",
+		a.type AS "type"
+	</sql>
+	
+	<!--<sql id="infoJoins">-->
+		<!---->
+		<!--LEFT JOIN test_category category ON category.id = a.category_id-->
+	<!--</sql>-->
+	
+    
+	<select id="get" resultType="WbsItem" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM sg_wbs_item a
+-- 		<include refid="goodsJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="WbsItem" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM sg_wbs_item a
+-- 		<include refid="goodsJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="itemName != null and itemName != ''">
+				AND a.item_name = #{itemName}
+			</if>
+			<if test="updateBy.id != null  and updateBy.id != ''">
+				AND a.update_by= #{updateBy.id}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="WbsItem" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM sg_wbs_item a
+-- 		<include refid="goodsJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert">
+		INSERT INTO sg_wbs_item(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			item_name,
+			unit,
+			type,
+			project_id,
+			parent_node
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{itemName},
+			#{unit},
+			#{type},
+			#{projectId},
+			#{parentNode}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE sg_wbs_item SET
+			item_name = #{itemName},
+			unit = #{unit},
+			type = #{type},
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM sg_wbs_item
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE sg_wbs_item SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="Goods" statementType="STATEMENT">
+		select * FROM sg_wbs_item  where ${propertyName} = '${value}'
+	</select>
+	
+</mapper>

+ 132 - 0
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ProjectMapper.xml

@@ -0,0 +1,132 @@
+<?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.jeeplus.modules.sg.project.entity.WbsProject">
+    
+	<sql id="infoColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.project_name AS "projectName",
+		a.number AS "number",
+		a.parent_node AS "parentNode"
+	</sql>
+	
+	<!--<sql id="infoJoins">-->
+		<!---->
+		<!--LEFT JOIN test_category category ON category.id = a.category_id-->
+	<!--</sql>-->
+	
+    
+	<select id="get" resultType="WbsProject" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM sg_wbs_project a
+-- 		<include refid="goodsJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="WbsProject" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM sg_wbs_project a
+-- 		<include refid="goodsJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="projectName != null and projectName != ''">
+				AND a.project_name = #{projectName}
+			</if>
+			<if test="updateBy.id != null  and updateBy.id != ''">
+				AND a.update_by= #{updateBy.id}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="WbsProject" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM sg_wbs_project a
+-- 		<include refid="goodsJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert">
+		INSERT INTO sg_wbs_project(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			project_name,
+			number,
+			parent_node
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{projectName},
+			#{number},
+			#{parentNode}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE sg_wbs_project SET
+			project_name = #{projectName},
+			number = #{number},
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM sg_wbs_project
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE sg_wbs_project SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="Goods" statementType="STATEMENT">
+		select * FROM sg_wbs_project  where ${propertyName} = '${value}'
+	</select>
+	
+</mapper>

+ 36 - 0
src/main/java/com/jeeplus/modules/sg/project/service/ItemService.java

@@ -0,0 +1,36 @@
+package com.jeeplus.modules.sg.project.service;
+
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.project.entity.WbsItem;
+import com.jeeplus.modules.sg.project.entity.WbsProject;
+import com.jeeplus.modules.sg.project.mapper.ItemMapper;
+import com.jeeplus.modules.sg.project.mapper.ProjectMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Service
+@Transactional(readOnly = true)
+public class ItemService extends CrudService<ItemMapper, WbsItem> {
+
+
+    public WbsItem get(String id) {
+        return super.get(id);
+    }
+
+
+    public List<WbsItem> findList(WbsItem wbsItem) {
+        return super.findList(wbsItem);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(WbsItem wbsItem) {
+        super.save(wbsItem);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(WbsItem wbsItem) {
+        super.delete(wbsItem);
+    }
+}

+ 34 - 0
src/main/java/com/jeeplus/modules/sg/project/service/ProjectService.java

@@ -0,0 +1,34 @@
+package com.jeeplus.modules.sg.project.service;
+
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.project.entity.WbsProject;
+import com.jeeplus.modules.sg.project.mapper.ProjectMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Service
+@Transactional(readOnly = true)
+public class ProjectService extends CrudService<ProjectMapper, WbsProject> {
+
+
+    public WbsProject get(String id) {
+        return super.get(id);
+    }
+
+
+    public List<WbsProject> findList(WbsProject wbsProject) {
+        return super.findList(wbsProject);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(WbsProject wbsProject) {
+        super.save(wbsProject);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(WbsProject wbsProject) {
+        super.delete(wbsProject);
+    }
+}

+ 65 - 0
src/main/java/com/jeeplus/modules/sg/project/web/ProjectController.java

@@ -0,0 +1,65 @@
+package com.jeeplus.modules.sg.project.web;
+
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.sg.project.entity.WbsProject;
+import com.jeeplus.modules.sg.project.service.ProjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+import springfox.documentation.schema.Model;
+
+
+@Controller
+@RequestMapping("${adminPath}/project")
+public class ProjectController extends BaseController {
+    @Autowired
+    private ProjectService projectService;
+
+    @ModelAttribute
+    public WbsProject get(@RequestParam(required=false) String id) {
+        WbsProject entity = null;
+        if (StringUtils.isNotBlank(id)){
+            entity = projectService.get(id);
+        }
+        if (entity == null){
+            entity = new WbsProject();
+        }
+        return entity;
+    }
+
+    //项目保存
+    @ResponseBody
+    @RequestMapping("/save")
+    public AjaxJson save(WbsProject wbsProject, Model model, RedirectAttributes redirectAttributes){
+        AjaxJson j = new AjaxJson();
+        //数据验证
+        String errMsg = beanValidator(wbsProject);
+        if (StringUtils.isNotBlank(errMsg)){
+            j.setSuccess(false);
+            j.setMsg(errMsg);
+            return j;
+        }
+        //新增或编辑表单保存
+        projectService.save(wbsProject);//保存
+        j.setSuccess(true);
+        j.setMsg("新建项目成功");
+        return j;
+    }
+
+    //项目删除
+    @ResponseBody
+    @RequestMapping(value = "delete")
+    public AjaxJson delete(WbsProject wbsProject) {
+        AjaxJson j = new AjaxJson();
+        projectService.delete(wbsProject);
+        j.setMsg("删除项目成功");
+        return j;
+    }
+
+}