yonge 4 năm trước cách đây
mục cha
commit
a5580e3126

+ 1 - 41
mec-biz/src/main/resources/config/mybatis/EmployeeInfoMapper.xml

@@ -70,85 +70,45 @@
 			<if test="subjectIdList != null">
 				subject_id_list_ = #{subjectIdList},
 			</if>
-			<if test="gender != null">
 				gender_ = #{gender},
-			</if>
-			<if test="entryDate != null">
 				entry_date_ = #{entryDate},
-			</if>
-			<if test="otherComment != null">
 				other_comment_ = #{otherComment},
-			</if>
 			<if test="status != null">
 				status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
-			<if test="educationalBackground != null">
 				educational_background_ = #{educationalBackground},
-			</if>
-			<if test="emergencyContactPhone != null">
 				emergency_contact_phone_ = #{emergencyContactPhone},
-			</if>
 				resignation_date_ = #{resignationDate},
-			<if test="position != null">
 				position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-			</if>
 			<if test="updateTime != null">
 				update_time_ = #{updateTime},
 			</if>
-			<if test="emergencyContactRelation != null">
 				emergency_contact_relation_ = #{emergencyContactRelation},
-			</if>
 			<if test="id != null">
 				id_ = #{id},
 			</if>
-			<if test="bankCardNo != null">
 				bank_card_no_ = #{bankCardNo},
-			</if>
-			<if test="realName != null">
 				real_name_ = #{realName},
-			</if>
-			<if test="idCard != null">
 				id_card_ = #{idCard},
-			</if>
-			<if test="age != null">
 				age_ = #{age},
-			</if>
-			<if test="liveCity != null">
 				live_city_ = #{liveCity},
-			</if>
-			<if test="intentionCity != null">
 				intention_city_ = #{intentionCity},
-			</if>
 			<if test="createTime != null">
 				create_time_ = #{createTime},
 			</if>
-			<if test="wechatNo != null">
 				wechat_no_ = #{wechatNo},
-			</if>
-			<if test="assessmentResult != null">
 				assessment_result_ = #{assessmentResult},
-			</if>
-			<if test="mobileNo != null">
 				mobile_no_ = #{mobileNo},
-			</if>
-			<if test="emergencyContactName != null">
 				emergency_contact_name_ = #{emergencyContactName},
-			</if>
-			<if test="birthdate != null">
 				birthdate_ = #{birthdate},
-			</if>
-			<if test="bankAddress != null">
 				bank_address_ = #{bankAddress},
-			</if>
 			<if test="organId != null">
 				organ_id_ = #{organId},
 			</if>
 			<if test="operatorId != null">
 				operator_id_ = #{operatorId},
 			</if>
-			<if test="sourceFrom != null">
-				source_from_ = #{sourceFrom},
-			</if>
+				source_from_ = #{sourceFrom}
 		</set>
 		WHERE id_ = #{id}
 	</update>

+ 127 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/AwSmsPlugin.java

@@ -0,0 +1,127 @@
+package com.ym.mec.thirdparty.message.provider;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.thirdparty.exception.ThirdpartyException;
+import com.ym.mec.thirdparty.message.MessageSenderPlugin;
+import com.ym.mec.util.http.HttpUtil;
+
+/**
+ * 昂网短信
+ */
+@Service
+public class AwSmsPlugin implements MessageSenderPlugin, InitializingBean {
+	/**
+	 * 请求地址
+	 */
+	private String reqURL = "http://47.104.84.72:8513/sms/Api/ReturnJson/Send.do";
+
+	private String appId = "2041";
+
+	/**
+	 * 账号
+	 */
+	private String account = "jmylhy";
+
+	/**
+	 * 密码
+	 */
+	private String pswd = "0Q!R1d@A";
+
+	private String signature = "【管乐迷】";
+
+	public static String getName() {
+		return "awsms";
+	}
+
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		// 参数检查
+		if (StringUtils.isBlank(reqURL)) {
+			throw new RuntimeException("Init parameter [reqURL] can not blank");
+		}
+		if (StringUtils.isBlank(account)) {
+			throw new RuntimeException("Init parameter [account] can not blank");
+		}
+		if (StringUtils.isBlank(pswd)) {
+			throw new RuntimeException("Init parameter [pswd] can not blank");
+		}
+	}
+
+	public void setReqURL(String reqURL) {
+		this.reqURL = reqURL;
+	}
+
+	public void setAccount(String account) {
+		this.account = account;
+	}
+
+	public void setPswd(String pswd) {
+		this.pswd = pswd;
+	}
+
+	@Override
+	public boolean send(String subject, String content, String receiver, String url, String jpushType) throws IOException {
+		try {
+			Map<String, Object> reqParams = new HashMap<String, Object>();
+			reqParams.put("SpCode", appId);
+			reqParams.put("LoginName", account);
+			reqParams.put("Password", pswd);
+			reqParams.put("MessageContent", signature + content);
+			reqParams.put("UserNumber", receiver);
+			// reqParams.put("SerialNumber", "");
+			// reqParams.put("ScheduleTime", "");
+			// reqParams.put("subPort", "");
+			String resultParams = HttpUtil.postForHttp(reqURL, reqParams);
+			JSONObject jsonObject = JSONObject.parseObject(resultParams);
+			if (jsonObject.get("result").equals("0")) {
+				return true;
+			} else {
+				throw new ThirdpartyException("短信发送失败:{}", jsonObject.get("description"));
+			}
+		} catch (Exception e) {
+			throw new ThirdpartyException("Failed to invoke awsms service", e);
+		}
+	}
+
+	@Override
+	public boolean batchSend(String subject, String content, String[] receivers, String url, String jpushType) throws IOException {
+		StringBuilder stringBuilder = new StringBuilder("");
+		for (int i = 0; i < receivers.length - 1; i++) {
+			stringBuilder.append(receivers[i]).append(",");
+		}
+		stringBuilder.append(receivers[receivers.length - 1]);
+		try {
+			Map<String, Object> reqParams = new HashMap<String, Object>();
+			reqParams.put("SpCode", appId);
+			reqParams.put("LoginName", account);
+			reqParams.put("Password", pswd);
+			reqParams.put("MessageContent", signature + content);
+			reqParams.put("UserNumber", stringBuilder.toString().trim());
+			// reqParams.put("SerialNumber", "");
+			// reqParams.put("ScheduleTime", "");
+			// reqParams.put("subPort", "");
+			String resultParams = HttpUtil.postForHttp(reqURL, reqParams);
+			JSONObject jsonObject = JSONObject.parseObject(resultParams);
+			if (jsonObject.get("result").equals("0")) {
+				return true;
+			} else {
+				throw new ThirdpartyException("短信发送失败:{}", jsonObject.get("description"));
+			}
+		} catch (Exception e) {
+			throw new ThirdpartyException("Failed to invoke awsms service", e);
+		}
+	}
+
+	public static void main(String[] args) throws IOException {
+		AwSmsPlugin plugin = new AwSmsPlugin();
+		plugin.send("测试", "您的验证码为274160(5分钟内有效),您正在进行商户认证,请不要向他人透露验证码", "13720176797", "", "");
+	}
+}