Commit 0e6830bc by 刘宇峰

特约店、围栏

1 parent f71572ab
...@@ -97,7 +97,7 @@ public class ElectricFenceController { ...@@ -97,7 +97,7 @@ public class ElectricFenceController {
@GetMapping(value = "/change/info") @GetMapping(value = "/change/info")
@ApiOperation(value = "查看修改围栏详情") @ApiOperation(value = "查看修改围栏详情")
public R changeInfo(@RequestParam("fenceId") Long fenceId) { public R changeInfo(@RequestParam("fenceId") Long fenceId) {
ElectricFenceDetailsDTO detailsDTO = electricFenceService.getInfoById(fenceId); ElectricFenceDetailsDTO detailsDTO = electricFenceService.getCopyInfoById(fenceId);
return R.ok().data(detailsDTO); return R.ok().data(detailsDTO);
} }
......
...@@ -3,7 +3,15 @@ package cn.com.glsx.admin.modules.mapper; ...@@ -3,7 +3,15 @@ package cn.com.glsx.admin.modules.mapper;
import cn.com.glsx.admin.modules.entity.ElectricFenceSnsCopy; import cn.com.glsx.admin.modules.entity.ElectricFenceSnsCopy;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper @Mapper
public interface ElectricFenceSnsCopyMapper extends CommonBaseMapper<ElectricFenceSnsCopy> { public interface ElectricFenceSnsCopyMapper extends CommonBaseMapper<ElectricFenceSnsCopy> {
@Select("select * from t_electric_fence_sns_copy where fence_id=#{fenceId} and source=1")
List<ElectricFenceSnsCopy> selectByFenceId(@Param("fenceId") Long fenceId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -87,4 +87,14 @@ public class ElectricFenceDetailsDTO { ...@@ -87,4 +87,14 @@ public class ElectricFenceDetailsDTO {
*/ */
private List<ElectricFenceSnsDTO> snList = new ArrayList<>(); private List<ElectricFenceSnsDTO> snList = new ArrayList<>();
/**
* 特约店id
*/
private Long shopId;
/**
* 特约店名称
*/
private String shopName;
} }
...@@ -19,6 +19,11 @@ public class ElectricFenceBO { ...@@ -19,6 +19,11 @@ public class ElectricFenceBO {
private Long id; private Long id;
/** /**
* 特约店id(特约店账号)
*/
private Long shopId;
/**
* 围栏名称 * 围栏名称
*/ */
@NotBlank(message = "围栏名称不能为空") @NotBlank(message = "围栏名称不能为空")
......
...@@ -21,7 +21,9 @@ import cn.com.glsx.admin.modules.model.param.ElectricFenceBO; ...@@ -21,7 +21,9 @@ import cn.com.glsx.admin.modules.model.param.ElectricFenceBO;
import cn.com.glsx.admin.modules.model.param.ElectricFenceSearch; import cn.com.glsx.admin.modules.model.param.ElectricFenceSearch;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.usercenter.api.dto.response.Organization; import cn.com.glsx.usercenter.api.dto.response.Organization;
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 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;
...@@ -63,6 +65,9 @@ public class ElectricFenceService { ...@@ -63,6 +65,9 @@ public class ElectricFenceService {
private ApprovalService approvalService; private ApprovalService approvalService;
@Autowired @Autowired
private UserService userService;
@Autowired
private OrganizationService organizationService; private OrganizationService organizationService;
@Autowired @Autowired
...@@ -124,7 +129,11 @@ public class ElectricFenceService { ...@@ -124,7 +129,11 @@ public class ElectricFenceService {
fence.setRecord("操作时间:" + DateUtils.formatNormal(new Date()) fence.setRecord("操作时间:" + DateUtils.formatNormal(new Date())
+ " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")" + " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")"
+ "<br/>"); + "<br/>");
if (fenceBO.getShopId() != null) {
fence.setCreatedBy(fenceBO.getShopId());
} else {
fence.setCreatedBy(ShieldContextHolder.getUserId()); fence.setCreatedBy(ShieldContextHolder.getUserId());
}
fence.setCreatedDate(new Date()); fence.setCreatedDate(new Date());
int insertCnt = electricFenceMapper.insertUseGeneratedKeys(fence); int insertCnt = electricFenceMapper.insertUseGeneratedKeys(fence);
...@@ -257,6 +266,45 @@ public class ElectricFenceService { ...@@ -257,6 +266,45 @@ public class ElectricFenceService {
snsList.add(snsDTO); snsList.add(snsDTO);
}); });
detailsDTO.setSnList(snsList); detailsDTO.setSnList(snsList);
R<User> userR = userService.getById(electricFence.getCreatedBy());
User user = userR.getData(User.class);
if (user != null) {
detailsDTO.setShopId(user.getId());
detailsDTO.setShopName(user.getUsername());
} else {
detailsDTO.setShopId(electricFence.getCreatedBy());
}
}
return detailsDTO;
}
public ElectricFenceDetailsDTO getCopyInfoById(Long fenceId) {
ElectricFenceDetailsDTO detailsDTO = null;
ElectricFenceCopy fenceCopy = electricFenceCopyMapper.selectByFenceId(fenceId);
if (fenceCopy != null) {
detailsDTO = new ElectricFenceDetailsDTO();
BeanUtils.copyProperties(fenceCopy, detailsDTO);
List<ElectricFenceSnsDTO> snsList = Lists.newLinkedList();
List<ElectricFenceSnsCopy> fenceSnsList = electricFenceSnsCopyMapper.selectByFenceId(fenceId);
fenceSnsList.forEach(fs -> {
ElectricFenceSnsDTO snsDTO = new ElectricFenceSnsDTO();
BeanUtils.copyProperties(fs, snsDTO);
snsList.add(snsDTO);
});
detailsDTO.setSnList(snsList);
R<User> userR = userService.getById(fenceCopy.getCreatedBy());
User user = userR.getData(User.class);
if (user != null) {
detailsDTO.setShopId(user.getId());
detailsDTO.setShopName(user.getUsername());
} else {
detailsDTO.setShopId(fenceCopy.getCreatedBy());
}
} }
return detailsDTO; return detailsDTO;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!