Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 4 years ago
parent
commit
4ce21ea960

+ 16 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -5,13 +5,12 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
-import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
-import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -21,11 +20,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
@@ -61,14 +64,12 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.storage.StoragePluginContext;
 import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
+import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
+import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
 import com.ym.mec.util.money.MoneyUtil;
 import com.ym.mec.util.pdf.PDFUtil;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 
 @Service
 public class ContractServiceImpl implements ContractService, InitializingBean {
@@ -979,7 +980,12 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 		if (sysUserTsign == null) {
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+			try {
+				sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+			} catch (Exception e) {
+				logger.error("用户电子签章注册失败", e);
+				return false;
+			}
 		}
 		Date date = new Date();
 

+ 2 - 42
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>
@@ -189,7 +149,7 @@
 		left join sys_user u on u.id_ = ei.operator_id_
         <include refid="queryPageMap"/>
         GROUP BY ei.id_
-		ORDER BY ei.update_time_
+		ORDER BY ei.update_time_ desc
 		<include refid="global.limit" />
 	</select>
 

+ 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", "", "");
+	}
+}