Quellcode durchsuchen

合租伙伴业务通知限制

lzm vor 3 Jahren
Ursprung
Commit
c76300186b

+ 14 - 1
sp-admin/sa-view/tb-partner/tb-partner-add.html

@@ -39,6 +39,13 @@
 							<sa-item type="text" name="联系人" v-model="m.dutyPeople" placeholder="请输入联系人" br></sa-item>
 							<sa-item type="text" name="联系电话" v-model="m.phone" placeholder="请输入联系号码" br></sa-item>
 							<div class="c-item">
+								<label class="c-label">业务类型:</label>
+								<el-select v-model="businessType" multiple :disabled="currentCustomerId!=='1'">
+									<el-option label="其他业务" value="1"></el-option>
+									<el-option label="整车业务" value="2"></el-option>
+								</el-select>
+							</div>
+							<div class="c-item">
 								<label class="c-label">类型:</label>
 								<el-select v-model="type" multiple :disabled="currentCustomerId!=='1'">
 									<el-option label="消杀公司" value="1"></el-option>
@@ -68,7 +75,8 @@
 					m: null, // 实体对象 
 					options: [],
 					currentCustomerId: '1',
-					type: []
+					type: [],
+					businessType: [],
 				},
 				methods: {
 					getCurrendCustomer() {
@@ -94,6 +102,7 @@
 					},
 					// 提交数据 
 					ok: function() {
+						console.log(this.businessType);
 						// 表单校验 
 						let m = this.m;
 						sa.checkNull(m.name, '请输入 [名称]');
@@ -103,6 +112,9 @@
 						}
 						sa.checkNull(m.dutyPeople, '请输入 [联系人]');
 						m.type = this.type.join(",")
+						m.businessType = this.businessType.join(",");
+						sa.checkNull(m.type, '请输入 [类型]');
+						sa.checkNull(m.businessType, '请输入 [业务类型]');
 						if (this.id <= 0) { // 添加
 							sa.ajax('/TbCostomer/add', m, function(res) {
 								sa.alert('增加成功', this.clean);
@@ -132,6 +144,7 @@
 						sa.ajax('/TbCostomer/getById?id=' + this.id, function(res) {
 							this.m = res.data;
 							this.type = this.m.type.split(',')
+							this.businessType = this.m.businessType.split(',')
 							if (res.data == null) {
 								sa.alert('未能查找到 id=' + this.id + " 详细数据");
 							}

+ 3 - 0
sp-admin/sa-view/tb-partner/tb-partner-info.html

@@ -33,6 +33,9 @@
 								<sa-info name="联系电话" br>{{m.phone}}</sa-info>
 							</el-col>
 							<el-col span="12">
+								<sa-info name="业务类型" br>
+									{{m.businessTypeDes}}
+								</sa-info>
 								<sa-info name="类型" br>
 									{{m.typeDes}}
 								</sa-info>

+ 0 - 2
sp-server/app.pid

@@ -1,2 +0,0 @@
-
-23292

+ 2 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -362,6 +362,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             String carNoStr = cars.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
             storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认" + DateUtil.now() + "。");
             List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(id);
+            Integer bigBusinessType = business.getBusinessType();
             items.forEach(item -> {
                 String businessType = item.getBusinessType();
                 if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
@@ -397,7 +398,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                         }
                         MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), item.getItemTypeName(),
                                 item.getItemName(), business.getGoodsName(), DateUtil.now(), remark);
-                        List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(businessType);
+                        List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(businessType, bigBusinessType);
                         openidList.forEach(openid -> {
                             String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + item.getId() + "&openid=" + openid;
                             wxService.sendTemplateMsg(wxConfig.getBusinessNoticeTemplate(), openid, msgDataBO, detailUrl);

+ 30 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java

@@ -112,6 +112,8 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
      */
     private String type = "0";
 
+    private String businessType = "2";
+
     @TableField(exist = false)
     private String typeDes;
 
@@ -125,6 +127,18 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
         return sb.substring(0, sb.lastIndexOf("、"));
     }
 
+    @TableField(exist = false)
+    private String businessTypeDes;
+    public String getBusinessTypeDes() {
+        String businessType = this.businessType;
+        StringBuilder sb = new StringBuilder();
+        StrUtil.splitTrim(businessType, ",")
+                .forEach(bt -> {
+                    sb.append(BusinessTypeEnum.getDesc(bt)).append("、");
+                });
+        return sb.substring(0, sb.lastIndexOf("、"));
+    }
+
     @Getter
     @AllArgsConstructor
     public static enum CustomerEnum {
@@ -157,5 +171,21 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
 
     }
 
+    @Getter
+    @AllArgsConstructor
+    public static enum BusinessTypeEnum {
+        CAR_DISINCLE("1","其他业务"),
+        HOLD_CAR("2","整车业务"),
+        ;
+        private String code;
+        private String desc;
+
+        public static String getDesc(String code) {
+            return Arrays.stream(BusinessTypeEnum.values()).filter(businessTypeEnum -> businessTypeEnum.getCode().equals(code))
+                    .findFirst().orElseThrow(() -> new BusinessException("不存在")).getDesc();
+        }
+
+    }
+
 
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.java

@@ -54,5 +54,5 @@ public interface TbCostomerMapper extends BaseMapper <TbCostomer> {
 	List<TbCostomer> getList(SoMap so);
 
 
-    List<String> findByBusinessTypeOpenid(@Param("businessType") String businessType);
+    List<String> findByBusinessTypeOpenid(@Param("businessType") String businessType, @Param("bigBusinessType") Integer bigBusinessType);
 }

+ 3 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml

@@ -105,7 +105,9 @@
     </select>
     <select id="findByBusinessTypeOpenid" resultType="java.lang.String">
 		SELECT b.openid from tb_costomer a LEFT JOIN sp_admin b on a.id=b.customer_id
-        WHERE a.type like concat('%',#{businessType},'%') and b.openid !='' and b.openid is not null
+        WHERE a.type like concat('%',#{businessType},'%')
+        and a.business_type like concat('%',#{bigBusinessType},'%')
+        and b.openid !='' and b.openid is not null
 	</select>
 
 

+ 2 - 2
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java

@@ -178,8 +178,8 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
         spAdminMapper.updateCustomerAdmin(costomer.getId(), 2);
     }
 
-    public List<String> findByBusinessTypeOpenid(String businessType) {
-        return  tbCostomerMapper.findByBusinessTypeOpenid(businessType);
+    public List<String> findByBusinessTypeOpenid(String businessType, Integer bigBusinessType) {
+        return  tbCostomerMapper.findByBusinessTypeOpenid(businessType, bigBusinessType);
 
     }
 }