Commit 5a83a4a2 authored by lvzhuangzhuang's avatar lvzhuangzhuang

清洗规则代码实现(修改生成表json存数据库)

parent 7787cfc7
...@@ -50,7 +50,10 @@ public class ActSuppliesCleaningRuleController extends BaseController ...@@ -50,7 +50,10 @@ public class ActSuppliesCleaningRuleController extends BaseController
@PostMapping("/addActSuppliesSixMinesSummaryTable") @PostMapping("/addActSuppliesSixMinesSummaryTable")
public AjaxResult addActSuppliesSixMinesSummaryTable(@RequestBody ActSuppliesSixMinesSummaryTable actSuppliesSixMinesSummaryTable) public AjaxResult addActSuppliesSixMinesSummaryTable(@RequestBody ActSuppliesSixMinesSummaryTable actSuppliesSixMinesSummaryTable)
{ {
return toAjax(actSuppliesCleaningRuleService.addActSuppliesSixMinesSummaryTable(actSuppliesSixMinesSummaryTable)); int i = actSuppliesCleaningRuleService.addActSuppliesSixMinesSummaryTable(actSuppliesSixMinesSummaryTable);
return toAjax(i);
} }
} }
......
...@@ -14,13 +14,15 @@ import org.apache.commons.lang3.builder.ToStringStyle; ...@@ -14,13 +14,15 @@ import org.apache.commons.lang3.builder.ToStringStyle;
public class ActSuppliesSixMinesSummaryTable extends BaseEntity public class ActSuppliesSixMinesSummaryTable extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 历史数据id */ /** 历史数据id */
private Long id; private Long hId;
/** 项目编码 */ /** 项目编码 */
@Excel(name = "项目编码") @Excel(name = "项目编码")
private Long projectId; private String projectId;
/** 项目名称 */ /** 项目名称 */
@Excel(name = "项目名称") @Excel(name = "项目名称")
...@@ -31,7 +33,7 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity ...@@ -31,7 +33,7 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
private String departmentName; private String departmentName;
/** 数量 */ /** 数量 */
@Excel(name = "数量") @Excel(name = "数量")
private Long number; private Double number;
/** 单价 */ /** 单价 */
@Excel(name = "单价") @Excel(name = "单价")
...@@ -57,11 +59,19 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity ...@@ -57,11 +59,19 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
this.id = id; this.id = id;
} }
public Long getProjectId() { public Long gethId() {
return hId;
}
public void sethId(Long hId) {
this.hId = hId;
}
public String getProjectId() {
return projectId; return projectId;
} }
public void setProjectId(Long projectId) { public void setProjectId(String projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
...@@ -81,11 +91,11 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity ...@@ -81,11 +91,11 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
this.departmentName = departmentName; this.departmentName = departmentName;
} }
public Long getNumber() { public Double getNumber() {
return number; return number;
} }
public void setNumber(Long number) { public void setNumber(Double number) {
this.number = number; this.number = number;
} }
...@@ -117,9 +127,10 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity ...@@ -117,9 +127,10 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return "ActSuppliesCleaningRule{" + return "ActSuppliesSixMinesSummaryTable{" +
"id=" + id + "id=" + id +
", projectId=" + projectId + ", hId=" + hId +
", projectId='" + projectId + '\'' +
", projectName='" + projectName + '\'' + ", projectName='" + projectName + '\'' +
", departmentName='" + departmentName + '\'' + ", departmentName='" + departmentName + '\'' +
", number=" + number + ", number=" + number +
......
...@@ -4,7 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -4,7 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.ActSuppliesCleaningRuleMapper"> <mapper namespace="com.ruoyi.system.mapper.ActSuppliesCleaningRuleMapper">
<resultMap type="ActSuppliesSixMinesSummaryTable" id="ActSuppliesSixMinesSummaryTableResult"> <resultMap type="ActSuppliesSixMinesSummaryTable" id="ActSuppliesSixMinesSummaryTableResult">
<result property="id" column="id" /> <result property="Id" column="id" />
<result property="hId" column="h_id" />
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
<result property="projectName" column="project_name" /> <result property="projectName" column="project_name" />
<result property="departmentName" column="department_name" /> <result property="departmentName" column="department_name" />
...@@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="addActSuppliesSixMinesSummaryTable" parameterType="ActSuppliesSixMinesSummaryTable" useGeneratedKeys="true" keyProperty="id"> <insert id="addActSuppliesSixMinesSummaryTable" parameterType="ActSuppliesSixMinesSummaryTable" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_sixminessummarytable insert into act_supplies_sixminessummarytable
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="hId != null">h_id,</if>
<if test="projectId != null">project_id,</if> <if test="projectId != null">project_id,</if>
<if test="projectName != null">project_name,</if> <if test="projectName != null">project_name,</if>
<if test="departmentName != null">department_name,</if> <if test="departmentName != null">department_name,</if>
...@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="hId != null">#{hId},</if>
<if test="projectId != null">#{projectId},</if> <if test="projectId != null">#{projectId},</if>
<if test="projectName != null">#{projectName},</if> <if test="projectName != null">#{projectName},</if>
<if test="departmentName != null">#{departmentName},</if> <if test="departmentName != null">#{departmentName},</if>
......
...@@ -15,15 +15,16 @@ export default { ...@@ -15,15 +15,16 @@ export default {
return { return {
// 表单参数 // 表单参数
from: { from: {
id : "", hId : "",
projectId : "", projectId : "",
projectName : "", projectName : "",
departmentName : "", departmentName : "",
number : "", number : "",
nuitPrice : "", nuitPrice : "",
money : "", money : "",
createBy : "" createBy : ""
},
},
}; };
}, },
created() { created() {
...@@ -35,12 +36,14 @@ export default { ...@@ -35,12 +36,14 @@ export default {
selectActSuppliesHistorydata().then(response => { selectActSuppliesHistorydata().then(response => {
var data = response.data; var data = response.data;
debugger
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if(data[i].identifyingCode == 1){ if(data[i].identifyingCode == 1){
/*生成表*/
let jsonDataa = JSON.parse(data[i].historyContent); let jsonDataa = JSON.parse(data[i].historyContent);
for (let j = 0; j < jsonDataa.length; j++) { for (let j = 0; j < jsonDataa.length; j++) {
let dataa=window.luckysheet.transToData(jsonDataa[j].celldata); let dataa=window.luckysheet.transToData(jsonDataa[j].celldata);
console.log(dataa)
for (let k = 2; k < dataa.length; k++) { for (let k = 2; k < dataa.length; k++) {
let a0; let a0;
let a1; let a1;
...@@ -69,47 +72,57 @@ export default { ...@@ -69,47 +72,57 @@ export default {
a3=""; a3="";
} }
} }
if(dataa[k][4] != null){ if(dataa[k][4] != null){
a4= dataa[k][4].v; a4= dataa[k][4].v;
if(a4 == undefined){ if(a4 == undefined){
a4=""; a4="";
} }
} }
if(dataa[k][5] != null){ if(dataa[k][5] != null){
a5= dataa[k][5].v; a5= dataa[k][5].v;
if(a5 == undefined){ if(a5 == undefined){
a5=""; a5="";
} }
} }
if(dataa[k][6] != null){ if(dataa[k][6] != null){
a6= dataa[k][6].v; a6= dataa[k][6].v;
if(a6 == undefined){ if(a6 == undefined){
a6=""; a6="";
} }
} }
if(a0 != "" && a1 != "" && a3 != "" && a4 != "" && a5 != "" && a6 != ""){ debugger
this.from.id =data[i].id; if(data[i].id != null){
this.from.projectId =a0; this.from.hId = data[i].id;
this.from.projectName =a1; this.from.projectId =a0;
this.from.departmentName =a3; this.from.projectName =a1;
this.from.number =a4; this.from.departmentName =a3;
this.from.nuitPrice =a5; this.from.number =a4;
this.from.money =a6; this.from.nuitPrice =a5;
this.from.createBy = data[i].createBy; this.from.money =a6;
this.from.createBy = data[i].createBy;
console.log(this.from)
addActSuppliesSixMinesSummaryTable(this.from).then(response => {});
} }
addActSuppliesSixMinesSummaryTable(this.from).then(response => {});
} }
} }
}else { }else {
let jsonDatab = JSON.parse(data[i].historyContent); /*导入表*/
/*let jsonDatab = JSON.parse(data[i].historyContent);
for (let j = 0; j < jsonDatab.length; j++) { for (let j = 0; j < jsonDatab.length; j++) {
let datab=window.luckysheet.transToData(jsonDatab[j].celldata); let datab=window.luckysheet.transToData(jsonDatab[j].celldata);
} }*/
} }
} }
}); });
}, },
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment