Commit fcd2ec35 by XiaHou

万科接口修复

parent 4e690c31
package com.macro.mall.controller; package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeSupplier;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.UmsAdminDto;
import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.system.UmsAdminService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
@Controller @Controller
@Api(tags = "万科后台_用户列表", description = "用户列表控制器") @Api(tags = "万科后台_用户列表管理员相关接口", description = "用户列表控制器")
@RequestMapping("/admin") @RequestMapping("/umsMember")
public class UmsMemberController { public class UmsMemberController {
@Autowired
private UmsMemberService umsMemberService;
@Autowired
private UmsAdminService umsAdminService;
@ApiOperation("万科后台_用户分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsMemberDto>> list(@ApiParam(value="分页大小 不传则不分页操作") @RequestParam(value = "pageSize", required = false) Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", required = false) Integer pageNum,
@ApiParam(value="会员名称") @RequestParam(value = "name", required = false) String name,
@ApiParam(value="部门Id") @RequestParam(value = "departId", required = false) Long departId) {
UmsMemberDto umsMemberDto = new UmsMemberDto();
umsMemberDto.setName(name);
umsMemberDto.setDepartId(departId);
return CommonResult.success(CommonPage.restPage(this.umsMemberService.getUmsMemberPageList(pageNum, pageSize,umsMemberDto)));
}
@ApiOperation("万科后台_设置为普通管理员")
@RequestMapping(value = "/setUpAdmin", method = RequestMethod.POST)
@ResponseBody
public CommonResult setUpAdmin(@ApiParam(value="接收对象") @RequestBody UmsAdminDto umsAdminDto){
ResultMsg res = this.umsAdminService.setUpAdmin(umsAdminDto);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("万科后台_解除普通管理员")
@RequestMapping(value = "/cancleAdmin", method = RequestMethod.POST)
@ResponseBody
public CommonResult cancleAdmin(@ApiParam(value="接收对象") @RequestBody UmsAdmin umsAdmin){
ResultMsg res = this.umsAdminService.cancleAdmin(umsAdmin);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
} }
package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.domain.dto.vanke.VankeBackLogDto;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.UmsAdminDto;
import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@Api(tags = "万科后台_操作日志相关接口", description = "操作日志控制器")
@RequestMapping("/vankeBackLog")
public class VankeBackLogController {
@Autowired
private IVankeBackLogService vankeBackLogService;
@ApiOperation("万科后台_操作日志分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<VankeBackLogDto>> list(@ApiParam(value="分页大小 不传则不分页操作") @RequestParam(value = "pageSize", required = false) Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", required = false) Integer pageNum,
@ApiParam(value="会员名称") @RequestParam(value = "name", required = false) String name) {
return CommonResult.success(CommonPage.restPage(this.vankeBackLogService.getPageList(pageNum, pageSize,name)));
}
}
package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.domain.dto.vanke.VankeBackLogDto;
import com.macro.mall.model.VankeConfig;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.UmsAdminDto;
import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@Api(tags = "万科后台_配置管理相关接口", description = "配置管理控制器")
@RequestMapping("/vankeConfig")
public class VankeConfigController {
@Autowired
private IVankeConfigService vankeConfigService;
@ApiOperation("万科后台_得到一条系统配置信息")
@RequestMapping(value = "/getOne", method = RequestMethod.GET)
@ResponseBody
public CommonResult<VankeConfig> getOne(){
return CommonResult.success(this.vankeConfigService.getConfig());
}
@ApiOperation("万科后台_修改配置信息")
@RequestMapping(value = "/insertAndUpdateConfig", method = RequestMethod.POST)
@ResponseBody
public CommonResult insertAndUpdateConfig(@ApiParam(value="接收对象") @RequestBody VankeConfig vankeConfig){
ResultMsg res = this.vankeConfigService.insertAndUpdateConfig(vankeConfig);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
...@@ -31,10 +31,11 @@ public class VankeOutboundRecordController { ...@@ -31,10 +31,11 @@ public class VankeOutboundRecordController {
public CommonResult<CommonPage<VankeOutboundRecordDto>> list(@ApiParam(value="分页大小") @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, public CommonResult<CommonPage<VankeOutboundRecordDto>> list(@ApiParam(value="分页大小") @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @ApiParam(value="分页页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@ApiParam(value="物品分类id") @RequestParam(value = "goodsCategoryId") Long goodsCategoryId, @ApiParam(value="物品分类id") @RequestParam(value = "goodsCategoryId") Long goodsCategoryId,
@ApiParam(value="部门id") @RequestParam(value = "stockRoomId") Long departId, @ApiParam(value="部门id") @RequestParam(value = "departId") Long departId,
@ApiParam(value="部门id") @RequestParam(value = "stockRoomId") Long stockRoomId,
@ApiParam(value="会员昵称") @RequestParam(value = "memberName") String memberName, @ApiParam(value="会员昵称") @RequestParam(value = "memberName") String memberName,
@ApiParam(value="物品名称") @RequestParam(value = "goodsMame") String goodsName @ApiParam(value="物品名称") @RequestParam(value = "goodsMame") String goodsName
){ ){
return CommonResult.success(CommonPage.restPage(this.vankeOutboundRecordService.getPageList(pageNum,pageSize,goodsCategoryId,departId,memberName,goodsName))); return CommonResult.success(CommonPage.restPage(this.vankeOutboundRecordService.getPageList(pageNum,pageSize,goodsCategoryId,departId,stockRoomId ,memberName,goodsName)));
} }
} }
...@@ -2,7 +2,7 @@ package com.macro.mall.controller.vanke; ...@@ -2,7 +2,7 @@ package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonResult; import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeGoodsRequestParam; import com.macro.mall.model.dto.vanke.*;
import com.macro.mall.service.vanke.IVankeGoodsStockService; import com.macro.mall.service.vanke.IVankeGoodsStockService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -22,18 +22,51 @@ public class VankeStatisticalChartController { ...@@ -22,18 +22,51 @@ public class VankeStatisticalChartController {
private IVankeGoodsStockService vankeGoodsStockService; private IVankeGoodsStockService vankeGoodsStockService;
@ApiOperation("万科后台_根据物品id 以及时间list 查询这个时间段内每天的库存信息") @ApiOperation("万科后台_根据物品id 以及时间list 查询这个时间段内每天的库存信息")
@RequestMapping(value = "/OutVankeGoodsStockChange", method = RequestMethod.GET) @RequestMapping(value = "/OutVankeGoodsStockChange", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public CommonResult selectGoodsStock(@ApiParam(value="查询时间集合 时间格式例如:dateList:[2020-06-24,2020-06-25,...]") @RequestParam(name = "dateList") List<String> dateList, public CommonResult selectGoodsStock(@ApiParam(value="接受封装对象") @RequestBody VankeStatisticalRequestParam vankeStatisticalRequestParam){
@ApiParam(value="物品id") @RequestParam(name = "goodsId") Long goodsId){ return CommonResult.success(this.vankeGoodsStockService.selectStockByGoodsIdAndTime(vankeStatisticalRequestParam.getDateList(),vankeStatisticalRequestParam.getGoodsId()));
return CommonResult.success(this.vankeGoodsStockService.selectStockByGoodsIdAndTime(dateList,goodsId));
} }
@ApiOperation("万科后台_根据物品id 以及时间list 查询这个时间段内每天的领用情况") @ApiOperation("万科后台_根据物品id 以及时间list 查询这个时间段内每天的领用情况")
@RequestMapping(value = "/selectGoodsCollection", method = RequestMethod.GET) @RequestMapping(value = "/selectGoodsCollection", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public CommonResult selectGoodsCollection(@ApiParam(value="查询时间集合 时间格式例如:dateList:[2020-06-24,2020-06-25,...]") @RequestParam(name = "dateList") List<String> dateList, public CommonResult selectGoodsCollection(@ApiParam(value="接受封装对象") @RequestBody VankeStatisticalRequestParam vankeStatisticalRequestParam){
@ApiParam(value="物品id") @RequestParam(name = "goodsId") Long goodsId){ return CommonResult.success(this.vankeGoodsStockService.selectGoodsCollection(vankeStatisticalRequestParam.getDateList(),vankeStatisticalRequestParam.getGoodsId()));
return CommonResult.success(this.vankeGoodsStockService.selectGoodsCollection(dateList,goodsId)); }
@ApiOperation("万科后台_获取首页领取物品类别分布")
@RequestMapping(value = "/selectOutBoundByCategory", method = RequestMethod.POST)
@ResponseBody
public CommonResult<List<VankeOutboundRecordDto>> selectOutBoundByCategory(@ApiParam(value="接受封装对象") @RequestBody StatiscalQueryParam statiscalQueryParam){
return CommonResult.success(this.vankeGoodsStockService.selectOutBoundByCategory(statiscalQueryParam));
}
@ApiOperation("万科后台_获取首页申领人部门分布")
@RequestMapping(value = "/selectOutBoundByDepartId", method = RequestMethod.POST)
@ResponseBody
public CommonResult<List<VankeOutboundRecordDto>> selectOutBoundByDepartId(@ApiParam(value="接受封装对象") @RequestBody StatiscalQueryParam statiscalQueryParam){
return CommonResult.success(this.vankeGoodsStockService.selectOutBoundByDepartId(statiscalQueryParam));
}
@ApiOperation("万科后台_获取首页入库物品类别分布")
@RequestMapping(value = "/selectInBoundByCategory", method = RequestMethod.POST)
@ResponseBody
public CommonResult<List<VankeInboundRecordDto>> selectInBoundByCategory(@ApiParam(value="接受封装对象") @RequestBody StatiscalQueryParam statiscalQueryParam){
return CommonResult.success(this.vankeGoodsStockService.selectInBoundByCategory(statiscalQueryParam));
}
@ApiOperation("万科后台_获取首页统计今日数据")
@RequestMapping(value = "/getHomeData", method = RequestMethod.POST)
@ResponseBody
public CommonResult getHomeData(@ApiParam(value="传入今日查询时间 eg:2020-06-29") @RequestParam(value = "queryTime") String queryTime){
return CommonResult.success(this.vankeGoodsStockService.getHomeData(queryTime));
}
@ApiOperation("万科后台_获取首页统计出库值和入库值的变化曲线图")
@RequestMapping(value = "/selectStockByGoodsIdAndTime", method = RequestMethod.POST)
@ResponseBody
public CommonResult selectStockByGoodsIdAndTime(@ApiParam(value="接受封装对象") @RequestBody StatiscalQueryParam statiscalQueryParam){
return CommonResult.success(this.vankeGoodsStockService.selectStockByGoodsIdAndTime(statiscalQueryParam.getDateList()));
} }
} }
package com.macro.mall.common.utils;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import java.util.*;
public class MyJsonUtil {
/**
* 传入json对象 得到map
* @param data
* @return
* @throws Exception
*/
public static Map<String, Object> getMapChangeJson(String data)throws Exception {
JSONObject obj = new JSONObject(data);
Stack<JSONObject> stObj = new Stack<JSONObject>();
stObj.push(obj);
Map<String, Object> resultMap =new HashMap<>();
JsonToMap(stObj,resultMap);
return resultMap;
}
private static void JsonToMap(Stack<JSONObject> stObj, Map<String, Object> resultMap) throws Exception {
if(stObj == null && stObj.pop() == null){
return ;
}
JSONObject json = stObj.pop();
Iterator it = json.keys();
while(it.hasNext()){
String key = (String) it.next();
//得到value的值
Object value = json.get(key);
//System.out.println(value);
if(value instanceof JSONObject)
{
stObj.push((JSONObject)value);
//递归遍历
JsonToMap(stObj,resultMap);
}
else {
resultMap.put(key, value);
}
}
}
}
...@@ -12,7 +12,7 @@ public class UmsAdmin implements Serializable { ...@@ -12,7 +12,7 @@ public class UmsAdmin implements Serializable {
@GeneratedValue(strategy= GenerationType.IDENTITY) @GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id; private Long id;
@ApiModelProperty(value = "账户类型 1管理员 2其他用户") @ApiModelProperty(value = "账户类型 1超级管理员 2普通管理员")
private Integer type; private Integer type;
private String username; private String username;
......
...@@ -124,7 +124,7 @@ public class UmsMember implements Serializable { ...@@ -124,7 +124,7 @@ public class UmsMember implements Serializable {
@ApiModelProperty(value = "分销层级") @ApiModelProperty(value = "分销层级")
private Integer distributionLevel; private Integer distributionLevel;
@ApiModelProperty(value = "账户类型(0管理员1供应商2分销商)") @ApiModelProperty(value = "账户类型(0管理员1普通用户)")
private Integer accouuntType; private Integer accouuntType;
@ApiModelProperty(value = "最后登录时间") @ApiModelProperty(value = "最后登录时间")
...@@ -143,6 +143,9 @@ public class UmsMember implements Serializable { ...@@ -143,6 +143,9 @@ public class UmsMember implements Serializable {
@ApiModelProperty(value = "部门id") @ApiModelProperty(value = "部门id")
private Long departId; private Long departId;
@ApiModelProperty(value = "库房id")
private Long stockRoomId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Long getId() { public Long getId() {
...@@ -489,6 +492,14 @@ public class UmsMember implements Serializable { ...@@ -489,6 +492,14 @@ public class UmsMember implements Serializable {
this.departId = departId; this.departId = departId;
} }
public Long getStockRoomId() {
return stockRoomId;
}
public void setStockRoomId(Long stockRoomId) {
this.stockRoomId = stockRoomId;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -538,6 +549,7 @@ public class UmsMember implements Serializable { ...@@ -538,6 +549,7 @@ public class UmsMember implements Serializable {
sb.append(", payType=").append(payType); sb.append(", payType=").append(payType);
sb.append(", jobNo=").append(jobNo); sb.append(", jobNo=").append(jobNo);
sb.append(", departId=").append(departId); sb.append(", departId=").append(departId);
sb.append(", stockRoomId=").append(stockRoomId);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
......
...@@ -2901,6 +2901,66 @@ public class UmsMemberExample { ...@@ -2901,6 +2901,66 @@ public class UmsMemberExample {
addCriterion("depart_id not between", value1, value2, "departId"); addCriterion("depart_id not between", value1, value2, "departId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStockRoomIdIsNull() {
addCriterion("stock_room_id is null");
return (Criteria) this;
}
public Criteria andStockRoomIdIsNotNull() {
addCriterion("stock_room_id is not null");
return (Criteria) this;
}
public Criteria andStockRoomIdEqualTo(Long value) {
addCriterion("stock_room_id =", value, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdNotEqualTo(Long value) {
addCriterion("stock_room_id <>", value, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdGreaterThan(Long value) {
addCriterion("stock_room_id >", value, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdGreaterThanOrEqualTo(Long value) {
addCriterion("stock_room_id >=", value, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdLessThan(Long value) {
addCriterion("stock_room_id <", value, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdLessThanOrEqualTo(Long value) {
addCriterion("stock_room_id <=", value, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdIn(List<Long> values) {
addCriterion("stock_room_id in", values, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdNotIn(List<Long> values) {
addCriterion("stock_room_id not in", values, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdBetween(Long value1, Long value2) {
addCriterion("stock_room_id between", value1, value2, "stockRoomId");
return (Criteria) this;
}
public Criteria andStockRoomIdNotBetween(Long value1, Long value2) {
addCriterion("stock_room_id not between", value1, value2, "stockRoomId");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
package com.macro.mall.model.dto; package com.macro.mall.model.dto;
import com.macro.mall.model.UmsAdmin; import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsMenu; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class UmsAdminDto extends UmsAdmin { public class UmsAdminDto extends UmsAdmin {
@ApiModelProperty(value="角色id")
private Long roleId;
} }
...@@ -12,4 +12,8 @@ public class UmsMemberDto extends UmsMember implements Serializable { ...@@ -12,4 +12,8 @@ public class UmsMemberDto extends UmsMember implements Serializable {
@ApiModelProperty(value = "会员相关审核信息对象") @ApiModelProperty(value = "会员相关审核信息对象")
private PmsSupplierAudit pmsSupplierAudit; private PmsSupplierAudit pmsSupplierAudit;
@ApiModelProperty(value="部门名称")
private String departName;
@ApiModelProperty(value="库房名称")
private String stockRoomName;
} }
package com.macro.mall.model.dto.vanke;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class StatiscalQueryParam implements Serializable {
@ApiModelProperty(value = "查询时间")
private String queryTime;
@ApiModelProperty(value = "会员id")
private Long memberId;
@ApiModelProperty(value = "库房id")
private Long stockRoomId;
@ApiModelProperty(value = "商品最低数量")
private Integer goodsNum;
@ApiModelProperty(value = "起始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "时间集合")
private List<String> dateList;
}
...@@ -15,5 +15,8 @@ public class VankeInboundRecordDto extends VankeInboundRecord { ...@@ -15,5 +15,8 @@ public class VankeInboundRecordDto extends VankeInboundRecord {
private String backInboundName; private String backInboundName;
@ApiModelProperty("物品名称") @ApiModelProperty("物品名称")
private String goodsName; private String goodsName;
@ApiModelProperty("分类名称")
private String categoryName;
@ApiModelProperty(value = "总数")
private Integer totalNum;
} }
...@@ -19,5 +19,8 @@ public class VankeOutboundRecordDto extends VankeOutboundRecord { ...@@ -19,5 +19,8 @@ public class VankeOutboundRecordDto extends VankeOutboundRecord {
private String memberName; private String memberName;
@ApiModelProperty("会员所属部门") @ApiModelProperty("会员所属部门")
private String departmentName; private String departmentName;
@ApiModelProperty(value = "物品分类名称")
private String categoryName;
@ApiModelProperty(value = "总数")
private Integer totalNum;
} }
package com.macro.mall.model.dto.vanke;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class VankeStatisticalRequestParam {
@ApiModelProperty("查询时间集合 时间格式例如:dateList:[2020-06-24,2020-06-25,...]")
private List<String> dateList;
@ApiModelProperty("物品id")
private Long goodsId;
}
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<result column="pay_type" jdbcType="INTEGER" property="payType" /> <result column="pay_type" jdbcType="INTEGER" property="payType" />
<result column="job_no" jdbcType="VARCHAR" property="jobNo" /> <result column="job_no" jdbcType="VARCHAR" property="jobNo" />
<result column="depart_id" jdbcType="BIGINT" property="departId" /> <result column="depart_id" jdbcType="BIGINT" property="departId" />
<result column="stock_room_id" jdbcType="BIGINT" property="stockRoomId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
history_integration, email, identity_number, identity_photo_a, identity_photo_b, history_integration, email, identity_number, identity_photo_a, identity_photo_b,
identity_review_opinion, identity_review_status, identity_review_time, invitation_code, identity_review_opinion, identity_review_status, identity_review_time, invitation_code,
invitation_code_id, union_id, label, distribution_level, accouunt_type, login_time, invitation_code_id, union_id, label, distribution_level, accouunt_type, login_time,
cycle_type, pay_type, job_no, depart_id cycle_type, pay_type, job_no, depart_id, stock_room_id
</sql> </sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsMemberExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.macro.mall.model.UmsMemberExample" resultMap="BaseResultMap">
select select
...@@ -161,7 +162,8 @@ ...@@ -161,7 +162,8 @@
invitation_code, invitation_code_id, union_id, invitation_code, invitation_code_id, union_id,
label, distribution_level, accouunt_type, label, distribution_level, accouunt_type,
login_time, cycle_type, pay_type, login_time, cycle_type, pay_type,
job_no, depart_id) job_no, depart_id, stock_room_id
)
values (#{memberLevelId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, values (#{memberLevelId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{nickname,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{icon,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, #{birthday,jdbcType=DATE}, #{icon,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, #{birthday,jdbcType=DATE},
...@@ -176,7 +178,8 @@ ...@@ -176,7 +178,8 @@
#{invitationCode,jdbcType=VARCHAR}, #{invitationCodeId,jdbcType=BIGINT}, #{unionId,jdbcType=VARCHAR}, #{invitationCode,jdbcType=VARCHAR}, #{invitationCodeId,jdbcType=BIGINT}, #{unionId,jdbcType=VARCHAR},
#{label,jdbcType=VARCHAR}, #{distributionLevel,jdbcType=INTEGER}, #{accouuntType,jdbcType=INTEGER}, #{label,jdbcType=VARCHAR}, #{distributionLevel,jdbcType=INTEGER}, #{accouuntType,jdbcType=INTEGER},
#{loginTime,jdbcType=TIMESTAMP}, #{cycleType,jdbcType=INTEGER}, #{payType,jdbcType=INTEGER}, #{loginTime,jdbcType=TIMESTAMP}, #{cycleType,jdbcType=INTEGER}, #{payType,jdbcType=INTEGER},
#{jobNo,jdbcType=VARCHAR}, #{departId,jdbcType=BIGINT}) #{jobNo,jdbcType=VARCHAR}, #{departId,jdbcType=BIGINT}, #{stockRoomId,jdbcType=BIGINT}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsMember"> <insert id="insertSelective" parameterType="com.macro.mall.model.UmsMember">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -310,6 +313,9 @@ ...@@ -310,6 +313,9 @@
<if test="departId != null"> <if test="departId != null">
depart_id, depart_id,
</if> </if>
<if test="stockRoomId != null">
stock_room_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="memberLevelId != null"> <if test="memberLevelId != null">
...@@ -438,6 +444,9 @@ ...@@ -438,6 +444,9 @@
<if test="departId != null"> <if test="departId != null">
#{departId,jdbcType=BIGINT}, #{departId,jdbcType=BIGINT},
</if> </if>
<if test="stockRoomId != null">
#{stockRoomId,jdbcType=BIGINT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsMemberExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.macro.mall.model.UmsMemberExample" resultType="java.lang.Long">
...@@ -578,6 +587,9 @@ ...@@ -578,6 +587,9 @@
<if test="record.departId != null"> <if test="record.departId != null">
depart_id = #{record.departId,jdbcType=BIGINT}, depart_id = #{record.departId,jdbcType=BIGINT},
</if> </if>
<if test="record.stockRoomId != null">
stock_room_id = #{record.stockRoomId,jdbcType=BIGINT},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -627,7 +639,8 @@ ...@@ -627,7 +639,8 @@
cycle_type = #{record.cycleType,jdbcType=INTEGER}, cycle_type = #{record.cycleType,jdbcType=INTEGER},
pay_type = #{record.payType,jdbcType=INTEGER}, pay_type = #{record.payType,jdbcType=INTEGER},
job_no = #{record.jobNo,jdbcType=VARCHAR}, job_no = #{record.jobNo,jdbcType=VARCHAR},
depart_id = #{record.departId,jdbcType=BIGINT} depart_id = #{record.departId,jdbcType=BIGINT},
stock_room_id = #{record.stockRoomId,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -761,6 +774,9 @@ ...@@ -761,6 +774,9 @@
<if test="departId != null"> <if test="departId != null">
depart_id = #{departId,jdbcType=BIGINT}, depart_id = #{departId,jdbcType=BIGINT},
</if> </if>
<if test="stockRoomId != null">
stock_room_id = #{stockRoomId,jdbcType=BIGINT},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -807,7 +823,8 @@ ...@@ -807,7 +823,8 @@
cycle_type = #{cycleType,jdbcType=INTEGER}, cycle_type = #{cycleType,jdbcType=INTEGER},
pay_type = #{payType,jdbcType=INTEGER}, pay_type = #{payType,jdbcType=INTEGER},
job_no = #{jobNo,jdbcType=VARCHAR}, job_no = #{jobNo,jdbcType=VARCHAR},
depart_id = #{departId,jdbcType=BIGINT} depart_id = #{departId,jdbcType=BIGINT},
stock_room_id = #{stockRoomId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -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_department"> <table tableName="vanke_vv_user">
<generatedKey column="id" sqlStatement="MySql" identity="true"/> <generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table> </table>
......
package com.macro.mall.portal.controller.member;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.vanke.IStaffService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@Api(tags = "万科h5_员工相关接口", description = "员工控制器")
@RequestMapping("/staff")
public class StaffController {
@Autowired
private IStaffService staffService;
@ApiOperation("万科h5_生成二维码唯一标识符 ")
@RequestMapping(value = "/generateQrcodeParam", method = RequestMethod.GET)
@ResponseBody
public CommonResult generateQrcodeParam(){
ResultMsg res = this.staffService.generateQrcodeParam();
if(res.isFlag()){
return CommonResult.success(res.getContext(),res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("万科h5_校验二维码唯一标识符 ")
@RequestMapping(value = "/checkOnlyId", method = RequestMethod.GET)
@ResponseBody
public CommonResult checkOnlyId(@ApiParam("二维码唯一标识符onlyId")@RequestParam(value = "onlyId")String onlyId,
@ApiParam("会员id")@RequestParam(value = "memberId")Long memberId){
ResultMsg res = this.staffService.checkOnlyId(onlyId,memberId);
if(res.isFlag()){
return CommonResult.success(res.getContext(),res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
...@@ -8,7 +8,9 @@ import com.macro.mall.portal.domain.UmsMemberPhoneReviewAddParam; ...@@ -8,7 +8,9 @@ import com.macro.mall.portal.domain.UmsMemberPhoneReviewAddParam;
import com.macro.mall.domain.UmsMemberVerified; import com.macro.mall.domain.UmsMemberVerified;
import com.macro.mall.portal.service.UmsMemberPhoneReviewService; import com.macro.mall.portal.service.UmsMemberPhoneReviewService;
import com.macro.mall.service.member.UmsMemberService; import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.vanke.IVankeMemberLoginService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -23,7 +25,7 @@ import java.util.Map; ...@@ -23,7 +25,7 @@ import java.util.Map;
* Created by macro on 2018/8/3. * Created by macro on 2018/8/3.
*/ */
@Controller @Controller
@Api(tags = "权星小程序_会员相关接口", description = "会员登录注册管理") @Api(tags = "万科h5_会员相关接口", description = "会员登录注册管理")
@RequestMapping("/sso") @RequestMapping("/sso")
public class UmsMemberController { public class UmsMemberController {
@Value("${jwt.tokenHeader}") @Value("${jwt.tokenHeader}")
...@@ -33,41 +35,33 @@ public class UmsMemberController { ...@@ -33,41 +35,33 @@ public class UmsMemberController {
@Autowired @Autowired
private UmsMemberService memberService; private UmsMemberService memberService;
@Autowired @Autowired
private UmsMemberPhoneReviewService memberPhoneReviewService; private IVankeMemberLoginService vankeMemberLoginService;
@ApiOperation("万科h5_通过ticket登录 返回token ")
@ApiOperation("权星小程序_会员根据手机号登录") @RequestMapping(value = "/getVankeUserInfo", method = RequestMethod.GET)
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public CommonResult login(@RequestParam String phone,
@RequestParam String password) {
return memberService.login(phone, password);
}
@ApiOperation("权星小程序_用户修改密码")
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public CommonResult updatePassword(@RequestBody UmsMemberRequestParam umsMemberRequestParam) { public CommonResult getVankeUserInfo(@ApiParam("传入前端通过url获取的ticket(必传)")@RequestParam(value = "ticket") String ticket){
ResultMsg res = memberService.updatePassword(umsMemberRequestParam); ResultMsg res = this.vankeMemberLoginService.getVankeUserInfo(ticket);
if(res.isFlag()){ if(res.isFlag()){
return CommonResult.success(null,res.getMsg()); return CommonResult.success(res.getContext(),res.getMsg());
} }
return CommonResult.failed(res.getMsg()); return CommonResult.failed(res.getMsg());
} }
@ApiOperation("权星小程序_用户修改手机号") @ApiOperation("万科h5_测试使用测试通过jobNo登录 返回token ")
@RequestMapping(value = "/updatePhone", method = RequestMethod.POST) @RequestMapping(value = "/testToken", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public CommonResult updatePhone(@RequestBody UmsMemberRequestParam umsMemberRequestParam) { public CommonResult testToken(@ApiParam("jobNo")@RequestParam(value = "jobNo") String jobNo){
ResultMsg res = memberService.updatePhone(umsMemberRequestParam); //得到通过返回的map数据 得到umsMember
if(res.isFlag()){ Map<String, Object> map = new HashMap<>();
return CommonResult.success(null,res.getMsg()); map.put("jobNo",jobNo);
} UmsMember um =this.vankeMemberLoginService.handleSuccessInfo(map);
return CommonResult.failed(res.getMsg()); Map<String, String> tokenMap = this.memberService.vankeLogin(um);
System.out.println(tokenMap);
return CommonResult.success(tokenMap,"获取成功");
} }
@ApiOperation("权星后台_根据会员id修改一条会员数据") @ApiOperation("万科h5_根据会员id修改一条会员数据")
@RequestMapping(value = "/updateOneById", method = RequestMethod.POST) @RequestMapping(value = "/updateOneById", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public CommonResult updateOneById(@ApiParam("会员对象,传入Id,以及对应的要修改的值.例如帐号启用状态:0->禁用;1->启用 禁用账号在对应的字段传入0") @RequestBody UmsMember umsMember){ public CommonResult updateOneById(@ApiParam("会员对象,传入Id,以及对应的要修改的值.例如帐号启用状态:0->禁用;1->启用 禁用账号在对应的字段传入0") @RequestBody UmsMember umsMember){
...@@ -101,14 +95,6 @@ public class UmsMemberController { ...@@ -101,14 +95,6 @@ public class UmsMemberController {
return CommonResult.success(currentMember); return CommonResult.success(currentMember);
} }
@ApiOperation("会员手机验证码登录")
@RequestMapping(value = "/loginPhone", method = RequestMethod.POST)
@ResponseBody
public CommonResult loginPhone( @RequestParam String telephone,
@RequestParam String authCode) {
return memberService.loginPhone(telephone, authCode);
}
......
package com.macro.mall.portal;
import com.macro.mall.dao.UmsMemberDao;
import com.macro.mall.dao.vanke.VankeVvUserDao;
import com.macro.mall.mapper.UmsMemberMapper;
import com.macro.mall.mapper.VankeDepartmentMapper;
import com.macro.mall.mapper.VankeVvUserMapper;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeDepartmentExample;
import com.macro.mall.model.VankeVvUser;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.system.RedisService;
import com.macro.mall.service.vanke.IVankeMemberLoginService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest
public class VankeTest {
@Autowired
private IVankeMemberLoginService vankeMemberLoginService;
@Autowired
private RedisService redisService;
@Resource
private VankeVvUserDao vankeVvUserDao;
@Resource
private VankeVvUserMapper vankeVvUserMapper;
@Resource
private VankeDepartmentMapper vankeDepartmentMapper;
@Resource
private UmsMemberDao umsMemberDao;
@Resource
private UmsMemberMapper umsMemberMapper;
@Autowired
private UmsMemberService umsMemberService;
@Test
public void testA(){
//得到通过返回的map数据 得到umsMember
Map<String, Object> map = new HashMap<>();
map.put("jobNo",12345);
UmsMember um =this.vankeMemberLoginService.handleSuccessInfo(map);
Map<String, String> tokenMap = this.umsMemberService.vankeLogin(um);
System.out.println(tokenMap);
}
}
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version> <version>4.12</version>
......
...@@ -34,4 +34,11 @@ public interface UmsAdminDao { ...@@ -34,4 +34,11 @@ public interface UmsAdminDao {
* @return * @return
*/ */
AdminManageParam selectByUserName(String username); AdminManageParam selectByUserName(String username);
/**
* 根据会员id 查询管理员是否存在
* @param memberId
* @return
*/
UmsAdmin selectByMemberId(Long memberId);
} }
...@@ -4,6 +4,7 @@ import com.macro.mall.domain.dto.UmsMemberParam; ...@@ -4,6 +4,7 @@ import com.macro.mall.domain.dto.UmsMemberParam;
import com.macro.mall.domain.vo.UmsMemberVo; import com.macro.mall.domain.vo.UmsMemberVo;
import com.macro.mall.model.UmsMember; import com.macro.mall.model.UmsMember;
import com.macro.mall.model.UmsMemberExample; import com.macro.mall.model.UmsMemberExample;
import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -46,4 +47,8 @@ public interface UmsMemberDao { ...@@ -46,4 +47,8 @@ public interface UmsMemberDao {
List<Long> getMemberIdList(UmsMemberParam umsMemberParam); List<Long> getMemberIdList(UmsMemberParam umsMemberParam);
Integer getMemberInviteNum(@Param("memberId") Long memberId); Integer getMemberInviteNum(@Param("memberId") Long memberId);
List<UmsMemberDto> selectUmsMember(UmsMemberDto umsMemberDto);
UmsMember selectUmsMemberByJobNo(String jobNo);
} }
package com.macro.mall.dao.vanke; package com.macro.mall.dao.vanke;
import com.macro.mall.model.dto.vanke.StatiscalQueryParam;
import com.macro.mall.model.dto.vanke.VankeGoodsDto; import com.macro.mall.model.dto.vanke.VankeGoodsDto;
import java.util.List; import java.util.List;
...@@ -20,4 +21,18 @@ public interface VankeGoodsDao { ...@@ -20,4 +21,18 @@ public interface VankeGoodsDao {
* @return * @return
*/ */
List<VankeGoodsDto> selectGoodsByCategotyAndSupplier(VankeGoodsDto vankeGoodsDto); List<VankeGoodsDto> selectGoodsByCategotyAndSupplier(VankeGoodsDto vankeGoodsDto);
/**
* 得到五条最低库存数据
* @param statiscalQueryParam
* @return
*/
List<VankeGoodsDto> selectListLowStock(StatiscalQueryParam statiscalQueryParam);
/**
* 得到低库存
* @param statiscalQueryParam
* @return
*/
Integer selectLowStock(StatiscalQueryParam statiscalQueryParam);
} }
package com.macro.mall.dao.vanke; package com.macro.mall.dao.vanke;
import com.macro.mall.model.VankeGoodsStock; import com.macro.mall.model.VankeGoodsStock;
import com.macro.mall.model.dto.vanke.StatiscalQueryParam;
import com.macro.mall.model.dto.vanke.VankeGoodsStockDto; import com.macro.mall.model.dto.vanke.VankeGoodsStockDto;
public interface VankeGoodsStockDao { public interface VankeGoodsStockDao {
...@@ -17,4 +18,11 @@ public interface VankeGoodsStockDao { ...@@ -17,4 +18,11 @@ public interface VankeGoodsStockDao {
* @return * @return
*/ */
Integer selectGoodsCollection(VankeGoodsStockDto vankeGoodsStockDto); Integer selectGoodsCollection(VankeGoodsStockDto vankeGoodsStockDto);
/**
* 统计剩余库存
* @return
*/
Integer selectGoodsStockCount(StatiscalQueryParam statiscalQueryParam);
} }
package com.macro.mall.dao.vanke; package com.macro.mall.dao.vanke;
import com.macro.mall.model.dto.vanke.StatiscalQueryParam;
import com.macro.mall.model.dto.vanke.VankeInboundRecordDto; import com.macro.mall.model.dto.vanke.VankeInboundRecordDto;
import java.util.List; import java.util.List;
...@@ -7,4 +8,18 @@ import java.util.List; ...@@ -7,4 +8,18 @@ import java.util.List;
public interface VankeInboundRecordDao { public interface VankeInboundRecordDao {
List<VankeInboundRecordDto> getPageList(VankeInboundRecordDto vankeInboundRecordDto); List<VankeInboundRecordDto> getPageList(VankeInboundRecordDto vankeInboundRecordDto);
/**
* 根据时间查询当日入库数
* @param statiscalQueryParam
* @return
*/
Integer selectInboundCountByQueryTime(StatiscalQueryParam statiscalQueryParam);
/**
* 入库物品类别分布
* @param statiscalQueryParam
* @return
*/
List<VankeInboundRecordDto> selectInBoundByCategory(StatiscalQueryParam statiscalQueryParam);
} }
package com.macro.mall.dao.vanke; package com.macro.mall.dao.vanke;
import com.macro.mall.model.dto.vanke.StatiscalQueryParam;
import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto; import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto;
import java.util.List; import java.util.List;
...@@ -7,4 +8,32 @@ import java.util.List; ...@@ -7,4 +8,32 @@ import java.util.List;
public interface VankeOutBoundRecordDao { public interface VankeOutBoundRecordDao {
List<VankeOutboundRecordDto> getPageList(VankeOutboundRecordDto vankeOutboundRecordDto); List<VankeOutboundRecordDto> getPageList(VankeOutboundRecordDto vankeOutboundRecordDto);
/**
* 根据时间查询当日出库数
* @param statiscalQueryParam
* @return
*/
Integer selectOutboundCountByQueryTime(StatiscalQueryParam statiscalQueryParam);
/**
* 根据时间查询当日申领人
* @param statiscalQueryParam
* @return
*/
Integer selectMemberCountByQueryTime(StatiscalQueryParam statiscalQueryParam);
/**
* 根据时间查询物品领取分类数量
* @param statiscalQueryParam
* @return
*/
List<VankeOutboundRecordDto> selectOutBoundByCategory(StatiscalQueryParam statiscalQueryParam);
/**
* 根据部门查询领取分布情况
* @param statiscalQueryParam
* @return
*/
List<VankeOutboundRecordDto> selectOutBoundByDepartId(StatiscalQueryParam statiscalQueryParam);
} }
package com.macro.mall.dao.vanke;
import com.macro.mall.model.VankeVvUser;
public interface VankeVvUserDao {
VankeVvUser selectByJobNo(String jobNo);
}
...@@ -11,10 +11,12 @@ import com.macro.mall.model.UmsMember; ...@@ -11,10 +11,12 @@ import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.UmsMemberDto; import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import com.macro.mall.model.dto.quanxing.UmsMemberRequestParam; import com.macro.mall.model.dto.quanxing.UmsMemberRequestParam;
import com.macro.mall.model.dto.vanke.VankeGoodsDto;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 会员管理Service * 会员管理Service
...@@ -92,6 +94,10 @@ public interface UmsMemberService { ...@@ -92,6 +94,10 @@ public interface UmsMemberService {
CommonResult login(String phone, String password); CommonResult login(String phone, String password);
/** /**
* 万科登录后获取token
*/
Map<String, String> vankeLogin(UmsMember umsMember);
/**
* 刷新token * 刷新token
*/ */
String refreshToken(String token); String refreshToken(String token);
...@@ -191,4 +197,13 @@ public interface UmsMemberService { ...@@ -191,4 +197,13 @@ public interface UmsMemberService {
ResultMsg updateOtherById(UmsMember umsMember); ResultMsg updateOtherById(UmsMember umsMember);
ResultMsg updatePhone(UmsMemberRequestParam umsMemberRequestParam); ResultMsg updatePhone(UmsMemberRequestParam umsMemberRequestParam);
/**
* 分页查询
* @param pageNum
* @param pageSize
* @param umsMemberDto
* @return
*/
List<UmsMemberDto> getUmsMemberPageList(Integer pageNum,Integer pageSize,UmsMemberDto umsMemberDto);
} }
...@@ -5,6 +5,8 @@ import com.github.pagehelper.PageInfo; ...@@ -5,6 +5,8 @@ import com.github.pagehelper.PageInfo;
import com.macro.mall.common.api.CommonPage; import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult; import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.api.DateUtils; import com.macro.mall.common.api.DateUtils;
import com.macro.mall.common.baiduyun.HttpUtil;
import com.macro.mall.common.utils.HttpsUtil;
import com.macro.mall.dao.UmsMemberDao; import com.macro.mall.dao.UmsMemberDao;
import com.macro.mall.domain.MemberDetails; import com.macro.mall.domain.MemberDetails;
import com.macro.mall.domain.dto.UmsMemberParam; import com.macro.mall.domain.dto.UmsMemberParam;
...@@ -25,6 +27,7 @@ import com.macro.mall.security.util.CodingUtil; ...@@ -25,6 +27,7 @@ import com.macro.mall.security.util.CodingUtil;
import com.macro.mall.security.util.JwtTokenUtil; import com.macro.mall.security.util.JwtTokenUtil;
import com.macro.mall.service.system.RedisService; import com.macro.mall.service.system.RedisService;
import com.macro.mall.service.system.UmsAdminService; import com.macro.mall.service.system.UmsAdminService;
import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -362,6 +365,27 @@ public class UmsMemberServiceImpl implements UmsMemberService { ...@@ -362,6 +365,27 @@ public class UmsMemberServiceImpl implements UmsMemberService {
return CommonResult.success(tokenMap); return CommonResult.success(tokenMap);
} }
/**
* 万科登录后获取token
*/
public Map<String, String> vankeLogin(UmsMember umsMember){
String token = null;
//密码需要客户端加密后传递
try {
UserDetails userDetails =new MemberDetails(umsMember);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(authentication);
token = jwtTokenUtil.generateToken(userDetails);
umsMember.setLoginTime(new Date());
umsMemberMapper.updateByPrimaryKeySelective(umsMember);
} catch (AuthenticationException e) {
LOGGER.warn("登录异常:{}", e.getMessage());
}
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", token);
tokenMap.put("tokenHead", tokenHead);
return tokenMap;
}
@Override @Override
public String refreshToken(String token) { public String refreshToken(String token) {
return jwtTokenUtil.refreshHeadToken(token); return jwtTokenUtil.refreshHeadToken(token);
...@@ -745,4 +769,19 @@ public class UmsMemberServiceImpl implements UmsMemberService { ...@@ -745,4 +769,19 @@ public class UmsMemberServiceImpl implements UmsMemberService {
return new ResultMsg(true,"操作成功"); return new ResultMsg(true,"操作成功");
} }
/**
* 分页查询
* @param pageNum
* @param pageSize
* @param umsMemberDto
* @return
*/
@Override
public List<UmsMemberDto> getUmsMemberPageList(Integer pageNum,Integer pageSize,UmsMemberDto umsMemberDto){
if(pageNum != null && pageSize != null){
PageHelper.startPage(pageNum, pageSize);
}
return this.memberDao.selectUmsMember(umsMemberDto);
}
} }
...@@ -9,6 +9,7 @@ import com.macro.mall.model.UmsAdmin; ...@@ -9,6 +9,7 @@ import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsPermission; import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsResource; import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsRole; import com.macro.mall.model.UmsRole;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.UmsAdminDto; import com.macro.mall.model.dto.UmsAdminDto;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -195,4 +196,17 @@ public interface UmsAdminService { ...@@ -195,4 +196,17 @@ public interface UmsAdminService {
* @return * @return
*/ */
Long getCurrentUmsAdminId(); Long getCurrentUmsAdminId();
/**
* 设置为管理员
* @param umsAdminDto
* @return
*/
ResultMsg setUpAdmin(UmsAdminDto umsAdminDto);
/**
* 取消管理员
* @return
*/
ResultMsg cancleAdmin(UmsAdmin umsAdmin);
} }
...@@ -12,6 +12,8 @@ import com.macro.mall.domain.dto.UmsAdminParam; ...@@ -12,6 +12,8 @@ import com.macro.mall.domain.dto.UmsAdminParam;
import com.macro.mall.domain.dto.UmsAdminQueryParam; import com.macro.mall.domain.dto.UmsAdminQueryParam;
import com.macro.mall.mapper.*; import com.macro.mall.mapper.*;
import com.macro.mall.model.*; import com.macro.mall.model.*;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.UmsAdminDto;
import com.macro.mall.security.admin.AdminUserDetails; import com.macro.mall.security.admin.AdminUserDetails;
import com.macro.mall.security.admin.DgbSecurityUserHelper; import com.macro.mall.security.admin.DgbSecurityUserHelper;
import com.macro.mall.security.util.JwtTokenUtil; import com.macro.mall.security.util.JwtTokenUtil;
...@@ -69,6 +71,8 @@ public class UmsAdminServiceImpl implements UmsAdminService { ...@@ -69,6 +71,8 @@ public class UmsAdminServiceImpl implements UmsAdminService {
@Resource @Resource
private UmsAdminDao adminDao; private UmsAdminDao adminDao;
@Resource @Resource
private UmsMemberMapper umsMemberMapper;
@Resource
private UmsMemberService memberService; private UmsMemberService memberService;
@Value("${jwt.tokenHead}") @Value("${jwt.tokenHead}")
private String tokenHead; private String tokenHead;
...@@ -682,5 +686,109 @@ public class UmsAdminServiceImpl implements UmsAdminService { ...@@ -682,5 +686,109 @@ public class UmsAdminServiceImpl implements UmsAdminService {
return umsAdminRoleRelations.get(0).getRoleId(); return umsAdminRoleRelations.get(0).getRoleId();
} }
/**
* 设置为普通管理员
* @param umsAdminDto
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg setUpAdmin(UmsAdminDto umsAdminDto){
ResultMsg res = this.checkSetUpAdmin(umsAdminDto);
if( !res.isFlag() ){
return new ResultMsg(false,res.getMsg());
}
//初始化前端会员
UmsMember umsMember = new UmsMember();
UmsAdmin ua =this.adminDao.selectByMemberId(umsAdminDto.getMemberId());
if( ua == null ){ //如果为空 则为新增操作
//插入到ums_admin 这张表内
UmsAdmin umsAdmin = new UmsAdmin();
umsAdmin.setCreateTime(new Date());
umsAdmin.setUpdateDate(new Date());
umsAdmin.setCreateDate(new Date());
umsAdmin.setIcon(umsAdminDto.getIcon());
umsAdmin.setPhone(umsAdminDto.getPhone());
umsAdmin.setUsername(umsAdminDto.getUsername());
umsAdmin.setPassword(umsAdminDto.getPassword());
umsAdmin.setName(umsAdminDto.getName());
umsAdmin.setMemberId(umsAdminDto.getMemberId());
umsAdmin.setDepartId(umsAdminDto.getDepartId());
umsAdmin.setStockRoomId(umsAdminDto.getStockRoomId());
this.adminMapper.insertSelective(umsAdmin);
//绑定角色关系
UmsAdminRoleRelation umsAdminRoleRelation = new UmsAdminRoleRelation();
umsAdminRoleRelation.setAdminId(umsAdmin.getId());
umsAdminRoleRelation.setRoleId(umsAdminDto.getRoleId());
umsAdminRoleRelation.setCreateDate(new Date());
umsAdminRoleRelation.setUpdateDate(new Date());
this.adminRoleRelationMapper.insertSelective(umsAdminRoleRelation);
//给前端会员设置库房
umsMember.setStockRoomId(umsAdminDto.getStockRoomId());
}else{ // 否则之前存在 后来解绑了 解绑就默认状态为删除状态 将删除状态修改回来
ua.setDeleteStatus(0);//删除标识0 未删除 1已删除
ua.setIcon(umsAdminDto.getIcon());
ua.setPhone(umsAdminDto.getPhone());
ua.setUsername(umsAdminDto.getUsername());
ua.setPassword(umsAdminDto.getPassword());
ua.setName(umsAdminDto.getName());
ua.setMemberId(umsAdminDto.getMemberId());
ua.setDepartId(umsAdminDto.getDepartId());
ua.setStockRoomId(umsAdminDto.getStockRoomId());
ua.setUpdateDate(new Date());
this.adminMapper.updateByPrimaryKeySelective(ua);
}
//前端状态修改
umsMember.setId(umsAdminDto.getId());
umsMember.setAccouuntType(0);//账户类型(0管理员1普通用户)
this.umsMemberMapper.updateByPrimaryKeySelective(umsMember);
return new ResultMsg(true,"操作成功");
}
private ResultMsg checkSetUpAdmin(UmsAdminDto umsAdmin){
if(umsAdmin.getUsername() == null || "".equals(umsAdmin.getUsername())){
return new ResultMsg(false,"传入用户名为空");
}
if(umsAdmin.getPassword() == null || "".equals(umsAdmin.getPassword())){
return new ResultMsg(false,"传入密码为空");
}
if(umsAdmin.getMemberId() == null ){
return new ResultMsg(false,"传入会员id为空");
}
if(umsAdmin.getDepartId() == null ){
return new ResultMsg(false,"传入部门id为空");
}
if(umsAdmin.getStockRoomId() == null ){
return new ResultMsg(false,"传入库房id为空");
}
if(umsAdmin.getRoleId() == null ){
return new ResultMsg(false,"传入角色id为空");
}
return new ResultMsg(true,"校验通过");
}
/**
* 取消管理员
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg cancleAdmin(UmsAdmin umsAdmin){
if(umsAdmin.getId() == null ){
return new ResultMsg(false,"传入管理员id为空");
}
if(umsAdmin.getMemberId() == null ){
return new ResultMsg(false,"传入会员id为空");
}
//ums_admin更改删除状态
umsAdmin.setUpdateDate(new Date());
umsAdmin.setDeleteStatus(1);//除标识0 未删除 1已删除
this.adminMapper.updateByPrimaryKeySelective(umsAdmin);
//ums_member 改为普通用户
UmsMember umsMember = new UmsMember();
umsMember.setId(umsAdmin.getMemberId());
umsMember.setAccouuntType(1);//0管理员1普通用户
this.umsMemberMapper.updateByPrimaryKeySelective(umsMember);
return new ResultMsg(true,"操作成功");
}
} }
package com.macro.mall.service.vanke;
import com.macro.mall.model.common.ResultMsg;
public interface IStaffService {
/**
* 生成二维码唯一标识符
* @return
*/
ResultMsg generateQrcodeParam();
/**
* 校验二维码唯一标识符
* @param onlyId
* @return
*/
ResultMsg checkOnlyId(String onlyId,Long memberId);
}
package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeConfig;
import com.macro.mall.model.common.ResultMsg;
public interface IVankeConfigService {
/**
* 得到config配置
* @return
*/
VankeConfig getConfig();
/**
* 根据id判断是修改还是新增
* @param vankeConfig
* @return
*/
ResultMsg insertAndUpdateConfig(VankeConfig vankeConfig);
}
...@@ -2,6 +2,9 @@ package com.macro.mall.service.vanke; ...@@ -2,6 +2,9 @@ package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeGoodsStock; import com.macro.mall.model.VankeGoodsStock;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.StatiscalQueryParam;
import com.macro.mall.model.dto.vanke.VankeInboundRecordDto;
import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -24,7 +27,7 @@ public interface IVankeGoodsStockService { ...@@ -24,7 +27,7 @@ public interface IVankeGoodsStockService {
* @param goodsId * @param goodsId
* @return * @return
*/ */
Map<String ,Object> selectStockByGoodsIdAndTime(List<String> dateList , Long goodsId); List<Map<String ,Object>> selectStockByGoodsIdAndTime(List<String> dateList , Long goodsId);
/** /**
* 根据时间和物品id查询物品领用情况 * 根据时间和物品id查询物品领用情况
...@@ -32,5 +35,40 @@ public interface IVankeGoodsStockService { ...@@ -32,5 +35,40 @@ public interface IVankeGoodsStockService {
* @param goodsId * @param goodsId
* @return * @return
*/ */
Map<String ,Object> selectGoodsCollection(List<String> dateList , Long goodsId); List<Map<String ,Object>> selectGoodsCollection(List<String> dateList , Long goodsId);
/**
* 根据时间查询出库 和入库值
* @param dateList
* @return
*/
List<Map<String ,Object>> selectStockByGoodsIdAndTime(List<String> dateList);
/**
* 查询首页今日数据
* @param queryTime
* @return
*/
Map<String,Object> getHomeData(String queryTime);
/**
* 根据时间查询物品领取分类数量
* @param statiscalQueryParam
* @return
*/
List<VankeOutboundRecordDto> selectOutBoundByCategory(StatiscalQueryParam statiscalQueryParam);
/**
* 根据部门查询领取分布情况
* @param statiscalQueryParam
* @return
*/
List<VankeOutboundRecordDto> selectOutBoundByDepartId(StatiscalQueryParam statiscalQueryParam);
/**
* 入库物品类别分布
* @param statiscalQueryParam
* @return
*/
List<VankeInboundRecordDto> selectInBoundByCategory(StatiscalQueryParam statiscalQueryParam);
} }
package com.macro.mall.service.vanke;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import java.util.Map;
public interface IVankeMemberLoginService {
/**
* 获取万科请求token
* @return
*/
String getVankeAccessToken();
/**
* 得到万科用户信息
* @return
*/
ResultMsg getVankeUserInfo(String ticket);
/**
* 将万科返回的map转成UmsMember对象
* @param map
* @return
*/
UmsMember handleSuccessInfo(Map<String,Object> map);
}
...@@ -17,5 +17,5 @@ public interface IVankeOutboundRecordService { ...@@ -17,5 +17,5 @@ public interface IVankeOutboundRecordService {
* @param goodsMame * @param goodsMame
* @return * @return
*/ */
List<VankeOutboundRecordDto> getPageList(Integer pageNum, Integer pageSize, Long goodsCategoryId, Long departId, String memberName, String goodsMame ); List<VankeOutboundRecordDto> getPageList(Integer pageNum, Integer pageSize, Long goodsCategoryId, Long departId,Long stockRoomId, String memberName, String goodsMame );
} }
package com.macro.mall.service.vanke.impl;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.system.RedisService;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IStaffService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Service
public class StaffServiceImpl implements IStaffService {
@Autowired
private UmsMemberService memberService;
@Autowired
private RedisService redisService;
/**
* 生成二维码唯一标识符
* @return
*/
@Override
public ResultMsg generateQrcodeParam(){
//获取会员数据
UmsMember um = memberService.getCurrentMember();
Map<String,Object> map = new HashMap<>();
String onlyId = UUID.randomUUID().toString().replaceAll("-","");
map.put("onlyId",onlyId);
//onlyId 设置5分钟有效期
redisService.set(onlyId, "1");//标识1为未使用 标识0为已使用
redisService.expire(onlyId,300);//设置有效期
//通过memberId 来绑定当前唯一二维码
redisService.set("memberId"+um.getId(),onlyId);
return new ResultMsg(true,"获得成功",map);
}
/**
* 校验二维码唯一标识符
* @param onlyId
* @return
*/
@Override
public ResultMsg checkOnlyId(String onlyId,Long memberId){
//校验二维码是否和当前会员一致
String mOnlyId = redisService.get("memberId"+memberId);
if(mOnlyId == null || !mOnlyId.equals(onlyId)){
return new ResultMsg(false,"二维码已失效!");
}
String flag = redisService.get(onlyId);
if(flag == null || "".equals(flag) || "0".equals(flag)){ //如果不存在说明已过期 或者已使用
return new ResultMsg(false,"二维码已失效或者已使用!");
}
return new ResultMsg(true,"二维码校验成功");
}
}
package com.macro.mall.service.vanke.impl;
import com.macro.mall.mapper.VankeConfigMapper;
import com.macro.mall.model.VankeConfig;
import com.macro.mall.model.VankeConfigExample;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.vanke.IVankeConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
public class VankeConfigServiceImpl implements IVankeConfigService {
@Resource
private VankeConfigMapper vankeConfigMapper;
/**
* 得到config配置
* @return
*/
@Override
public VankeConfig getConfig(){
VankeConfigExample example = new VankeConfigExample();
VankeConfigExample.Criteria criteria = example.createCriteria();
List<VankeConfig> vcList = this.vankeConfigMapper.selectByExample(example);
if(vcList != null && vcList.size()>0 ){
return vcList.get(0);
}
return null;
}
/**
* 根据id判断是修改还是新增
* @param vankeConfig
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg insertAndUpdateConfig(VankeConfig vankeConfig){
if(vankeConfig.getStockWarning() == null){
return new ResultMsg(false,"库存预警传入为空");
}
if(vankeConfig.getReceiveInterval() == null){
return new ResultMsg(false,"领取时间间隔为空");
}
if(vankeConfig.getId() != null){ //如果id不为空 说明是修改
this.vankeConfigMapper.updateByPrimaryKeySelective(vankeConfig);
}else{ //否则新增操作
this.vankeConfigMapper.insertSelective(vankeConfig);
}
return new ResultMsg(true,"操作成功");
}
}
package com.macro.mall.service.vanke.impl; package com.macro.mall.service.vanke.impl;
import com.macro.mall.dao.vanke.VankeGoodsDao;
import com.macro.mall.dao.vanke.VankeGoodsStockDao; import com.macro.mall.dao.vanke.VankeGoodsStockDao;
import com.macro.mall.dao.vanke.VankeInboundRecordDao;
import com.macro.mall.dao.vanke.VankeOutBoundRecordDao;
import com.macro.mall.mapper.VankeConfigMapper;
import com.macro.mall.mapper.VankeGoodsStockMapper; import com.macro.mall.mapper.VankeGoodsStockMapper;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeConfig;
import com.macro.mall.model.VankeGoodsStock; import com.macro.mall.model.VankeGoodsStock;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.StatiscalQueryParam;
import com.macro.mall.model.dto.vanke.VankeGoodsStockDto; import com.macro.mall.model.dto.vanke.VankeGoodsStockDto;
import com.macro.mall.model.dto.vanke.VankeInboundRecordDto;
import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeConfigService;
import com.macro.mall.service.vanke.IVankeGoodsStockService; import com.macro.mall.service.vanke.IVankeGoodsStockService;
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.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -21,7 +34,16 @@ public class VankeGoodsStockServiceImpl implements IVankeGoodsStockService { ...@@ -21,7 +34,16 @@ public class VankeGoodsStockServiceImpl implements IVankeGoodsStockService {
private VankeGoodsStockMapper vankeGoodsStockMapper; private VankeGoodsStockMapper vankeGoodsStockMapper;
@Resource @Resource
private VankeGoodsStockDao vankeGoodsStockDao; private VankeGoodsStockDao vankeGoodsStockDao;
@Resource
private VankeOutBoundRecordDao vankeOutBoundRecordDao;
@Resource
private VankeInboundRecordDao vankeInboundRecordDao;
@Resource
private IVankeConfigService vankeConfigService;
@Autowired
private UmsAdminService umsAdminService;
@Resource
private VankeGoodsDao vankeGoodsDao;
/** /**
* 插入商品库存变化信息 * 插入商品库存变化信息
* @param goodsId * @param goodsId
...@@ -47,18 +69,80 @@ public class VankeGoodsStockServiceImpl implements IVankeGoodsStockService { ...@@ -47,18 +69,80 @@ public class VankeGoodsStockServiceImpl implements IVankeGoodsStockService {
* @return * @return
*/ */
@Override @Override
public Map<String ,Object> selectStockByGoodsIdAndTime(List<String> dateList , Long goodsId){ public List<Map<String ,Object>> selectStockByGoodsIdAndTime(List<String> dateList , Long goodsId){
//初始化结果map List<Map<String ,Object>> object = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
//初始化查询对象 //初始化查询对象
VankeGoodsStockDto vankeGoodsStockDto = new VankeGoodsStockDto(); VankeGoodsStockDto vankeGoodsStockDto = new VankeGoodsStockDto();
vankeGoodsStockDto.setGoodsId(goodsId); vankeGoodsStockDto.setGoodsId(goodsId);
//初始化查询结果对象 //初始化查询结果对象
for(String date : dateList) { for(String date : dateList) {
//初始化结果map
Map<String,Object> map = new HashMap<>();
vankeGoodsStockDto.setQueryTime(date); vankeGoodsStockDto.setQueryTime(date);
map.put(date,this.vankeGoodsStockDao.selectOneByGoodsIdAndCreatetime(vankeGoodsStockDto)); map.put("data",date);
map.put("num",this.vankeGoodsStockDao.selectOneByGoodsIdAndCreatetime(vankeGoodsStockDto));
object.add(map);
}
return object;
}
/**
* 根据时间查询出库 和入库值
* @param dateList
* @return
*/
@Override
public List<Map<String ,Object>> selectStockByGoodsIdAndTime(List<String> dateList){
List<Map<String ,Object>> object = new ArrayList<>();
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
//查询对象
StatiscalQueryParam statiscalQueryParam = new StatiscalQueryParam();
if(ua.getType() == 2){ //如果是普通管理员
statiscalQueryParam.setMemberId(ua.getMemberId());
}
for(String date : dateList) {
//初始化结果map
Map<String,Object> map = new HashMap<>();
statiscalQueryParam.setQueryTime(date);
map.put("data",date);
map.put("outBoundNum",this.vankeOutBoundRecordDao.selectOutboundCountByQueryTime(statiscalQueryParam));
map.put("inBoundNum",this.vankeInboundRecordDao.selectInboundCountByQueryTime(statiscalQueryParam));
object.add(map);
}
return object;
}
/**
* 查询首页今日数据
* @param queryTime
* @return
*/
@Override
public Map<String,Object> getHomeData(String queryTime){
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
//查询对象
StatiscalQueryParam statiscalQueryParam = new StatiscalQueryParam();
if(ua.getType() == 2){ //如果是普通管理员
statiscalQueryParam.setMemberId(ua.getMemberId());
statiscalQueryParam.setStockRoomId(ua.getStockRoomId());
}
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("今日出库",this.vankeOutBoundRecordDao.selectOutboundCountByQueryTime(statiscalQueryParam));
dataMap.put("今日入库",this.vankeInboundRecordDao.selectInboundCountByQueryTime(statiscalQueryParam));
dataMap.put("今日申领人",this.vankeOutBoundRecordDao.selectMemberCountByQueryTime(statiscalQueryParam));
dataMap.put("剩余库存",this.vankeGoodsStockDao.selectGoodsStockCount(statiscalQueryParam));
//计算库存预警的数量
VankeConfig vc = this.vankeConfigService.getConfig();
if(vc == null){
vc = new VankeConfig();
vc.setStockWarning(0);
} }
return map; statiscalQueryParam.setGoodsNum(vc.getStockWarning());
dataMap.put("库存预警",this.vankeGoodsDao.selectLowStock(statiscalQueryParam));
dataMap.put("库存预警集合",this.vankeGoodsDao.selectListLowStock(statiscalQueryParam));
return dataMap;
} }
/** /**
...@@ -68,16 +152,65 @@ public class VankeGoodsStockServiceImpl implements IVankeGoodsStockService { ...@@ -68,16 +152,65 @@ public class VankeGoodsStockServiceImpl implements IVankeGoodsStockService {
* @return * @return
*/ */
@Override @Override
public Map<String ,Object> selectGoodsCollection(List<String> dateList , Long goodsId){ public List<Map<String ,Object>> selectGoodsCollection(List<String> dateList , Long goodsId){
//初始化结果map List<Map<String ,Object>> object = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
//初始化查询对象 //初始化查询对象
VankeGoodsStockDto vankeGoodsStockDto = new VankeGoodsStockDto(); VankeGoodsStockDto vankeGoodsStockDto = new VankeGoodsStockDto();
vankeGoodsStockDto.setGoodsId(goodsId); vankeGoodsStockDto.setGoodsId(goodsId);
for(String date : dateList) { for(String date : dateList) {
//初始化结果map
Map<String,Object> map = new HashMap<>();
vankeGoodsStockDto.setQueryTime(date); vankeGoodsStockDto.setQueryTime(date);
map.put(date,this.vankeGoodsStockDao.selectGoodsCollection(vankeGoodsStockDto)); map.put("data",date);
map.put("num",this.vankeGoodsStockDao.selectGoodsCollection(vankeGoodsStockDto));
object.add(map);
}
return object;
}
/**
* 根据时间查询物品领取分类数量
* @param statiscalQueryParam
* @return
*/
@Override
public List<VankeOutboundRecordDto> selectOutBoundByCategory(StatiscalQueryParam statiscalQueryParam){
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
if(ua.getType() == 2){ //如果是普通管理员
statiscalQueryParam.setStockRoomId(ua.getStockRoomId());
}
return this.vankeOutBoundRecordDao.selectOutBoundByCategory(statiscalQueryParam);
}
/**
* 根据部门查询领取分布情况
* @param statiscalQueryParam
* @return
*/
@Override
public List<VankeOutboundRecordDto> selectOutBoundByDepartId(StatiscalQueryParam statiscalQueryParam){
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
if(ua.getType() == 2){ //如果是普通管理员
statiscalQueryParam.setStockRoomId(ua.getStockRoomId());
}
return this.vankeOutBoundRecordDao.selectOutBoundByDepartId(statiscalQueryParam);
}
/**
* 入库物品类别分布
* @param statiscalQueryParam
* @return
*/
@Override
public List<VankeInboundRecordDto> selectInBoundByCategory(StatiscalQueryParam statiscalQueryParam){
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
if(ua.getType() == 2){ //如果是普通管理员
statiscalQueryParam.setStockRoomId(ua.getStockRoomId());
} }
return map; return this.vankeInboundRecordDao.selectInBoundByCategory(statiscalQueryParam);
} }
} }
...@@ -3,9 +3,12 @@ package com.macro.mall.service.vanke.impl; ...@@ -3,9 +3,12 @@ package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.vanke.VankeInboundRecordDao; import com.macro.mall.dao.vanke.VankeInboundRecordDao;
import com.macro.mall.mapper.VankeInboundRecordMapper; import com.macro.mall.mapper.VankeInboundRecordMapper;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.dto.vanke.VankeInboundRecordDto; import com.macro.mall.model.dto.vanke.VankeInboundRecordDto;
import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto; import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeInboundRecordService; import com.macro.mall.service.vanke.IVankeInboundRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -16,7 +19,8 @@ public class VankeInboundRecordServiceImpl implements IVankeInboundRecordService ...@@ -16,7 +19,8 @@ public class VankeInboundRecordServiceImpl implements IVankeInboundRecordService
@Resource @Resource
private VankeInboundRecordDao vankeInboundRecordDao; private VankeInboundRecordDao vankeInboundRecordDao;
@Autowired
private UmsAdminService umsAdminService;
/** /**
* 入库分页操作 * 入库分页操作
...@@ -27,9 +31,14 @@ public class VankeInboundRecordServiceImpl implements IVankeInboundRecordService ...@@ -27,9 +31,14 @@ public class VankeInboundRecordServiceImpl implements IVankeInboundRecordService
*/ */
@Override @Override
public List<VankeInboundRecordDto> getPageList(Integer pageNum, Integer pageSize, String goodsName){ public List<VankeInboundRecordDto> getPageList(Integer pageNum, Integer pageSize, String goodsName){
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
VankeInboundRecordDto vankeInboundRecordDto = new VankeInboundRecordDto(); VankeInboundRecordDto vankeInboundRecordDto = new VankeInboundRecordDto();
vankeInboundRecordDto.setGoodsName(goodsName); vankeInboundRecordDto.setGoodsName(goodsName);
if(ua.getMemberId() != null){//如果管理的会员id不为空说明是普通会员 只能查看自己的入库
vankeInboundRecordDto.setReceptInboundMemberId(ua.getMemberId());
}
return this.vankeInboundRecordDao.getPageList(vankeInboundRecordDto); return this.vankeInboundRecordDao.getPageList(vankeInboundRecordDto);
} }
} }
package com.macro.mall.service.vanke.impl;
import com.macro.mall.common.baiduyun.HttpUtil;
import com.macro.mall.common.utils.MyJsonUtil;
import com.macro.mall.dao.UmsMemberDao;
import com.macro.mall.dao.vanke.VankeVvUserDao;
import com.macro.mall.mapper.UmsMemberMapper;
import com.macro.mall.mapper.VankeDepartmentMapper;
import com.macro.mall.mapper.VankeVvUserMapper;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeDepartmentExample;
import com.macro.mall.model.VankeVvUser;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.system.RedisService;
import com.macro.mall.service.system.impl.RedisServiceImpl;
import com.macro.mall.service.vanke.IVankeMemberLoginService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
@Service
@Slf4j
public class VankeMemberLoginServiceImpl implements IVankeMemberLoginService {
//轻应用id
private String appId="500000185";
//轻应用secret,即appsecret
private String secret="HEKm5mevdFJjyT7v";
//当前北京时间,Unix格式13位时间戳,精确到毫秒,5分钟内有效。
private Long timestamp=new java.util.Date().getTime();
//授权级别:app
private String scope="app";
@Autowired
private RedisService redisService;
@Resource
private VankeVvUserDao vankeVvUserDao;
@Resource
private VankeVvUserMapper vankeVvUserMapper;
@Resource
private VankeDepartmentMapper vankeDepartmentMapper;
@Resource
private UmsMemberDao umsMemberDao;
@Resource
private UmsMemberMapper umsMemberMapper;
@Autowired
private UmsMemberService umsMemberService;
@Override
public String getVankeAccessToken() {
//先判断redis是否存在vankeAccessToken
String vankeAccessToken = this.redisService.get("vankeAccessToken");
vankeAccessToken="";
if(vankeAccessToken == null || vankeAccessToken.isEmpty()){
Long times = this.timestamp;
String params ="{\n" +
" \"appId\": \""+this.appId+"\",\n" +
" \"secret\": \""+this.secret+"\",\n" +
" \"timestamp\": "+times+",\n" +
" \"scope\": \""+this.scope+"\"\n" +
"}";
String res = null;
Map<String,Object> map = new HashMap<>();
try {
res = HttpUtil.postGeneralUrl("https://vvtest.vanke.com/gateway/oauth2/token/getAccessToken","application/json",params,"UTF-8");
map = MyJsonUtil.getMapChangeJson(res);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
if((boolean)map.get("success")){
//将token储存到redis 设置2小时有效期
redisService.set("vankeAccessToken", (String)map.get("accessToken"));
redisService.expire("vankeAccessToken",(Integer)map.get("expireIn"));
}else{//获取token失败
log.info("获取token失败" + res);
}
return (String)map.get("accessToken");
}else{//否则存在直接返回accesToken
return vankeAccessToken;
}
}
/**
* 得到万科用户信息
* @return
*/
@Override
public ResultMsg getVankeUserInfo(String ticket){
if(ticket == null || "".equals(ticket)){
return new ResultMsg(false,"传入ticket为空");
}
//通过appId 和 ticket 以及 token发起获取用户身份信息请求
String params ="{\n" +
" \"appid\": \""+this.appId+"\",\n" +
" \"ticket\": \""+ticket+"\"\n" +
"}";
String res = null;
Map<String,Object> map = new HashMap<>();
try {
res = HttpUtil.postGeneralUrl("https://vvtest.vanke.com/gateway/ticket/user/acquirecontext?accessToken="+this.getVankeAccessToken(),"application/json",params,"UTF-8");
map = MyJsonUtil.getMapChangeJson(res);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
if((boolean)map.get("success")){ //如果成功 执行成功的业务
//得到通过返回的map数据 得到umsMember
UmsMember um =this.handleSuccessInfo(map);
Map<String, String> tokenMap = this.umsMemberService.vankeLogin(um);
return new ResultMsg(true,"登录成功",tokenMap);
}else{//否则获取失败 打印失败信息 return出去
log.info("获取用户信息失败失败" + res);
return new ResultMsg(false,res);
}
}
/**
* 处理回调成功的会员数据信息 得到Ums_member
*/
@Override
public UmsMember handleSuccessInfo(Map<String,Object> map){
//通过job_no(员工编号)判断表中是否已经存在数据 不存在插入 存在则返回已登录 同时需要登录通过 返回自己系统token给前端
UmsMember um = this.umsMemberDao.selectUmsMemberByJobNo( map.get("jobNo")+"");
if(um == null ){//执行插入操作
VankeVvUser vankeVvUser = new VankeVvUser();
vankeVvUser.setAccount( map.get("account")+"");
vankeVvUser.setAppid( map.get("appid")+"");
vankeVvUser.setDepartOrgName( map.get("departOrgName")+"");
vankeVvUser.setDepartment(map.get("department")+"");
vankeVvUser.setDeviceId( map.get("deviceId")+"");
vankeVvUser.setEid( map.get("eid")+"");
vankeVvUser.setEmail( map.get("email")+"");
vankeVvUser.setJobNo( map.get("jobNo")+"");
vankeVvUser.setLongName( map.get("longName")+"");
vankeVvUser.setMobile( map.get("mobile")+"");
vankeVvUser.setNetworkid( map.get("networkid")+"");
vankeVvUser.setOid( map.get("oid")+"");
vankeVvUser.setOpenid( map.get("openid")+"");
vankeVvUser.setOrgid( map.get("orgId")+"");
vankeVvUser.setPhotourl( map.get("photoUrl")+"");
vankeVvUser.setTid( map.get("tid")+"");
vankeVvUser.setUid( map.get("uid")+"");
vankeVvUser.setUserid( map.get("userid")+"");
vankeVvUser.setUsername( map.get("username")+"");
vankeVvUser.setXtid( map.get("xtid")+"");
vankeVvUser.setIsAdmin( map.get("isAdmin")+"");
this.vankeVvUserMapper.insertSelective(vankeVvUser);
//根据部门名称判断是否存在此部门
VankeDepartmentExample example = new VankeDepartmentExample();
VankeDepartmentExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(vankeVvUser.getDepartment());
List<VankeDepartment> vdList = this.vankeDepartmentMapper.selectByExample(example);
//初始化部门对象
VankeDepartment vd = new VankeDepartment();
if(vdList == null || vdList.size() == 0 ){ // 如果不存在此部门 则新增部门
vd.setName(vankeVvUser.getDepartment());
}else{//否则存在
vd = vdList.get(0);
}
// 执行插入会员操作插入ums_member表
um = new UmsMember();
um.setUsername(vankeVvUser.getAccount());
um.setPhone(vankeVvUser.getMobile());
um.setCreateTime(new Date());
um.setUpdateDate(new Date());
um.setCreateDate(new Date());
um.setName(vankeVvUser.getUsername());
um.setEmail(vankeVvUser.getEmail());
um.setLoginTime(new Date());
um.setJobNo(vankeVvUser.getJobNo());
um.setDepartId(vd.getId());
this.umsMemberMapper.insertSelective(um);
return um;
}
return um;
}
}
...@@ -2,8 +2,11 @@ package com.macro.mall.service.vanke.impl; ...@@ -2,8 +2,11 @@ package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.vanke.VankeOutBoundRecordDao; import com.macro.mall.dao.vanke.VankeOutBoundRecordDao;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto; import com.macro.mall.model.dto.vanke.VankeOutboundRecordDto;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeOutboundRecordService; import com.macro.mall.service.vanke.IVankeOutboundRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -14,6 +17,8 @@ public class VankeOutboundRecordServiceImpl implements IVankeOutboundRecordServi ...@@ -14,6 +17,8 @@ public class VankeOutboundRecordServiceImpl implements IVankeOutboundRecordServi
@Resource @Resource
private VankeOutBoundRecordDao vankeOutBoundRecordDao; private VankeOutBoundRecordDao vankeOutBoundRecordDao;
@Autowired
private UmsAdminService umsAdminService;
/** /**
* 出库记录分页操作 * 出库记录分页操作
...@@ -24,13 +29,19 @@ public class VankeOutboundRecordServiceImpl implements IVankeOutboundRecordServi ...@@ -24,13 +29,19 @@ public class VankeOutboundRecordServiceImpl implements IVankeOutboundRecordServi
* @return * @return
*/ */
@Override @Override
public List<VankeOutboundRecordDto> getPageList(Integer pageNum, Integer pageSize, Long goodsCategoryId, Long departId, String memberName, String goodsMame){ public List<VankeOutboundRecordDto> getPageList(Integer pageNum, Integer pageSize, Long goodsCategoryId, Long departId,Long stockRoomId, String memberName, String goodsMame){
//获取管理员对象
UmsAdmin ua = umsAdminService.getCurrentUmsAdmin();
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
VankeOutboundRecordDto vord = new VankeOutboundRecordDto(); VankeOutboundRecordDto vord = new VankeOutboundRecordDto();
vord.setGoodsCategoryId(goodsCategoryId); vord.setGoodsCategoryId(goodsCategoryId);
vord.setDepartId(departId); vord.setDepartId(departId);
vord.setMemberName(memberName); vord.setMemberName(memberName);
vord.setGoodsName(goodsMame); vord.setGoodsName(goodsMame);
vord.setStockRoomId(stockRoomId);
if(ua.getMemberId() != null){//如果管理的会员id不为空说明是普通会员 只能查看自己的入库
vord.setReceptOutboundMemberId(ua.getMemberId());
}
return this.vankeOutBoundRecordDao.getPageList(vord); return this.vankeOutBoundRecordDao.getPageList(vord);
} }
......
...@@ -71,4 +71,9 @@ ...@@ -71,4 +71,9 @@
where a.username = #{username} where a.username = #{username}
and a.delete_status = 0 and a.delete_status = 0
</select> </select>
<select id="selectByMemberId" parameterType="java.lang.Long" resultMap="resultMap">
select * from ums_admin
where member_id = #{memberId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -41,6 +41,12 @@ ...@@ -41,6 +41,12 @@
<resultMap id="umsMemberBaseResultMap" type="com.macro.mall.domain.vo.UmsMemberVo" extends="BaseResultMap"> <resultMap id="umsMemberBaseResultMap" type="com.macro.mall.domain.vo.UmsMemberVo" extends="BaseResultMap">
<result column="level_name" jdbcType="VARCHAR" property="levelName"/> <result column="level_name" jdbcType="VARCHAR" property="levelName"/>
</resultMap> </resultMap>
<resultMap id="BaseResultMap2" type="com.macro.mall.model.dto.quanxing.UmsMemberDto" extends="com.macro.mall.mapper.UmsMemberMapper.BaseResultMap">
<result column="departName" jdbcType="VARCHAR" property="departName"/>
<result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName"/>
</resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
...@@ -843,4 +849,15 @@ ...@@ -843,4 +849,15 @@
where delete_status = 0 where delete_status = 0
and invitation_code_id = #{memberId} and invitation_code_id = #{memberId}
</select> </select>
<select id="selectUmsMember" parameterType="com.macro.mall.model.dto.quanxing.UmsMemberDto" resultMap="BaseResultMap2">
select a.* from ums_member a
left join vanke_department b ON a.depart_id = b.id
where a.delete_status = 0
</select>
<select id="selectUmsMemberByJobNo" parameterType="java.lang.String" resultMap="BaseResultMap">
select * from ums_member
where job_no = #{jobNo}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -42,4 +42,30 @@ ...@@ -42,4 +42,30 @@
and a.supplier_id = #{supplierId} and a.supplier_id = #{supplierId}
and a.goods_category_id = #{goodsCategoryId} and a.goods_category_id = #{goodsCategoryId}
</select> </select>
<select id="selectListLowStock" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" resultMap="BaseResultMap">
select a.*,b.name goodsCategoryName,c.name stockRoomName,d.supplier_name supplierName from vanke_goods a
left join vanke_goods_category b ON a.goods_category_id = b.id
left join vanke_stock_room c ON a.stock_room_id = c.id
left join vanke_supplier d ON a.supplier_id = d.id
where a.delete_status = 1
and a.goods_num &lt;= #{goodsNum}
<if test="stockRoomId != null">
a.stock_room_id = #{stockRoomId}
</if>
order by a.goods_num asc
limit 0,5
</select>
<select id="selectLowStock" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" resultType="java.lang.Integer">
select count(*) from vanke_goods
where delete_status = 1
and goods_num &lt;= #{goodsNum}
<if test="stockRoomId != null">
stock_room_id = #{stockRoomId}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -19,4 +19,14 @@ ...@@ -19,4 +19,14 @@
and date_format(createtime,'%Y-%m-%d') = #{queryTime} and date_format(createtime,'%Y-%m-%d') = #{queryTime}
</select> </select>
<select id="selectGoodsStockCount" resultType="java.lang.Integer" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam">
select IFNULL(sum(goods_num),0) from vanke_goods
where delete_status = 1
<if test="stockRoomId != null ">
and stock_room_id = #{stockRoomId}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
<result column="backInboundName" jdbcType="VARCHAR" property="backInboundName" /> <result column="backInboundName" jdbcType="VARCHAR" property="backInboundName" />
<result column="goodsName" jdbcType="VARCHAR" property="goodsName" /> <result column="goodsName" jdbcType="VARCHAR" property="goodsName" />
<result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" /> <result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
<result column="totalNum" jdbcType="INTEGER" property="totalNum" />
</resultMap> </resultMap>
<select id="getPageList" parameterType="com.macro.mall.model.dto.vanke.VankeInboundRecordDto" resultMap="BaseResultMap"> <select id="getPageList" parameterType="com.macro.mall.model.dto.vanke.VankeInboundRecordDto" resultMap="BaseResultMap">
select select
a.*,b.name receptInboundName,c.name backInboundName,d.name goodsName,e.name stockRoomName,f.name memberName,g.name departmentName a.*,b.name receptInboundName,c.name backInboundName,d.name goodsName,e.name stockRoomName
from vanke_inbound_record a from vanke_inbound_record a
left join ums_member b ON a.recept_inbound_member_id = b.id left join ums_member b ON a.recept_inbound_member_id = b.id
left join ums_member c ON a.back_inbound_member_id = c.id left join ums_member c ON a.back_inbound_member_id = c.id
...@@ -20,8 +22,35 @@ ...@@ -20,8 +22,35 @@
<if test="goodsName != null and goodsName!=''"> <if test="goodsName != null and goodsName!=''">
and d.name like CONCAT(#{goodsName},'%') and d.name like CONCAT(#{goodsName},'%')
</if> </if>
<if test="receptInboundMemberId != null">
and a.recept_inbound_member_id = #{receptInboundMemberId}
</if>
</select> </select>
<select id="selectInboundCountByQueryTime" resultType="java.lang.Integer" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" >
select IFNULL(sum(inbound_num),0) from vanke_inbound_record
where delete_status = 1
and date_format(createtime,'%Y-%m-%d') = #{queryTime}
<if test="memberId != null">
and recept_inbound_member_id = #{memberId}
</if>
</select>
<select id="selectInBoundByCategory" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" resultMap="BaseResultMap">
SELECT c.* ,sum(c.inbound_num) totalNum FROM(
select
a.*,b.goods_category_id,h.name categoryName
from vanke_inbound_record a
left join vanke_goods b ON a.goods_id = b.id
left join vanke_goods_category h ON b.goods_category_id = h.id
where a.delete_status = 1
and #{startTime} &lt;= date_format( a.createtime, '%Y-%m-%d' )
and date_format( a.createtime, '%Y-%m-%d' ) &lt;= #{endTime}
<if test="stockRoomId != null">
and a.stock_room_id = #{stockRoomId}
</if>
) c
GROUP BY c.goods_category_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
<result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" /> <result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" />
<result column="memberName" jdbcType="VARCHAR" property="memberName" /> <result column="memberName" jdbcType="VARCHAR" property="memberName" />
<result column="departmentName" jdbcType="VARCHAR" property="departmentName" /> <result column="departmentName" jdbcType="VARCHAR" property="departmentName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
<result column="totalNum" jdbcType="INTEGER" property="totalNum" />
</resultMap> </resultMap>
<select id="getPageList" parameterType="com.macro.mall.model.dto.vanke.VankeOutboundRecordDto" resultMap="BaseResultMap"> <select id="getPageList" parameterType="com.macro.mall.model.dto.vanke.VankeOutboundRecordDto" resultMap="BaseResultMap">
select select
a.*,b.name receptOutboundName,c.name backOutboundName,d.name goodsName,e.name stockRoomName,f.name memberName,g.name departmentName a.*,b.name receptOutboundName,c.name backOutboundName,d.name goodsName,e.name stockRoomName,f.name memberName,g.name departmentName,h.name categoryName
from vanke_outbound_record a from vanke_outbound_record a
left join ums_member b ON a.recept_outbound_member_id = b.id left join ums_member b ON a.recept_outbound_member_id = b.id
left join ums_member c ON a.back_outbound_member_id = c.id left join ums_member c ON a.back_outbound_member_id = c.id
...@@ -20,7 +22,7 @@ ...@@ -20,7 +22,7 @@
left join vanke_stock_room e ON a.stock_room_id = e.id left join vanke_stock_room e ON a.stock_room_id = e.id
left join ums_member f ON a.member_id = f.id left join ums_member f ON a.member_id = f.id
left join vanke_department g ON a.depart_id = g.id left join vanke_department g ON a.depart_id = g.id
left join vanke_goods_category h ON a. left join vanke_goods_category h ON a.goods_category_id = h.id
where a.delete_status = 1 where a.delete_status = 1
<if test="goodsCategoryId != null"> <if test="goodsCategoryId != null">
and a.goods_category_id = #{goodsCategoryId} and a.goods_category_id = #{goodsCategoryId}
...@@ -28,14 +30,78 @@ ...@@ -28,14 +30,78 @@
<if test="departId != null"> <if test="departId != null">
and a.depart_id = #{departId} and a.depart_id = #{departId}
</if> </if>
<if test="stockRoomId != null">
and a.stock_room_id = #{stockRoomId}
</if>
<if test="goodsName != null and goodsName!=''"> <if test="goodsName != null and goodsName!=''">
and d.name like CONCAT(#{goodsName},'%') and d.name like CONCAT(#{goodsName},'%')
</if> </if>
<if test="memberName != null and memberName!=''"> <if test="memberName != null and memberName!=''">
and f.name like CONCAT(#{memberName},'%') and f.name like CONCAT(#{memberName},'%')
</if> </if>
<if test="receptOutboundMemberId != null">
and a.recept_outbound_member_id = #{receptOutboundMemberId}
</if>
</select> </select>
<select id="selectOutboundCountByQueryTime" resultType="java.lang.Integer" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" >
select IFNULL(sum(outbound_num),0) from vanke_outbound_record
where delete_status = 1
and date_format(createtime,'%Y-%m-%d') = #{queryTime}
<if test="memberId != null">
and recept_outbound_member_id = #{memberId}
</if>
</select>
<select id="selectMemberCountByQueryTime" resultType="java.lang.Integer" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" >
SELECT
IFNULL(count(*),0)
from
(
SELECT
*
FROM
vanke_outbound_record
WHERE
delete_status = 1
and date_format( createtime, '%Y-%m-%d' ) = #{queryTime}
<if test="memberId != null">
and recept_outbound_member_id = #{memberId}
</if>
GROUP BY member_id
)a
</select>
<select id="selectOutBoundByCategory" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" resultMap="BaseResultMap">
SELECT b.* ,sum(b.outbound_num) totalNum FROM(
select
a.*,h.name categoryName
from vanke_outbound_record a
left join vanke_goods_category h ON a.goods_category_id = h.id
where a.delete_status = 1
and #{startTime} &lt;= date_format( a.createtime, '%Y-%m-%d' )
and date_format( a.createtime, '%Y-%m-%d' ) &lt;= #{endTime}
<if test="stockRoomId != null">
and a.stock_room_id = #{stockRoomId}
</if>
) b
GROUP BY b.goods_category_id
</select>
<select id="selectOutBoundByDepartId" parameterType="com.macro.mall.model.dto.vanke.StatiscalQueryParam" resultMap="BaseResultMap">
SELECT b.* ,sum(b.outbound_num) totalNum FROM(
select
a.*,h.name departmentName
from vanke_outbound_record a
left join vanke_department h ON a.goods_category_id = h.id
where a.delete_status = 1
and #{startTime} &lt;= date_format( a.createtime, '%Y-%m-%d' )
and date_format( a.createtime, '%Y-%m-%d' ) &lt;= #{endTime}
<if test="stockRoomId != null">
and a.stock_room_id = #{stockRoomId}
</if>
) b
GROUP BY b.depart_id
</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.VankeVvUserDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.VankeVvUser" extends="com.macro.mall.mapper.VankeVvUserMapper.BaseResultMap">
</resultMap>
<select id="selectByJobNo" parameterType="java.lang.String" resultMap="BaseResultMap">
select * from FROM vanke_vv_user
where job_no = #{jobNo}
</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