Bläddra i källkod

后端接口开发

dengyj 4 år sedan
förälder
incheckning
edf38f9ff3
22 ändrade filer med 1150 tillägg och 209 borttagningar
  1. 37 27
      pom.xml
  2. 129 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/controller/AppVerificationCodeController.java
  3. 11 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/mapper/AppVerificationCodeMapper.java
  4. 242 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/mapper/AppVerificationCodeMapper.xml
  5. 122 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/model/AppVerificationCode.java
  6. 25 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/service/IAppVerificationCodeService.java
  7. 217 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/service/impl/AppVerificationCodeServiceImpl.java
  8. 38 0
      src/main/java/com/steerinfo/baseinfo/appverificationcode/service/impl/InboundMessageCallbackTestImpl.java
  9. 59 39
      src/main/java/com/steerinfo/baseinfo/meterbasecar/controller/MeterBaseCarController.java
  10. 3 0
      src/main/java/com/steerinfo/baseinfo/meterbasecar/service/IMeterBaseCarService.java
  11. 5 9
      src/main/java/com/steerinfo/baseinfo/meterbasecar/service/impl/MeterBaseCarServiceImpl.java
  12. 12 1
      src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/controller/MeterBaseTermTareDataController.java
  13. 1 0
      src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/mapper/MeterBaseTermTareDataMapper.java
  14. 1 0
      src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/mapper/MeterBaseTermTareDataMapper.xml
  15. 3 0
      src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/service/IMeterBaseTermTareDataService.java
  16. 40 0
      src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/service/impl/MeterBaseTermTareDataServiceImpl.java
  17. 2 0
      src/main/java/com/steerinfo/meterwork/meterworkcaractual/controller/MeterWorkCarActualController.java
  18. 14 0
      src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/controller/MeterWorkCarActualFirstController.java
  19. 2 0
      src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/IMeterWorkCarActualFirstService.java
  20. 185 129
      src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java
  21. 1 2
      src/main/java/com/steerinfo/meterwork/meterworkhookactfirst/service/impl/MeterWorkHookActFirstServiceImpl.java
  22. 1 2
      src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/service/impl/MeterWorkRailwayActFirstServiceImpl.java

+ 37 - 27
pom.xml

@@ -71,16 +71,21 @@
                 <version>3.0</version>
                 <configuration>
                     <!--数据库链接、目标路径、数据库用户、数据库密码-->
-                    <connUrl>jdbc:oracle:thin:@192.168.185.183:1521/JGJLDB</connUrl>
+                    <connUrl>jdbc:oracle:thin:@10.99.200.87:1521/jgwzjl</connUrl>
                     <targetPackage>com.steerinfo.baseinfo</targetPackage>
                     <user>lims</user>
-                    <password>lims2021</password>
+                    <password>lims_2021</password>
                     <!-- 一对一 一对多的配置文件generatorConfig.xml 请填写- - -绝对路经	-->
                     <!-- 配置文件模版位置在 generator-maven-plugin-3.0.jar 包的主目录下 -->
                     <!--<xmlProject>${project.basedir}\src\main\resources\generatorConfig.xml</xmlProject>-->
                     <!-- 表生成model默认生成驼峰式:sys_user->SysUser,如果需要生成其它名字可以用逗号分隔:sys_user,User -->
                     <tables>
-                        <params> METER_WORK_BELT_SCALE_ACTUAL </params>
+
+
+                        <params>app_verification_code</params>
+
+
+
                     </tables>
                 </configuration>
                 <executions>
@@ -116,30 +121,30 @@
             <plugins>
                 <!-- This plugin's configuration is used to store Eclipse m2e settings
                     only. It has no influence on the Maven build itself. -->
-                <plugin>
-                    <groupId>org.eclipse.m2e</groupId>
-                    <artifactId>lifecycle-mapping</artifactId>
-                    <version>1.0.0</version>
-                    <configuration>
-                        <lifecycleMappingMetadata>
-                            <pluginExecutions>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>com.steerinfo</groupId>
-                                        <artifactId>generator-maven-plugin</artifactId>
-                                        <versionRange>[0.0.1,)</versionRange>
-                                        <goals>
-                                            <goal>steerinfo</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore></ignore>
-                                    </action>
-                                </pluginExecution>
-                            </pluginExecutions>
-                        </lifecycleMappingMetadata>
-                    </configuration>
-                </plugin>
+<!--                <plugin>-->
+<!--                    <groupId>org.eclipse.m2e</groupId>-->
+<!--                    <artifactId>lifecycle-mapping</artifactId>-->
+<!--                    <version>1.0.0</version>-->
+<!--                    <configuration>-->
+<!--                        <lifecycleMappingMetadata>-->
+<!--                            <pluginExecutions>-->
+<!--                                <pluginExecution>-->
+<!--                                    <pluginExecutionFilter>-->
+<!--                                        <groupId>com.steerinfo</groupId>-->
+<!--                                        <artifactId>generator-maven-plugin</artifactId>-->
+<!--                                        <versionRange>[0.0.1,)</versionRange>-->
+<!--                                        <goals>-->
+<!--                                            <goal>steerinfo</goal>-->
+<!--                                        </goals>-->
+<!--                                    </pluginExecutionFilter>-->
+<!--                                    <action>-->
+<!--                                        <ignore></ignore>-->
+<!--                                    </action>-->
+<!--                                </pluginExecution>-->
+<!--                            </pluginExecutions>-->
+<!--                        </lifecycleMappingMetadata>-->
+<!--                    </configuration>-->
+<!--                </plugin>-->
             </plugins>
         </pluginManagement>
     </build>
@@ -216,6 +221,11 @@
             <artifactId>javacv-platform</artifactId>
             <version>1.5.4</version>
         </dependency>
+        <dependency>
+            <groupId>com.wellbole</groupId>
+            <artifactId>smsengine-client</artifactId>
+            <version>3.8.0</version>
+        </dependency>
     </dependencies>
 
     <repositories>

+ 129 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/controller/AppVerificationCodeController.java

