Ver código fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	shiwan/admin/src/main/java/com/huimv/admin/service/secondary/impl/DaZsdaServiceImpl.java
yangdi 4 anos atrás
pai
commit
694f3777e3

+ 17 - 5
shiwan/admin/admin.iml

@@ -59,7 +59,6 @@
     <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
-    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
     <orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
     <orderEntry type="library" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.18.1" level="project" />
@@ -98,8 +97,8 @@
     <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:2.2" level="project" />
     <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
     <orderEntry type="library" name="Maven: log4j:apache-log4j-extras:1.1" level="project" />
-    <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0" level="project" />
-    <orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
+    <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.8.0-M1" level="project" />
+    <orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.1.1" level="project" />
     <orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
     <orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.7.0" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:2.1.5.RELEASE" level="project" />
@@ -109,8 +108,6 @@
     <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
     <orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
     <orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
-    <orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" />
-    <orderEntry type="library" name="Maven: commons-io:commons-io:2.2" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.22" level="project" />
     <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.16" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:2.4.1" level="project" />
@@ -155,5 +152,20 @@
     <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.62" level="project" />
     <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.6" level="project" />
     <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.6" level="project" />
+    <orderEntry type="library" name="Maven: com.baidu.aip:java-sdk:4.15.0" level="project" />
+    <orderEntry type="library" name="Maven: org.json:json:20160810" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:23.0" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+    <orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.0.18" level="project" />
+    <orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.14" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
+    <orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
+    <orderEntry type="library" name="Maven: commons-io:commons-io:2.2" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:dynamic-datasource-spring-boot-starter:2.4.2" level="project" />
   </component>
 </module>

+ 87 - 0
shiwan/admin/src/main/java/com/huimv/admin/controller/secondary/MachineControlController.java

@@ -0,0 +1,87 @@
+package com.huimv.admin.controller.secondary;
+
+import com.huimv.admin.dto.MachineControlDTO;
+import com.huimv.admin.service.secondary.MachineControlService;
+import com.huimv.admin.utils.Result;
+import com.huimv.admin.utils.ResultCode;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 17:40
+ * @Description 料控管理Controller
+ */
+@CrossOrigin
+@RestController
+@RequestMapping("/machineControl")
+public class MachineControlController {
+
+    @Autowired
+    private MachineControlService machineControlService;
+
+    /**
+     * 保存料机信息
+     * @param machineControlDTO
+     * @return
+     */
+    @RequestMapping("/save")
+    public Result save(@RequestBody MachineControlDTO machineControlDTO) {
+        machineControlService.save(machineControlDTO);
+        return new Result(10000,"保存料机信息成功",true);
+    }
+
+    /**
+     * 分页条件查询料机信息
+     * @param pageNum
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    @RequestMapping("/list")
+    public Result list(Integer pageNum,Integer pageSize,String keyword){
+        Map<String,Object> map = machineControlService.list(pageNum,pageSize,keyword);
+        return new Result(ResultCode.SUCCESS,map);
+    }
+
+    /**
+     * 根据id删除料机信息
+     * @param id
+     * @return
+     */
+    @RequestMapping("/deleteById")
+    public Result delete(@RequestParam(name = "id") Integer id){
+        machineControlService.deleteById(id);
+        return new Result(10000,"删除料机信息成功",true);
+    }
+
+    /**
+     * 新增时选择猪舍的下拉框
+     * @return
+     */
+    @RequestMapping("/selectBox")
+    public Result selectBox4add(){
+        List<String> zsList = machineControlService.selectBox4add();
+        return new Result(ResultCode.SUCCESS,zsList);
+    }
+
+
+
+//    @RequestMapping("/changeMachineStartTime")
+//    public Result changeMachineStartTime() {
+//        return null;
+//    }
+
+    //    /**
+//     * 根据机器id查询料机信息
+//     * @param zsId
+//     * @return
+//     */
+//    @RequestMapping("/listByZsId")
+//    public Result listByZsId(@RequestParam(name = "zsId") Integer zsId){
+//       return machineControlService.listByZsId(zsId);
+//    }
+}

