Compare commits
3 Commits
4f55e0e9f8
...
67f8738c5e
| Author | SHA1 | Date |
|---|---|---|
|
|
67f8738c5e | |
|
|
8a8cd9353b | |
|
|
88db2391d2 |
|
|
@ -110,16 +110,17 @@ public class OrderDetailInsuranceUserController extends BaseController
|
|||
aliCloudService.certNoTwoElementVerification(req);
|
||||
} catch (Exception e) {
|
||||
log.error("身份证二要素校验失败:{}", e.getMessage(), e);
|
||||
return AjaxResult.error(e.getMessage(), "身份证二要素校验失败!");
|
||||
return AjaxResult.error("请核对姓名与身份证号!");
|
||||
}
|
||||
// 将保险人员增员到原保险订单上去
|
||||
try {
|
||||
insuranceService.editInsurance(orderDetailInsuranceUser);
|
||||
orderDetailInsuranceUserService.insertOrderDetailInsuranceUser(orderDetailInsuranceUser);
|
||||
return AjaxResult.success("增员完毕,保险已生效。");
|
||||
}catch (Exception e){
|
||||
log.error("保险增员失败:{}", e.getMessage(), e);
|
||||
return AjaxResult.error(e.getMessage(), "保险增员失败!");
|
||||
return AjaxResult.error("保险正生成中,可能需几秒或几分钟,请稍等即可!若超半小时可联系发单方或平台。");
|
||||
}
|
||||
return toAjax(orderDetailInsuranceUserService.insertOrderDetailInsuranceUser(orderDetailInsuranceUser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1481,6 +1481,26 @@ public class OrderMasterController extends BaseController {
|
|||
public AjaxResult editOrderMaster(@RequestBody OrderMaster orderMaster) {
|
||||
try {
|
||||
int result = orderMasterService.updateOrderMaster(orderMaster);
|
||||
// 下单
|
||||
if(orderMaster.getOrderStatus() != null && OrderStatus.PLAIN.code() == orderMaster.getOrderStatus()){
|
||||
OrderMaster model = orderMasterService.selectById(orderMaster.getId());
|
||||
try {
|
||||
if(model.getInsuranceId()!=null){
|
||||
insuranceService.orderInsurance(model.getCode());
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("下单报错:" + ExceptionUtils.getMessage(e));
|
||||
return AjaxResult.error("保险正生成中,可能需几秒或几分钟,请稍等即可!若超半小时可联系发单方或平台!");
|
||||
}
|
||||
// 判断是否是在线支付订单--如果是在线支付,且未付款,则需要提示支付后接单
|
||||
if(PayTypeEnum.WX_LITE.getCode().equals(model.getPayType())){
|
||||
// 查询财务信息
|
||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(model.getId());
|
||||
if(!PayStatus.PAID.getCode().equals(financialMaster.getPayStatus())){
|
||||
return AjaxResult.error("客户支付中,请稍后!待支付完成可接单!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
List<OrderDetail> orderDetails = orderDetailService.selectByOrderMasterId(orderMaster.getId());
|
||||
orderDetails.forEach(orderDetail -> {
|
||||
|
|
@ -1488,24 +1508,7 @@ public class OrderMasterController extends BaseController {
|
|||
orderDetailService.updateOrderDetail(orderDetail);
|
||||
});
|
||||
}
|
||||
// 下单
|
||||
if(orderMaster.getOrderStatus() != null && OrderStatus.PLAIN.code() == orderMaster.getOrderStatus()){
|
||||
OrderMaster model = orderMasterService.selectById(orderMaster.getId());
|
||||
try {
|
||||
insuranceService.orderInsurance(model.getCode());
|
||||
}catch (Exception e){
|
||||
logger.error("下单报错:" + ExceptionUtils.getMessage(e));
|
||||
}
|
||||
// 判断是否是在线支付订单--如果是在线支付,且未付款,则需要提示支付后接单
|
||||
if(PayTypeEnum.WX_LITE.getCode().equals(model.getPayType())){
|
||||
// 查询财务信息
|
||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(model.getId());
|
||||
if(!PayStatus.PAID.getCode().equals(financialMaster.getPayStatus())){
|
||||
return AjaxResult.error("待支付后再接单!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("");
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("派单失败:" + ExceptionUtils.getMessage(e));
|
||||
|
|
|
|||
|
|
@ -133,32 +133,84 @@ public class WorkerController extends BaseController {
|
|||
|
||||
try {
|
||||
// 查询满足区域条件的师傅区域记录
|
||||
List<Long> workerIdsByArea;
|
||||
List<Long> workerIdsByArea = new ArrayList<>();
|
||||
if(workerListRequest.getAreaId() != null){
|
||||
WorkerArea workerArea = new WorkerArea();
|
||||
workerArea.setDistrictId(workerListRequest.getAreaId());
|
||||
// 如果有省市区的查询条件,需要构建完整的区域查询条件
|
||||
boolean flag = StringUtils.isNotEmpty(workerListRequest.getDistrictId()) || StringUtils.isNotEmpty(workerListRequest.getProvinceId())
|
||||
|| StringUtils.isNotEmpty(workerListRequest.getCityId()) || StringUtils.isNotEmpty(workerListRequest.getStreetId());
|
||||
if(flag){
|
||||
workerArea.setDistrictId(null);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(workerListRequest.getDistrictId())){
|
||||
workerArea.setDistrictId(Long.valueOf(workerListRequest.getDistrictId()));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(workerListRequest.getProvinceId())) {
|
||||
workerArea.setProvinceId(Long.valueOf(workerListRequest.getProvinceId()));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(workerListRequest.getCityId())) {
|
||||
workerArea.setCityId(Long.valueOf(workerListRequest.getCityId()));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(workerListRequest.getStreetId())) {
|
||||
workerArea.setStreetId(Long.valueOf(workerListRequest.getStreetId()));
|
||||
}
|
||||
List<WorkerArea> workerAreaList = workerAreaService.getWorkerAreaList(workerArea);
|
||||
workerIdsByArea = workerAreaList.stream().map(WorkerArea::getWorkerId).collect(Collectors.toList());
|
||||
}else {
|
||||
workerIdsByArea = new ArrayList<>();
|
||||
workerIdsByArea = workerAreaList.stream()
|
||||
.map(WorkerArea::getWorkerId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 查询满足技能条件的师傅技能记录
|
||||
List<Long> workerIdsByCategory;
|
||||
if(workerListRequest.getGoodsCategoryId()!=null){
|
||||
List<Long> workerIdsByCategory = new ArrayList<>();
|
||||
if(workerListRequest.getGoodsCategoryId() != null){
|
||||
WorkerGoodsCategory workerGoodsCategory = new WorkerGoodsCategory();
|
||||
workerGoodsCategory.setGoodsCategoryId(workerListRequest.getGoodsCategoryId());
|
||||
// 如果选择了上级类目但未选择最终类目,则查询该类目下所有子类目
|
||||
if(StringUtils.isNotEmpty(workerListRequest.getCategoryLevel1())
|
||||
&& workerListRequest.getGoodsCategoryId() == null) {
|
||||
GoodsCategory param = new GoodsCategory();
|
||||
param.setParentCategoryId(Long.valueOf(workerListRequest.getCategoryLevel1()));
|
||||
List<GoodsCategory> subCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
||||
List<String> categoryIds = subCategories.stream()
|
||||
.map(x->x.getGoodsCategoryId().toString())
|
||||
.collect(Collectors.toList());
|
||||
workerGoodsCategory.setCategoryIds(categoryIds);
|
||||
}
|
||||
// 如果选择了二级类目但未选择三级类目
|
||||
else if(StringUtils.isNotEmpty(workerListRequest.getCategoryLevel2())
|
||||
&& workerListRequest.getGoodsCategoryId() == null) {
|
||||
GoodsCategory param = new GoodsCategory();
|
||||
param.setParentCategoryId(Long.valueOf(workerListRequest.getCategoryLevel2()));
|
||||
List<GoodsCategory> subCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
||||
List<String> categoryIds = subCategories.stream()
|
||||
.map(x->x.getGoodsCategoryId().toString())
|
||||
.collect(Collectors.toList());
|
||||
workerGoodsCategory.setCategoryIds(categoryIds);
|
||||
}
|
||||
List<WorkerGoodsCategory> workerGoodsCategoryList = workerGoodsCategoryService.getWorkerGoodsCategory(workerGoodsCategory);
|
||||
workerIdsByCategory = workerGoodsCategoryList.stream().map(WorkerGoodsCategory::getWorkerId).collect(Collectors.toList());
|
||||
}else {
|
||||
workerIdsByCategory = new ArrayList<>();
|
||||
workerIdsByCategory = workerGoodsCategoryList.stream()
|
||||
.map(WorkerGoodsCategory::getWorkerId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 两个list中的workerid取交集
|
||||
List<Long> resWorkerIds = new ArrayList<>(CollectionUtils.intersection(workerIdsByArea, workerIdsByCategory));
|
||||
if (CollectionUtils.isEmpty(resWorkerIds) && (workerListRequest.getAreaId() != null || workerListRequest.getGoodsCategoryId()!=null)) {
|
||||
// 交集不存在的情况直接返回空list
|
||||
return getDataTable(resList);
|
||||
List<Long> resWorkerIds = new ArrayList<>();
|
||||
if(!workerIdsByArea.isEmpty() && !workerIdsByCategory.isEmpty()) {
|
||||
resWorkerIds.addAll(CollectionUtils.intersection(workerIdsByArea, workerIdsByCategory));
|
||||
} else if(!workerIdsByArea.isEmpty()) {
|
||||
resWorkerIds.addAll(workerIdsByArea);
|
||||
} else if(!workerIdsByCategory.isEmpty()) {
|
||||
resWorkerIds.addAll(workerIdsByCategory);
|
||||
}
|
||||
|
||||
if (!resWorkerIds.isEmpty() ||
|
||||
workerListRequest.getAreaId() != null ||
|
||||
workerListRequest.getGoodsCategoryId() != null) {
|
||||
// 有查询条件但无匹配结果时直接返回空列表
|
||||
if(resWorkerIds.isEmpty()) {
|
||||
return getDataTable(resList);
|
||||
}
|
||||
}
|
||||
|
||||
startPage();
|
||||
|
|
|
|||
|
|
@ -29,4 +29,16 @@ public class WorkerListRequest extends BaseEntity {
|
|||
private boolean justShowCurWorkerArea;
|
||||
|
||||
private String keyWords;
|
||||
|
||||
private String provinceId;
|
||||
|
||||
private String cityId;
|
||||
|
||||
private String districtId;
|
||||
|
||||
private String streetId;
|
||||
|
||||
private String categoryLevel1;
|
||||
|
||||
private String categoryLevel2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://58.49.150.163:3306/gqz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://8.138.169.236:3306/gqz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Clunt@12345
|
||||
password: clunt@12345
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -35,6 +35,33 @@
|
|||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
|
||||
</li>
|
||||
<li>
|
||||
服务区域:
|
||||
<select name="provinceId" id="provinceId" onchange="areaChange(this, 'cityId')">
|
||||
<option value="">所有省份</option>
|
||||
</select>
|
||||
<select name="cityId" id="cityId" onchange="areaChange(this, 'districtId')">
|
||||
<option value="">所有城市</option>
|
||||
</select>
|
||||
<select name="districtId" id="districtId" onchange="areaChange(this, 'streetId')">
|
||||
<option value="">所有区县</option>
|
||||
</select>
|
||||
<select name="streetId" id="streetId">
|
||||
<option value="">所有街道</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
服务技能:
|
||||
<select name="categoryLevel1" id="categoryLevel1" onchange="categoryChange(this, 'categoryLevel2')">
|
||||
<option value="">所有类目</option>
|
||||
</select>
|
||||
<select name="categoryLevel2" id="categoryLevel2" onchange="categoryChange(this, 'categoryLevel3')">
|
||||
<option value="">二级类目</option>
|
||||
</select>
|
||||
<select name="goodsCategoryId" id="categoryLevel3">
|
||||
<option value="">三级类目</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
|
|
@ -87,6 +114,37 @@
|
|||
$('#scroll-up').toTop(opt);
|
||||
}
|
||||
queryUserList();
|
||||
|
||||
// 初始化区域下拉框
|
||||
$.ajax({
|
||||
url: ctx + "system/area/list",
|
||||
type: "post",
|
||||
data: {levelType: 1}, // 查询levelType为1的省级区域
|
||||
success: function(data) {
|
||||
console.log("区域数据:", data); // 添加日志查看返回的数据结构
|
||||
var html = '<option value="">所有省份</option>';
|
||||
// 检查data.data,因为可能返回的是AjaxResult格式
|
||||
var areaList = data.data || data;
|
||||
$.each(areaList, function(i, item) {
|
||||
html += '<option value="' + item.areaCode + '">' + item.areaName + '</option>';
|
||||
});
|
||||
$("#provinceId").html(html);
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化技能类别下拉框
|
||||
$.ajax({
|
||||
url: ctx + "goods/category/list",
|
||||
type: "post",
|
||||
data: {parentCategoryId: 1}, // 查询parentCategoryId为1的一级类目
|
||||
success: function(data) {
|
||||
var html = '<option value="">所有类目</option>';
|
||||
$.each(data, function(i, item) {
|
||||
html += '<option value="' + item.goodsCategoryId + '">' + item.goodsCategoryName + '</option>';
|
||||
});
|
||||
$("#categoryLevel1").html(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function queryUserList() {
|
||||
|
|
@ -99,6 +157,39 @@
|
|||
sortName: "createTime",
|
||||
sortOrder: "desc",
|
||||
modalName: "师傅",
|
||||
queryParams: function(params) {
|
||||
// 先获取默认的分页参数
|
||||
var defaultParams = {
|
||||
pageSize: params.limit,
|
||||
pageNum: params.offset / params.limit + 1,
|
||||
searchValue: params.search,
|
||||
orderByColumn: params.sort,
|
||||
isAsc: params.order
|
||||
};
|
||||
|
||||
// 获取表单参数
|
||||
var curParams = $.common.formToJSON("user-form");
|
||||
|
||||
// 处理区域ID,使用最后一个选中的非空区域值作为对应字段
|
||||
var streetId = $("#streetId").val();
|
||||
var districtId = $("#districtId").val();
|
||||
var cityId = $("#cityId").val();
|
||||
var provinceId = $("#provinceId").val();
|
||||
|
||||
if(streetId) {
|
||||
curParams.streetId = streetId; // 使用streetId字段
|
||||
curParams.areaId = districtId; // 区县ID作为areaId
|
||||
} else if(districtId) {
|
||||
curParams.areaId = districtId;
|
||||
} else if(cityId) {
|
||||
curParams.areaId = cityId;
|
||||
} else if(provinceId) {
|
||||
curParams.areaId = provinceId;
|
||||
}
|
||||
|
||||
// 合并默认参数和自定义参数
|
||||
return $.extend(defaultParams, curParams);
|
||||
},
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
|
|
@ -204,6 +295,139 @@
|
|||
$.operate.post(prefix + "/changeStatus", { "workerId": workerId, "status": 0 });
|
||||
})
|
||||
}
|
||||
|
||||
// 区域联动处理
|
||||
function areaChange(obj, nextId) {
|
||||
var parentCode = $(obj).val();
|
||||
if (parentCode) {
|
||||
$.ajax({
|
||||
url: ctx + "system/area/list",
|
||||
type: "post",
|
||||
data: {parentCode: parentCode},
|
||||
success: function(data) {
|
||||
console.log("下级区域数据:", data);
|
||||
var html = '<option value="">' + getAreaLevelName(nextId) + '</option>';
|
||||
var areaList = data.data || data;
|
||||
$.each(areaList, function(i, item) {
|
||||
html += '<option value="' + item.areaCode + '">' + item.areaName + '</option>';
|
||||
});
|
||||
$("#" + nextId).html(html);
|
||||
// 清空下级选项
|
||||
clearLowerLevels(nextId);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#" + nextId).html('<option value="">' + getAreaLevelName(nextId) + '</option>');
|
||||
// 清空下级选项
|
||||
clearLowerLevels(nextId);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取区域层级名称
|
||||
function getAreaLevelName(levelId) {
|
||||
switch(levelId) {
|
||||
case 'cityId':
|
||||
return '所有城市';
|
||||
case 'districtId':
|
||||
return '所有区县';
|
||||
case 'streetId':
|
||||
return '所有街道';
|
||||
default:
|
||||
return '所有';
|
||||
}
|
||||
}
|
||||
|
||||
// 清空下级选项
|
||||
function clearLowerLevels(currentId) {
|
||||
var levels = ['cityId', 'districtId', 'streetId'];
|
||||
var startClearing = false;
|
||||
|
||||
for(var i = 0; i < levels.length; i++) {
|
||||
if(startClearing) {
|
||||
$("#" + levels[i]).html('<option value="">' + getAreaLevelName(levels[i]) + '</option>');
|
||||
}
|
||||
if(levels[i] === currentId) {
|
||||
startClearing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 类目联动处理
|
||||
function categoryChange(obj, nextId) {
|
||||
var parentId = $(obj).val();
|
||||
if (parentId) {
|
||||
$.ajax({
|
||||
url: ctx + "goods/category/list",
|
||||
type: "post",
|
||||
data: {parentCategoryId: parentId}, // 直接使用选中的ID作为父类目ID查询
|
||||
success: function(data) {
|
||||
var html = '<option value="">' + (nextId === 'categoryLevel2' ? '所有二级类目' : '所有三级类目') + '</option>';
|
||||
$.each(data, function(i, item) {
|
||||
html += '<option value="' + item.goodsCategoryId + '">' + item.goodsCategoryName + '</option>';
|
||||
});
|
||||
$("#" + nextId).html(html);
|
||||
// 清空下级选项
|
||||
if(nextId === 'categoryLevel2') {
|
||||
$("#categoryLevel3").html('<option value="">所有三级类目</option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#" + nextId).html('<option value="">' + (nextId === 'categoryLevel2' ? '所有二级类目' : '所有三级类目') + '</option>');
|
||||
if(nextId === 'categoryLevel2') {
|
||||
$("#categoryLevel3").html('<option value="">所有三级类目</option>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 修改重置函数,确保重置时清空所有区域选择
|
||||
$.form.reset = function() {
|
||||
var currentForm = document.getElementById("user-form");
|
||||
currentForm.reset();
|
||||
// 手动清空所有区域下拉框
|
||||
$("#provinceId").html('<option value="">所有省份</option>');
|
||||
$("#cityId").html('<option value="">所有城市</option>');
|
||||
$("#districtId").html('<option value="">所有区县</option>');
|
||||
$("#streetId").html('<option value="">所有街道</option>');
|
||||
// 手动清空所有类目下拉框
|
||||
$("#categoryLevel2").html('<option value="">二级类目</option>');
|
||||
$("#categoryLevel3").html('<option value="">三级类目</option>');
|
||||
// 重新加载一级数据
|
||||
loadInitialData();
|
||||
$.table.search();
|
||||
}
|
||||
|
||||
// 添加初始数据加载函数
|
||||
function loadInitialData() {
|
||||
// 加载省份数据
|
||||
$.ajax({
|
||||
url: ctx + "system/area/list",
|
||||
type: "post",
|
||||
data: {levelType: 1},
|
||||
success: function(data) {
|
||||
var html = '<option value="">所有省份</option>';
|
||||
var areaList = data.data || data;
|
||||
$.each(areaList, function(i, item) {
|
||||
html += '<option value="' + item.areaCode + '">' + item.areaName + '</option>';
|
||||
});
|
||||
$("#provinceId").html(html);
|
||||
}
|
||||
});
|
||||
|
||||
// 加载一级类目
|
||||
$.ajax({
|
||||
url: ctx + "goods/category/list",
|
||||
type: "post",
|
||||
data: {parentCategoryId: 1},
|
||||
success: function(data) {
|
||||
var html = '<option value="">所有类目</option>';
|
||||
$.each(data, function(i, item) {
|
||||
html += '<option value="' + item.goodsCategoryId + '">' + item.goodsCategoryName + '</option>';
|
||||
});
|
||||
$("#categoryLevel1").html(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
<!-- 导入区域 -->
|
||||
|
|
@ -216,7 +440,7 @@
|
|||
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
|
||||
</div>
|
||||
<font color="red" class="pull-left mt10">
|
||||
提示:仅允许导入“xls”或“xlsx”格式文件!
|
||||
提示:仅允许导入"xls"或"xlsx"格式文件!
|
||||
</font>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,15 @@
|
|||
<if test="districtId != null">
|
||||
AND wa.district_id = #{districtId}
|
||||
</if>
|
||||
<if test="provinceId != null">
|
||||
AND wa.province_id = #{provinceId}
|
||||
</if>
|
||||
<if test="cityId != null">
|
||||
AND wa.city_id = #{cityId}
|
||||
</if>
|
||||
<if test="streetId != null">
|
||||
AND wa.street_id = #{streetId}
|
||||
</if>
|
||||
<if test="cityIds != null and cityIds.size > 0">
|
||||
AND wa.city_id in
|
||||
<foreach collection="cityIds" item="cityId" open="(" separator="," close=")">
|
||||
|
|
|
|||
Loading…
Reference in New Issue