@@ -0,0 +1,129 @@
+package com.steerinfo.baseinfo.appverificationcode.controller;
+
+import com.steerinfo.framework.controller.BaseRESTfulController;
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import com.steerinfo.framework.utils.collection.ListUtils;
+import com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode;
+import com.steerinfo.baseinfo.appverificationcode.service.IAppVerificationCodeService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.math.BigDecimal;
+
+/**
+ * AppVerificationCode RESTful接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-03-16 04:15
+ * 类描述
+ * 修订历史:
+ * 日期:2022-03-16
+ * 作者:generator
+ * 参考:
+ * 描述:AppVerificationCode RESTful接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@RestController
+@RequestMapping("/${api.version}/appverificationcodes")
+public class AppVerificationCodeController extends BaseRESTfulController {
+
+    @Autowired
+    IAppVerificationCodeService appVerificationCodeService;
+
+    @ApiOperation(value="获取列表", notes="分页查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("appverificationcode:view")
+    @GetMapping(value = "/")
+    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<AppVerificationCode> list = appVerificationCodeService.queryForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("appverificationcode:view")
+    @GetMapping(value = "/like/")
+    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<AppVerificationCode> list = appVerificationCodeService.queryLikeForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+    
+    @ApiOperation(value="创建", notes="根据AppVerificationCode对象创建")
+    @ApiImplicitParam(name = "appVerificationCode", value = "详细实体appVerificationCode", required = true, dataType = "AppVerificationCode")
+    //@RequiresPermissions("appverificationcode:create")
+    @PostMapping(value = "/")
+    public RESTfulResult add(@ModelAttribute AppVerificationCode model){
+        AppVerificationCode appVerificationCode = appVerificationCodeService.add(model);
+        return success(appVerificationCode);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("appverificationcode:view")
+    @GetMapping(value = "/{id}")
+    public RESTfulResult get(@PathVariable String id){
+        AppVerificationCode appVerificationCode = appVerificationCodeService.getById(id);
+        return success(appVerificationCode);
+    }
+
+    @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的appVerificationCode信息来更新详细信息")
+    @ApiImplicitParams({
+        @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
+        @ApiImplicitParam(name = "appVerificationCode", value = "详细实体appVerificationCode", required = true, dataType = "AppVerificationCode")
+    })
+    //@RequiresPermissions("appverificationcode:update")
+    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult update(@PathVariable String id, @RequestBody AppVerificationCode model){
+        model.setId(id);
+        AppVerificationCode appVerificationCode = appVerificationCodeService.modify(model);
+        return success(appVerificationCode);
+    }
+
+    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("appverificationcode:delete")
+    @DeleteMapping(value = "/{id}")//String
+    public RESTfulResult delete(@PathVariable String id){
+    	List<String> list = Arrays.asList(id.split(","));
+    	if(ListUtils.isNotEmpty(list)) {
+	    	List<String> ids = ListUtils.convertList(list);
+			  appVerificationCodeService.delete(ids);
+    	}
+      return success();
+    }
+
+    @ApiOperation(value = "电话短信发送功能-酒钢信息发送平台", notes = "电话短信发送功能-酒钢信息发送平台")
+    @GetMapping(value = "/sendInfo")
+    public RESTfulResult sendInfo(@RequestParam String phoneNum) {
+        RESTfulResult rm = failed();
+        int len = phoneNum.length();
+        try{
+            if(len != 11){
+                rm.setMessage("电话号码为无效号码!!");
+            }else{
+                appVerificationCodeService.sendInfo(phoneNum);
+                rm = success();
+            }
+        }catch(Exception e){
+            e.printStackTrace();
+            rm.setMessage("操作异常,请确认!!");
+        }
+        return rm;
+    }
+}

+ 11 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/mapper/AppVerificationCodeMapper.java

@@ -0,0 +1,11 @@
+package com.steerinfo.baseinfo.appverificationcode.mapper;
+
+import com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import java.math.*;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AppVerificationCodeMapper extends IBaseMapper<AppVerificationCode, String> {
+    AppVerificationCode selectByPhone(String phoneNum);
+}

+ 242 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/mapper/AppVerificationCodeMapper.xml

@@ -0,0 +1,242 @@
+<?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.steerinfo.baseinfo.appverificationcode.mapper.AppVerificationCodeMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode">
+    <id column="INFO_ID" jdbcType="VARCHAR" property="infoId" />
+    <result column="PHONE_NO" jdbcType="VARCHAR" property="phoneNo" />
+    <result column="CODE" jdbcType="VARCHAR" property="code" />
+    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="EXPIRATION_TIME" jdbcType="TIMESTAMP" property="expirationTime" />
+    <result column="VALUE_FLAG" jdbcType="VARCHAR" property="valueFlag" />
+  </resultMap>
+  <sql id="columns">
+    INFO_ID, PHONE_NO, CODE, CREATE_TIME, EXPIRATION_TIME, VALUE_FLAG
+  </sql>
+  <sql id="columns_alias">
+    t.INFO_ID, t.PHONE_NO, t.CODE, t.CREATE_TIME, t.EXPIRATION_TIME, t.VALUE_FLAG
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM APP_VERIFICATION_CODE
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM APP_VERIFICATION_CODE t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="infoId != null and infoId != ''">
+        and INFO_ID = #{infoId}
+      </if>
+      <if test="phoneNo != null and phoneNo != ''">
+        and PHONE_NO = #{phoneNo}
+      </if>
+      <if test="code != null and code != ''">
+        and CODE = #{code}
+      </if>
+      <if test="createTime != null">
+        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
+      </if>
+      <if test="expirationTime != null">
+        and TO_CHAR(EXPIRATION_TIME,'yyyy-MM-dd') = #{expirationTime}
+      </if>
+      <if test="valueFlag != null and valueFlag != ''">
+        and VALUE_FLAG = #{valueFlag}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="infoId != null and infoId != ''">
+        and INFO_ID LIKE '%${infoId}%'
+      </if>
+      <if test="phoneNo != null and phoneNo != ''">
+        and PHONE_NO LIKE '%${phoneNo}%'
+      </if>
+      <if test="code != null and code != ''">
+        and CODE LIKE '%${code}%'
+      </if>
+      <if test="createTime != null">
+        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
+      </if>
+      <if test="expirationTime != null">
+        and TO_CHAR(EXPIRATION_TIME,'yyyy-MM-dd') = #{expirationTime}
+      </if>
+      <if test="valueFlag != null and valueFlag != ''">
+        and VALUE_FLAG LIKE '%${valueFlag}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from APP_VERIFICATION_CODE
+    where INFO_ID = #{infoId,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from APP_VERIFICATION_CODE
+    where 1!=1 
+      <if test="phoneNo != null and phoneNo != ''">
+        or PHONE_NO = #{phoneNo}
+      </if>
+      <if test="code != null and code != ''">
+        or CODE = #{code}
+      </if>
+      <if test="createTime != null">
+        or TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = '#{createTime}'
+      </if>
+      <if test="expirationTime != null">
+        or TO_CHAR(EXPIRATION_TIME,'yyyy-MM-dd') = '#{expirationTime}'
+      </if>
+      <if test="valueFlag != null and valueFlag != ''">
+        or VALUE_FLAG = #{valueFlag}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode">
+    insert into APP_VERIFICATION_CODE (INFO_ID, PHONE_NO, CODE, 
+      CREATE_TIME, EXPIRATION_TIME, VALUE_FLAG
+      )
+    values (#{infoId,jdbcType=VARCHAR}, #{phoneNo,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{expirationTime,jdbcType=TIMESTAMP}, #{valueFlag,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode">
+    insert into APP_VERIFICATION_CODE
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="infoId != null">
+        INFO_ID,
+      </if>
+      <if test="phoneNo != null">
+        PHONE_NO,
+      </if>
+      <if test="code != null">
+        CODE,
+      </if>
+      <if test="createTime != null">
+        CREATE_TIME,
+      </if>
+      <if test="expirationTime != null">
+        EXPIRATION_TIME,
+      </if>
+      <if test="valueFlag != null">
+        VALUE_FLAG,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="infoId != null">
+        #{infoId,jdbcType=VARCHAR},
+      </if>
+      <if test="phoneNo != null">
+        #{phoneNo,jdbcType=VARCHAR},
+      </if>
+      <if test="code != null">
+        #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="expirationTime != null">
+        #{expirationTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="valueFlag != null">
+        #{valueFlag,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode">
+    update APP_VERIFICATION_CODE
+    set PHONE_NO = #{phoneNo,jdbcType=VARCHAR},
+      CODE = #{code,jdbcType=VARCHAR},
+      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
+      EXPIRATION_TIME = #{expirationTime,jdbcType=TIMESTAMP},
+      VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR}
+    where INFO_ID = #{infoId,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode">
+    update APP_VERIFICATION_CODE
+    <set>
+      <if test="phoneNo != null">
+        PHONE_NO = #{phoneNo,jdbcType=VARCHAR},
+      </if>
+      <if test="code != null">
+        CODE = #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="expirationTime != null">
+        EXPIRATION_TIME = #{expirationTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="valueFlag != null">
+        VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where INFO_ID = #{infoId,jdbcType=VARCHAR}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where INFO_ID = #{infoId,jdbcType=VARCHAR}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="where"/>
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="whereLike"/>
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into APP_VERIFICATION_CODE 
+      (INFO_ID, 
+      PHONE_NO, CODE, CREATE_TIME, 
+      EXPIRATION_TIME, VALUE_FLAG)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.infoId,jdbcType=VARCHAR}, 
+      #{item.phoneNo,jdbcType=VARCHAR}, #{item.code,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, 
+      #{item.expirationTime,jdbcType=TIMESTAMP}, #{item.valueFlag,jdbcType=VARCHAR} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update APP_VERIFICATION_CODE
+     set
+       INFO_ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case INFO_ID" close="end">
+          when #{item.infoId,jdbcType=VARCHAR} then #{item.infoId,jdbcType=VARCHAR}
+       </foreach>
+       ,PHONE_NO=
+       <foreach collection="list" item="item" index="index" separator=" " open="case INFO_ID" close="end">
+          when #{item.infoId,jdbcType=VARCHAR} then #{item.phoneNo,jdbcType=VARCHAR}
+       </foreach>
+       ,CODE=
+       <foreach collection="list" item="item" index="index" separator=" " open="case INFO_ID" close="end">
+          when #{item.infoId,jdbcType=VARCHAR} then #{item.code,jdbcType=VARCHAR}
+       </foreach>
+       ,CREATE_TIME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case INFO_ID" close="end">
+          when #{item.infoId,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,EXPIRATION_TIME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case INFO_ID" close="end">
+          when #{item.infoId,jdbcType=VARCHAR} then #{item.expirationTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,VALUE_FLAG=
+       <foreach collection="list" item="item" index="index" separator=" " open="case INFO_ID" close="end">
+          when #{item.infoId,jdbcType=VARCHAR} then #{item.valueFlag,jdbcType=VARCHAR}
+       </foreach>
+     where INFO_ID in 
+     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+    #{item.infoId,jdbcType=VARCHAR}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from APP_VERIFICATION_CODE
+    where INFO_ID in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+  <select id="selectByPhone" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where phone_no = #{phoneNum,jdbcType=VARCHAR}
+  </select>
+</mapper>

+ 122 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/model/AppVerificationCode.java

@@ -0,0 +1,122 @@
+package com.steerinfo.baseinfo.appverificationcode.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.Date;
+
+@ApiModel(value="验证码匹配表")
+public class AppVerificationCode implements IBasePO<String> {
+    /**
+     * 主键(INFO_ID,VARCHAR,20)
+     */
+    @ApiModelProperty(value="主键",required=true)
+    private String infoId;
+
+    /**
+     * 电话号码(PHONE_NO,VARCHAR,11)
+     */
+    @ApiModelProperty(value="电话号码",required=true)
+    private String phoneNo;
+
+    /**
+     * 验证码(CODE,VARCHAR,20)
+     */
+    @ApiModelProperty(value="验证码",required=false)
+    private String code;
+
+    /**
+     * 创建时间(CREATE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="创建时间",required=false)
+    private Date createTime;
+
+    /**
+     * 过期时间(EXPIRATION_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="过期时间",required=false)
+    private Date expirationTime;
+
+    /**
+     * 验证码有效状态(0:作废,1:有效)(VALUE_FLAG,VARCHAR,1)
+     */
+    @ApiModelProperty(value="验证码有效状态(0:作废,1:有效)",required=false)
+    private String valueFlag;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public String getId() {
+        return this.infoId;
+    }
+
+    @Override
+    public void setId(String infoId) {
+        this.infoId = infoId == null ? null : infoId.trim();
+    }
+
+    public String getInfoId() {
+        return infoId;
+    }
+
+    public void setInfoId(String infoId) {
+        this.infoId = infoId == null ? null : infoId.trim();
+    }
+
+    public String getPhoneNo() {
+        return phoneNo;
+    }
+
+    public void setPhoneNo(String phoneNo) {
+        this.phoneNo = phoneNo == null ? null : phoneNo.trim();
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code == null ? null : code.trim();
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getExpirationTime() {
+        return expirationTime;
+    }
+
+    public void setExpirationTime(Date expirationTime) {
+        this.expirationTime = expirationTime;
+    }
+
+    public String getValueFlag() {
+        return valueFlag;
+    }
+
+    public void setValueFlag(String valueFlag) {
+        this.valueFlag = valueFlag == null ? null : valueFlag.trim();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", infoId=").append(infoId);
+        sb.append(", phoneNo=").append(phoneNo);
+        sb.append(", code=").append(code);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", expirationTime=").append(expirationTime);
+        sb.append(", valueFlag=").append(valueFlag);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 25 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/service/IAppVerificationCodeService.java

