Browse Source

Merge branch 'dev-mysql' of ssh://10.10.101.21/source/platform-b2c into dev-mysql

yujia 8 years ago
parent
commit
e3dc08c6b7

+ 1 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java

@@ -167,6 +167,7 @@ public class SecurityController {
 	public ModelMap afterCrossLogin(HttpServletRequest request, HttpServletResponse response, String replyTxt) {
 		if (!StringUtils.isEmpty(replyTxt)) {
 			Object returnUrl = request.getSession().getAttribute(SSOConfig.SSOReferer);
+			returnUrl = returnUrl.toString().replaceAll("login/proxy","auth/login");
 			SSOConfig config = SSOHelper.getSSOService().getConfig();
 			AuthToken token = SSOHelper.ok(request, response, replyTxt, config.getClientPublicKey(), config.getCenterPublicKey());
 			if (token != null) {

+ 7 - 5
src/main/java/com/uas/platform/b2c/common/base/service/impl/RestMailServiceImpl.java

@@ -7,6 +7,7 @@ import com.uas.message.mail.domain.MailLog;
 import com.uas.message.mail.service.MailService;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
@@ -31,17 +32,18 @@ public class RestMailServiceImpl implements MailService {
     /**
      * 邮件服务主机地址
      */
-    private static final String MAIL_CONSOLE_HOST = "http://10.10.100.23:28029/";
+    @Value("#{sys.messageServiceIp ?: 'http://message.ubtob.com/'}")
+    private String MAIL_CONSOLE_HOST;
 
     /**
      * 发送邮件给单个人url
      */
-    private static final String MAIL_SEND_URL = MAIL_CONSOLE_HOST  + "mail/send";
+    private String MAIL_SEND_URL = "mail/send";
 
     /**
      * 发送邮件给多个人 url
      */
-    private static final String MAIL_SEND_MANY_URL = MAIL_CONSOLE_HOST + "mail/send/o2m";
+    private String MAIL_SEND_MANY_URL = "mail/send/o2m";
 
     @Autowired
     public RestMailServiceImpl(RestTemplate restTemplate) {
@@ -86,7 +88,7 @@ public class RestMailServiceImpl implements MailService {
         object.put("params", params);
 
         HttpEntity<String> formEntity = new HttpEntity<String>(object.toJSONString(), headers);
-        ResponseEntity<MailLog> responseEntity = restTemplate.postForEntity(MAIL_SEND_URL, formEntity, MailLog.class);
+        ResponseEntity<MailLog> responseEntity = restTemplate.postForEntity(MAIL_CONSOLE_HOST + MAIL_SEND_URL, formEntity, MailLog.class);
         return responseEntity.getBody();
     }
 
@@ -110,7 +112,7 @@ public class RestMailServiceImpl implements MailService {
         object.put("params", params);
 
         HttpEntity<String> formEntity = new HttpEntity<String>(object.toJSONString(), headers);
-        ResponseEntity<String> responseEntity = restTemplate.postForEntity(MAIL_SEND_MANY_URL, formEntity, String.class);
+        ResponseEntity<String> responseEntity = restTemplate.postForEntity(MAIL_CONSOLE_HOST + MAIL_SEND_MANY_URL, formEntity, String.class);
         List<MailLog> mailLogs = FastjsonUtils.fromJsonArray(responseEntity.getBody(), MailLog.class);
         return mailLogs;
     }

+ 7 - 5
src/main/java/com/uas/platform/b2c/common/base/service/impl/RestSmsServiceImpl.java

@@ -8,6 +8,7 @@ import com.uas.message.sms.domain.SmsLog;
 import com.uas.message.sms.service.SmsService;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
@@ -33,17 +34,18 @@ public class RestSmsServiceImpl implements SmsService {
     /**
      * 短信服务主机地址
      */
-    private static final String SMS_CONSOLE_HOST = "http://10.10.100.23:28029/";
+    @Value("#{sys.messageServiceIp ?: 'http://message.ubtob.com/'}")
+    private String SMS_CONSOLE_HOST;
 
     /**
      * 发送短信给单个人url
      */
-    private static final String SMS_SEND_URL = SMS_CONSOLE_HOST  + "sms/send";
+    private static final String SMS_SEND_URL = "sms/send";
 
     /**
      * 发送短信给多个人 url
      */
-    private static final String SMS_SEND_MANY_URL = SMS_CONSOLE_HOST + "sms/send/o2m";
+    private static final String SMS_SEND_MANY_URL = "sms/send/o2m";
 
     @Autowired
     public RestSmsServiceImpl(RestTemplate restTemplate) {
@@ -85,7 +87,7 @@ public class RestSmsServiceImpl implements SmsService {
         object.put("params", params);
 
         HttpEntity<String> formEntity = new HttpEntity<String>(object.toJSONString(), headers);
-        ResponseEntity<SmsLog> responseEntity = restTemplate.postForEntity(SMS_SEND_URL, formEntity, SmsLog.class);
+        ResponseEntity<SmsLog> responseEntity = restTemplate.postForEntity(SMS_CONSOLE_HOST + SMS_SEND_URL, formEntity, SmsLog.class);
         return responseEntity.getBody();
     }
 
@@ -109,7 +111,7 @@ public class RestSmsServiceImpl implements SmsService {
         object.put("params", params);
 
         HttpEntity<String> formEntity = new HttpEntity<String>(object.toJSONString(), headers);
-        ResponseEntity<String> responseEntity = restTemplate.postForEntity(SMS_SEND_MANY_URL, formEntity, String.class);
+        ResponseEntity<String> responseEntity = restTemplate.postForEntity(SMS_CONSOLE_HOST + SMS_SEND_MANY_URL, formEntity, String.class);
         List<SmsLog> mailLogs = FastjsonUtils.fromJsonArray(responseEntity.getBody(), SmsLog.class);
         return mailLogs;
     }

+ 14 - 0
src/main/java/com/uas/platform/b2c/core/config/SysConf.java

@@ -142,6 +142,12 @@ public class SysConf {
 	@Value("#{sys.searchUrl}")
 	private String searchUrl;
 
+	/**
+	 * 搜索的地址
+	 */
+	@Value("#{sys.searchUrl}")
+	private String messageServiceIp;
+
 	public Boolean getRebuildIndexesOnRefresh() {
 		return rebuildIndexesOnRefresh;
 	}
@@ -305,4 +311,12 @@ public class SysConf {
 		this.searchUrl = searchUrl;
 		return this;
 	}
+
+	public String getMessageServiceIp() {
+		return messageServiceIp;
+	}
+
+	public void setMessageServiceIp(String messageServiceIp) {
+		this.messageServiceIp = messageServiceIp;
+	}
 }

+ 35 - 2
src/main/java/com/uas/platform/b2c/prod/product/common/api/CommonCountController.java

@@ -3,6 +3,9 @@ package com.uas.platform.b2c.prod.product.common.api;
 import com.uas.platform.b2c.prod.product.common.model.CommonCount;
 import com.uas.platform.b2c.prod.product.common.service.CommonCountService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.repository.query.Param;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -26,7 +29,37 @@ public class CommonCountController {
      * @return
      */
     @RequestMapping(method = RequestMethod.GET, params = "_status=actived")
-    public List<CommonCount> findActived() {
-        return commonCountService.findByStatus((short) 1, "b2c_index");
+    public List<CommonCount> findActived(@Param("userFor") String usedFor) {
+        usedFor = StringUtils.isEmpty(usedFor) ? "b2c_index" : usedFor;
+        return commonCountService.findByStatus((short) 1, usedFor);
     }
+
+    /**
+     * 根据ID获取计数器
+     * @author suntg
+     * @date 2017年11月7日17:03:28
+     * @return
+     */
+    @RequestMapping(value ="/{id}", method = RequestMethod.GET)
+    public CommonCount findById(@PathVariable("id") Long id) {
+        CommonCount commonCount = commonCountService.findById(id);
+        if(commonCount == null)
+            throw new IllegalArgumentException("参数ID错误,数据不存在");
+        return commonCount;
+    }
+
+    /**
+     * 根据ID获取计数器的结果
+     * @author suntg
+     * @date 2017年11月7日17:03:34
+     * @return
+     */
+    @RequestMapping(value ="/{id}/count", method = RequestMethod.GET)
+    public Long findCountById(@PathVariable("id") Long id) {
+        CommonCount commonCount = commonCountService.findById(id);
+        if(commonCount == null)
+            throw new IllegalArgumentException("参数ID错误,数据不存在");
+        return commonCount.getCount();
+    }
+
 }

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/service/CommonCountService.java

@@ -15,4 +15,11 @@ public interface CommonCountService {
      * @return
      */
     List<CommonCount> findByStatus(Short status, String usedFor);
+
+    /**
+     * 根据ID获取计数器内容
+     * @param id
+     * @return
+     */
+    CommonCount findById(Long id);
 }

+ 5 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/service/impl/CommonCountServiceImpl.java

@@ -25,4 +25,9 @@ public class CommonCountServiceImpl implements CommonCountService{
         }
         return commonCounts;
     }
+
+    @Override
+    public CommonCount findById(Long id) {
+        return commonCountDao.findOne(id);
+    }
 }

+ 2 - 0
src/main/resources/dev/sys.properties

@@ -34,6 +34,8 @@ recommendPort=20102
 uploadFileUrl = http://10.10.100.200:9999
 # search file
 searchUrl = http://10.10.100.191:8092
+# message ip
+messageServiceIp=http://message.ubtob.com/
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292

+ 4 - 0
src/main/resources/prod/sys.properties

@@ -35,5 +35,9 @@ recommendPort=20100
 uploadFileUrl=http://10.10.0.254:20290
 # search file
 searchUrl=http://10.10.0.76:8081
+
+# message ip
+messageServiceIp=http://message.ubtob.com/
+
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292

+ 3 - 0
src/main/resources/test/sys.properties

@@ -35,5 +35,8 @@ uploadFileUrl = http://10.10.100.200:9999
 # search file
 searchUrl = http://10.10.100.191:8092
 
+# message ip
+messageServiceIp=http://message.ubtob.com/
+
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292

+ 3 - 3
src/main/webapp/resources/view/usercenter/forstore/buyer_invoice.html

@@ -553,14 +553,14 @@
                     <div class="form-group"  ng-if="billType == 1205">
                         <label class="col-md-2 control-label"><b class="text-inverse">*</b>单位电话:</label>
                         <div class="form-input-line">
-                            <input type="text" class="form-control" ng-class="{'bg-fff8ee':!initFlag.initCompanyPhone&&form.companyPhone.$error.required, 'bg-fff':!form.companyPhone.$invalid}" ng-focus="form.companyPhone.$touched = false" ng-blur="form.companyPhone.$touched = true;initFlag.initCompanyPhone=false;" placeholder="区号和号码使用 '-' 隔开" name="companyPhone" ng-model="bill.companyPhone" ng-pattern="/^0\d{2,3}-[1-9]\d{6,7}$/" ng-maxlength="20" required="required">
+                            <input type="text" class="form-control" ng-class="{'bg-fff8ee':!initFlag.initCompanyPhone&&form.companyPhone.$error.required, 'bg-fff':!initFlag.initCompanyPhone&&!form.companyPhone.$invalid}" ng-focus="form.companyPhone.$touched = false" ng-blur="form.companyPhone.$touched = true;initFlag.initCompanyPhone=false;" placeholder="区号和号码使用 '-' 隔开" name="companyPhone" ng-model="bill.companyPhone" ng-pattern="/^0\d{2,3}-[1-9]\d{6,7}$/" ng-maxlength="20" required="required">
                         </div>
                         <div class="text-inverse error col-md-3" ng-show="form.companyPhone.$touched&&form.companyPhone.$invalid" ng-bind="form.companyPhone.$error.required?'请填写单位电话':form.companyPhone.$error.maxlength?'请勿超过20个字符':'请填写正确的电话号码,用-隔开'"></div>
                     </div>
                     <div class="form-group"  ng-if="billType == 1205">
                         <label class="col-md-2 control-label"><b class="text-inverse">*</b>税务登记号:</label>
                         <div class="form-input-line">
-                            <input type="text" class="form-control" ng-class="{'bg-fff8ee':!initFlag.initCompanyTaxNum&&form.companyTaxNum.$error.required, 'bg-fff':!form.companyTaxNum.$invalid}" ng-model="bill.companyTaxNumber" ng-focus="form.companyTaxNum.$touched = false" ng-blur="form.companyTaxNum.$touched = true; initFlag.initCompanyTaxNum = false;" name="companyTaxNum" required="true" ng-maxlength="20" ng-minlength="15" ng-pattern="/^[0-9a-zA-Z]+$/" placeholder="请输入税务登记号">
+                            <input type="text" class="form-control" ng-class="{'bg-fff8ee':!initFlag.initCompanyTaxNum&&form.companyTaxNum.$error.required, 'bg-fff':!initFlag.initCompanyTaxNum&&!form.companyTaxNum.$invalid}" ng-model="bill.companyTaxNumber" ng-focus="form.companyTaxNum.$touched = false" ng-blur="form.companyTaxNum.$touched = true; initFlag.initCompanyTaxNum = false;" name="companyTaxNum" required="true" ng-maxlength="20" ng-minlength="15" ng-pattern="/^[0-9a-zA-Z]+$/" placeholder="请输入税务登记号">
                         </div>
                         <div class="text-inverse error col-md-3" ng-show="form.companyTaxNum.$touched&&(form.companyTaxNum.$invalid)" ng-bind="form.companyTaxNum.$error.required?'请填写税务登记号':'请填写15-20位数字或字母'"></div>
                     </div>
@@ -600,7 +600,7 @@
                     <div class="form-group">
                         <label class="col-md-2 control-label"><b class="text-inverse">*</b>联系电话:</label>
                         <div class="form-input-line">
-                            <input type="text" class="form-control" ng-class="{'bg-fff8ee':!initFlag.initTelephone&&form.billTel.$error.required, 'bg-fff':!form.billTel.$invalid||!form.billTel.$touched}" ng-model="bill.telephone" ng-focus="form.billTel.$touched = false" ng-blur="form.billTel.$touched = true; initFlag.initTelephone=false;" name="billTel"
+                            <input type="text" class="form-control" ng-class="{'bg-fff8ee':!initFlag.initTelephone&&form.billTel.$error.required, 'bg-fff':!initFlag.initTelephone&&(!form.billTel.$invalid||!form.billTel.$touched)}" ng-model="bill.telephone" ng-focus="form.billTel.$touched = false" ng-blur="form.billTel.$touched = true; initFlag.initTelephone=false;" name="billTel"
                                    ng-pattern="/^[0-9]*$/" ng-minlength="8" ng-maxlength="11" required="required" placeholder="请输入联系电话">
                         </div>
                         <div class="text-inverse error col-md-3" ng-show="form.billTel.$touched&&form.billTel.$invalid" ng-bind="form.billTel.$error.required?'请填写联系电话':'请输入8-11位数字'"></div>

+ 2 - 2
src/main/webapp/resources/view/usercenter/forstore/order_detail.html

@@ -569,13 +569,13 @@
 					<b>发票抬头:</b>
 					<span ng-bind="order.invoiceInfo.head || '空'"></span>
 				</p>
-				<p>
+				<p ng-if="order.invoicetype == 1205">
 					<b>单位地址:</b>
 					<span ng-bind="order.invoiceInfo.companyAddress || '空'"></span>
 				</p>
 				<p ng-if="order.invoicetype == 1205">
 					<b>单位电话:</b>
-					<span ng-bind="order.invoiceInfo.landlineNumber || '空'">0755-58956655</span>
+					<span ng-bind="order.invoiceInfo.companyPhone || '空'">0755-58956655</span>
 				</p>
 				<p ng-if="order.invoicetype == 1205">
 					<b>税务登记号:</b>