Commit 5a83a4a2 authored by lvzhuangzhuang's avatar lvzhuangzhuang

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

parent 7787cfc7
......@@ -50,7 +50,10 @@ public class ActSuppliesCleaningRuleController extends BaseController
@PostMapping("/addActSuppliesSixMinesSummaryTable")
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;
public class ActSuppliesSixMinesSummaryTable extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 历史数据id */
private Long id;
private Long hId;
/** 项目编码 */
@Excel(name = "项目编码")
private Long projectId;
private String projectId;
/** 项目名称 */
@Excel(name = "项目名称")
......@@ -31,7 +33,7 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
private String departmentName;
/** 数量 */
@Excel(name = "数量")
private Long number;
private Double number;
/** 单价 */
@Excel(name = "单价")
......@@ -57,11 +59,19 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
this.id = id;
}
public Long getProjectId() {
public Long gethId() {
return hId;
}
public void sethId(Long hId) {
this.hId = hId;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
public void setProjectId(String projectId) {
this.projectId = projectId;
}
......@@ -81,11 +91,11 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
this.departmentName = departmentName;
}
public Long getNumber() {
public Double getNumber() {
return number;
}
public void setNumber(Long number) {
public void setNumber(Double number) {
this.number = number;
}
......@@ -117,9 +127,10 @@ public class ActSuppliesSixMinesSummaryTable extends BaseEntity
@Override
public String toString() {
return "ActSuppliesCleaningRule{" +
return "ActSuppliesSixMinesSummaryTable{" +
"id=" + id +
", projectId=" + projectId +
", hId=" + hId +
", projectId='" + projectId + '\'' +
", projectName='" + projectName + '\'' +
", departmentName='" + departmentName + '\'' +
", number=" + number +
......
......@@ -4,7 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.ActSuppliesCleaningRuleMapper">
<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="projectName" column="project_name" />
<result property="departmentName" column="department_name" />
......@@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="addActSuppliesSixMinesSummaryTable" parameterType="ActSuppliesSixMinesSummaryTable" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies_sixminessummarytable
<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="projectName != null">project_name,</if>
<if test="departmentName != null">department_name,</if>
......@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
</trim>
<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="projectName != null">#{projectName},</if>
<if test="departmentName != null">#{departmentName},</if>
......
......@@ -15,15 +15,16 @@ export default {
return {
// 表单参数
from: {
id : "",
projectId : "",
projectName : "",
departmentName : "",
number : "",
nuitPrice : "",
money : "",
createBy : ""
},
hId : "",
projectId : "",
projectName : "",
departmentName : "",
number : "",
nuitPrice : "",
money : "",
createBy : ""
},
};
},
created() {
......@@ -35,12 +36,14 @@ export default {
selectActSuppliesHistorydata().then(response => {
var data = response.data;
debugger
for (let i = 0; i < data.length; i++) {
if(data[i].identifyingCode == 1){
/*生成表*/
let jsonDataa = JSON.parse(data[i].historyContent);
for (let j = 0; j < jsonDataa.length; j++) {
let dataa=window.luckysheet.transToData(jsonDataa[j].celldata);
console.log(dataa)
for (let k = 2; k < dataa.length; k++) {
let a0;
let a1;
......@@ -69,47 +72,57 @@ export default {
a3="";
}
}
if(dataa[k][4] != null){
a4= dataa[k][4].v;
if(a4 == undefined){
a4="";
}
}
if(dataa[k][5] != null){
a5= dataa[k][5].v;
if(a5 == undefined){
a5="";
}
}
if(dataa[k][6] != null){
a6= dataa[k][6].v;
if(a6 == undefined){
a6="";
}
}
if(a0 != "" && a1 != "" && a3 != "" && a4 != "" && a5 != "" && a6 != ""){
this.from.id =data[i].id;
this.from.projectId =a0;
this.from.projectName =a1;
this.from.departmentName =a3;
this.from.number =a4;
this.from.nuitPrice =a5;
this.from.money =a6;
this.from.createBy = data[i].createBy;
debugger
if(data[i].id != null){
this.from.hId = data[i].id;
this.from.projectId =a0;
this.from.projectName =a1;
this.from.departmentName =a3;
this.from.number =a4;
this.from.nuitPrice =a5;
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 {
let jsonDatab = JSON.parse(data[i].historyContent);
/*导入表*/
/*let jsonDatab = JSON.parse(data[i].historyContent);
for (let j = 0; j < jsonDatab.length; j++) {
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