@@ -0,0 +1,25 @@
+package com.steerinfo.baseinfo.appverificationcode.service;
+
+import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * AppVerificationCode服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-03-16 04:15
+ * 类描述
+ * 修订历史:
+ * 日期:2022-03-16
+ * 作者:generator
+ * 参考:
+ * 描述:AppVerificationCode服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IAppVerificationCodeService extends IBaseService<AppVerificationCode, String>{
+    void sendInfo(String phoneNum) throws InterruptedException;
+
+}

+ 217 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/service/impl/AppVerificationCodeServiceImpl.java

@@ -0,0 +1,217 @@
+package com.steerinfo.baseinfo.appverificationcode.service.impl;
+
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode;
+import com.steerinfo.baseinfo.appverificationcode.mapper.AppVerificationCodeMapper;
+import com.steerinfo.baseinfo.appverificationcode.service.IAppVerificationCodeService;
+import com.wellbole.sms.client.callback.InboundMessageFetchCallback;
+import com.wellbole.sms.client.callback.StatusReportMessageFetchCallback;
+import com.wellbole.sms.client.impl.HttpPostSmsClient;
+import com.wellbole.sms.client.impl.SmsFetcherImpl;
+import com.wellbole.sms.client.impl.SmsSenderImpl;
+import com.wellbole.sms.client.impl.StatusReportFetcherImpl;
+import com.wellbole.sms.client.message.InboundMessage;
+import com.wellbole.sms.client.message.OutboundMessage;
+import com.wellbole.sms.client.message.StatusReportMessage;
+import com.wellbole.sms.client.result.SmsFetchResult;
+import com.wellbole.sms.client.result.SmsSendResult;
+import com.wellbole.sms.client.service.SmsFetcherThreadService;
+import com.wellbole.sms.client.service.StatusReportFetcherThreadService;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * AppVerificationCode服务实现:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-03-16 04:15
+ * 类描述
+ * 修订历史:
+ * 日期:2022-03-16
+ * 作者:generator
+ * 参考:
+ * 描述:AppVerificationCode服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "appVerificationCodeService")
+public class AppVerificationCodeServiceImpl extends BaseServiceImpl<AppVerificationCode, String> implements IAppVerificationCodeService {
+
+    @Autowired
+    private AppVerificationCodeMapper appVerificationCodeMapper;
+
+    @Override
+    protected IBaseMapper<AppVerificationCode, String> getMapper() {
+        return appVerificationCodeMapper;
+    }
+
+    @Override
+    public void sendInfo(String phoneNum) throws InterruptedException{
+        Logger logger = LogManager.getLogger(AppVerificationCodeServiceImpl.class);
+
+        /*********************************************
+         * 构造基本发送数据客户端,短信发送器,短信接收器
+         ********************************************/
+        //构造基于HTTP POST方式的发送数据客户端
+        //注入方式HttpPostSmsClient实现了SmsClient接口
+        HttpPostSmsClient client = new HttpPostSmsClient();
+        client.setServerUrl("http://10.99.200.19:10086/router");
+        //f2e0d49b4f7c4735a0e3e3b9d173e5e4]
+        client.setAppKey("53e548b23a784379b6c30ec88b28c801");
+        client.setAppSecret("c339eaa1099449fba94751649f185f63");
+
+
+        //构造短信发送器(平台-》用户手机)
+        //SmsSenderImpl smsSender = new SmsSenderImpl(client);
+        //注入方式,SmsSenderImpl实现了SmsSender接口
+        SmsSenderImpl smsSender = new SmsSenderImpl();
+        smsSender.setClient(client);
+
+        /*********************************************
+         * 短信发送测试
+         ********************************************/
+        //构造下行短信(平台-》用户手机)
+        OutboundMessage message = new OutboundMessage();
+        message.setPhone(phoneNum);
+        //开会通知,xxx在xxx召开xxx会议,请准时参加。
+        //系统异常报告:xxx系统于xxx 发生故障,请及时处理。
+        //message.setContent("系统异常报告:站群系统于2016-01-18 20:32:04 发生故障,请及时处理。");
+        //message.setExtCode("");
+
+        //随机生成六位数的密码
+        Integer randNum = (int)(Math.random()* (999999)+1);
+        String password = String.format("%06d",randNum);
+        //查询出有多少与phoneNum匹配的号码
+        AppVerificationCode modelTemp =  appVerificationCodeMapper.selectByPhone(phoneNum);
+
+        Calendar c = Calendar.getInstance();
+        //如果电话号码已存在,只需更新新建时间、过期时间、标志位,
+        if(appVerificationCodeMapper.selectByPhone(phoneNum) != null && modelTemp.getPhoneNo().equals(phoneNum)) {
+            //验证码有效
+            modelTemp.setValueFlag("1");
+            //验证码发送时间
+            modelTemp.setCreateTime(new Date());
+            //过期时间:当前时间后三分钟
+               //实例化
+            c.add(Calendar.MINUTE, 3);  //分钟+3
+            modelTemp.setExpirationTime(c.getTime());
+            //设置验证码
+            modelTemp.setCode(password);
+            appVerificationCodeMapper.updateByPrimaryKey(modelTemp);
+        }else{  //未查到号码直接插入验证码匹配信息
+            //生成ID
+            AppVerificationCode model = new AppVerificationCode();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+            model.setInfoId(sdf.format(new Date()));
+            //设置电话号码
+            model.setPhoneNo(phoneNum);
+            //设置验证码
+            model.setCode(password);
+            //验证码有效
+            model.setValueFlag("1");
+            //验证码发送时间
+            model.setCreateTime(new Date());
+            //过期时间:当前时间后三分钟
+            c.add(Calendar.MINUTE, 3);
+            model.setExpirationTime(c.getTime());
+
+            appVerificationCodeMapper.insertSelective(model);
+        }
+
+        message.setContent("您的验证码是"+ password +"(3分钟之内有效),请不要把验证码泄露给其他人。如非本人操作,可不用理会");
+        //以下是可选参数
+        //默认不指定该参数,若指定,平台将返回该指定的msgid,若不指定,则由平台自动生成
+        //message.setMsgid("用户指定的id");
+        //设定发送时间,可指定未来的时间,表示延迟发送,若不指定,则默认立即发送。
+        //message.setSendAt(new Date());
+        //发送短信
+        StatusReportFetcherThreadService statusService = new StatusReportFetcherThreadService();
+        StatusReportFetcherImpl statusReportFetcher = new StatusReportFetcherImpl();
+        statusReportFetcher.setClient(client);
+        statusService.setStatusReportFetcher(statusReportFetcher);
+        statusService.setPeriod(10);
+        statusService.setStatusReportMessageFetchCallback(new StatusReportMessageFetchCallback(){
+            @Override
+            public void onFetch(StatusReportMessage msg) {
+                logger.info("phone=" + msg.getPhone());
+                logger.info("status="+msg.getStatusCode());
+            }
+        });
+        statusService.start();
+        for(int index =0 ;index < 1; index++){
+            SmsSendResult sendResult = smsSender.send(message);
+            if(sendResult != null){
+                //statusService.AddToStatusReportQueue(sendResult.getMsgid());
+            }
+            //发送结果检查
+            if(sendResult.hasError()){
+                logger.info("发送失败,原因=" + sendResult.getErrorMessage());
+            }else{
+                //发送成功时,服务器端会生成一个36字节长度的唯一标示。
+                logger.info("发送成功,服务器端返回的msgid=" +sendResult.getMsgid());
+            }
+        }
+
+        /*********************************************
+         * 短信接收测试(由调用端调用接收接口进行接收,手动模式)
+         ********************************************/
+
+
+        //构造短信接收器(用户手机-》平台)
+        //SmsFetcher smsFetcher = new SmsFetcherImpl(client);
+        //注入方式,SmsFetcherImpl实现了SmsFetcher接口
+        SmsFetcherImpl smsFetcher = new SmsFetcherImpl();
+        smsFetcher.setClient(client);
+        //获取上行短信,建议每间隔5秒以上获取一次,
+        //太频繁会造成短信服务负载过大。
+        String extCode = "";
+        SmsFetchResult fetchResult = smsFetcher.fetch(extCode);
+        if(fetchResult.hasError()){
+            logger.info("获取上行短信失败,原因=" + fetchResult.getErrorMessage());
+        }else if(fetchResult.hasData()){//有数据返回。
+            for(InboundMessage inboundMessage : fetchResult.getInboundMessageList()){
+                //msgid,平台自动生成的消息id
+                logger.info("msgid=" + inboundMessage.getMsgid());
+                //扩展代码,默认为空。
+                logger.info("extcode=" + inboundMessage.getExtCode());
+                //用户手机号码
+                logger.info("phone=" + inboundMessage.getPhone());
+                //用户发送的短信内容
+                logger.info("content=" + inboundMessage.getContent());
+                //平台接收上行短信时间
+                logger.info("receiverAt=" + inboundMessage.getReceiveAt());
+            }
+        }
+
+
+
+
+        /*********************************************
+         * 短信接收测试(内置线程自动获取方式,需要提供回调接口实现,自动模式)
+         *******************************************
+        //构造回调接口实现
+
+        //上行短信(用户手机-》平台)回调接口实现
+        InboundMessageFetchCallback callback = new InboundMessageCallbackTestImpl();
+        //构造短息获取服务线程
+        SmsFetcherThreadService fetcherService = new SmsFetcherThreadService();
+        //注入接收器(服务线程定期调用接收器来获取平台的上行短信)
+        fetcherService.setSmsFetcher(smsFetcher);
+        //每隔10秒检查一次
+        fetcherService.setPeriod(5);
+        //设定回调接口
+        fetcherService.setInboundMessageFetchCallback(callback);
+        //开始服务
+        fetcherService.start();
+        //15分钟后停止服务
+        Thread.sleep(1000);
+        fetcherService.stop();
+        statusService.stop();*/
+    }
+}

