Commit 6df6e67b by 刘宇峰

特约店、围栏

1 parent 4cb46f93
...@@ -113,7 +113,7 @@ public class TrialDriveShopController { ...@@ -113,7 +113,7 @@ public class TrialDriveShopController {
@GetMapping(value = "/shopusers") @GetMapping(value = "/shopusers")
@ApiOperation(value = "获取特约店层级") @ApiOperation(value = "获取特约店层级")
public R getShopWithUser() { public R getShopWithUser() {
List<SimpleTreeModel> treeModelList = trialDriveShopService.getShopWithUser(); List<SimpleTreeModel> treeModelList = trialDriveShopService.getShopWithUserTree();
return R.ok().data(treeModelList); return R.ok().data(treeModelList);
} }
......
...@@ -21,6 +21,6 @@ public class ElectricFenceDTO { ...@@ -21,6 +21,6 @@ public class ElectricFenceDTO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdDate; private Date createdDate;
@JsonIgnore @JsonIgnore
private Long departmentId; private Long creatorId;
} }
...@@ -42,6 +42,6 @@ public class ElectricFenceExport { ...@@ -42,6 +42,6 @@ public class ElectricFenceExport {
private Date createdDate; private Date createdDate;
@ExcelIgnore @ExcelIgnore
private Long departmentId; private Long creatorId;
} }
...@@ -23,10 +23,7 @@ public class ElectricFenceBO { ...@@ -23,10 +23,7 @@ public class ElectricFenceBO {
*/ */
@NotBlank(message = "围栏名称不能为空") @NotBlank(message = "围栏名称不能为空")
private String fenceName; private String fenceName;
/**
* 围栏编号
*/
private String fenceNo;
/** /**
* 业务围栏类型 0警情围栏,1试驾围栏 * 业务围栏类型 0警情围栏,1试驾围栏
*/ */
......
...@@ -19,7 +19,6 @@ import cn.com.glsx.usercenter.api.dto.response.Organization; ...@@ -19,7 +19,6 @@ import cn.com.glsx.usercenter.api.dto.response.Organization;
import cn.com.glsx.usercenter.api.dto.response.User; import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.feign.OrganizationService; import cn.com.glsx.usercenter.api.feign.OrganizationService;
import cn.com.glsx.usercenter.api.feign.UserService; import cn.com.glsx.usercenter.api.feign.UserService;
import cn.hutool.core.lang.UUID;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -35,6 +34,7 @@ import org.springframework.stereotype.Service; ...@@ -35,6 +34,7 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
...@@ -83,7 +83,6 @@ public class TrialDriveShopService { ...@@ -83,7 +83,6 @@ public class TrialDriveShopService {
public ElectricFence syncAddFence(TrialDriveShopBO shopBO) throws Exception { public ElectricFence syncAddFence(TrialDriveShopBO shopBO) throws Exception {
ElectricFenceBO fenceBO = new ElectricFenceBO(); ElectricFenceBO fenceBO = new ElectricFenceBO();
fenceBO.setFenceName(shopBO.getFenceName()); fenceBO.setFenceName(shopBO.getFenceName());
fenceBO.setFenceNo(UUID.randomUUID().toString());
fenceBO.setBizFenceType(13); fenceBO.setBizFenceType(13);
fenceBO.setShapeType(1); fenceBO.setShapeType(1);
fenceBO.setRadius(shopBO.getRadius()); fenceBO.setRadius(shopBO.getRadius());
...@@ -130,7 +129,6 @@ public class TrialDriveShopService { ...@@ -130,7 +129,6 @@ public class TrialDriveShopService {
ElectricFenceBO fenceBO = new ElectricFenceBO(); ElectricFenceBO fenceBO = new ElectricFenceBO();
fenceBO.setId(shop.getFenceId()); fenceBO.setId(shop.getFenceId());
fenceBO.setFenceName(shopBO.getFenceName()); fenceBO.setFenceName(shopBO.getFenceName());
fenceBO.setFenceNo(UUID.randomUUID().toString());
fenceBO.setBizFenceType(13); fenceBO.setBizFenceType(13);
fenceBO.setShapeType(1); fenceBO.setShapeType(1);
fenceBO.setRadius(shopBO.getRadius()); fenceBO.setRadius(shopBO.getRadius());
...@@ -199,10 +197,22 @@ public class TrialDriveShopService { ...@@ -199,10 +197,22 @@ public class TrialDriveShopService {
electricFenceService.deleteById(shop.getFenceId()); electricFenceService.deleteById(shop.getFenceId());
} }
public List<SimpleTreeModel> getShopWithUser() { public List<Organization> getShopOrgs() {
R<List<Organization>> orgListR = organizationService.getSpecialLevelOrganizations(4); R<List<Organization>> orgListR = organizationService.getSpecialLevelOrganizations(4);
List<Organization> orgList = orgListR.getDataList(new TypeToken<List<Organization>>() { List<Organization> orgList = orgListR.getDataList(new TypeToken<List<Organization>>() {
}.getType()); }.getType());
return orgList;
}
public List<Long> getShopOrgIds() {
List<Organization> orgList = getShopOrgs();
List<Long> orgIds = orgList.stream().map(Organization::getId).collect(Collectors.toList());
return orgIds;
}
public List<SimpleTreeModel> getShopWithUserTree() {
List<Organization> orgList = getShopOrgs();
List<SimpleTreeModel> treeModelList = Lists.newArrayList(); List<SimpleTreeModel> treeModelList = Lists.newArrayList();
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
select select
<include refid="Base_Column_List"/>, <include refid="Base_Column_List"/>,
<include refid="Blob_Column_List"/> <include refid="Blob_Column_List"/>
from t_electric_fence from t_electric_fence_copy
where del_flag = 0 where del_flag = 0
and fence_id = #{fenceId} and fence_id = #{fenceId}
</select> </select>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
ttds.shop_code shopCode, ttds.shop_code shopCode,
ttds.shop_level shopLevel, ttds.shop_level shopLevel,
tef.created_date createdDate, tef.created_date createdDate,
tu.department_id departmentId tef.created_by creatorId
from t_electric_fence tef from t_electric_fence tef
left join t_user tu on tu.id = tef.created_by left join t_user tu on tu.id = tef.created_by
left join t_trial_drive_shop ttds on ttds.shop_code = tu.account left join t_trial_drive_shop ttds on ttds.shop_code = tu.account
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
ttds.shop_code shopCode, ttds.shop_code shopCode,
ttds.shop_level shopLevel, ttds.shop_level shopLevel,
tef.created_date createdDate, tef.created_date createdDate,
tu.department_id departmentId tef.created_by creatorId
from t_electric_fence tef from t_electric_fence tef
left join t_user tu on tu.id = tef.created_by left join t_user tu on tu.id = tef.created_by
left join t_trial_drive_shop ttds on ttds.shop_code = tu.account left join t_trial_drive_shop ttds on ttds.shop_code = tu.account
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</sql> </sql>
<update id="logicDeleteByFenceId"> <update id="logicDeleteByFenceId">
update t_electric_fence update t_electric_fence_sns
set del_flag = -1 set del_flag = -1
where fence_id = #{fenceId} where fence_id = #{fenceId}
</update> </update>
......
...@@ -4,12 +4,11 @@ import cn.com.glsx.Application; ...@@ -4,12 +4,11 @@ import cn.com.glsx.Application;
import cn.com.glsx.admin.modules.model.ElectricFenceSnsModel; import cn.com.glsx.admin.modules.model.ElectricFenceSnsModel;
import cn.com.glsx.admin.modules.model.param.ElectricFenceBO; import cn.com.glsx.admin.modules.model.param.ElectricFenceBO;
import cn.com.glsx.admin.modules.service.ElectricFenceService; import cn.com.glsx.admin.modules.service.ElectricFenceService;
import cn.com.glsx.auth.model.Department;
import cn.com.glsx.auth.model.SyntheticUser; import cn.com.glsx.auth.model.SyntheticUser;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.usercenter.api.dto.request.FindUserRequest; import cn.com.glsx.usercenter.api.dto.request.FindUserRequest;
import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.feign.UserService; import cn.com.glsx.usercenter.api.feign.UserService;
import cn.hutool.core.lang.UUID;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -43,10 +42,14 @@ public class AdminApplicationTests { ...@@ -43,10 +42,14 @@ public class AdminApplicationTests {
System.out.println("@Before - runBeforeTestMethod"); System.out.println("@Before - runBeforeTestMethod");
SyntheticUser user = new SyntheticUser(); SyntheticUser user = new SyntheticUser();
user.setUserId(2L); user.setUserId(6427L);
user.setAdmin(false); user.setIsAdmin(false);
user.setAccount("payxz"); user.setAccount("payxz");
ShieldContextHolder.setUser(user); ShieldContextHolder.setUser(user);
Department department = new Department();
department.setDeptId(182L);
user.setDepartment(department);
} }
// Should rename to @AfterTestMethod // Should rename to @AfterTestMethod
...@@ -58,8 +61,7 @@ public class AdminApplicationTests { ...@@ -58,8 +61,7 @@ public class AdminApplicationTests {
@Test @Test
public void testAddFence() throws Exception { public void testAddFence() throws Exception {
ElectricFenceBO fenceBO = new ElectricFenceBO(); ElectricFenceBO fenceBO = new ElectricFenceBO();
fenceBO.setFenceName("测试围栏3"); fenceBO.setFenceName("特约店围栏1");
fenceBO.setFenceNo(UUID.randomUUID().toString());
fenceBO.setBizFenceType(1); fenceBO.setBizFenceType(1);
fenceBO.setShapeType(1); fenceBO.setShapeType(1);
fenceBO.setRadius(3000); fenceBO.setRadius(3000);
...@@ -90,9 +92,8 @@ public class AdminApplicationTests { ...@@ -90,9 +92,8 @@ public class AdminApplicationTests {
@Test @Test
public void testUpdateFence() throws Exception { public void testUpdateFence() throws Exception {
ElectricFenceBO fenceBO = new ElectricFenceBO(); ElectricFenceBO fenceBO = new ElectricFenceBO();
fenceBO.setId(1L); fenceBO.setId(1024L);
fenceBO.setFenceName("测试围栏-1"); fenceBO.setFenceName("特约店围栏1-修改测试");
fenceBO.setFenceNo(UUID.randomUUID().toString());
fenceBO.setBizFenceType(1); fenceBO.setBizFenceType(1);
fenceBO.setShapeType(1); fenceBO.setShapeType(1);
fenceBO.setRadius(1000); fenceBO.setRadius(1000);
......
...@@ -31,7 +31,7 @@ public class VehicleTest { ...@@ -31,7 +31,7 @@ public class VehicleTest {
System.out.println("@Before - runBeforeTestMethod"); System.out.println("@Before - runBeforeTestMethod");
SyntheticUser user = new SyntheticUser(); SyntheticUser user = new SyntheticUser();
user.setUserId(2L); user.setUserId(2L);
user.setAdmin(false); user.setIsAdmin(false);
user.setAccount("huangxc"); user.setAccount("huangxc");
ShieldContextHolder.setUser(user); ShieldContextHolder.setUser(user);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!