+ 2 - 0
shiwan/admin/src/main/java/com/huimv/admin/domain/secondary/DaZsda.java

@@ -1,5 +1,6 @@
 package com.huimv.admin.domain.secondary;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import javax.persistence.*;
@@ -46,6 +47,7 @@ public class DaZsda implements Serializable {
 	@Column(name = "XGR")
 	private String xgr;
 
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
 	@Column(name = "XGSJ")
 	private Date xgsj;
 

+ 240 - 0
shiwan/admin/src/main/java/com/huimv/admin/domain/secondary/MachineControlEntity.java

@@ -0,0 +1,240 @@
+package com.huimv.admin.domain.secondary;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 18:01
+ * @Description 料控管理实体类
+ */
+
+@Entity
+@Table(name = "da_lkpz")
+public class MachineControlEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "id", nullable = false)
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    @Column(name = "jqid")
+    private String jqId;
+
+    @Column(name = "no1_dlstart_time1")
+    private String no1DlstartTime1;
+
+    @Column(name = "no1_dlstart_time2")
+    private String no1DlstartTime2;
+
+    @Column(name = "no1_dlstart_time3")
+    private String no1DlstartTime3;
+
+    @Column(name = "no1_dlstart_time4")
+    private String no1DlstartTime4;
+
+    @Column(name = "no2_dlstart_time1")
+    private String no2DlstartTime1;
+
+    @Column(name = "no2_dlstart_time2")
+    private String no2DlstartTime2;
+
+    @Column(name = "no2_dlstart_time3")
+    private String no2DlstartTime3;
+
+    @Column(name = "no2_dlstart_time4")
+    private String no2DlstartTime4;
+
+    @Column(name = "no3_dlstart_time1")
+    private String no3DlstartTime1;
+
+    @Column(name = "no3_dlstart_time2")
+    private String no3DlstartTime2;
+
+    @Column(name = "no3_dlstart_time3")
+    private String no3DlstartTime3;
+
+    @Column(name = "no3_dlstart_time4")
+    private String no3DlstartTime4;
+
+    @Column(name = "no4_dlstart_time1")
+    private String no4DlstartTime1;
+
+    @Column(name = "no4_dlstart_time2")
+    private String no4DlstartTime2;
+
+    @Column(name = "no4_dlstart_time3")
+    private String no4DlstartTime3;
+
+    @Column(name = "no4_dlstart_time4")
+    private String no4DlstartTime4;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getJqId() {
+        return jqId;
+    }
+
+    public void setJqId(String jqId) {
+        this.jqId = jqId;
+    }
+
+    public String getNo1DlstartTime1() {
+        return no1DlstartTime1;
+    }
+
+    public void setNo1DlstartTime1(String no1DlstartTime1) {
+        this.no1DlstartTime1 = no1DlstartTime1;
+    }
+
+    public String getNo1DlstartTime2() {
+        return no1DlstartTime2;
+    }
+
+    public void setNo1DlstartTime2(String no1DlstartTime2) {
+        this.no1DlstartTime2 = no1DlstartTime2;
+    }
+
+    public String getNo1DlstartTime3() {
+        return no1DlstartTime3;
+    }
+
+    public void setNo1DlstartTime3(String no1DlstartTime3) {
+        this.no1DlstartTime3 = no1DlstartTime3;
+    }
+
+    public String getNo1DlstartTime4() {
+        return no1DlstartTime4;
+    }
+
+    public void setNo1DlstartTime4(String no1DlstartTime4) {
+        this.no1DlstartTime4 = no1DlstartTime4;
+    }
+
+    public String getNo2DlstartTime1() {
+        return no2DlstartTime1;
+    }
+
+    public void setNo2DlstartTime1(String no2DlstartTime1) {
+        this.no2DlstartTime1 = no2DlstartTime1;
+    }
+
+    public String getNo2DlstartTime2() {
+        return no2DlstartTime2;
+    }
+
+    public void setNo2DlstartTime2(String no2DlstartTime2) {
+        this.no2DlstartTime2 = no2DlstartTime2;
+    }
+
+    public String getNo2DlstartTime3() {
+        return no2DlstartTime3;
+    }
+
+    public void setNo2DlstartTime3(String no2DlstartTime3) {
+        this.no2DlstartTime3 = no2DlstartTime3;
+    }
+
+    public String getNo2DlstartTime4() {
+        return no2DlstartTime4;
+    }
+
+    public void setNo2DlstartTime4(String no2DlstartTime4) {
+        this.no2DlstartTime4 = no2DlstartTime4;
+    }
+
+    public String getNo3DlstartTime1() {
+        return no3DlstartTime1;
+    }
+
+    public void setNo3DlstartTime1(String no3DlstartTime1) {
+        this.no3DlstartTime1 = no3DlstartTime1;
+    }
+
+    public String getNo3DlstartTime2() {
+        return no3DlstartTime2;
+    }
+
+    public void setNo3DlstartTime2(String no3DlstartTime2) {
+        this.no3DlstartTime2 = no3DlstartTime2;
+    }
+
+    public String getNo3DlstartTime3() {
+        return no3DlstartTime3;
+    }
+
+    public void setNo3DlstartTime3(String no3DlstartTime3) {
+        this.no3DlstartTime3 = no3DlstartTime3;
+    }
+
+    public String getNo3DlstartTime4() {
+        return no3DlstartTime4;
+    }
+
+    public void setNo3DlstartTime4(String no3DlstartTime4) {
+        this.no3DlstartTime4 = no3DlstartTime4;
+    }
+
+    public String getNo4DlstartTime1() {
+        return no4DlstartTime1;
+    }
+
+    public void setNo4DlstartTime1(String no4DlstartTime1) {
+        this.no4DlstartTime1 = no4DlstartTime1;
+    }
+
+    public String getNo4DlstartTime2() {
+        return no4DlstartTime2;
+    }
+
+    public void setNo4DlstartTime2(String no4DlstartTime2) {
+        this.no4DlstartTime2 = no4DlstartTime2;
+    }
+
+    public String getNo4DlstartTime3() {
+        return no4DlstartTime3;
+    }
+
+    public void setNo4DlstartTime3(String no4DlstartTime3) {
+        this.no4DlstartTime3 = no4DlstartTime3;
+    }
+
+    public String getNo4DlstartTime4() {
+        return no4DlstartTime4;
+    }
+
+    public void setNo4DlstartTime4(String no4DlstartTime4) {
+        this.no4DlstartTime4 = no4DlstartTime4;
+    }
+
+    @Override
+    public String toString() {
+        return "MachineControlEntity{" +
+                "id=" + id +
+                ", jqId='" + jqId + '\'' +
+                ", no1DlstartTime1='" + no1DlstartTime1 + '\'' +
+                ", no1DlstartTime2='" + no1DlstartTime2 + '\'' +
+                ", no1DlstartTime3='" + no1DlstartTime3 + '\'' +
+                ", no1DlstartTime4='" + no1DlstartTime4 + '\'' +
+                ", no2DlstartTime1='" + no2DlstartTime1 + '\'' +
+                ", no2DlstartTime2='" + no2DlstartTime2 + '\'' +
+                ", no2DlstartTime3='" + no2DlstartTime3 + '\'' +
+                ", no2DlstartTime4='" + no2DlstartTime4 + '\'' +
+                ", no3DlstartTime1='" + no3DlstartTime1 + '\'' +
+                ", no3DlstartTime2='" + no3DlstartTime2 + '\'' +
+                ", no3DlstartTime3='" + no3DlstartTime3 + '\'' +
+                ", no3DlstartTime4='" + no3DlstartTime4 + '\'' +
+                ", no4DlstartTime1='" + no4DlstartTime1 + '\'' +
+                ", no4DlstartTime2='" + no4DlstartTime2 + '\'' +
+                ", no4DlstartTime3='" + no4DlstartTime3 + '\'' +
+                ", no4DlstartTime4='" + no4DlstartTime4 + '\'' +
+                '}';
+    }
+}

