Pārlūkot izejas kodu

lrl - 2021-11-15

lirl 3 gadi atpakaļ
vecāks
revīzija
fa33f8d04f

+ 64 - 32
src/main/java/com/steerinfo/ems/emscalpointvalue/mapper/EmsCalpointValueMapper.xml

@@ -306,28 +306,45 @@
       ${locateid}
     </if>
     union all
-    select #{clockt} clock,itemid,itemname,itemdesc,locateid,energyid,tag_modulus,
-    nvl((select mendvalue from EMS_CALPOINT_VALUE where itemid =t.itemid and clock =
-    (select max(clock) from EMS_CALPOINT_VALUE where itemid = t.itemid and clock &lt; #{clockt})), 0) mintvalue,0 mendvalue,
-    0 apportvalue,'' bz,1 ed,'' oper_user,'' oper_date,unitid,mintimegranid as timegranid,to_number(REGEXP_REPLACE(bdesc2,'[^0-9]','')) as xh
-    from T_RM_CALPOINT t 
-    where itemid in (${itemid}) and mintimegranid = 'DAY'
+    select c.clock,
+    t.itemid,
+    t.itemname,
+    t.itemdesc,
+    t.locateid,
+    t.energyid,
+    t.tag_modulus,
+    c.mintvalue,
+    c.mendvalue,
+    c.apportvalue,
+    c.bz,
+    case
+    when clock = '2021-11-14' then
+    1
+    else
+    0
+    end ed,
+    c.crman as oper_user,
+    c.REC_TIME as oper_date,
+    t.unitid,
+    t.mintimegranid as timegranid,
+    to_number(REGEXP_REPLACE(bdesc2, '[^0-9]', '')) as xh
+    from T_RM_CALPOINT t
+    INNER JOIN T_RM_CALPOINT_VALUE c
+    on t.itemid = c.itemid
+    where t.itemid in (${itemid}) and mintimegranid = 'DAY'
+    and t.itemid not in
+    (select itemid from EMS_CALPOINT_VALUE where clock = #{clockt})
     <if test="itemid2 != null and itemid2 != ''">
-      and itemid = #{itemid2}
+      and t.itemid = #{itemid2}
     </if>
-    and itemid not in 
-    (select itemid from EMS_CALPOINT_VALUE where clock = #{clockt})
     <if test="clock != null and clock != ''">
-        and #{clockt} &gt;= #{clock}
-    </if>
-    <if test="clocke != null and clocke != ''">
-        and #{clockt} &lt;= #{clocke}
+        and c.clock = #{clock}
     </if>
     <if test="itemname != null and itemname != ''">
-      and ITEMNAME LIKE '%${itemname}%'
+      and t.ITEMNAME LIKE '%${itemname}%'
     </if>
     <if test="itemdesc != null and itemdesc != ''">
-      and itemdesc LIKE '%${itemdesc}%'
+      and t.itemdesc LIKE '%${itemdesc}%'
     </if>
     <if test="locateid != null and locateid != ''">
       ${locateid}
@@ -357,28 +374,43 @@
       ${locateid}
     </if>
     union all
-    select #{clocktm} clock,itemid,itemname,itemdesc,locateid,energyid,tag_modulus,
-    nvl((select mendvalue from EMS_CALPOINT_VALUE where itemid =t.itemid and clock =
-    (select max(clock) from EMS_CALPOINT_VALUE where itemid = t.itemid and clock &lt; #{clocktm})), 0) mintvalue,0 mendvalue,
-    0 apportvalue,'' bz,1 ed,'' oper_user,'' oper_date,unitid,mintimegranid as timegranid,to_number(REGEXP_REPLACE(bdesc2,'[^0-9]','')) as xh
-    from T_RM_CALPOINT t 
-    where itemid in (${itemid}) and mintimegranid = 'MONTH'
-    <if test="itemid2 != null and itemid2 != ''">
-      and itemid = #{itemid2}
-    </if>
-    and itemid not in 
+    select c.clock,
+    t.itemid,
+    t.itemname,
+    t.itemdesc,
+    t.locateid,
+    t.energyid,
+    t.tag_modulus,
+    c.mintvalue,
+    c.mendvalue,
+    c.apportvalue,
+    c.bz,
+    case
+    when clock = '2021-11-14' then
+    1
+    else
+    0
+    end ed,
+    c.crman as oper_user,
+    c.REC_TIME as oper_date,
+    t.unitid,
+    t.mintimegranid as timegranid,
+    to_number(REGEXP_REPLACE(bdesc2, '[^0-9]', '')) as xh
+    from T_RM_CALPOINT t
+    INNER JOIN T_RM_CALPOINT_VALUE c
+    on t.itemid = c.itemid
+    where t.itemid in (${itemid}) and mintimegranid = 'MONTH'
+    and t.itemid not in
     (select itemid from EMS_CALPOINT_VALUE where clock = #{clocktm})
-    <if test="clock != null and clock != ''">
-        and #{clocktm} &gt;= substr(#{clock}, 0, 7)
-    </if>
-    <if test="clocke != null and clocke != ''">
-        and #{clocktm} &lt;= substr(#{clocke}, 0, 7)
+    and c.clock = #{clocktm}
+    <if test="itemid2 != null and itemid2 != ''">
+      and t.itemid = #{itemid2}
     </if>
     <if test="itemname != null and itemname != ''">
-      and ITEMNAME LIKE '%${itemname}%'
+      and t.ITEMNAME LIKE '%${itemname}%'
     </if>
     <if test="itemdesc != null and itemdesc != ''">
-      and itemdesc LIKE '%${itemdesc}%'
+      and t.itemdesc LIKE '%${itemdesc}%'
     </if>
     <if test="locateid != null and locateid != ''">
       ${locateid}

+ 23 - 0
src/main/java/com/steerinfo/ems/emslog/enums/BusinessType.java

@@ -0,0 +1,23 @@
+package com.steerinfo.ems.emslog.enums;
+
+public enum BusinessType {
+    /**
+     * 其它
+     */
+    OTHER,
+
+    /**
+     * 新增
+     */
+    INSERT,
+
+    /**
+     * 修改
+     */
+    UPDATE,
+
+    /**
+     * 删除
+     */
+    DELETE,
+}

+ 9 - 7
src/main/java/com/steerinfo/ems/emslog/mapper/EmsLogMapper.xml

@@ -7,9 +7,11 @@
     <result column="CODE" jdbcType="VARCHAR" property="code" />
     <result column="OPERATORTIME" jdbcType="TIMESTAMP" property="operatortime" />
     <result column="OPERATOR" jdbcType="VARCHAR" property="operator" />
+    <result column="TYPE" jdbcType="VARCHAR" property="type"/>
+    <result column="PAGE" jdbcType="VARCHAR" property="page"/>
   </resultMap>
   <sql id="columns">
-    ID, UPDATETABLE, CODE, OPERATORTIME, OPERATOR
+    ID, UPDATETABLE, CODE, OPERATORTIME, OPERATOR, TYPE, PAGE
   </sql>
   <sql id="columns_alias">
     t.ID, t.UPDATETABLE, t.CODE, t.OPERATORTIME, t.OPERATOR
@@ -80,9 +82,9 @@
   </delete>
   <insert id="insert" parameterType="com.steerinfo.ems.emslog.model.EmsLog">
     insert into EMS_LOG (ID, UPDATETABLE, CODE, 
-      OPERATORTIME, OPERATOR)
+      OPERATORTIME, OPERATOR,TYPE,PAGE)
     values (#{id,jdbcType=VARCHAR}, #{updatetable,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, 
-      #{operatortime,jdbcType=TIMESTAMP}, #{operator,jdbcType=VARCHAR})
+      #{operatortime,jdbcType=TIMESTAMP}, #{operator,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{page,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.ems.emslog.model.EmsLog">
     insert into EMS_LOG
@@ -160,15 +162,15 @@
     <include refid="whereLike"/>
   </select>
   <insert id="batchInsert" parameterType="java.util.List">
-    insert into EMS_LOG 
+    insert into EMS_LOG 
       (ID, 
       UPDATETABLE, CODE, OPERATORTIME, 
       OPERATOR)
-    ( <foreach collection="list" item="item" separator="union all"> 
-   select  
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
       #{item.id,jdbcType=VARCHAR}, 
       #{item.updatetable,jdbcType=VARCHAR}, #{item.code,jdbcType=VARCHAR}, #{item.operatortime,jdbcType=TIMESTAMP}, 
-      #{item.operator,jdbcType=VARCHAR} from dual  
+      #{item.operator,jdbcType=VARCHAR} from dual  
    </foreach> )
   </insert>
   <update id="batchUpdate" parameterType="java.util.List">

+ 26 - 4
src/main/java/com/steerinfo/ems/emslog/model/EmsLog.java

@@ -16,27 +16,49 @@ public class EmsLog implements IBasePO<String> {
     /**
      * 修改的表名(UPDATETABLE,VARCHAR,50)
      */
-    @ApiModelProperty(value="修改的表名",required=false)
+    @ApiModelProperty(value="操作的表名",required=false)
     private String updatetable;
 
     /**
      * 修改内容(CODE,VARCHAR,1000)
      */
-    @ApiModelProperty(value="修改内容",required=false)
+    @ApiModelProperty(value="操作内容",required=false)
     private String code;
 
     /**
      * 操作人(OPERATORTIME,TIMESTAMP,7)
      */
-    @ApiModelProperty(value="操作",required=false)
+    @ApiModelProperty(value="操作时间",required=false)
     private Date operatortime;
 
     /**
      * 操作时间(OPERATOR,VARCHAR,50)
      */
-    @ApiModelProperty(value="操作时间",required=false)
+    @ApiModelProperty(value="操作",required=false)
     private String operator;
 
+    @ApiModelProperty(value="操作类型",required=false)
+    private String type;
+
+    @ApiModelProperty
+    private String page;
+
+    public String getPage() {
+        return page;
+    }
+
+    public void setPage(String page) {
+        this.page = page;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
     private static final long serialVersionUID = 1L;
 
     public String getId() {

+ 1 - 0
src/main/java/com/steerinfo/ems/emslog/service/IEmsLogService.java

@@ -19,5 +19,6 @@ import java.math.BigDecimal;
  * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  */
 public interface IEmsLogService extends IBaseService<EmsLog, String>{
+    public void insertlog(String code,String page,String table,String type);
 
 }

+ 20 - 1
src/main/java/com/steerinfo/ems/emslog/service/impl/EmsLogServiceImpl.java

@@ -1,10 +1,13 @@
 package com.steerinfo.ems.emslog.service.impl;
 
+import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.emslog.enums.BusinessType;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
 import com.steerinfo.ems.emslog.model.EmsLog;
 import com.steerinfo.ems.emslog.mapper.EmsLogMapper;
 import com.steerinfo.ems.emslog.service.IEmsLogService;
+import com.steerinfo.framework.utils.misc.IdGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import java.util.Date;
@@ -28,9 +31,25 @@ public class EmsLogServiceImpl extends BaseServiceImpl<EmsLog, String> implement
 
     @Autowired
     private EmsLogMapper emsLogMapper;
-
+    @Autowired
+    IdGenerator idGenerator;
     @Override
     protected IBaseMapper<EmsLog, String> getMapper() {
         return emsLogMapper;
     }
+
+    public void insertlog(String code,String page,String table,String type){
+        String userId = JwtUtil.getUseridByToken();
+        EmsLog emsLog =  new EmsLog();
+        emsLog.setCode(code);
+        emsLog.setOperator(userId);
+        emsLog.setPage(page);
+        emsLog.setUpdatetable(table);
+        emsLog.setType(type);
+        emsLog.setOperatortime(new Date());
+        emsLog.setId(idGenerator.getNextStr());
+        emsLogMapper.insert(emsLog);
+    }
+
+
 }

+ 3 - 8
src/main/java/com/steerinfo/ems/emsprodplanround/controller/EmsProdplanRoundController.java

@@ -4,6 +4,7 @@ import com.steerinfo.auth.utils.JwtUtil;
 import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
 import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
+import com.steerinfo.ems.emslog.enums.BusinessType;
 import com.steerinfo.ems.emslog.mapper.EmsLogMapper;
 import com.steerinfo.ems.emslog.model.EmsLog;
 import com.steerinfo.ems.emslog.service.IEmsLogService;
@@ -195,19 +196,13 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     @PutMapping(value = "ForcedUpdate", produces  = "application/json;charset=UTF-8")
     public RESTfulResult ForcedUpdate(@RequestBody EmsProdplanRound[] models) {
         String userId = JwtUtil.getUseridByToken();
-        EmsLog emsLog =  new EmsLog();
         for (int i = 0; i < models.length; i++) {
             EmsProdplanRound  model = models[i];
+            EmsProdplanRound emsProdplanRound = emsProdplanRoundMapper.selectByPrimaryKey(model.getId());
             model.setUpdateman(userId);
             model.setUpdatetime(new Date());
-            String str = "{修改前的数据为:"+emsProdplanRoundMapper.selectByPrimaryKey(model.getId())+"修改后的数据为:"+model+"}";
             emsProdplanRoundMapper.updateByPrimaryKey(model);
-            emsLog.setCode(str);
-            emsLog.setOperator(userId);
-            emsLog.setUpdatetable("ems_prodplan_round");
-            emsLog.setOperatortime(new Date());
-            emsLog.setId(idGenerator.getNextStr());
-            emsLogService.add(emsLog);
+            emsLogService.insertlog(emsProdplanRoundService.tostr(emsProdplanRound,model),"轮次计划页面","EMS_PRODPLAN_ROUND",BusinessType.UPDATE.toString());
         }
            return  success();
     }

+ 1 - 0
src/main/java/com/steerinfo/ems/emsprodplanround/service/IEmsProdplanRoundService.java

@@ -51,4 +51,5 @@ public interface IEmsProdplanRoundService extends IBaseService<EmsProdplanRound,
     List<EmsProdplanRound> getRounds(EmsProdplanRound emsProdplanRound);
     //
     PageList<EmsProdplanRound>getTableDetailAsRadioForPage(HashMap<String, Object> hashMap, Integer pageNum, Integer pageSize);
+    public String tostr(EmsProdplanRound model,EmsProdplanRound model2);
 }

+ 33 - 0
src/main/java/com/steerinfo/ems/emsprodplanround/service/impl/EmsProdplanRoundServiceImpl.java

@@ -1,5 +1,6 @@
 package com.steerinfo.ems.emsprodplanround.service.impl;
 
+import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
 import com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound;
@@ -116,4 +117,36 @@ public class EmsProdplanRoundServiceImpl extends BaseServiceImpl<EmsProdplanRoun
 //        PageList pageInfo = new PageList(rows);
 //        return pageInfo;
 //    }
+public String tostr(EmsProdplanRound model,EmsProdplanRound model2) {
+    StringBuilder sb = new StringBuilder();
+    sb.append("操作前的数据为:[");
+    sb.append(" 轮次编号=").append(model.getId());
+    sb.append(", 排产时间=").append(DateUtils.dateStr(model.getMay(),"yyyy-MM-dd"));
+    sb.append(", 描述=").append(model.getDescribe());
+    sb.append(", 钢种=").append(model.getGrades());
+    sb.append(", 重量=").append(model.getPlanWeight());
+    sb.append(", 规格=").append(model.getSpecifications());
+    sb.append(", 长度=").append(model.getLengths());
+    sb.append(", 化学成分执行标准=").append(model.getChemicalStandard());
+    sb.append(", 表面成分执行标准=").append(model.getSurfaceStandard());
+    sb.append(", 备注=").append(model.getMemo());
+    sb.append(", 运输方式=").append(model.getTransportType());
+    sb.append(", 用途=").append(model.getPurpose());
+    sb.append("]");
+    sb.append(",操作后的数据为:[");
+    sb.append(" 轮次编号=").append(model2.getId());
+    sb.append(", 排产时间=").append(DateUtils.dateStr(model2.getMay(),"yyyy-MM-dd"));
+    sb.append(", 描述=").append(model2.getDescribe());
+    sb.append(", 钢种=").append(model2.getGrades());
+    sb.append(", 重量=").append(model2.getPlanWeight());
+    sb.append(", 规格=").append(model2.getSpecifications());
+    sb.append(", 长度=").append(model2.getLengths());
+    sb.append(", 化学成分执行标准=").append(model2.getChemicalStandard());
+    sb.append(", 表面成分执行标准=").append(model2.getSurfaceStandard());
+    sb.append(", 备注=").append(model2.getMemo());
+    sb.append(", 运输方式=").append(model2.getTransportType());
+    sb.append(", 用途=").append(model2.getPurpose());
+    sb.append("]");
+    return sb.toString();
+}
 }

+ 0 - 1
src/main/java/com/steerinfo/ems/tcm0318/mapper/TCm0318Mapper.xml

@@ -578,7 +578,6 @@
                                                              '100013',
                                                              YLC_SJTLPS2_PSL as
                                                              '100014'
-
                                                              ))
         union
         select sitem,