+ 38 - 0
src/main/java/com/steerinfo/baseinfo/appverificationcode/service/impl/InboundMessageCallbackTestImpl.java

@@ -0,0 +1,38 @@
+package com.steerinfo.baseinfo.appverificationcode.service.impl;
+
+import com.wellbole.sms.client.callback.InboundMessageFetchCallback;
+import com.wellbole.sms.client.message.InboundMessage;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+/**
+ * @description: TODO
+ * @author: dyj
+ * @date: 2022年03月16日11:00
+ */
+public class InboundMessageCallbackTestImpl implements InboundMessageFetchCallback {
+    /**
+     * 日志
+     */
+    private static final Logger logger = LogManager.getLogger(InboundMessageCallbackTestImpl.class);
+
+    /**
+     * (non-Javadoc)
+     * TODO 简单描述该方法的实现功能(可选)
+     * @see com.wellbole.sms.client.callback.InboundMessageFetchCallback#onFetch(com.wellbole.sms.client.message.InboundMessage)
+     */
+    @Override
+    public void onFetch(InboundMessage inboundMessage) {
+        //inboundMessage是上行短信(用户手机-》平台)
+        //msgid,平台自动生成的消息id
+        logger.info("msgid=" + inboundMessage.getMsgid());
+        //扩展代码,默认为空。
+        logger.info("extcode=" + inboundMessage.getExtCode());
+        //用户手机号码
+        logger.info("phone=" + inboundMessage.getPhone());
+        //用户发送的短信内容
+        logger.info("content=" + inboundMessage.getContent());
+        //平台接收上行短信时间
+        logger.info("receiverAt=" + inboundMessage.getReceiveAt());
+    }
+}

+ 59 - 39
src/main/java/com/steerinfo/baseinfo/meterbasecar/controller/MeterBaseCarController.java

@@ -1,6 +1,8 @@
 package com.steerinfo.baseinfo.meterbasecar.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.baseinfo.appverificationcode.mapper.AppVerificationCodeMapper;
+import com.steerinfo.baseinfo.appverificationcode.model.AppVerificationCode;
 import com.steerinfo.baseinfo.meterbasecar.mapper.MeterBaseCarMapper;
 import com.steerinfo.baseinfo.meterbasecussupcar.model.MeterBaseCusSupCar;
 import com.steerinfo.baseinfo.meterbasedriver.mapper.MeterBaseDriverMapper;
