Commit c53a0c46 by XiaHou

万科接口修复

parent ee58df50
...@@ -5,6 +5,7 @@ import com.macro.mall.common.api.CommonResult; ...@@ -5,6 +5,7 @@ import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.VankeDepartment; import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeStockRoom; import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeStockRoomDto;
import com.macro.mall.service.vanke.IVankeStockRoomService; import com.macro.mall.service.vanke.IVankeStockRoomService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,9 +28,10 @@ public class VankeStockRoomController { ...@@ -27,9 +28,10 @@ public class VankeStockRoomController {
@ApiOperation("万科后台_库房分页操作") @ApiOperation("万科后台_库房分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public CommonResult<CommonPage<VankeStockRoom>> list(@ApiParam(value="分页大小 不传则不分页") @RequestParam(value = "pageSize", required = false) Integer pageSize, public CommonResult list(@ApiParam(value="分页大小 不传则不分页") @RequestParam(value = "pageSize", required = false) Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", required = false) Integer pageNum) { @ApiParam(value="分页页数") @RequestParam(value = "pageNum", required = false) Integer pageNum,
return CommonResult.success(CommonPage.restPage(this.vankeStockRoomService.getPageList(pageNum, pageSize))); @ApiParam(value="启用状态 1启用 0禁用") @RequestParam(value = "status", required = false) Integer status) {
return CommonResult.success(this.vankeStockRoomService.getPageList(pageNum, pageSize,status));
} }
@ApiOperation("万科后台_库房插入操作") @ApiOperation("万科后台_库房插入操作")
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.macro.mall.mapper" <javaClientGenerator type="XMLMAPPER" targetPackage="com.macro.mall.mapper"
targetProject="mall-mbg/src/main/java"/> targetProject="mall-mbg/src/main/java"/>
<!--生成全部表tableName设为%--> <!--生成全部表tableName设为%-->
<table tableName="vanke_outbound_order"> <table tableName="vanke_goods">
<generatedKey column="id" sqlStatement="MySql" identity="true"/> <generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table> </table>
......
...@@ -41,4 +41,11 @@ public interface UmsAdminDao { ...@@ -41,4 +41,11 @@ public interface UmsAdminDao {
* @return * @return
*/ */
UmsAdmin selectByMemberId(Long memberId); UmsAdmin selectByMemberId(Long memberId);
/**
* 根据其他参数查询多条数据
* @param adminManageParam
* @return
*/
List<AdminManageParam> selectListByOther(AdminManageParam adminManageParam);
} }
package com.macro.mall.dao.vanke;
import com.macro.mall.model.dto.vanke.VankeStockRoomDto;
import java.util.List;
public interface VankeStockRoomDao {
/**
* 根据其他查询多条数据
* @param vankeStockRoomDto
* @return
*/
List<VankeStockRoomDto> selectByOther(VankeStockRoomDto vankeStockRoomDto);
}
...@@ -25,7 +25,8 @@ public class AdminManageParam extends UmsAdmin { ...@@ -25,7 +25,8 @@ public class AdminManageParam extends UmsAdmin {
private String departName; private String departName;
@ApiModelProperty("库房名称") @ApiModelProperty("库房名称")
private String stockRoomName; private String stockRoomName;
@ApiModelProperty("c端会员昵称")
private String memberName;
private List<String> roles; private List<String> roles;
private List<UmsMenu> menus; private List<UmsMenu> menus;
......
...@@ -709,6 +709,11 @@ public class UmsAdminServiceImpl implements UmsAdminService { ...@@ -709,6 +709,11 @@ public class UmsAdminServiceImpl implements UmsAdminService {
UmsMember umsMember = new UmsMember(); UmsMember umsMember = new UmsMember();
UmsAdmin ua =this.adminDao.selectByMemberId(umsAdminDto.getMemberId()); UmsAdmin ua =this.adminDao.selectByMemberId(umsAdminDto.getMemberId());
if( ua == null ){ //如果为空 则为新增操作 if( ua == null ){ //如果为空 则为新增操作
//插入前先判断是否已经有了
AdminManageParam AdminManageParam = this.adminDao.selectByUserName(umsAdminDto.getUsername());
if(AdminManageParam != null){
return new ResultMsg(false,"已存在此账号!");
}
//插入到ums_admin 这张表内 //插入到ums_admin 这张表内
UmsAdmin umsAdmin = new UmsAdmin(); UmsAdmin umsAdmin = new UmsAdmin();
umsAdmin.setCreateTime(new Date()); umsAdmin.setCreateTime(new Date());
......
package com.macro.mall.service.vanke; package com.macro.mall.service.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.model.VankeStockRoom; import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeStockRoomDto;
import java.util.List; import java.util.List;
...@@ -27,6 +29,6 @@ public interface IVankeStockRoomService { ...@@ -27,6 +29,6 @@ public interface IVankeStockRoomService {
* @param pageSize * @param pageSize
* @return * @return
*/ */
List<VankeStockRoom> getPageList(Integer pageNum,Integer pageSize); CommonPage<VankeStockRoomDto> getPageList(Integer pageNum, Integer pageSize, Integer status);
} }
...@@ -114,6 +114,10 @@ public class VankeGoodsServiceImpl implements IVankeGoodsService { ...@@ -114,6 +114,10 @@ public class VankeGoodsServiceImpl implements IVankeGoodsService {
+"改为:"+vankeGoods.getGoodsNum()); +"改为:"+vankeGoods.getGoodsNum());
} }
if(vankeGoods.getName() != null && !vankeGoods.getName().isEmpty()){ //如果名字不为空 if(vankeGoods.getName() != null && !vankeGoods.getName().isEmpty()){ //如果名字不为空
//不能修改一样的名称
if(vg.getName().equals(vankeGoods.getName())){
return new ResultMsg(false,"已存在此物品名称!!");
}
//插入日志表 //插入日志表
this.vankeBackLogService.insertVankeBackLog("将物品名称为:" + vg.getName()+"改为:"+vankeGoods.getName()); this.vankeBackLogService.insertVankeBackLog("将物品名称为:" + vg.getName()+"改为:"+vankeGoods.getName());
} }
......
package com.macro.mall.service.vanke.impl; package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.macro.mall.common.utils.HttpsUtil; import com.github.pagehelper.PageInfo;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.dao.UmsAdminDao;
import com.macro.mall.dao.vanke.VankeStockRoomDao;
import com.macro.mall.domain.dto.AdminManageParam;
import com.macro.mall.mapper.UmsAdminMapper;
import com.macro.mall.mapper.VankeStockRoomMapper; import com.macro.mall.mapper.VankeStockRoomMapper;
import com.macro.mall.model.UmsAdmin; import com.macro.mall.model.*;
import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.VankeStockRoomExample;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeStockRoomDto;
import com.macro.mall.service.system.UmsAdminService; import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService; import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeStockRoomService; import com.macro.mall.service.vanke.IVankeStockRoomService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/** /**
* 库房业务 * 库房业务
...@@ -37,8 +34,10 @@ public class VankeStockRoomServiceImpl implements IVankeStockRoomService { ...@@ -37,8 +34,10 @@ public class VankeStockRoomServiceImpl implements IVankeStockRoomService {
private UmsAdminService umsAdminService; private UmsAdminService umsAdminService;
@Autowired @Autowired
private IVankeBackLogService vankeBackLogService; private IVankeBackLogService vankeBackLogService;
@Resource
private VankeStockRoomDao vankeStockRoomDao;
@Resource
private UmsAdminDao umsAdminDao;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -84,14 +83,37 @@ public class VankeStockRoomServiceImpl implements IVankeStockRoomService { ...@@ -84,14 +83,37 @@ public class VankeStockRoomServiceImpl implements IVankeStockRoomService {
} }
@Override @Override
public List<VankeStockRoom> getPageList(Integer pageNum, Integer pageSize) { public CommonPage<VankeStockRoomDto> getPageList(Integer pageNum, Integer pageSize, Integer status) {
if(pageNum != null && pageSize != null){ if(pageNum != null && pageSize != null){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
} }
VankeStockRoomExample example = new VankeStockRoomExample(); VankeStockRoomDto vankeStockRoomDto = new VankeStockRoomDto();
VankeStockRoomExample.Criteria criteria = example.createCriteria(); vankeStockRoomDto.setStatus(status);
criteria.andDeleteStatusEqualTo(1);//1未删除 0已删除 List<VankeStockRoomDto> vsrList = this.vankeStockRoomDao.selectByOther(vankeStockRoomDto);
return this.vankeStockRoomMapper.selectByExample(example); //记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<VankeStockRoomDto> pageInfo = new PageInfo<>(vsrList);
AdminManageParam adminManageParam = new AdminManageParam();
vsrList.forEach(vsr ->{
adminManageParam.setStockRoomId(vsr.getId());
List<AdminManageParam> ampList = this.umsAdminDao.selectListByOther(adminManageParam);
String adminNames = "";
for (AdminManageParam amp : ampList){
if(adminNames.equals("")){
adminNames = amp.getMemberName();
}else {
adminNames = adminNames+"/"+amp.getMemberName();
}
}
vsr.setAdminName(adminNames);
});
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<VankeStockRoomDto> result = new CommonPage<VankeStockRoomDto>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(vsrList);
return result;
} }
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="resultMap" type="com.macro.mall.domain.dto.AdminManageParam" extends="com.macro.mall.mapper.UmsAdminMapper.BaseResultMap"> <resultMap id="resultMap" type="com.macro.mall.domain.dto.AdminManageParam" extends="com.macro.mall.mapper.UmsAdminMapper.BaseResultMap">
<result column="departName" jdbcType="VARCHAR" property="departName" /> <result column="departName" jdbcType="VARCHAR" property="departName" />
<result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" /> <result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" />
<result column="memberName" jdbcType="VARCHAR" property="memberName" />
</resultMap> </resultMap>
<select id="getListByUmsAdmin" parameterType="com.macro.mall.domain.dto.UmsAdminQueryParam" resultMap="resultMap"> <select id="getListByUmsAdmin" parameterType="com.macro.mall.domain.dto.UmsAdminQueryParam" resultMap="resultMap">
select a.*,r.name as roleName ,r.id as roleId ,d.depart_name as departName select a.*,r.name as roleName ,r.id as roleId ,d.depart_name as departName
...@@ -76,4 +77,13 @@ ...@@ -76,4 +77,13 @@
select * from ums_admin select * from ums_admin
where member_id = #{memberId} where member_id = #{memberId}
</select> </select>
<select id="selectListByOther" parameterType="com.macro.mall.domain.dto.AdminManageParam" resultMap="resultMap">
select a.*,b.name memberName from ums_admin a
left join ums_member b ON a.member_id = b.id
where a.delete_status = 0
<if test="stockRoomId != null">
and a.stock_room_id = #{stockRoomId}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.dao.vanke.VankeStockRoomDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.dto.vanke.VankeStockRoomDto" extends="com.macro.mall.mapper.VankeStockRoomMapper.BaseResultMap">
</resultMap>
<select id="selectByOther" parameterType="com.macro.mall.model.dto.vanke.VankeStockRoomDto" resultMap="BaseResultMap">
select * from vanke_stock_room
where delete_status = 1
<if test="status != null">
and status = #{status}
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment