Browse Source

Merge remote-tracking branch 'origin/master'

wanglm 4 years ago
parent
commit
95883d7e21

+ 32 - 0
src/main/java/com/minpay/db/table/model/VmOrderDetails.java

@@ -164,6 +164,14 @@ public class VmOrderDetails extends AbstractMINBean {
     private String isDelivery;
 
     /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_order_details.VOD_PICKUP_TIME
+     *
+     * @mbggenerated
+     */
+    private String pickupTime;
+
+    /**
      * This method was generated by MyBatis Generator.
      * This method returns the value of the database column vm_order_details.VOD_DETAILS_ID
      *
@@ -642,4 +650,28 @@ public class VmOrderDetails extends AbstractMINBean {
     public void setIsDelivery(String isDelivery) {
         this.isDelivery = isDelivery == null ? null : isDelivery.trim();
     }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_order_details.VOD_PICKUP_TIME
+     *
+     * @return the value of vm_order_details.VOD_PICKUP_TIME
+     *
+     * @mbggenerated
+     */
+    public String getPickupTime() {
+        return pickupTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_order_details.VOD_PICKUP_TIME
+     *
+     * @param pickupTime the value for vm_order_details.VOD_PICKUP_TIME
+     *
+     * @mbggenerated
+     */
+    public void setPickupTime(String pickupTime) {
+        this.pickupTime = pickupTime == null ? null : pickupTime.trim();
+    }
 }

+ 78 - 0
src/main/java/com/minpay/db/table/model/VmOrderDetailsExample.java

@@ -1749,6 +1749,84 @@ public class VmOrderDetailsExample {
             addCriterion("VOD_IS_DELIVERY not between", value1, value2, "isDelivery");
             return (Criteria) this;
         }
+
+        public Criteria andPickupTimeIsNull() {
+            addCriterion("VOD_PICKUP_TIME is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeIsNotNull() {
+            addCriterion("VOD_PICKUP_TIME is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeEqualTo(String value) {
+            if(value == null ){
+                andPickupTimeIsNull();
+            } else {
+                addCriterion("VOD_PICKUP_TIME =", value, "pickupTime");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeNotEqualTo(String value) {
+            if(value == null ){
+                andPickupTimeIsNotNull();
+            } else {
+                addCriterion("VOD_PICKUP_TIME <>", value, "pickupTime");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeGreaterThan(String value) {
+            addCriterion("VOD_PICKUP_TIME >", value, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeGreaterThanOrEqualTo(String value) {
+            addCriterion("VOD_PICKUP_TIME >=", value, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeLessThan(String value) {
+            addCriterion("VOD_PICKUP_TIME <", value, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeLessThanOrEqualTo(String value) {
+            addCriterion("VOD_PICKUP_TIME <=", value, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeLike(String value) {
+            addCriterion("VOD_PICKUP_TIME like", value, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeNotLike(String value) {
+            addCriterion("VOD_PICKUP_TIME not like", value, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeIn(List<String> values) {
+            addCriterion("VOD_PICKUP_TIME in", values, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeNotIn(List<String> values) {
+            addCriterion("VOD_PICKUP_TIME not in", values, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeBetween(String value1, String value2) {
+            addCriterion("VOD_PICKUP_TIME between", value1, value2, "pickupTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andPickupTimeNotBetween(String value1, String value2) {
+            addCriterion("VOD_PICKUP_TIME not between", value1, value2, "pickupTime");
+            return (Criteria) this;
+        }
     }
 
     /**

+ 72 - 9
src/main/java/com/minpay/shouhuo/PersManageAction.java

@@ -13,8 +13,11 @@ import com.minpay.common.service.IQrcodeService;
 import com.minpay.common.service.impl.QrcodeServiceImpl;
 import com.minpay.common.util.*;
 import com.minpay.db.table.mapper.VmPersonInfMapper;
+import com.minpay.db.table.mapper.VmPersonRoleInfMapper;
 import com.minpay.db.table.model.VmPersonInf;
 import com.minpay.db.table.model.VmPersonInfExample;
+import com.minpay.db.table.model.VmPersonRoleInf;
+import com.minpay.db.table.model.VmPersonRoleInfExample;
 import com.minpay.db.table.own.mapper.PersonManageMapper;
 import com.minpay.db.table.own.mapper.SequenceMapper;
 import com.minpay.huicai.util.EquCodeCreateUtil;
@@ -33,6 +36,9 @@ import com.startup.minpay.frame.target.MINAction;
 import com.startup.minpay.frame.target.MINComponent;
 import com.startup.minpay.frame.target.MINParam;
 import net.sf.json.JSONObject;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
@@ -193,14 +199,17 @@ public class PersManageAction implements IMINAction {
 		if(CommonUtil.isEmpty((String) result.get("openId"))) {
 			throw new MINBusinessException("JA0001", "非法登录!");
 		}
+		//用户表可以存在  角色表不可以
+
 		VmPersonInfExample personex = new VmPersonInfExample();
 		personex.createCriteria().andChannelEqualTo(channel).andTypeEqualTo(type).andOpenidEqualTo((String) result.get("openId"));
 		List<VmPersonInf> perLst = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonInfMapper.class).selectByExample(personex);
-		if(perLst.size() > 0 ){
-			throw new MINBusinessException("用户已存在!");
+		if(perLst.size() > 1 ){
+			throw new MINBusinessException("用户异常,请联系管理员!");
 		}
 
-		if(perLst.size() == 0) {
+		if(perLst.size() == 0) { //新用户,新角色
+			/**添加用户*/
 			//获取用户主键
 			String perId = Service.lookup(IMINDataBaseService.class).getMybatisMapper(SequenceMapper.class).getSequence("VM_PERSON_INF_NO");
 			person.setId(perId);
@@ -219,11 +228,36 @@ public class PersManageAction implements IMINAction {
 			person.setRole(role);
 			person.setUserId(branchId);
 			Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonInfMapper.class).insertSelective(person);
-		}else{
+			/**添加角色*/
+			String roleId = Service.lookup(IMINDataBaseService.class).getMybatisMapper(SequenceMapper.class).getSequence("VM_PERSON_ROLE_ID");
+			VmPersonRoleInf vmPersonRoleInf = new VmPersonRoleInf();
+			vmPersonRoleInf.setId(roleId);
+			vmPersonRoleInf.setBranchId(branchId);
+			vmPersonRoleInf.setPersonId(perId);
+			vmPersonRoleInf.setRole(role);
+			Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonRoleInfMapper.class).insertSelective(vmPersonRoleInf);
+		}else{ //有用户,无角色
 			VmPersonInf vmPersonInf = perLst.get(0);
 			if("0".equals(vmPersonInf.getIsUser())){
 				vmPersonInf.setIsUser("1");
 				Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonInfMapper.class).updateByPrimaryKeySelective(person);
+
+			}else{
+				/**查询是否有此角色*/
+				VmPersonRoleInfExample vmPersonRoleInfExample = new VmPersonRoleInfExample();
+				vmPersonRoleInfExample.createCriteria().andRoleEqualTo(role).andPersonIdEqualTo(vmPersonInf.getId()).andStateEqualTo("00");
+				List<VmPersonRoleInf> vmPersonRoleInfList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonRoleInfMapper.class).selectByExample(vmPersonRoleInfExample);
+				if(vmPersonRoleInfList.size() > 0){
+					throw new MINBusinessException("已有此角色,无需再次添加");
+				}
+				/**添加角色*/
+				String roleId = Service.lookup(IMINDataBaseService.class).getMybatisMapper(SequenceMapper.class).getSequence("VM_PERSON_ROLE_ID");
+				VmPersonRoleInf vmPersonRoleInf = new VmPersonRoleInf();
+				vmPersonRoleInf.setId(roleId);
+				vmPersonRoleInf.setBranchId(branchId);
+				vmPersonRoleInf.setPersonId(vmPersonInf.getId());
+				vmPersonRoleInf.setRole(role);
+				Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonRoleInfMapper.class).insertSelective(vmPersonRoleInf);
 			}
 		}
 		return res;
@@ -290,7 +324,7 @@ public class PersManageAction implements IMINAction {
 	 * @param flash 是否刷新
 	 */
 	@MINAction(value = CREATE_QRCODE, transaction = IMINTransactionEnum.CMT)
-	public static MINActionResult createQrCode(
+	public  MINActionResult createQrCode(
 			@MINParam(key = "flash") String flash,
 			@MINParam(key = "role") String role,
 			MINSession session)throws MINBusinessException, FileNotFoundException, WriterException, IOException {
@@ -346,7 +380,7 @@ public class PersManageAction implements IMINAction {
 		String urls = iQrcodeService.createQrCode("-1",paramStr.toString(),"-1");
 		//String urlString = URLEncoder.encode(, "GBK");
 		http://shjservices.personalpay.cn/adm
-		// 生成二维码图片到本地
+		// 生成二维码图片到本地+
 		try {
 			EquCodeCreateUtil.createQrCode(outputStream,urls,900,"JPEG");
 		} catch (com.google.zxing.WriterException e) {
@@ -356,14 +390,43 @@ public class PersManageAction implements IMINAction {
 		outputStream.close();
 		// 上传图片到服务器
 		InputStream inputSteam = new FileInputStream(file);
-		String url = UpLoadFile.uploadImg(inputSteam,"jpg",channel,"00");
-
+		String ambient = Service.lookup(IPublicService.class)
+				.getSysParValue("AMBIENT");//当前环境
+		FileItem fileItem = createFileItem(file ,"itemFileName");
+		Map<String, Object> map = null;
+		if("00".equals(ambient)){//测试
+			map =Service.lookup(IPublicService.class).uploadFile(fileItem, "00", 0, true,"V01");
+		}
+		if("01".equals(ambient)){//生产
+			map =Service.lookup(IPublicService.class).uploadFileBD(fileItem, "00", 0, true,"V01");
+		}
+		String url  = String.valueOf(map.get("url"));
 		inputSteam.close();
 		// 删除本地图片
 		file.delete();
 		res.set("url", url);
 		return res;
 	}
-
+	/*
+       创建FileItem
+        */
+	private FileItem createFileItem(File file, String fieldName) {
+		FileItemFactory factory = new DiskFileItemFactory(16, null);
+		FileItem item = factory.createItem(fieldName, "text/plain", true, file.getName());
+		int bytesRead = 0;
+		byte[] buffer = new byte[8192];
+		try {
+			FileInputStream fis = new FileInputStream(file);
+			OutputStream os = item.getOutputStream();
+			while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
+				os.write(buffer, 0, bytesRead);
+			}
+			os.close();
+			fis.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return item;
+	}
 
 }

+ 2 - 0
src/main/java/com/minpay/shouhuo/invCardManageAction.java

@@ -402,6 +402,7 @@ public class invCardManageAction implements IMINAction {
 		String info = "";
 		if ("0".equals(temp)) {
 			vd.setStatus("6");
+
 			info = "废止";
 			//修改提货表
 			Service.lookup(IMINDataBaseService.class)
@@ -409,6 +410,7 @@ public class invCardManageAction implements IMINAction {
 					.updateByPrimaryKeySelective(vd);
 			//修改订单详情表
 			vmOrderDetails.setIsDelivery("01");
+			vmOrderDetails.setPickupTime(DateUtil.getCurrentDateTimeString());
 			Service.lookup(IMINDataBaseService.class)
 					.getMybatisMapper(VmOrderDetailsMapper.class)
 					.updateByPrimaryKeySelective(vmOrderDetails);

+ 22 - 5
src/main/resources/com/minpay/db/table/mapper/VmOrderDetailsMapper.xml

@@ -26,6 +26,7 @@
     <result column="VOD_MODIFY_TIME" jdbcType="VARCHAR" property="modifyTime" />
     <result column="VOD_DELIVERY_ID" jdbcType="VARCHAR" property="deliveryId" />
     <result column="VOD_IS_DELIVERY" jdbcType="VARCHAR" property="isDelivery" />
+    <result column="VOD_PICKUP_TIME" jdbcType="VARCHAR" property="pickupTime" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -101,7 +102,7 @@
     VOD_DETAILS_ID, VOD_CHANNEL, VOD_ORDER_ID, VOD_PRO_EQU_REL_ID, VOD_CARGO_WAY, VOD_PRODUCT_ID, 
     VOD_PRO_TYPE, VOD_PRO_NAME, VOD_PRO_PRICE, VOD_PRO_NUMS, VOD_AMOUNT, VOD_RECORD_ID, 
     VOD_REMARKS, VOD_IS_WINNING, VOD_CREATE_USER, VOD_CREATE_TIME, VOD_MODIFY_USER, VOD_MODIFY_TIME, 
-    VOD_DELIVERY_ID, VOD_IS_DELIVERY
+    VOD_DELIVERY_ID, VOD_IS_DELIVERY, VOD_PICKUP_TIME
   </sql>
   <select id="selectByExample" parameterType="com.minpay.db.table.model.VmOrderDetailsExample" resultMap="BaseResultMap">
     <!--
@@ -160,14 +161,16 @@
       VOD_PRO_NUMS, VOD_AMOUNT, VOD_RECORD_ID, 
       VOD_REMARKS, VOD_IS_WINNING, VOD_CREATE_USER, 
       VOD_CREATE_TIME, VOD_MODIFY_USER, VOD_MODIFY_TIME, 
-      VOD_DELIVERY_ID, VOD_IS_DELIVERY)
+      VOD_DELIVERY_ID, VOD_IS_DELIVERY, VOD_PICKUP_TIME
+      )
     values (#{detailsId,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR}, 
       #{proEquRelId,jdbcType=VARCHAR}, #{cargoWay,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, 
       #{proType,jdbcType=VARCHAR}, #{proName,jdbcType=VARCHAR}, #{proPrice,jdbcType=VARCHAR}, 
       #{proNums,jdbcType=VARCHAR}, #{amount,jdbcType=VARCHAR}, #{recordId,jdbcType=VARCHAR}, 
       #{remarks,jdbcType=VARCHAR}, #{isWinning,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, 
       #{createTime,jdbcType=VARCHAR}, #{modifyUser,jdbcType=VARCHAR}, #{modifyTime,jdbcType=VARCHAR}, 
-      #{deliveryId,jdbcType=VARCHAR}, #{isDelivery,jdbcType=VARCHAR})
+      #{deliveryId,jdbcType=VARCHAR}, #{isDelivery,jdbcType=VARCHAR}, #{pickupTime,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.minpay.db.table.model.VmOrderDetails">
     <!--
@@ -236,6 +239,9 @@
       <if test="isDelivery != null">
         VOD_IS_DELIVERY,
       </if>
+      <if test="pickupTime != null">
+        VOD_PICKUP_TIME,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="detailsId != null">
@@ -298,6 +304,9 @@
       <if test="isDelivery != null">
         #{isDelivery,jdbcType=VARCHAR},
       </if>
+      <if test="pickupTime != null">
+        #{pickupTime,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.minpay.db.table.model.VmOrderDetailsExample" resultType="java.lang.Integer">
@@ -377,6 +386,9 @@
       <if test="record.isDelivery != null">
         VOD_IS_DELIVERY = #{record.isDelivery,jdbcType=VARCHAR},
       </if>
+      <if test="record.pickupTime != null">
+        VOD_PICKUP_TIME = #{record.pickupTime,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -407,7 +419,8 @@
       VOD_MODIFY_USER = #{record.modifyUser,jdbcType=VARCHAR},
       VOD_MODIFY_TIME = #{record.modifyTime,jdbcType=VARCHAR},
       VOD_DELIVERY_ID = #{record.deliveryId,jdbcType=VARCHAR},
-      VOD_IS_DELIVERY = #{record.isDelivery,jdbcType=VARCHAR}
+      VOD_IS_DELIVERY = #{record.isDelivery,jdbcType=VARCHAR},
+      VOD_PICKUP_TIME = #{record.pickupTime,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -476,6 +489,9 @@
       <if test="isDelivery != null">
         VOD_IS_DELIVERY = #{isDelivery,jdbcType=VARCHAR},
       </if>
+      <if test="pickupTime != null">
+        VOD_PICKUP_TIME = #{pickupTime,jdbcType=VARCHAR},
+      </if>
     </set>
     where VOD_DETAILS_ID = #{detailsId,jdbcType=VARCHAR}
   </update>
@@ -503,7 +519,8 @@
       VOD_MODIFY_USER = #{modifyUser,jdbcType=VARCHAR},
       VOD_MODIFY_TIME = #{modifyTime,jdbcType=VARCHAR},
       VOD_DELIVERY_ID = #{deliveryId,jdbcType=VARCHAR},
-      VOD_IS_DELIVERY = #{isDelivery,jdbcType=VARCHAR}
+      VOD_IS_DELIVERY = #{isDelivery,jdbcType=VARCHAR},
+      VOD_PICKUP_TIME = #{pickupTime,jdbcType=VARCHAR}
     where VOD_DETAILS_ID = #{detailsId,jdbcType=VARCHAR}
   </update>
 </mapper>