@@ -25,6 +27,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import javafx.scene.effect.Blend;
+import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,6 +74,9 @@ public class MeterBaseCarController extends BaseRESTfulController {
     @Autowired
     MeterBaseTravellingMerchantMapper meterBaseTravellingMerchantMapper;
 
+    @Autowired
+    AppVerificationCodeMapper appVerificationCodeMapper;
+
     @Autowired
     MeterBaseVerificationCodeMapper meterBaseVerificationCodeMapper;
 
@@ -373,54 +380,66 @@ public class MeterBaseCarController extends BaseRESTfulController {
     @PostMapping(value = "/appchangepwd")
     public RESTfulResult appchangepwd(@RequestBody HashMap params) {
 
-        String msg = "";
-
+        RESTfulResult rm = failed();
+        String carNo = params.get("carNo").toString();
+        String telNum = params.get("telNum").toString();
+        String passWord = params.get("passWord").toString();
+        String passCode = params.get("passCode").toString();
         try {
-            if (params.get("carNo") == null || com.steerinfo.util.StringUtils.isEmpty(params.get("carNo").toString())) {
-                msg = "车号不能为空!!";
-            } else if (params.get("telNum") == null || com.steerinfo.util.StringUtils.isEmpty(params.get("telNum").toString())) {
-                msg = "手机号不能为空!!";
-            } else {
-                // 状态(0:服役;1:停役;2:删除)
-                params.put("validFlag", "0");
-
-                //通过手机号获取验证码列表
-                List<MeterBaseVerificationCode> mbvc = meterBaseVerificationCodeMapper.getCode(params.get("telNum").toString());
-
-                //判断是否有未使用并且没过期的验证码
-                if (mbvc.size() <= 0){
-                    return failed(null, "验证码错误");
-                }
-
-                //修改验证码为已使用状态
-                meterBaseVerificationCodeMapper.updateVaild(mbvc.get(0).getVerificationCodeNo());
-
-                // 判断车号,司机手机号是否存在
-                List<MeterBaseCusSupCar> list = meterBaseDriverService.query(params);
-                if (list.size() >= 1) {
-                    // SSO修改密码
-                    SSOUtil ssoUtil = new SSOUtil();
-                    HashMap map = ssoUtil.ssoChangePwd(params);
-
-                    if (map.get("code").toString().equals("0")) {
-                    } else {
-                        msg = map.get("msg").toString();
+            if (carNo == null || com.steerinfo.util.StringUtils.isEmpty(carNo)) {
+                rm.setMessage("车号不能为空!!");
+                return rm;
+            } else if (telNum == null || com.steerinfo.util.StringUtils.isEmpty(telNum)) {
+                rm.setMessage("手机号不能为空!!");
+                return rm;
+            } else if (passWord == null || com.steerinfo.util.StringUtils.isEmpty(passWord)) {
+                rm.setMessage("新密码不能为空!!");
+                return rm;
+            } else if(passCode == null || com.steerinfo.util.StringUtils.isEmpty(passCode)) {
+                rm.setMessage("验证码不能为空!!");
+                return rm;
+            }else{
+                //通过手机获取验证码列表
+                AppVerificationCode modelTemp =  appVerificationCodeMapper.selectByPhone(telNum);
+                //手机号验证是否存在
+                if(modelTemp!=null){
+                    //当前时间是否在过期时间之内
+                    Date date = new Date();
+                    //验证码是否过期
+                    if(date.compareTo(modelTemp.getExpirationTime()) > 0){
+                        rm.setMessage("验证码已过期,请重新发送验证码!!");
+                        modelTemp.setValueFlag("0");
+                        appVerificationCodeMapper.updateByPrimaryKey(modelTemp);
+                        return rm;
+                    }
+                    //验证码没过期且相等
+                    if(modelTemp.getCode().equals(passCode) && modelTemp.getValueFlag().equals("1")){
+                        modelTemp.setValueFlag("0");
+                        appVerificationCodeMapper.updateByPrimaryKey(modelTemp);
+                        // 判断车号,司机手机号是否存在
+                        List<MeterBaseCusSupCar> list = meterBaseDriverService.query(params);
+                        if (list.size() >= 1) {
+                            // SSO修改密码
+                            SSOUtil ssoUtil = new SSOUtil();
+                            HashMap map = ssoUtil.ssoChangePwd(params);
+
+                            if (map.get("code").toString().equals("0")) {
+                            } else {
+                                rm.setMessage(map.get("msg").toString());
+                            }
+                        } else {
+                            rm.setMessage("没有此车号或手机号");
+                        }
+                    }else{
+                        return failed(null, "验证码错误");
                     }
-                } else {
-                    msg = "没有此车号或手机号";
                 }
             }
-
-            if (com.steerinfo.util.StringUtils.isNotEmpty(msg)) {
-                return failed(null, msg);
-            }
-
         } catch (Exception e) {
             e.printStackTrace();
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return failed(null, "操作异常,请确认!");
         }
-
         return success();
     }
 
@@ -668,4 +687,5 @@ public class MeterBaseCarController extends BaseRESTfulController {
             throw new MarkerMetException(500, "操作异常!!");
         }
     }
+
 }

+ 3 - 0
src/main/java/com/steerinfo/baseinfo/meterbasecar/service/IMeterBaseCarService.java

@@ -37,4 +37,7 @@ public interface IMeterBaseCarService extends IBaseService<MeterBaseCar, String>
     String checkandupdate(String id,MeterBaseCar model);
 
     String batchAddCar(List<HashMap> models);
+
+
+
 }

+ 5 - 9
src/main/java/com/steerinfo/baseinfo/meterbasecar/service/impl/MeterBaseCarServiceImpl.java

@@ -1,8 +1,5 @@
 package com.steerinfo.baseinfo.meterbasecar.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
-import com.steerinfo.baseinfo.meterbasecussupcar.model.MeterBaseCusSupCar;
-import com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
@@ -13,10 +10,8 @@ import com.steerinfo.framework.service.pagehelper.PageHelper;
 import com.steerinfo.framework.service.pagehelper.PageList;
 import com.steerinfo.meterwork.meterworkcaractual.mapper.MeterWorkCarActualMapper;
 import com.steerinfo.meterwork.meterworkcaractual.model.MeterWorkCarActual;
-import com.steerinfo.meterwork.meterworkrailwayactual.model.MeterWorkRailwayActual;
 import com.steerinfo.util.CommonPage;
 import com.steerinfo.util.FieldsCollector;
-import com.steerinfo.util.SSOUtil;
 import com.steerinfo.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,11 +19,8 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.util.*;
 import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 /**
  * MeterBaseCar服务实现:
@@ -247,4 +239,8 @@ public class MeterBaseCarServiceImpl extends BaseServiceImpl<MeterBaseCar, Strin
         }
         return rm;
     }
+
+
 }
+
+

+ 12 - 1
src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/controller/MeterBaseTermTareDataController.java

@@ -261,5 +261,16 @@ throw new MarkerMetException(500, "操作异常!!");
         }
     }
 
-
+    @ApiOperation(value = "根据Id手动保存期限皮")
+    @Transactional
+    @PostMapping(value = "/doSaveTerm")
+    public RESTfulResult doSaveTerm(@RequestBody String id) {
+        try {
+            RESTfulResult rm = meterBaseTermTareDataService.doSaveTerm(id);
+            return rm;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return failed(null, "保存失败,请确认!");
+        }
+    }
 }

+ 1 - 0
src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/mapper/MeterBaseTermTareDataMapper.java

@@ -20,4 +20,5 @@ public interface MeterBaseTermTareDataMapper extends IBaseMapper<MeterBaseTermTa
     MeterBaseTermTareData selectByCarNo(HashMap<String, Object> mp);
 
     MeterBaseTermTareData selectByDataNo(HashMap<String, Object> mp);
+
 }

+ 1 - 0
src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/mapper/MeterBaseTermTareDataMapper.xml

@@ -601,4 +601,5 @@
   <update id="cancelTermTare">
     update METER_BASE_TERM_TARE_DATA set value_flag=#{valueFlag} where car_no=#{carNo}
   </update>
+
 </mapper>

+ 3 - 0
src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/service/IMeterBaseTermTareDataService.java

@@ -5,6 +5,7 @@ import com.steerinfo.framework.service.IBaseService;
 import com.steerinfo.baseinfo.meterbasetermtaredata.model.MeterBaseTermTareData;
 import com.steerinfo.metermonitor.metermonitornote.model.MeterMonitorNote;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -30,4 +31,6 @@ public interface IMeterBaseTermTareDataService extends IBaseService<MeterBaseTer
     List<MeterBaseTermTareData> doQueryWf(MeterBaseTermTareData oci);
 
     RESTfulResult doSaveWf(MeterBaseTermTareData oci, MeterMonitorNote note);
+
+    RESTfulResult doSaveTerm(String id);
 }

+ 40 - 0
src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/service/impl/MeterBaseTermTareDataServiceImpl.java

@@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -240,6 +241,45 @@ public class MeterBaseTermTareDataServiceImpl extends BaseServiceImpl<MeterBaseT
         return rm;
     }
 
+    @Override
+    public RESTfulResult doSaveTerm(String id) {
+        RESTfulResult rm = new RESTfulResult();
+        rm.setCode("200");
+
+        MeterWorkCarActualFirst modelTemp = meterWorkCarActualFirstMapper.selectByPrimaryKey(id);
+
+        String carNo = modelTemp.getCarNo();
+        String baseSpotName = modelTemp.getBaseSpotName();
+        String baseSpotNo = modelTemp.getBaseSpotNo();
+        Date meterTime = modelTemp.getCreateTime();
+        Date startTime = modelTemp.getCreateTime();
+        Date createTime = new Date();
+        String createManNo = modelTemp.getCreateManNo();
+        String createManName = modelTemp.getCreateManName();
+        BigDecimal meterWeight = modelTemp.getMeterWeight();
+
+        MeterBaseTermTareData model = new MeterBaseTermTareData();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+        model.setDataNo(sdf.format(new Date()));
+        model.setBaseSpotName(baseSpotName);
+        model.setBaseSpotNo(baseSpotNo);
+        model.setEndTime(createTime);
+        model.setWarnTime(createTime);
+        model.setUpWeight(0L);
+        model.setCarNo(carNo);
+        model.setMeterTime(meterTime);
+        model.setStartTime(startTime);
+        model.setCreateTime(createTime);
+        model.setValueFlag("0");
+        model.setCreateManNo("createManNo");
+        model.setCreateManName("createManName");
+        model.setMeterNum(7L);
+        model.setMeterWeight(meterWeight);
+
+        meterBaseTermTareDataMapper.insertSelective(model);
+        return rm;
+    }
+
     private String saveNote(MeterMonitorNote note){
         SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
         String afl = formatter.format(new Date());

+ 2 - 0
src/main/java/com/steerinfo/meterwork/meterworkcaractual/controller/MeterWorkCarActualController.java

@@ -24,6 +24,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;

+ 14 - 0
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/controller/MeterWorkCarActualFirstController.java

@@ -943,4 +943,18 @@ public class MeterWorkCarActualFirstController extends BaseRESTfulController {
             return failed(null, "操作异常,请确认!");
         }
     }
+
+    @ApiOperation(value = "期限皮重洁净")
+    @Transactional
+    @PostMapping(value = "/doNetTermTare", produces = "application/json;charset=UTF-8")
+    public RESTfulResult doNetTermTare(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual,MeterWorkPreLink, MeterMonitorNote> com) {
+        try {
+            RESTfulResult rm = meterWorkCarActualFirstService.doNetTermTare(com.getOne(), com.getTwo(), com.getSOne());
+            return rm;
+        } catch (Exception e) {
+            e.printStackTrace();
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return failed(null, "操作异常,请确认!");
+        }
+    }
 }

+ 2 - 0
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/IMeterWorkCarActualFirstService.java

@@ -88,6 +88,8 @@ public interface IMeterWorkCarActualFirstService extends IBaseService<MeterWorkC
 
     RESTfulResult doAddNetByTermWf(MeterWorkCarActualFirst one, MeterWorkCarActual two, MeterMonitorNote three);
 
+    RESTfulResult doNetTermTare(MeterWorkCarActualFirst actualFirst, MeterWorkCarActual netDb, String saveTare) throws Exception;
+
     //按照时间排序
     PageList<MeterWorkCarActualFirst> queryOrderByTime(HashMap parmas, Integer pageNum, Integer pageSize);
 

+ 185 - 129
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java

@@ -1035,7 +1035,6 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             RESTfulResult rm = new RESTfulResult();
             rm.setCode("200");
 
-
             //1、存储当前计量的数据
             SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
             String afl = formatter.format(new Date());
@@ -1068,22 +1067,27 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             if (StringUtils.isNotEmpty(netDb.getPredictionNo())) {
                 MeterWorkCarActualFirst meca1 = meterWorkCarActualFirstMapper.selectAndMatch(firstUpdate.getActualFirstNo(), netDb.getPredictionNo());
                 meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(meca1);
+                PreTrackScale preTrackScale = new PreTrackScale();
+                preTrackScale.setPredictionNo(netDb.getPredictionNo());
+                preTrackScale.setValueFlag("2");
+                preTrackScale.setUploadFlag("1");
+                preTrackScaleMapper.updateByPrimaryKeySelective(preTrackScale);
             }
 
             // 判断当前数据是否存在委托
-            if (netDb.getPredictionNo() != null && "".equals(netDb.getPredictionNo())) {
-                MeterWorkCarActualFirst gross = meterWorkCarActualFirstMapper.selectByPrimaryKey(netDb.getActualFirst1No());
-                if ((gross.getPredictionNo() == null || "".equals(gross.getPredictionNo()))) {
-                    // 如果毛重数据还未匹配委托,则匹配委托操作
-                    MeterWorkCarActualFirst meca1 = meterWorkCarActualFirstMapper.selectAndMatch(gross.getActualFirstNo(), netDb.getPredictionNo());
-                    meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(meca1);
-                    PreTrackScale preTrackScale = new PreTrackScale();
-                    preTrackScale.setPredictionNo(netDb.getPredictionNo());
-                    preTrackScale.setValueFlag("2");
-                    preTrackScale.setUploadFlag("1");
-                    preTrackScaleMapper.updateByPrimaryKeySelective(preTrackScale);
-                }
-            }
+//            if (netDb.getPredictionNo() != null && "".equals(netDb.getPredictionNo())) {
+//                MeterWorkCarActualFirst gross = meterWorkCarActualFirstMapper.selectByPrimaryKey(netDb.getActualFirst1No());
+//                if ((gross.getPredictionNo() == null || "".equals(gross.getPredictionNo()))) {
+//                    // 如果毛重数据还未匹配委托,则匹配委托操作
+//                    MeterWorkCarActualFirst meca1 = meterWorkCarActualFirstMapper.selectAndMatch(gross.getActualFirstNo(), netDb.getPredictionNo());
+//                    meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(meca1);
+//                    PreTrackScale preTrackScale = new PreTrackScale();
+//                    preTrackScale.setPredictionNo(netDb.getPredictionNo());
+//                    preTrackScale.setValueFlag("2");
+//                    preTrackScale.setUploadFlag("1");
+//                    preTrackScaleMapper.updateByPrimaryKeySelective(preTrackScale);
+//                }
+//            }
 
             String no1 = meterWorkCarActualMapper.getNewID(afl);
             netDb.setActualNo(afl + no1);
@@ -1175,7 +1179,7 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             }
 
 
-            rm.setData(secondDb.getActualFirstNo());
+            rm.setData(afl + no1);
             rm.setMessage(flag);
             return rm;
         }
@@ -2708,21 +2712,21 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             preTrackScaleMapper.updateByPrimaryKeySelective(scale1);
 
             //更新一次数据
-            //更新第一次皮重数据
+            //更新第一次皮重数据
             mwcaf1.setValueFlag(DbConstants.NET);
             mwcaf1.setUpdateManName("system");
             mwcaf1.setUpdateManName("二次计量洁净更新");
             mwcaf1.setUpdateTime(new Date());
             mwcaf1.setIsPreScale("1");
             meterWorkCarActualFirstMapper.updateByPrimaryKey(mwcaf1);
-            //更新第一次毛重数据
+            //更新第一次毛重数据
             mwcaf2.setValueFlag(DbConstants.NET);
             mwcaf2.setUpdateManName("system");
             mwcaf2.setUpdateManName("二次计量洁净更新");
             mwcaf2.setUpdateTime(new Date());
             mwcaf2.setIsPreScale("1");
             meterWorkCarActualFirstMapper.updateByPrimaryKey(mwcaf2);
-            //添加第一次皮重数据库
+            //添加第二次皮重数据
             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
             String afl = sdf.format(new Date());
             String actualFirstNo = sdf.format(new Date()) + meterWorkCarActualFirstMapper.getNewID(afl);
@@ -2733,7 +2737,7 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             mwcaf3.setUpdateTime(new Date());
             mwcaf3.setIsPreScale("1");
             meterWorkCarActualFirstMapper.insertSelective(mwcaf3);
-            //更新第二次毛重数据
+            //更新第二次毛重数据
             mwcaf4.setValueFlag(DbConstants.NET);
             mwcaf4.setUpdateManName("system");
             mwcaf4.setUpdateManName("二次计量洁净更新");
@@ -2749,6 +2753,9 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             actualRow1.setNote("混装结净");
             actualRow1.setUploadFlag("1");
             actualRow1.setIsPreScale("1");
+            actualRow1.setValueFlag("2");
+            actualRow1.setCreateTime(new Date());
+            actualRow1.setCreateManName("洁净");
             actualRow1.setNetWeight(mwcaf2.getMeterWeight().subtract(mwcaf1.getMeterWeight()));
             meterWorkCarActualMapper.insertSelective(actualRow1);
 
@@ -2759,6 +2766,9 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             actualRow2.setNote("混装结净");
             actualRow2.setUploadFlag("1");
             actualRow2.setIsPreScale("1");
+            actualRow2.setValueFlag("2");
+            actualRow2.setCreateTime(new Date());
+            actualRow2.setCreateManName("洁净");
             actualRow2.setNetWeight(mwcaf4.getMeterWeight().subtract(mwcaf3.getMeterWeight()));
             meterWorkCarActualMapper.insertSelective(actualRow2);
         }
@@ -2847,34 +2857,34 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             preTrackScaleMapper.updateByPrimaryKeySelective(scale1);
 
             //更新一次数据
-            //更新第一次毛重数据
+            //更新第一次毛重数据
             mwcaf1.setValueFlag(DbConstants.NET);
-            mwcaf1.setUpdateManName("system");
+            mwcaf1.setUpdateManNo("system");
             mwcaf1.setUpdateManName("二次计量洁净更新");
             mwcaf1.setUpdateTime(new Date());
             mwcaf1.setIsPreScale("1");
             meterWorkCarActualFirstMapper.updateByPrimaryKey(mwcaf1);
-            //更新第一次皮重数据
+            //更新第一次皮重数据
             mwcaf2.setValueFlag(DbConstants.NET);
-            mwcaf2.setUpdateManName("system");
+            mwcaf2.setUpdateManNo("system");
             mwcaf2.setUpdateManName("二次计量洁净更新");
             mwcaf2.setUpdateTime(new Date());
             mwcaf2.setIsPreScale("1");
             meterWorkCarActualFirstMapper.updateByPrimaryKey(mwcaf2);
-            //添加第一次毛重数据库
+            //添加第二次毛重数据
             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
             String afl = sdf.format(new Date());
             String actualFirstNo = sdf.format(new Date()) + meterWorkCarActualFirstMapper.getNewID(afl);
             mwcaf3.setActualFirstNo(actualFirstNo);
             mwcaf3.setValueFlag(DbConstants.NET);
-            mwcaf3.setUpdateManName("system");
+            mwcaf3.setUpdateManNo("system");
             mwcaf3.setUpdateManName("二次计量洁净更新");
             mwcaf3.setUpdateTime(new Date());
             mwcaf3.setIsPreScale("1");
             meterWorkCarActualFirstMapper.insertSelective(mwcaf3);
-            //更新第二次皮重数据
+            //更新第二次皮重数据
             mwcaf4.setValueFlag(DbConstants.NET);
-            mwcaf4.setUpdateManName("system");
+            mwcaf4.setUpdateManNo("system");
             mwcaf4.setUpdateManName("二次计量洁净更新");
             mwcaf4.setUpdateTime(new Date());
             mwcaf4.setIsPreScale("1");
@@ -2888,6 +2898,9 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             actualRow1.setNote("混装结净");
             actualRow1.setUploadFlag("1");
             actualRow1.setIsPreScale("1");
+            actualRow1.setValueFlag("2");
+            actualRow1.setCreateManName("洁净");
+            actualRow1.setCreateTime(new Date());
             actualRow1.setNetWeight(mwcaf1.getMeterWeight().subtract(mwcaf2.getMeterWeight()));
             meterWorkCarActualMapper.insertSelective(actualRow1);
 
@@ -2895,9 +2908,12 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
             actualRow2.setActualNo(sdf.format(new Date()) + no1);
             actualRow2.setNetTime(new Date());
             actualRow2.setNetMode(DbConstants.TYPE);
-            actualRow2.setNote(" 结净");
+            actualRow2.setNote("混装结净");
             actualRow2.setUploadFlag("1");
             actualRow2.setIsPreScale("1");
+            actualRow2.setValueFlag("2");
+            actualRow2.setCreateManName("洁净");
+            actualRow2.setCreateTime(new Date());
             actualRow2.setNetWeight(mwcaf3.getMeterWeight().subtract(mwcaf4.getMeterWeight()));
             meterWorkCarActualMapper.insertSelective(actualRow2);
         }
@@ -3173,106 +3189,146 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
         return rm;
     }
 
-//    @Override
-//    public RESTfulResult doNetMass(MeterWorkCarActualFirst one, MeterWorkCarActual two, PreTrackScale three, PreTrackScale four) throws Exception {
-//        RESTfulResult rm = new RESTfulResult();
-//        rm.setCode("200");
-//
-//        //1、存储当前计量的数据
-//        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
-//        String afl = formatter.format(one.getCreateTime());
-//        String no = meterWorkCarActualFirstMapper.getNewID(afl);
-//        String actualNo = formatter.format(new Date()) + no;
-//        one.setActualFirstNo(actualNo);
-//        one.setValueFlag("2");//洁净
-//        meterWorkCarActualFirstMapper.insertSelective(one);
-//
-//        //2、存储第二次一次数据编号
-//        two.setActualFirst2No(actualNo);
-//
-//        //2、修改第一次存储的计量数据状态为洁净
-//        MeterWorkCarActualFirst firstUpdate = new MeterWorkCarActualFirst();
-//        firstUpdate.setActualFirstNo(two.getActualFirst1No());
-//        firstUpdate.setValueFlag("2");
-//        meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(firstUpdate);
-//
-//
-//        //4、判断第一次计量数据是否匹配委托
-//        MeterWorkCarActualFirst mwca1 = meterWorkCarActualFirstMapper.selectByPrimaryKey(firstUpdate.getActualFirstNo());
-//        if(StringUtils.isEmpty(mwca1.getPredictionNo())){
-//            MeterWorkCarActualFirst meca1 = meterWorkCarActualFirstMapper.selectAndMatch(firstUpdate.getActualFirstNo(), three.getPredictionNo());
-//            meca1.setIsPreScale("1");
-//            meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(meca1);
-//        }
-//        //5、判断这次一次计量数据是否匹配委托
-//        if (StringUtils.isEmpty(one.getPredictionNo())){
-//            MeterWorkCarActualFirst meca1 = meterWorkCarActualFirstMapper.selectAndMatch(actualNo, three.getPredictionNo());
-//            meca1.setIsPreScale("1");
-//            meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(meca1);
-//        }
-//
-//        //复制此次计量数据并设置类型为毛重
-//        MeterWorkCarActualFirst actualFirstNew = new MeterWorkCarActualFirst();
-//        String noNew = meterWorkCarActualFirstMapper.getNewID(afl);
-//        String actualNoNew = formatter.format(new Date()) + noNew;
-//        actualFirstNew.setActualFirstNo(actualNoNew);
-//        actualFirstNew.setWeightType("0");
-//        meterWorkCarActualFirstMapper.insertSelective(actualFirstNew);
-//
-//        //将新加的毛重数据匹配第二条委托
-//        MeterWorkCarActualFirst meca1 = meterWorkCarActualFirstMapper.selectAndMatch(actualNoNew, four.getPredictionNo());
-//        meca1.setIsPreScale("1");
-//        meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(meca1);
-//
-//        //7、判断洁净数据是否匹配委托
-//        if(StringUtils.isEmpty(two.getPredictionNo())){
-//            MeterWorkCarActual mwcaOld = meterWorkCarActualMapper.manualAddPre(two.getActualFirst1No(),two.getActualFirst2No(), three.getPredictionNo());
-//            BeanUtils.copyProperties(mwcaOld,two);
-//        }
-//
-//        //8、插入洁净数据
-//        String no1 = meterWorkCarActualMapper.getNewID(afl);
-//        two.setActualNo(afl + no1);
-//        two.setIsPreScale("1");
-//        two.setUploadFlag("1");
-//        if (two != null && two.getNetWeight() != null) {
-//            //2021年3月7日 净重保留两位小数;
-//            BigDecimal net;
-//            net = new BigDecimal(String.valueOf(two.getNetWeight())).setScale(2, BigDecimal.ROUND_HALF_UP);
-//            two.setNetWeight(net);
-//        }
-//        meterWorkCarActualMapper.insert(two);
-//
-//        //修改委托为已使用状态
-//        three.setValueFlag("4");
-//        three.setUploadFlag("1");
-//        preTrackScaleMapper.updateByPrimaryKeySelective(three);
-//        four.setValueFlag("4");
-//        four.setUploadFlag("1");
-//        preTrackScaleMapper.updateByPrimaryKeySelective(four);
-//
-//        //10、保存图片
-//        SaveImg(one);
-//
-//        //11、修改计量监控
-//        updateMonitor(one.getBaseSpotNo());
-//
-//        //12、当存储一次数据或者结净时,将本车辆的预处理重量改为已使用
-//        updatePreWeight(one.getCarNo());
-//
-//        updateMonitorOver(one.getActualFirstNo(), one.getBaseSpotNo());
-//
-//        //重量类型为毛重则调用接口为
-//        String flag = "";
-//
-//        //补充附加重量的数据
-//        if (StringUtils.isNotEmpty(one.getAddWgtPk())) {
-//            insertAddWgtNo(one.getActualFirstNo(), one.getAddWgtPk(), one.getCreateManNo(), one.getCreateManName());
-//        }
-//
-//        rm.setData(one.getActualFirstNo());
-//        rm.setMessage(flag);
-//        return rm;
-//    }
+    /**
+     * 内倒车辆洁净
+     *
+     * @param secondDb 二次计量数据
+     * @param netDb    净重数据
+     * @param saveTare 0 不保存历史皮,1保存历史皮
+     * @return
+     * @throws Exception
+     */
+    @Override
+    @Transactional(value = "tm", rollbackFor = Exception.class)
+    public RESTfulResult doNetTermTare(MeterWorkCarActualFirst secondDb, MeterWorkCarActual netDb, String saveTare) throws Exception {
+        try{
+            RESTfulResult rm = new RESTfulResult();
+            rm.setCode("200");
+
+            //1、存储当前计量的数据
+            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
+            String afl = formatter.format(new Date());
+            String no = meterWorkCarActualFirstMapper.getNewID(afl);
+            secondDb.setActualFirstNo(formatter.format(new Date()) + no);
+            secondDb.setValueFlag("2");//洁净
+            meterWorkCarActualFirstMapper.insertSelective(secondDb);
+
+            String no1 = meterWorkCarActualMapper.getNewID(afl);
+            netDb.setActualNo(afl + no1);
+            if (netDb != null && netDb.getNetWeight() != null) {
+                //2021年3月7日 净重保留两位小数;
+                BigDecimal net;
+                net = new BigDecimal(String.valueOf(netDb.getNetWeight())).setScale(2, BigDecimal.ROUND_HALF_UP);
+                netDb.setNetWeight(net);
+            }
+            netDb.setUploadFlag("1");
+            meterWorkCarActualMapper.insert(netDb);
+
+            //4、将期限皮重转化为一条皮重计量数据保存
+            MeterBaseTermTareData mbttd = new MeterBaseTermTareData();
+            HashMap mbMap = new HashMap();
+            SimpleDateFormat mbsdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            mbMap.put("endTime",mbsdf.format(new Date()));
+            if(StringUtils.isNotEmpty(netDb.getActualFirst2No())){
+                mbMap.put("dataNo",netDb.getActualFirst2No());
+                mbttd = meterBaseTermTareDataMapper.selectByDataNo(mbMap);
+            }
+            else{
+                mbMap.put("carNo",netDb.getCarNo());
+                mbttd = meterBaseTermTareDataMapper.selectByCarNo(mbMap);
+            }
+            MeterWorkCarActualFirst imTare = new MeterWorkCarActualFirst();
+            //补充数据
+            String afl1 = formatter.format(new Date());
+            String imTareNO = meterWorkCarActualFirstMapper.getNewID(afl1);
+            String actualNo = afl1 + imTareNO;
+            imTare.setActualFirstNo(actualNo);
+            imTare.setMeterTypeNo(secondDb.getMeterTypeNo());
+            imTare.setMeterTypeName(secondDb.getMeterTypeName());
+            imTare.setBaseSpotNo(mbttd.getBaseSpotNo());
+            imTare.setBaseSpotName(mbttd.getBaseSpotName());
+            imTare.setCarNo(mbttd.getCarNo());
+            imTare.setCreateTime(mbttd.getCreateTime());
+            imTare.setCreateManNo(mbttd.getCreateManNo());
+            imTare.setCreateManName(mbttd.getCreateManName());
+            imTare.setMeterWeight(mbttd.getMeterWeight());
+            imTare.setWeightType("2");//期限皮重
+            imTare.setValueFlag("2");//洁净
+            imTare.setDataSource("1");
+            meterWorkCarActualFirstMapper.insertSelective(imTare);
+            //将洁净数据中的皮重编号修改
+            MeterWorkCarActual mwca = new MeterWorkCarActual();
+            mwca.setActualNo(netDb.getActualNo());
+            mwca.setActualFirst2No(imTare.getActualFirstNo());
+            mwca.setTareWeight(mbttd.getMeterWeight());
+            mwca.setNetWeight(secondDb.getMeterWeight().subtract(imTare.getMeterWeight()));
+            meterWorkCarActualMapper.updateByPrimaryKeySelective(mwca);
+
+            //皮重数据匹配委托
+            MeterWorkCarActualFirst mwcaf2 = meterWorkCarActualFirstMapper.selectAndMatch(actualNo, netDb.getPredictionNo());
+            String nomwcaf2 = meterWorkCarActualFirstMapper.getNewID(afl);
+            mwcaf2.setIsPreScale("1");
+            mwcaf2.setActualFirstNo(actualNo);
+            meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(mwcaf2);
+
+            //判断洁净数据是否匹配委托
+            if (StringUtils.isNotEmpty(netDb.getPredictionNo())) {
+                PreTrackScale preTrackScale = new PreTrackScale();
+                preTrackScale.setPredictionNo(netDb.getPredictionNo());
+                preTrackScale.setValueFlag("2");
+                preTrackScale.setUploadFlag("1");
+                preTrackScaleMapper.updateByPrimaryKeySelective(preTrackScale);
+            }
+
+            //4、存储历史皮重及历史皮重明细信息
+            if ("1".equals(saveTare)) {
+                MeterWorkCarActualFirst oci = new MeterWorkCarActualFirst();
+                oci.setCarNo(netDb.getCarNo());
+                oci.setCreateTime(mbttd.getCreateTime());
+                oci.setBaseSpotNo(mbttd.getBaseSpotNo());
+                oci.setBaseSpotName(mbttd.getBaseSpotName());
+                oci.setMeterWeight(mbttd.getMeterWeight());
+                oci.setActualFirstNo(actualNo);
+                doSaveHisTare(oci);
+            }
+
+            //5、保存图片
+            SaveImg(secondDb);
+
+            //6、修改计量监控
+            updateMonitor(secondDb.getBaseSpotNo());
+
+            //当存储一次数据或者结净时,将本车辆的预处理重量改为已使用
+            updatePreWeight(secondDb.getCarNo());
+
+            updateMonitorOver(secondDb.getActualFirstNo(), secondDb.getBaseSpotNo());
+
+            //重量类型为毛重则调用接口为
+            String flag = "";
+            /*
+            if("0".equals(secondDb.getWeightType())){
+                flag = transferParamForLims(netDb.getCarNo(),netDb.getMatterNo(),netDb.getReceivingUintName(),netDb.getForwardingUnitName(),netDb.getNetWeight().toString(),netDb.getNetTime(),"",netDb.getActualNo());
+            }
+            //*/
+
+            //补充附加重量的数据
+            if (StringUtils.isNotEmpty(secondDb.getAddWgtPk())) {
+                insertAddWgtNo(secondDb.getActualFirstNo(), secondDb.getAddWgtPk(), secondDb.getCreateManNo(), secondDb.getCreateManName());
+            }
+
+
+            rm.setData(afl + no1);
+            rm.setMessage(flag);
+            return rm;
+        }
+        catch (Exception e){
+            RESTfulResult rm = new RESTfulResult();
+            rm.setCode("500");
+            rm.setData(null);
+            rm.setMessage(e.getMessage());
+            e.printStackTrace();
+            return rm;
+        }
+    }
 }
 

+ 1 - 2
src/main/java/com/steerinfo/meterwork/meterworkhookactfirst/service/impl/MeterWorkHookActFirstServiceImpl.java

@@ -776,8 +776,7 @@ public class MeterWorkHookActFirstServiceImpl extends BaseServiceImpl<MeterWorkH
         }
         netHook.setNetWeight(one.getMeterBalanceWeight().subtract(two.getMeterBalanceWeight()));
         netHook.setNetMode("1");
-        netHook.setValueFlag("0");
-        netHook.setUploadFlag("0");
+        netHook.setValueFlag("1");
         netHook.setUploadFlag("1");
         if ("001019002".equals(one.getRailwayTypeNo())) {
             netHook.setNetTime(new Date()); //动轨的特殊处理

+ 1 - 2
src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/service/impl/MeterWorkRailwayActFirstServiceImpl.java

@@ -1280,8 +1280,7 @@ public class MeterWorkRailwayActFirstServiceImpl extends BaseServiceImpl<MeterWo
         }
         netRail.setNetWeight(one.getMeterBalanceWeight().subtract(two.getMeterBalanceWeight()));
         netRail.setNetMode("1");
-        netRail.setValueFlag("0");
-        netRail.setUploadFlag("0");
+        netRail.setValueFlag("1");
         netRail.setUploadFlag("1");
         if ("001019002".equals(one.getRailwayTypeNo())) {
             netRail.setNetTime(new Date()); //动轨的特殊处理