+ 195 - 0
shiwan/admin/src/main/java/com/huimv/admin/dto/MachineControlDTO.java

@@ -0,0 +1,195 @@
+package com.huimv.admin.dto;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 19:30
+ * @Description
+ */
+public class MachineControlDTO {
+
+    private Integer id;
+
+    private String jqId;
+
+    private String no1DlstartTime1;
+
+    private String no1DlstartTime2;
+
+    private String no1DlstartTime3;
+
+    private String no1DlstartTime4;
+
+    private String no2DlstartTime1;
+
+    private String no2DlstartTime2;
+
+    private String no2DlstartTime3;
+
+    private String no2DlstartTime4;
+
+    private String no3DlstartTime1;
+
+    private String no3DlstartTime2;
+
+    private String no3DlstartTime3;
+
+    private String no3DlstartTime4;
+
+    private String no4DlstartTime1;
+
+    private String no4DlstartTime2;
+
+    private String no4DlstartTime3;
+
+    private String no4DlstartTime4;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getJqId() {
+        return jqId;
+    }
+
+    public void setJqId(String jqId) {
+        this.jqId = jqId;
+    }
+
+    public String getNo1DlstartTime1() {
+        return no1DlstartTime1;
+    }
+
+    public void setNo1DlstartTime1(String no1DlstartTime1) {
+        this.no1DlstartTime1 = no1DlstartTime1;
+    }
+
+    public String getNo1DlstartTime2() {
+        return no1DlstartTime2;
+    }
+
+    public void setNo1DlstartTime2(String no1DlstartTime2) {
+        this.no1DlstartTime2 = no1DlstartTime2;
+    }
+
+    public String getNo1DlstartTime3() {
+        return no1DlstartTime3;
+    }
+
+    public void setNo1DlstartTime3(String no1DlstartTime3) {
+        this.no1DlstartTime3 = no1DlstartTime3;
+    }
+
+    public String getNo1DlstartTime4() {
+        return no1DlstartTime4;
+    }
+
+    public void setNo1DlstartTime4(String no1DlstartTime4) {
+        this.no1DlstartTime4 = no1DlstartTime4;
+    }
+
+    public String getNo2DlstartTime1() {
+        return no2DlstartTime1;
+    }
+
+    public void setNo2DlstartTime1(String no2DlstartTime1) {
+        this.no2DlstartTime1 = no2DlstartTime1;
+    }
+
+    public String getNo2DlstartTime2() {
+        return no2DlstartTime2;
+    }
+
+    public void setNo2DlstartTime2(String no2DlstartTime2) {
+        this.no2DlstartTime2 = no2DlstartTime2;
+    }
+
+    public String getNo2DlstartTime3() {
+        return no2DlstartTime3;
+    }
+
+    public void setNo2DlstartTime3(String no2DlstartTime3) {
+        this.no2DlstartTime3 = no2DlstartTime3;
+    }
+
+    public String getNo2DlstartTime4() {
+        return no2DlstartTime4;
+    }
+
+    public void setNo2DlstartTime4(String no2DlstartTime4) {
+        this.no2DlstartTime4 = no2DlstartTime4;
+    }
+
+    public String getNo3DlstartTime1() {
+        return no3DlstartTime1;
+    }
+
+    public void setNo3DlstartTime1(String no3DlstartTime1) {
+        this.no3DlstartTime1 = no3DlstartTime1;
+    }
+
+    public String getNo3DlstartTime2() {
+        return no3DlstartTime2;
+    }
+
+    public void setNo3DlstartTime2(String no3DlstartTime2) {
+        this.no3DlstartTime2 = no3DlstartTime2;
+    }
+
+    public String getNo3DlstartTime3() {
+        return no3DlstartTime3;
+    }
+
+    public void setNo3DlstartTime3(String no3DlstartTime3) {
+        this.no3DlstartTime3 = no3DlstartTime3;
+    }
+
+    public String getNo3DlstartTime4() {
+        return no3DlstartTime4;
+    }
+
+    public void setNo3DlstartTime4(String no3DlstartTime4) {
+        this.no3DlstartTime4 = no3DlstartTime4;
+    }
+
+    public String getNo4DlstartTime1() {
+        return no4DlstartTime1;
+    }
+
+    public void setNo4DlstartTime1(String no4DlstartTime1) {
+        this.no4DlstartTime1 = no4DlstartTime1;
+    }
+
+    public String getNo4DlstartTime2() {
+        return no4DlstartTime2;
+    }
+
+    public void setNo4DlstartTime2(String no4DlstartTime2) {
+        this.no4DlstartTime2 = no4DlstartTime2;
+    }
+
+    public String getNo4DlstartTime3() {
+        return no4DlstartTime3;
+    }
+
+    public void setNo4DlstartTime3(String no4DlstartTime3) {
+        this.no4DlstartTime3 = no4DlstartTime3;
+    }
+
+    public String getNo4DlstartTime4() {
+        return no4DlstartTime4;
+    }
+
+    public void setNo4DlstartTime4(String no4DlstartTime4) {
+        this.no4DlstartTime4 = no4DlstartTime4;
+    }
+
+}

+ 7 - 0
shiwan/admin/src/main/java/com/huimv/admin/repo/secondary/DaJqdaRepo.java

@@ -3,7 +3,14 @@ package com.huimv.admin.repo.secondary;
 import com.huimv.admin.domain.secondary.DaJqda;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
 
 public interface DaJqdaRepo extends JpaRepository<DaJqda, Integer>, JpaSpecificationExecutor<DaJqda> {
 
+    @Query(nativeQuery = true ,value = "SELECT MAX(id) FROM da_jqda ")
+    List<Integer> findMax();
+
+    List<DaJqda> findAllByZSID(Integer ZSID);
 }

+ 4 - 2
shiwan/admin/src/main/java/com/huimv/admin/repo/secondary/DaZsdaRepository.java

@@ -8,8 +8,10 @@ import org.springframework.data.jpa.repository.Query;
 import java.util.List;
 
 public interface DaZsdaRepository extends JpaRepository<DaZsda, Integer>, JpaSpecificationExecutor<DaZsda> {
-	
-	@Query(nativeQuery = true ,value = "select * from da_zsda where mcid like %?1% and MCID = 11 and ZFBZ = 0 limit ?2 , ?3")
+    @Query(nativeQuery = true ,value = "select * from da_zsda where MCID = 11 and ZFBZ = 0")
+    List<DaZsda> findAlla();
+
+	@Query(nativeQuery = true ,value = "select * from da_zsda where ZSMC like %?1% and MCID = 11 and ZFBZ = 0  order by XGSJ DESC limit ?2 , ?3")
     List<DaZsda> findAll(String name, Integer startPage, Integer pageSize);
 
     @Query(nativeQuery = true ,value = "SELECT MAX(id) FROM da_zsda ")

+ 63 - 0
shiwan/admin/src/main/java/com/huimv/admin/repo/secondary/MachineControlRepository.java

@@ -0,0 +1,63 @@
+package com.huimv.admin.repo.secondary;
+
+import com.huimv.admin.domain.secondary.MachineControlEntity;
+import com.huimv.admin.vo.MachineControlVO;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 18:12
+ * @Description 料控管理Dao
+ */
+public interface MachineControlRepository extends JpaRepository<MachineControlEntity, Integer>, JpaSpecificationExecutor<MachineControlEntity> {
+
+//    MachineControlEntity findByJqid(String jqId);
+
+    @Query(nativeQuery = true,value = "SELECT\n" +
+            "    lk.id,\n" +
+            "    ZSMC,\n" +
+            "    lk.jqid,\n" +
+            "    no1_dlstart_time1 no1DlstartTime1,\n" +
+            "    no1_dlstart_time2 no1DlstartTime2,\n" +
+            "    no1_dlstart_time3 no1DlstartTime3,\n" +
+            "    no1_dlstart_time4 no1DlstartTime4,\n" +
+            "    no2_dlstart_time1 no2DlstartTime1,\n" +
+            "    no2_dlstart_time2 no2DlstartTime2,\n" +
+            "    no2_dlstart_time3 no2DlstartTime3,\n" +
+            "    no2_dlstart_time4 no2DlstartTime4,\n" +
+            "    no3_dlstart_time1 no3DlstartTime1,\n" +
+            "    no3_dlstart_time2 no3DlstartTime2,\n" +
+            "    no3_dlstart_time3 no3DlstartTime3,\n" +
+            "    no3_dlstart_time4 no3DlstartTime4,\n" +
+            "    no4_dlstart_time1 no4DlstartTime1,\n" +
+            "    no4_dlstart_time2 no4DlstartTime2,\n" +
+            "    no4_dlstart_time3 no4DlstartTime3,\n" +
+            "    no4_dlstart_time4 no4DlstartTime4\n" +
+            "FROM\n" +
+            "  da_zsda zs\n" +
+            "  JOIN da_jqda jq\n" +
+            "    ON zs.`ID` = jq.`ZSID`\n" +
+            "  JOIN da_lkpz lk\n" +
+            "    ON jq.`JQID` = lk.`jqid`\n" +
+            "WHERE ZSMC LIKE CONCAT('%',?3,'%') LIMIT ?1,?2")
+    List<Map> getMachineControlInfo(Integer start, Integer pageSize, String keyword);
+
+//    @Query(nativeQuery = true,value = "SELECT zs.`ZSMC`,lk.* FROM da_zsda  zs JOIN da_jqda  jq ON zs.`ID`=jq.`ZSID` JOIN da_lkpz lk ON jq.`JQID`=lk.`jqid` where zs.ZSMC like %?3% limit ?1,?2")
+//    List<Map> findMachineControlInfo(Integer start,Integer pageSize,String keyword);
+
+    @Query(nativeQuery = true,value = "SELECT count(*) FROM da_zsda  zs JOIN da_jqda  jq ON zs.`ID`=jq.`ZSID` JOIN da_lkpz lk ON jq.`JQID`=lk.`jqid` where zs.ZSMC like %?1%")
+    Long countTotalSize(String keyword);
+
+    /**
+     * 新增时的猪舍名称下拉框
+     * @return
+     */
+    @Query(nativeQuery = true,value = "SELECT zs.ZSMC FROM da_zsda zs JOIN da_jqda jq ON zs.ID = jq.ZSID WHERE jq.JQID NOT IN (SELECT jqid FROM da_lkpz lk)")
+    List<String> selectZsList();
+}

+ 53 - 0
shiwan/admin/src/main/java/com/huimv/admin/service/secondary/MachineControlService.java

@@ -0,0 +1,53 @@
+package com.huimv.admin.service.secondary;
+
+import com.huimv.admin.dto.MachineControlDTO;
+import com.huimv.admin.utils.Result;
+import com.huimv.admin.vo.MachineControlVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 17:46
+ * @Description 料控管理Service Interface
+ */
+public interface MachineControlService {
+
+//    /**
+//     * 根据机器id查询料机信息
+//     * @param zsId
+//     * @return
+//     */
+//    Result listByZsId(Integer zsId);
+
+    /**
+     * 根据机器id保存或修改料机信息
+     * @param machineControlDTO
+     * @return
+     */
+    void save(MachineControlDTO machineControlDTO);
+
+    /**
+     * 分页条件列表查询
+     * @param pageNum
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    Map<String,Object> list(Integer pageNum, Integer pageSize, String keyword);
+
+
+    /**
+     * 根据id删除
+     * @param id
+     */
+    void deleteById(Integer id);
+
+    /**
+     * 新增时选择猪舍的下拉框
+     * @return
+     */
+    List<String> selectBox4add();
+
+}

+ 9 - 5
shiwan/admin/src/main/java/com/huimv/admin/service/secondary/impl/DaZsdaServiceImpl.java

@@ -10,6 +10,7 @@ import com.huimv.admin.utils.Result;
 import com.huimv.admin.utils.ResultCode;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -32,14 +33,14 @@ public class DaZsdaServiceImpl implements DaZsdaService {
 			return new Result(ResultCode.FAIL);
 		}
 		try {
-			rep.save(entity);
-			/*entity.setMcid(11);
+
+			entity.setMcid(11);
 			Integer  id = rep.findMax().get(0);
 			entity.setXgsj(new Date());
 			DaJqda daJqda =new DaJqda() ;
 			daJqda.setZSID(id);
 			jqdaRepo.save(daJqda);
-			rep.save(entity);*/
+			rep.save(entity);
 
 			return new Result(ResultCode.SUCCESS);
 		}catch (Exception e){
@@ -47,6 +48,8 @@ public class DaZsdaServiceImpl implements DaZsdaService {
 		}
 	}
 
+
+
 	@Override
 	public Result remove(Integer[] ids) {
 		if (ids == null || ids.length==0){
@@ -73,9 +76,9 @@ public class DaZsdaServiceImpl implements DaZsdaService {
 			rep.save(entity);
 			return new Result(ResultCode.SUCCESS);
 		}catch (Exception e){
-		return new Result(ResultCode.FAIL);
-		}
+			return new Result(ResultCode.FAIL);
 		}
+	}
 
 	@Override
 	public Result findAll(String name , Integer pageNum , Integer pageSize) {
@@ -87,6 +90,7 @@ public class DaZsdaServiceImpl implements DaZsdaService {
 			map.put("total",size);
 			map.put("totalPageNum",(size  +  pageSize  - 1) / pageSize);
 			map.put("data",all);
+			
 			return new Result(ResultCode.SUCCESS,map);
 		}catch (Exception e){
 			return new Result(ResultCode.FAIL);

+ 96 - 0
shiwan/admin/src/main/java/com/huimv/admin/service/secondary/impl/MachineControlServiceImpl.java

@@ -0,0 +1,96 @@
+package com.huimv.admin.service.secondary.impl;
+
+import com.huimv.admin.domain.secondary.MachineControlEntity;
+import com.huimv.admin.dto.MachineControlDTO;
+import com.huimv.admin.repo.secondary.MachineControlRepository;
+import com.huimv.admin.service.secondary.MachineControlService;
+import com.huimv.admin.vo.MachineControlVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 17:54
+ * @Description 料控管理Service
+ */
+@Service
+public class MachineControlServiceImpl implements MachineControlService {
+
+    @Autowired
+    private MachineControlRepository machineControlRepository;
+
+//    @Autowired
+//    private DaJqdaRepository daJqdaRepository;
+
+//    @Override
+//    public Result listByZsId(Integer zsId) {
+//        String jqId = daJqdaRepository.findJQIDByZSID(zsId);
+//        MachineControlEntity machineControlEntity = machineControlRepository.findByJqid(jqId);
+//        return new Result(ResultCode.SUCCESS, machineControlEntity);
+//    }
+
+    @Override
+    public void save(MachineControlDTO machineControlDTO) {
+        boolean isAdd = null == machineControlDTO.getId();
+        saveOrUpdateMachineControl(isAdd, machineControlDTO);
+    }
+
+    public void saveOrUpdateMachineControl(boolean isAdd, MachineControlDTO machineControlDTO) {
+
+        MachineControlEntity machineControlEntity = new MachineControlEntity();
+        machineControlEntity.setNo1DlstartTime1(machineControlDTO.getNo1DlstartTime1());
+        machineControlEntity.setNo1DlstartTime2(machineControlDTO.getNo1DlstartTime2());
+        machineControlEntity.setNo1DlstartTime3(machineControlDTO.getNo1DlstartTime3());
+        machineControlEntity.setNo1DlstartTime4(machineControlDTO.getNo1DlstartTime4());
+        machineControlEntity.setNo2DlstartTime1(machineControlDTO.getNo2DlstartTime1());
+        machineControlEntity.setNo2DlstartTime2(machineControlDTO.getNo2DlstartTime2());
+        machineControlEntity.setNo2DlstartTime3(machineControlDTO.getNo2DlstartTime3());
+        machineControlEntity.setNo2DlstartTime4(machineControlDTO.getNo2DlstartTime4());
+        machineControlEntity.setNo3DlstartTime1(machineControlDTO.getNo3DlstartTime1());
+        machineControlEntity.setNo3DlstartTime2(machineControlDTO.getNo3DlstartTime2());
+        machineControlEntity.setNo3DlstartTime3(machineControlDTO.getNo3DlstartTime3());
+        machineControlEntity.setNo3DlstartTime4(machineControlDTO.getNo3DlstartTime4());
+        machineControlEntity.setNo4DlstartTime1(machineControlDTO.getNo4DlstartTime1());
+        machineControlEntity.setNo4DlstartTime2(machineControlDTO.getNo4DlstartTime2());
+        machineControlEntity.setNo4DlstartTime3(machineControlDTO.getNo4DlstartTime3());
+        machineControlEntity.setNo4DlstartTime4(machineControlDTO.getNo4DlstartTime4());
+
+        if (isAdd) {
+            machineControlEntity.setJqId(machineControlDTO.getJqId());
+            machineControlRepository.saveAndFlush(machineControlEntity);
+            return;
+        }
+
+        machineControlEntity.setId(machineControlDTO.getId());
+        machineControlRepository.saveAndFlush(machineControlEntity);
+
+    }
+
+    @Override
+    public Map<String,Object> list(Integer pageNum, Integer pageSize, String keyword) {
+        Map<String,Object> map = new HashMap<>(16);
+        Long totalSize = machineControlRepository.countTotalSize(keyword);
+        map.put("totalSize",totalSize);
+        map.put("totalPageNum",(totalSize + pageSize - 1) / pageSize);
+        Integer start = (pageNum - 1) * pageSize;
+        List<Map> machineControlInfoList = machineControlRepository.getMachineControlInfo(start, pageSize, keyword);
+        map.put("data",machineControlInfoList);
+        return map;
+    }
+
+    @Override
+    public void deleteById(Integer id) {
+        machineControlRepository.deleteById(id);
+    }
+
+    @Override
+    public List<String> selectBox4add() {
+        return machineControlRepository.selectZsList();
+    }
+
+
+}

+ 51 - 0
shiwan/admin/src/main/java/com/huimv/admin/vo/MachineControlVO.java

@@ -0,0 +1,51 @@
+package com.huimv.admin.vo;
+
+import lombok.Data;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/1 20:48
+ * @Description 料控管理VO
+ */
+
+@Data
+public class MachineControlVO {
+
+    private Integer id;
+
+    private String ZSWC;
+
+    private String jqid;
+
+    private String no1DlstartTime1;
+
+    private String no1DlstartTime2;
+
+    private String no1DlstartTime3;
+
+    private String no1DlstartTime4;
+
+    private String no2DlstartTime1;
+
+    private String no2DlstartTime2;
+
+    private String no2DlstartTime3;
+
+    private String no2DlstartTime4;
+
+    private String no3DlstartTime1;
+
+    private String no3DlstartTime2;
+
+    private String no3DlstartTime3;
+
+    private String no3DlstartTime4;
+
+    private String no4DlstartTime1;
+
+    private String no4DlstartTime2;
+
+    private String no4DlstartTime3;
+
+    private String no4DlstartTime4;
+}