Commit 65956a4c authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/master'

parents 31f355cf 33675910
package com.github.wxiaoqi.security.admin.dto; package com.github.wxiaoqi.security.admin.dto;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Set; import java.util.Set;
...@@ -8,6 +10,8 @@ import java.util.Set; ...@@ -8,6 +10,8 @@ import java.util.Set;
* 用户信息表 * 用户信息表
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
public class AppUserManageDTO { public class AppUserManageDTO {
/** /**
* 每页条数 * 每页条数
......
package com.github.wxiaoqi.security.admin.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* 员工变更记录表
*/
@Data
public class AppUserPositionChangeRecordDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Integer id;
/**
* 用户id
*/
private String phone;
/**
* 用户名称
*/
private String userName;
/**
* 变更后所在公司ID
*/
private Integer newCompanyId;
/**
* 变更前所在公司ID
*/
private Integer oldCompanyId;
/**
* 变更后所在公司名称
*/
private String newCompanyName;
/**
* 变更前所在公司名称
*/
private String oldCompanyName;
/**
* 旧职位ID
*/
private Integer oldJobId;
/**
* 新职位ID
*/
private Integer newJobId;
/**
* 新职位名称
*/
private String newJobName;
/**
* 旧职位名称
*/
private String oldJobName;
/**
* 操作人名称
*/
private Integer operatorId;
/**
* 操作时间
*/
private Timestamp crtTime;
/**
* 状态
* 1:入职;2:职位变更;3:身份变更 4:公司所属变更;5离职
*/
private Integer jobRemark;
/***
* 旧身份ID
*/
private Integer oldPositionId;
/***
* 新身份ID
*/
private Integer newPositionId;
/***
* 新身份名称
*/
private String newPositionName;
/***
* 旧身份名称
*/
private String oldPositionName;
/**
* 员工职位、所属公司、离职、入职等的实际上任时间
*/
private Timestamp relTime;
}
...@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -20,11 +22,9 @@ public class AppUserPositionTempDTO { ...@@ -20,11 +22,9 @@ public class AppUserPositionTempDTO {
@ApiModelProperty(value = "手机号码") @ApiModelProperty(value = "手机号码")
private String phone; private String phone;
@ApiModelProperty(value = "姓名") @ApiModelProperty(value = "姓名")
private String name; private String name;
@ApiModelProperty(value = "身份id") @ApiModelProperty(value = "身份id")
private Integer positionId; private Integer positionId;
...@@ -37,4 +37,21 @@ public class AppUserPositionTempDTO { ...@@ -37,4 +37,21 @@ public class AppUserPositionTempDTO {
@ApiModelProperty(value = "分公司") @ApiModelProperty(value = "分公司")
private String companyName; private String companyName;
@ApiModelProperty(value = "变动操作内容")
private Integer ChangeStatus;
@ApiModelProperty(value = "员工职位、所属公司、离职、入职等的实际上任时间")
private Timestamp relTime;
@ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel;
@ApiModelProperty(value = "员工职位状态:0-正常;1-离职")
private Integer isQuit;
@ApiModelProperty(value = "用户id")
private Integer userId;
} }
...@@ -15,4 +15,5 @@ public class AppUserPositionTempFindDTO extends PageParam { ...@@ -15,4 +15,5 @@ public class AppUserPositionTempFindDTO extends PageParam {
private String name; private String name;
private Integer status; private Integer status;
private Integer companyId; private Integer companyId;
private Integer positionId;
} }
package com.github.wxiaoqi.security.admin.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
/**
* 员工变更记录表
*/
@Table(name = "app_user_position_change_record")
@Data
public class AppUserPositionChangeRecord implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")//此处加上注解
@ApiModelProperty("主键id")
private Integer id;
@ApiModelProperty("用户id")
@Column(name = "phone")
private String phone;
@ApiModelProperty("用户名称")
@Column(name = "user_name")
private String userName;
@ApiModelProperty("变更后所在公司ID")
@Column(name = "new_company_id")
private Integer newCompanyId;
@ApiModelProperty("变更前所在公司ID")
@Column(name = "old_company_id")
private Integer oldCompanyId;
@ApiModelProperty("变更后所在公司名称")
@Column(name = "new_company_name")
private String newCompanyName;
@ApiModelProperty("变更前所在公司名称")
@Column(name = "old_company_name")
private String oldCompanyName;
@ApiModelProperty("旧职位ID")
@Column(name = "old_job_id")
private Integer oldJobId;
@ApiModelProperty("新职位ID")
@Column(name = "new_job_id")
private Integer newJobId;
@ApiModelProperty("操作人名称")
@Column(name = "operator_id")
private Integer operatorId;
@ApiModelProperty("操作时间")
@Column(name = "crt_time")
private Timestamp crtTime;
@ApiModelProperty("员工职位、所属公司、离职、入职等的实际上任时间")
@Column(name = "rel_time")
private Timestamp relTime;
@ApiModelProperty("新身份ID")
@Column(name = "new_position_id")
private Integer newPositionId;
@ApiModelProperty("旧身份ID")
@Column(name = "old_position_id")
private Integer oldPositionId;
@ApiModelProperty("1:入职;2:职位变更;3:身份变更 4:公司所属变更;5离职")
@Column(name = "job_remark")
private Integer jobRemark;
@ApiModelProperty("新身份名称")
@Column(name = "new_position_name")
private String newPositionName;
@ApiModelProperty("旧身份名称")
@Column(name = "old_position_name")
private String oldPositionName;
@ApiModelProperty("新职位名称")
@Column(name = "new_job_name")
private String newJobName;
@ApiModelProperty("旧职位名称")
@Column(name = "old_job_name")
private String oldJobName;
}
...@@ -75,5 +75,9 @@ public class AppUserPositionTemp implements Serializable { ...@@ -75,5 +75,9 @@ public class AppUserPositionTemp implements Serializable {
@ApiModelProperty(value = "是否删除:0-正常;1-删除") @ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel; private Integer isDel;
@Column(name = "is_quit")
@ApiModelProperty(value = "员工职位状态:0-正常;1-离职")
private Integer isQuit;
} }
...@@ -46,6 +46,8 @@ public class BaseUserMemberExport implements Serializable { ...@@ -46,6 +46,8 @@ public class BaseUserMemberExport implements Serializable {
private Integer beforeDiscount; private Integer beforeDiscount;
@Column(name = "source") @Column(name = "source")
private Integer source; private Integer source;
@Column(name = "user_id")
private Integer userId;
} }
...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.bo.UserStaffBo; ...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO; import com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember; import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel; import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
...@@ -185,4 +184,10 @@ public interface UserFeign { ...@@ -185,4 +184,10 @@ public interface UserFeign {
@GetMapping("/public/getUsersByUserIdList") @GetMapping("/public/getUsersByUserIdList")
ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds); ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds);
@GetMapping("/app/user/collect/exist")
boolean isCollectionByTypeAndTypeId(@RequestParam("userId") Integer userId,
@RequestParam(value = "type") int type,
@RequestParam("id") Integer typId);
} }
...@@ -14,12 +14,14 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO; ...@@ -14,12 +14,14 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
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 tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* ${DESCRIPTION} * ${DESCRIPTION}
...@@ -105,17 +107,13 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl ...@@ -105,17 +107,13 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
} }
public boolean isCollectionByTypeAndTypeId(Integer userId,int type, Integer typeId) {
AppUserCollect appUserCollect = new AppUserCollect();
appUserCollect.setType(type);
appUserCollect.setTypeId(typeId);
appUserCollect.setUserId(userId);
appUserCollect.setIsDel(0);
List<AppUserCollect> collect = mapper.select(appUserCollect);
return CollectionUtils.isNotEmpty(collect);
}
} }
...@@ -95,13 +95,13 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -95,13 +95,13 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
AppUserDetail entity = new AppUserDetail(); AppUserDetail entity = new AppUserDetail();
Example example = new Example(AppUserDetail.class); Example example = new Example(AppUserDetail.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userid",userVo.getUserid()); criteria.andEqualTo("userid", userVo.getUserid());
try { try {
BeanUtils.copyProperties(entity, userVo); BeanUtils.copyProperties(entity, userVo);
if (entity != null) { if (entity != null) {
entity.setUpdHost(AppPermissionService.getIp()); entity.setUpdHost(AppPermissionService.getIp());
entity.setUpdatetime(Instant.now().toEpochMilli() / 1000L); entity.setUpdatetime(Instant.now().toEpochMilli() / 1000L);
mapper.updateByExampleSelective(entity,example); mapper.updateByExampleSelective(entity, example);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -134,7 +134,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -134,7 +134,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
@CacheClear(pre = "user{1}") @CacheClear(pre = "user{1}")
public void updateUserPositionByUserId(Integer userId, Integer positionId) { public void updateUserPositionByUserId(Integer userId, Integer positionId) {
mapper.updateUserPositionByUserId(userId,positionId); mapper.updateUserPositionByUserId(userId, positionId);
} }
public AppUserInfoVo findUserInfoByCode(String code) { public AppUserInfoVo findUserInfoByCode(String code) {
...@@ -144,7 +144,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -144,7 +144,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
appUserDetail.setCode(code); appUserDetail.setCode(code);
AppUserDetail userDetail = mapper.selectOne(appUserDetail); AppUserDetail userDetail = mapper.selectOne(appUserDetail);
if (userDetail==null){ if (userDetail == null) {
return appUserInfoVo; return appUserInfoVo;
} }
appUserInfoVo.setHeadimgurl(userDetail.getHeadimgurl()); appUserInfoVo.setHeadimgurl(userDetail.getHeadimgurl());
...@@ -156,19 +156,19 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -156,19 +156,19 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
return mapper.getUserIdByUsername(keywords); return mapper.getUserIdByUsername(keywords);
} }
public void updateByUserId(AccountBindDTO accountBindDTO,Integer userId) { public void updateByUserId(AccountBindDTO accountBindDTO, Integer userId) {
AppUserDetail appUserDetail = new AppUserDetail(); AppUserDetail appUserDetail = new AppUserDetail();
if (accountBindDTO.getType().equals("wx")){ if (accountBindDTO.getType().equals("wx")) {
appUserDetail.setWxNickname(accountBindDTO.getNickName()); appUserDetail.setWxNickname(accountBindDTO.getNickName());
} }
if(accountBindDTO.getType().equals("q")){ if (accountBindDTO.getType().equals("q")) {
appUserDetail.setQqNickname(accountBindDTO.getNickName()); appUserDetail.setQqNickname(accountBindDTO.getNickName());
} }
Example example = new Example(AppUserDetail.class); Example example = new Example(AppUserDetail.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userid",userId); criteria.andEqualTo("userid", userId);
mapper.updateByExampleSelective(appUserDetail,example); mapper.updateByExampleSelective(appUserDetail, example);
} }
public List<AppUserVo> getUserByUserIds(List<Integer> ids) { public List<AppUserVo> getUserByUserIds(List<Integer> ids) {
...@@ -177,21 +177,21 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -177,21 +177,21 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
public List<UserStaffBo> findAllStaffs() { public List<UserStaffBo> findAllStaffs() {
List<UserStaffBo> userStaffBos = mapper.selectAllStaffs(); List<UserStaffBo> userStaffBos = mapper.selectAllStaffs();
return CollectionUtils.isEmpty(userStaffBos)? Collections.EMPTY_LIST:userStaffBos; return CollectionUtils.isEmpty(userStaffBos) ? Collections.EMPTY_LIST : userStaffBos;
} }
public List<AppUserVo> getUserByUserIdList(List<Integer> userIds) { public List<AppUserVo> getUserByUserIdList(List<Integer> userIds) {
List<AppUserVo> appUserVos = mapper.getUserByUserIdList(userIds); List<AppUserVo> appUserVos = mapper.getUserByUserIdList(userIds);
return CollectionUtils.isEmpty(appUserVos)?Collections.EMPTY_LIST:appUserVos; return CollectionUtils.isEmpty(appUserVos) ? Collections.EMPTY_LIST : appUserVos;
} }
public PageDataVO<UserStaffBo> findAllStaffsByCompanyIdAndPostionIdWithPage(StaffStatisticsFindDTO staffStatisticsFindDTO) { public PageDataVO<UserStaffBo> findAllStaffsByCompanyIdAndPostionIdWithPage(StaffStatisticsFindDTO staffStatisticsFindDTO) {
return PageDataVO.pageInfo(staffStatisticsFindDTO.getPage(),staffStatisticsFindDTO.getLimit(),()->mapper.findAllStaffsByCompanyIdAndPostionId(staffStatisticsFindDTO)); return PageDataVO.pageInfo(staffStatisticsFindDTO.getPage(), staffStatisticsFindDTO.getLimit(), () -> mapper.findAllStaffsByCompanyIdAndPostionId(staffStatisticsFindDTO));
} }
public List<UserStaffBo> findStaffsByIdsAndCompanyAndPostion(StaffStatisticsFindDTO staffStatisticsFindDTO) { public List<UserStaffBo> findStaffsByIdsAndCompanyAndPostion(StaffStatisticsFindDTO staffStatisticsFindDTO) {
List<UserStaffBo> staffBos = mapper.findAllStaffsByCompanyIdAndPostionId(staffStatisticsFindDTO); List<UserStaffBo> staffBos = mapper.findAllStaffsByCompanyIdAndPostionId(staffStatisticsFindDTO);
return CollectionUtils.isEmpty(staffBos)?Collections.EMPTY_LIST:staffBos; return CollectionUtils.isEmpty(staffBos) ? Collections.EMPTY_LIST : staffBos;
} }
public AppUserVo findByCode(String code) { public AppUserVo findByCode(String code) {
...@@ -199,7 +199,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -199,7 +199,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
AppUserDetail appUserDetail = new AppUserDetail(); AppUserDetail appUserDetail = new AppUserDetail();
appUserDetail.setCode(code); appUserDetail.setCode(code);
appUserDetail = mapper.selectOne(appUserDetail); appUserDetail = mapper.selectOne(appUserDetail);
org.springframework.beans.BeanUtils.copyProperties(appUserDetail,appUserVo); org.springframework.beans.BeanUtils.copyProperties(appUserDetail, appUserVo);
return appUserVo; return appUserVo;
} }
...@@ -207,4 +207,19 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -207,4 +207,19 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
return mapper.getUser(userId); return mapper.getUser(userId);
} }
/**
* 判断员工是否是APP用户
*
* @return
*/
public AppUserDetail checkeIsAppUser(Integer userid) {
Example example = new Example(AppUserDetail.class);
example.createCriteria().andEqualTo("userid", userid);
List<AppUserDetail> appUserDetailList = mapper.selectByExample(example);
if (appUserDetailList != null && appUserDetailList.size() != 0) {
return appUserDetailList.get(0);
}
return null;
}
} }
...@@ -66,6 +66,10 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -66,6 +66,10 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
@Autowired @Autowired
private AppUserSellingWaterBiz appUserSellingWaterBiz; private AppUserSellingWaterBiz appUserSellingWaterBiz;
@Autowired
private AppUserPositionTempBiz appUserPositionTempBiz;
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
@Override @Override
public void insertSelective(AppUserLogin entity) { public void insertSelective(AppUserLogin entity) {
...@@ -334,7 +338,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -334,7 +338,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public List<AppUserLogin> getUserByUsernameAndRealName(String username, String realName) { public List<AppUserLogin> getUserByUsernameAndRealName(String username, String realName) {
return mapper.getUserByUsernameAndRealName(username,realName); return mapper.getUserByUsernameAndRealName(username, realName);
} }
...@@ -410,7 +414,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -410,7 +414,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public List<Integer> findAppuser(String phone, String leaderPhone, String name) { public List<Integer> findAppuser(String phone, String leaderPhone, String name) {
List<Integer> memberIds = null; List<Integer> memberIds = null;
//1.根据leader手机号查询userid //1.根据leader手机号查询userid
boolean isNoNullLeaderPhone = StringUtils.isNotEmpty(leaderPhone) && leaderPhone.trim().length()>0; boolean isNoNullLeaderPhone = StringUtils.isNotEmpty(leaderPhone) && leaderPhone.trim().length() > 0;
if (isNoNullLeaderPhone) { if (isNoNullLeaderPhone) {
List<AppUserLogin> appUserLogins = mapper.selectbyPhones(Arrays.asList(leaderPhone)); List<AppUserLogin> appUserLogins = mapper.selectbyPhones(Arrays.asList(leaderPhone));
Integer leaderId = null; Integer leaderId = null;
...@@ -420,18 +424,18 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -420,18 +424,18 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
leaderId = appUserLogins.get(0).getId(); leaderId = appUserLogins.get(0).getId();
//2.根据leader userId查询下级 userid //2.根据leader userId查询下级 userid
if (Objects.nonNull(leaderId)) { if (Objects.nonNull(leaderId)) {
memberIds = appUserSellingWaterBiz.findMemberIdByLeaderIdAndOrdreType(leaderId,3); memberIds = appUserSellingWaterBiz.findMemberIdByLeaderIdAndOrdreType(leaderId, 3);
if(CollectionUtils.isEmpty(memberIds)){ if (CollectionUtils.isEmpty(memberIds)) {
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
} }
} }
List<Integer> userIds = mapper.findAppUser(phone, name, memberIds); List<Integer> userIds = mapper.findAppUser(phone, name, memberIds);
return userIds==null?Collections.EMPTY_LIST:userIds; return userIds == null ? Collections.EMPTY_LIST : userIds;
} }
public List<UserBo> findUserDetailInfo(List<UserBo> userBos) { public List<UserBo> findUserDetailInfo(List<UserBo> userBos) {
Map<String, Integer> userIdAndFacilitateIdMap = userBos.stream().filter(x->Objects.nonNull(x.getFacilitateId())).collect(Collectors.toMap(UserBo::getOrderNo, UserBo::getFacilitateId)); Map<String, Integer> userIdAndFacilitateIdMap = userBos.stream().filter(x -> Objects.nonNull(x.getFacilitateId())).collect(Collectors.toMap(UserBo::getOrderNo, UserBo::getFacilitateId));
List<Integer> userIdList = userBos.stream().map(UserBo::getUserId).distinct().collect(Collectors.toList()); List<Integer> userIdList = userBos.stream().map(UserBo::getUserId).distinct().collect(Collectors.toList());
//查询上级人 //查询上级人
...@@ -439,13 +443,13 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -439,13 +443,13 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
Map<Integer, Integer> memberIdAndParentMap = appUserRelationList.stream().collect(Collectors.toMap(AppUserRelation::getUserId, AppUserRelation::getParentId)); Map<Integer, Integer> memberIdAndParentMap = appUserRelationList.stream().collect(Collectors.toMap(AppUserRelation::getUserId, AppUserRelation::getParentId));
List<Integer> uids = new ArrayList<>(); List<Integer> uids = new ArrayList<>();
uids.addAll(userIdAndFacilitateIdMap==null?Collections.EMPTY_LIST:userIdList); uids.addAll(userIdAndFacilitateIdMap == null ? Collections.EMPTY_LIST : userIdList);
uids.addAll(userIdAndFacilitateIdMap==null?Collections.EMPTY_LIST:userIdAndFacilitateIdMap.values()); uids.addAll(userIdAndFacilitateIdMap == null ? Collections.EMPTY_LIST : userIdAndFacilitateIdMap.values());
uids.addAll(memberIdAndParentMap==null?Collections.EMPTY_LIST:memberIdAndParentMap.values()); uids.addAll(memberIdAndParentMap == null ? Collections.EMPTY_LIST : memberIdAndParentMap.values());
List<UserBo> userBoList = mapper.selectByUserIds(uids); List<UserBo> userBoList = mapper.selectByUserIds(uids);
Map<Integer, UserBo> userMap = userBoList==null?Collections.EMPTY_MAP:userBoList.stream().collect(Collectors.toMap(UserBo::getUserId, Function.identity())); Map<Integer, UserBo> userMap = userBoList == null ? Collections.EMPTY_MAP : userBoList.stream().collect(Collectors.toMap(UserBo::getUserId, Function.identity()));
if (userMap.isEmpty()){ if (userMap.isEmpty()) {
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
...@@ -468,4 +472,21 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -468,4 +472,21 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
} }
return userBos; return userBos;
} }
@CacheClear(pre = "user{1}")
public void updateUserPosition(Integer userId, Integer positionId, Integer operatorId) {
AppUserLogin appUserLogin = selectById(userId);
if (appUserLogin != null) {
String phone = appUserLogin.getUsername();
appUserPositionTempBiz.findUserPositionTemp(userId, positionId, operatorId);
}
appUserDetailBiz.updateUserPositionByUserId(userId, positionId);
}
@CacheClear(pre = "user{1}")
public void updateUserPosition(Integer userId, Integer positionId) {
appUserDetailBiz.updateUserPositionByUserId(userId, positionId);
}
} }
...@@ -7,7 +7,6 @@ import com.github.wxiaoqi.security.admin.entity.AppUserDetail; ...@@ -7,7 +7,6 @@ import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.mapper.AppUserDetailMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserDetailMapper;
import com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper;
import com.github.wxiaoqi.security.admin.mapper.BaseUserMemberMapper;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo; import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -26,7 +25,7 @@ import tk.mybatis.mapper.entity.Example; ...@@ -26,7 +25,7 @@ import tk.mybatis.mapper.entity.Example;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -55,6 +54,10 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -55,6 +54,10 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
* @return * @return
*/ */
public PageInfo<AppUserManageVo> findAllByQuery(AppUserManageDTO appUserManageDTO) { public PageInfo<AppUserManageVo> findAllByQuery(AppUserManageDTO appUserManageDTO) {
if (Objects.nonNull(appUserManageDTO.getRegistrationTimeEnd())){
long registerEndTime = appUserManageDTO.getRegistrationTimeEnd()+(24*60*60);
appUserManageDTO.setRegistrationTimeEnd(registerEndTime);
}
PageHelper.startPage(appUserManageDTO.getPage(), appUserManageDTO.getLimit()); PageHelper.startPage(appUserManageDTO.getPage(), appUserManageDTO.getLimit());
List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO); List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO);
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos); PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
......
package com.github.wxiaoqi.security.admin.biz;
import com.alibaba.druid.sql.visitor.functions.If;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionChangeRecordDTO;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionChangeRecord;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp;
import com.github.wxiaoqi.security.admin.mapper.AppUserPositionChangeRecordMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.NonNull;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.select.Evaluator;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Transactional
@Service("appUserPositionChangeRecordBiz")
public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChangeRecordMapper, AppUserPositionChangeRecord> {
@Autowired
private AppUserPositionBiz appUserPositionBiz;
@Autowired
private AppUserJobLevelBiz appUserJobLevelBiz;
public static final int USER_ADD_COMPANY = 1;
public static final int JOB_CHANGE = 2;
public static final int POSITION_CHANGE = 3;
public static final int COMPANY_CHANGE = 4;
public static final int USER_LEAVE_COMPANT = 5;
public static final int USER_AND_ADD_COMPANY = 6;
/**
* 变更记录表插入
*
* @param userPositionTemp
*/
public void addPositionChangeRecord(AppUserPositionTemp userPositionTemp, AppUserPositionTemp oldData, Integer operatorId, Timestamp relTime) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
if (!(userPositionTemp.getIsQuit().equals(oldData.getIsQuit()))) {
appUserPositionChangeRecord.setJobRemark(USER_LEAVE_COMPANT);
}
//状态1:职位变动
if (!(userPositionTemp.getJobId().equals(oldData.getJobId()))) {
appUserPositionChangeRecord.setOldJobId(oldData.getJobId());
appUserPositionChangeRecord.setNewJobId(userPositionTemp.getJobId());
appUserPositionChangeRecord.setJobRemark(JOB_CHANGE);
findUserJobName(appUserPositionChangeRecord);
}
//状态2:身份变动
if (!(userPositionTemp.getPositionId().equals(oldData.getPositionId()))) {
appUserPositionChangeRecord.setOldPositionId(oldData.getPositionId());
appUserPositionChangeRecord.setNewPositionId(userPositionTemp.getPositionId());
appUserPositionChangeRecord.setJobRemark(POSITION_CHANGE);
findUserPositionName(appUserPositionChangeRecord);
}
//状态3:公司变动调整
if (!(userPositionTemp.getCompanyId().equals(oldData.getCompanyId()))) {
appUserPositionChangeRecord.setOldCompanyId(oldData.getCompanyId());
appUserPositionChangeRecord.setOldCompanyName(oldData.getCompanyName());
appUserPositionChangeRecord.setNewCompanyId(userPositionTemp.getCompanyId());
appUserPositionChangeRecord.setNewCompanyName(userPositionTemp.getCompanyName());
appUserPositionChangeRecord.setJobRemark(COMPANY_CHANGE);
}
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
appUserPositionChangeRecord.setRelTime(relTime);
appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
appUserPositionChangeRecord.setOperatorId(operatorId);
mapper.insert(appUserPositionChangeRecord);
}
/**
* 入职时插入记录表
*
* @param userPositionTemp
* @param updUserId
*/
public void addJoinJobRecord(AppUserPositionTempDTO userPositionTemp, Integer updUserId) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setRelTime(userPositionTemp.getRelTime());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
appUserPositionChangeRecord.setJobRemark(USER_ADD_COMPANY);
appUserPositionChangeRecord.setOperatorId(updUserId);
mapper.insert(appUserPositionChangeRecord);
}
/**
* 员工复职
*
* @param userPositionTemp
* @param updUserId
*/
public void andAddJoinJobRecord(AppUserPositionTempDTO userPositionTemp, Integer updUserId) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
if (userPositionTemp.getPositionId() != null) {
appUserPositionChangeRecord.setNewPositionId(userPositionTemp.getPositionId());
}
appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setRelTime(userPositionTemp.getRelTime());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
appUserPositionChangeRecord.setJobRemark(USER_AND_ADD_COMPANY);
appUserPositionChangeRecord.setOperatorId(updUserId);
mapper.insert(appUserPositionChangeRecord);
}
/**
* APP用户修改身份
*
* @param userPositionTemp
* @param updUserId
*/
public void andAddJoinJobRecord(AppUserPositionTemp userPositionTemp, Integer updUserId) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
if (userPositionTemp.getPositionId() != null) {
appUserPositionChangeRecord.setNewPositionId(userPositionTemp.getPositionId());
}
appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
appUserPositionChangeRecord.setJobRemark(USER_AND_ADD_COMPANY);
appUserPositionChangeRecord.setOperatorId(updUserId);
mapper.insert(appUserPositionChangeRecord);
}
/**
* 查询新旧职位名称
* zyh
*
* @param appUserPositionChangeRecord
* @return
*/
public AppUserPositionChangeRecord findUserJobName(AppUserPositionChangeRecord appUserPositionChangeRecord) {
appUserPositionChangeRecord.setNewJobName(appUserJobLevelBiz.selectById(appUserPositionChangeRecord.getNewJobId()).getName());
appUserPositionChangeRecord.setOldJobName(appUserJobLevelBiz.selectById(appUserPositionChangeRecord.getOldJobId()).getName());
return appUserPositionChangeRecord;
}
/**
* 查询新旧身份名称
* zyh
*
* @param appUserPositionChangeRecord
* @return
*/
public AppUserPositionChangeRecord findUserPositionName(AppUserPositionChangeRecord appUserPositionChangeRecord) {
appUserPositionChangeRecord.setOldPositionName(appUserPositionBiz.selectById(appUserPositionChangeRecord.getOldPositionId()).getName());
appUserPositionChangeRecord.setNewPositionName(appUserPositionBiz.selectById(appUserPositionChangeRecord.getNewPositionId()).getName());
return appUserPositionChangeRecord;
}
/**
* 查询员工信息变更记录表
*/
public List<AppUserPositionChangeRecordDTO> findPositionChangeRecord(AppUserPositionTemp userPositionTemp) {
Example example = new Example(AppUserPositionChangeRecord.class);
example.createCriteria().andEqualTo("phone", userPositionTemp.getPhone());
List<AppUserPositionChangeRecord> list = selectByExample(example);
List<AppUserPositionChangeRecordDTO> listAppUserPositionChangeRecordDTO = new ArrayList<>();
list.stream().forEach(x -> {
AppUserPositionChangeRecordDTO appUserPositionChangeRecordDTO = new AppUserPositionChangeRecordDTO();
BeanUtils.copyProperties(x, appUserPositionChangeRecordDTO);
listAppUserPositionChangeRecordDTO.add(appUserPositionChangeRecordDTO);
});
return listAppUserPositionChangeRecordDTO;
}
}
...@@ -79,7 +79,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -79,7 +79,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
@Cache(key = "user:member{1}") @Cache(key = "user:member{1}")
public UserMemberVo getMemberInfoByUserId(Integer userId) { public UserMemberVo getMemberInfoByUserId(Integer userId) {
return mapper.getInfoByUserId(userId); return mapper.getInfoByUserId(userId);
} }
//更新会员信息 //更新会员信息
@Override @Override
...@@ -287,6 +287,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -287,6 +287,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
baseUserMember.setRentFreeDays(days); baseUserMember.setRentFreeDays(days);
getMyBiz().updateSelectiveById(baseUserMember); getMyBiz().updateSelectiveById(baseUserMember);
} }
AppUserVo userVo = detailBiz.getUserInfoById(userId); AppUserVo userVo = detailBiz.getUserInfoById(userId);
if (userVo != null && (userVo.getIsMember() == null || userVo.getIsMember() == 0)) { if (userVo != null && (userVo.getIsMember() == null || userVo.getIsMember() == 0)) {
AppUserVo userVo1 = new AppUserVo(); AppUserVo userVo1 = new AppUserVo();
...@@ -309,21 +310,28 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -309,21 +310,28 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
mapper.deleteByExample(example); mapper.deleteByExample(example);
} }
private void setModifyData(UserMemberVo beforeMember, BaseUserMember aftereMember) throws Exception { private void setModifyData(UserMemberVo beforeMember, BaseUserMember aftereMember) throws Exception {
log.info("保存修改会员记录={}",aftereMember); log.info("保存修改会员记录={}",aftereMember);
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)); IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
log.info("token信息={}",infoFromToken);
if (beforeMember==null) {
beforeMember = new UserMemberVo();
}
UserMemberVo finalBeforeMember = beforeMember;
executorService.submit(()->{ executorService.submit(()->{
try { try {
AppUserVo qppUser = detailBiz.getUserInfoById(beforeMember.getUserId()); AppUserVo qppUser = detailBiz.getUserInfoById(aftereMember.getUserId());
BaseUserMemberExport baseUserMemberExport = BaseUserMemberExport BaseUserMemberExport baseUserMemberExport = BaseUserMemberExport
.builder() .builder()
.username(qppUser.getUsername()) .username(qppUser.getUsername())
.beforeMemberLevel(beforeMember.getMemberLevel()) .beforeMemberLevel(finalBeforeMember.getMemberLevel())
.memberLevel(aftereMember.getMemberLevel()) .memberLevel(aftereMember.getMemberLevel())
.totalNumber(aftereMember.getTotalNumber() - beforeMember.getTotalNumber()) .totalNumber(aftereMember.getTotalNumber() - (finalBeforeMember.getTotalNumber()==null?0:finalBeforeMember.getTotalNumber()))
.rentFreeDays(aftereMember.getRentFreeDays() - beforeMember.getRentFreeDays()) .rentFreeDays(aftereMember.getRentFreeDays() - (finalBeforeMember.getRentFreeDays()==null?0:finalBeforeMember.getRentFreeDays()))
.beforeDiscount(beforeMember.getDiscount()) .beforeDiscount(finalBeforeMember.getDiscount())
.discount(aftereMember.getDiscount()) .discount(aftereMember.getDiscount())
.status(1) .status(1)
.userId(aftereMember.getUserId())
.crtTime(System.currentTimeMillis()) .crtTime(System.currentTimeMillis())
.crtId(Integer.valueOf(infoFromToken.getId())) .crtId(Integer.valueOf(infoFromToken.getId()))
.crtName(infoFromToken.getUniqueName()) .crtName(infoFromToken.getUniqueName())
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionChangeRecord;
import tk.mybatis.mapper.common.Mapper;
public interface AppUserPositionChangeRecordMapper extends Mapper<AppUserPositionChangeRecord> {
}
...@@ -19,6 +19,7 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode; ...@@ -19,6 +19,7 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -108,4 +109,11 @@ public class AppUserCollectController extends CommonBaseController { ...@@ -108,4 +109,11 @@ public class AppUserCollectController extends CommonBaseController {
return collectBiz.upUserCollect(collectDTO); return collectBiz.upUserCollect(collectDTO);
} }
@GetMapping("/collect/exist")
@ApiOperation("判断是否收藏")
public boolean isCollectionByTypeAndTypeId(@RequestParam("userId") Integer userId,
@RequestParam(value = "type") int type,
@RequestParam("id") Integer typId){
return collectBiz.isCollectionByTypeAndTypeId(userId,type,typId);
}
} }
...@@ -12,19 +12,24 @@ import com.github.wxiaoqi.security.admin.entity.User; ...@@ -12,19 +12,24 @@ import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo; import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Set; import java.util.Set;
/** /**
* app用户管理类 * app用户管理类
* @author Administrator * @author Administrator
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("appUsersManage") @RequestMapping("appUsersManage")
public class AppUsersManageController extends BaseController<AppUserManageBiz,AppUserManage> { public class AppUsersManageController extends BaseController<AppUserManageBiz,AppUserManage> {
...@@ -44,6 +49,10 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -44,6 +49,10 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired @Autowired
private VehicleFeign vehicleFeign; private VehicleFeign vehicleFeign;
@Autowired
private UserAuthUtil userAuthUtil;
private Integer ALL_PERMISSIONS=1; private Integer ALL_PERMISSIONS=1;
/** /**
* 查询所有 * 查询所有
...@@ -137,9 +146,17 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -137,9 +146,17 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
} }
@PutMapping("/user_position") @PutMapping("/user_position")
public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id,@RequestParam("positionId") Integer positionId){ public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id, @RequestParam("positionId") Integer positionId, HttpServletRequest request) {
appUserDetailBiz.updateUserPositionByUserId(id,positionId); try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId());
appUserLoginBiz.updateUserPosition(id, positionId,operatorId);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
} }
}
} }
...@@ -6,15 +6,22 @@ import com.github.wxiaoqi.security.admin.biz.AppUserPositionTempBiz; ...@@ -6,15 +6,22 @@ import com.github.wxiaoqi.security.admin.biz.AppUserPositionTempBiz;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO; import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempFindDTO; import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempFindDTO;
import com.github.wxiaoqi.security.admin.dto.UserPostionDTO; import com.github.wxiaoqi.security.admin.dto.UserPostionDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp;
import com.github.wxiaoqi.security.admin.vo.AppUserPositionTempVo; import com.github.wxiaoqi.security.admin.vo.AppUserPositionTempVo;
import com.github.wxiaoqi.security.admin.vo.WalletPostionVo; import com.github.wxiaoqi.security.admin.vo.WalletPostionVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.excel.ExcelImport; import com.github.wxiaoqi.security.common.util.excel.ExcelImport;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -24,6 +31,7 @@ import java.util.Map; ...@@ -24,6 +31,7 @@ import java.util.Map;
* @description * @description
* @data 2019/7/17 16:13 * @data 2019/7/17 16:13
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/postion/admin") @RequestMapping("/postion/admin")
public class AppUserPositionController { public class AppUserPositionController {
...@@ -37,6 +45,13 @@ public class AppUserPositionController { ...@@ -37,6 +45,13 @@ public class AppUserPositionController {
@Autowired @Autowired
private AppUserPositionTempBiz appUserPositionTempBiz; private AppUserPositionTempBiz appUserPositionTempBiz;
@Autowired
private UserAuthUtil userAuthUtil;
@Autowired
private UserAuthConfig userAuthConfig;
@GetMapping("/jobs") @GetMapping("/jobs")
public ObjectRestResponse findAllJobs() { public ObjectRestResponse findAllJobs() {
return ObjectRestResponse.succ(jobLevelBiz.selectListAll()); return ObjectRestResponse.succ(jobLevelBiz.selectListAll());
...@@ -57,21 +72,78 @@ public class AppUserPositionController { ...@@ -57,21 +72,78 @@ public class AppUserPositionController {
/** /**
* 新增或编辑身份信息 * 新增或编辑身份信息
*
* @return * @return
*/ */
@PostMapping("/addUserPostion") @PostMapping("/addUserPostion")
public ObjectRestResponse<Void> addUserPostion(@RequestBody AppUserPositionTempDTO appUserPositionTempDTO){ public ObjectRestResponse<Void> addUserPostion(@RequestBody AppUserPositionTempDTO appUserPositionTempDTO, HttpServletRequest request) {
return appUserPositionTempBiz.add(appUserPositionTempDTO); try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer s = Integer.valueOf(infoFromToken.getId());
return appUserPositionTempBiz.add(appUserPositionTempDTO, Integer.valueOf(infoFromToken.getId()));
} catch (Exception e) {
log.error("新增失败【{}】", e);
throw new BaseException("新增失败");
}
} }
/** /**
* 新增或编辑身份信息 * 新增或编辑身份信息
*
* @return * @return
*/ */
@PostMapping("/updUserPostion") @PostMapping("/updUserPostion")
public ObjectRestResponse<Void> updUserPostion(@RequestBody AppUserPositionTempDTO appUserPositionTempDTO){ public ObjectRestResponse<Void> updUserPostion(@RequestBody AppUserPositionTempDTO appUserPositionTempDTO, HttpServletRequest request) {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
return appUserPositionTempBiz.add(appUserPositionTempDTO, Integer.valueOf(infoFromToken.getId()));
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
}
}
return appUserPositionTempBiz.add(appUserPositionTempDTO); /**
* 员工信息更改,并插入变更记录表
* zuoyh
*
* @return
*/
@PostMapping("/updUserChange")
public ObjectRestResponse<Void> updUserChange(@RequestBody AppUserPositionTempDTO appUserPositionTempDTO, HttpServletRequest request) {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId());
return ObjectRestResponse.succ(appUserPositionTempBiz.addUserPositionChangeRecord(appUserPositionTempDTO.getChangeStatus(), appUserPositionTempDTO, operatorId)) ;
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
}
}
/**
* 查询员工信息变更记录表
*/
@GetMapping("/findPositionChangeRecord")
public ObjectRestResponse findPositionChangeRecord(AppUserPositionTemp appUserPositionTemp) {
return ObjectRestResponse.succ(appUserPositionTempBiz.findPositionChangeRecord(appUserPositionTemp));
}
/**
* 员工复职位
*/
@PostMapping("/updAddPositionChangeRecord")
public ObjectRestResponse updAddPositionChangeRecord(@RequestBody AppUserPositionTempDTO appUserPositionTempDTO, HttpServletRequest request) {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId());
appUserPositionTempBiz.andAddUserPositionChangeRecord(appUserPositionTempDTO, operatorId);
return ObjectRestResponse.succ();
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
}
} }
/** /**
......
package com.xxfc.platform.app.entity;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* 下载记录
* @author Administrator
*/
@Data
public class AppDownloadRecord {
@Id
@GeneratedValue(generator ="JDBC")
private Integer id;
private String source;
private Date creTime;
private String terminal;
}
package com.xxfc.platform.app.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.app.entity.AppDownloadRecord;
import com.xxfc.platform.app.mapper.AppDownloadRecordMapper;
import org.springframework.stereotype.Service;
/**
* @author hf
* @Date: 2019/12/19 15:47
* @Description:
*/
@Service
public class AppDownloadRecordBiz extends BaseBiz<AppDownloadRecordMapper, AppDownloadRecord> {
}
package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.AppDownloadRecord;
import tk.mybatis.mapper.common.Mapper;
/**
* @Auther: Administrator
* @Date: 2019/12/19 15:49
* @Description:
*/
public interface AppDownloadRecordMapper extends Mapper<AppDownloadRecord> {
}
package com.xxfc.platform.app.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.app.biz.AppDownloadRecordBiz;
import com.xxfc.platform.app.entity.AppDownloadRecord;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
/**
* @Auther: Administrator
* @Date: 2019/12/19 15:46
* @Description:
*/
@RestController
@RequestMapping("/app/unauth/adr")
public class AppDownloadRecordController extends BaseController<AppDownloadRecordBiz, AppDownloadRecord> {
@Override
@ApiOperation("添加")
@PostMapping(value = "add")
public ObjectRestResponse<AppDownloadRecord> add(@RequestBody AppDownloadRecord appDownloadRecord ){
appDownloadRecord.setCreTime(new Date());
baseBiz.insertSelective(appDownloadRecord);
return ObjectRestResponse.succ();
}
}
<?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.xxfc.platform.app.mapper.AppDownloadRecordMapper">
</mapper>
\ No newline at end of file
...@@ -19,4 +19,6 @@ public class CampsiteShopFindDTO extends PageParam { ...@@ -19,4 +19,6 @@ public class CampsiteShopFindDTO extends PageParam {
private Integer type; private Integer type;
private String name; private String name;
private String keyWord;
} }
...@@ -100,4 +100,9 @@ public class CampsiteShopDetailVo { ...@@ -100,4 +100,9 @@ public class CampsiteShopDetailVo {
@ApiModelProperty(value = "海报背景") @ApiModelProperty(value = "海报背景")
private String posterBackground; private String posterBackground;
/**
* 是否已经被收藏
*/
private Boolean hasCollection;
} }
...@@ -19,6 +19,7 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -19,6 +19,7 @@ import tk.mybatis.spring.annotation.MapperScan;
*/ */
@SpringBootApplication(scanBasePackages = { @SpringBootApplication(scanBasePackages = {
"com.xxfc.platform", "com.xxfc.platform",
"com.github.wxiaoqi.security.admin.support.aop",
"com.github.wxiaoqi.security.common.handler", "com.github.wxiaoqi.security.common.handler",
"com.github.wxiaoqi.security.common.log" "com.github.wxiaoqi.security.common.log"
}) })
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.campsite.biz; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.campsite.biz;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil; import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
...@@ -22,6 +23,7 @@ import com.xxfc.platform.campsite.mapper.CampsiteShopMapper; ...@@ -22,6 +23,7 @@ import com.xxfc.platform.campsite.mapper.CampsiteShopMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.Instant; import java.time.Instant;
...@@ -41,6 +43,8 @@ import java.util.stream.Collectors; ...@@ -41,6 +43,8 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
private final int CAMPSITE_COLLECTION_TYPE=3;
@Autowired @Autowired
private CampsiteShopTagBiz campsiteShopTagBiz; private CampsiteShopTagBiz campsiteShopTagBiz;
...@@ -56,6 +60,9 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -56,6 +60,9 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
@Resource(name = "customRedisTemplate") @Resource(name = "customRedisTemplate")
ValueOperations<String, String> campsiteValueOperations; ValueOperations<String, String> campsiteValueOperations;
@Autowired
private UserFeign userFeign ;
/** /**
* 营地缓存前缀 * 营地缓存前缀
*/ */
...@@ -81,7 +88,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -81,7 +88,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
public PageDataVO<CampsiteShopPageVo> findCampsiteShopPageByType(CampsiteShopFindDTO campsiteShopFindDTO) { public PageDataVO<CampsiteShopPageVo> findCampsiteShopPageByType(CampsiteShopFindDTO campsiteShopFindDTO) {
String campsite_cache_key = String.format("%s%s%s%s%s", campsiteShopFindDTO.getType() == null ? "" : campsiteShopFindDTO.getType() + ":", /* String campsite_cache_key = String.format("%s%s%s%s%s", campsiteShopFindDTO.getType() == null ? "" : campsiteShopFindDTO.getType() + ":",
campsiteShopFindDTO.getAddrProvince() == null ? "" : campsiteShopFindDTO.getAddrProvince() + ":", campsiteShopFindDTO.getAddrProvince() == null ? "" : campsiteShopFindDTO.getAddrProvince() + ":",
campsiteShopFindDTO.getAddrCity()==null?"":campsiteShopFindDTO.getAddrCity()+":", campsiteShopFindDTO.getAddrCity()==null?"":campsiteShopFindDTO.getAddrCity()+":",
campsiteShopFindDTO.getPage()+":", campsiteShopFindDTO.getPage()+":",
...@@ -90,9 +97,9 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -90,9 +97,9 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
if (result != null) { if (result != null) {
return JSONObject.parseObject(result, new TypeReference<PageDataVO<CampsiteShopPageVo>>() { return JSONObject.parseObject(result, new TypeReference<PageDataVO<CampsiteShopPageVo>>() {
}); });
} }*/
PageDataVO<CampsiteShopPageVo> campsiteShopPageDataVO = findCampsiteShopPageByTypeAndName(campsiteShopFindDTO); PageDataVO<CampsiteShopPageVo> campsiteShopPageDataVO = findCampsiteShopPageByTypeAndName(campsiteShopFindDTO);
campHashOperations.put(CAMPSITE_LIST_CACHE_PREKEY,campsite_cache_key,JSONObject.toJSONString(campsiteShopPageDataVO)); /* campHashOperations.put(CAMPSITE_LIST_CACHE_PREKEY,campsite_cache_key,JSONObject.toJSONString(campsiteShopPageDataVO));*/
return campsiteShopPageDataVO; return campsiteShopPageDataVO;
} }
...@@ -100,8 +107,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -100,8 +107,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
public PageDataVO<CampsiteShopPageVo> findCampsiteShopPageByTypeAndName(CampsiteShopFindDTO campsiteShopFindDTO){ public PageDataVO<CampsiteShopPageVo> findCampsiteShopPageByTypeAndName(CampsiteShopFindDTO campsiteShopFindDTO){
PageDataVO<CampsiteShopPageVo> campsiteShopPageDataVO = new PageDataVO<>(); PageDataVO<CampsiteShopPageVo> campsiteShopPageDataVO = new PageDataVO<>();
PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(), PageDataVO<CampsiteShopPageDTO> pageDataVO = PageDataVO.pageInfo(campsiteShopFindDTO.getPage(), campsiteShopFindDTO.getLimit(),
() -> mapper.findAllCampsiteShopsByTypeOrCodeOrName(campsiteShopFindDTO.getType(),campsiteShopFindDTO.getAddrProvince(), () -> mapper.findAllCampsiteShopsByTypeOrCodeOrName(campsiteShopFindDTO));
campsiteShopFindDTO.getAddrCity(),campsiteShopFindDTO.getName()));
List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData(); List<CampsiteShopPageDTO> campsiteShopPageDTOS = pageDataVO.getData();
if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) { if (CollectionUtils.isEmpty(campsiteShopPageDTOS)) {
campsiteShopPageDataVO.setPageNum(campsiteShopFindDTO.getPage()); campsiteShopPageDataVO.setPageNum(campsiteShopFindDTO.getPage());
...@@ -131,18 +137,19 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -131,18 +137,19 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
} }
/** /**
* @param id
* @param longitude 经度 * @param longitude 经度
* @param latitude 纬度 * @param latitude 纬度
* @return * @return
*/ */
public CampsiteShopDetailVo findCampsiteShopDetailById(Integer id, Double longitude, Double latitude) { public CampsiteShopDetailVo findCampsiteShopDetailById(Integer userId,Integer id, Double longitude, Double latitude) {
/*
String result = campsiteValueOperations.get(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id)); String result = campsiteValueOperations.get(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id));
if (Objects.nonNull(result)) { if (Objects.nonNull(result)) {
return JSONObject.parseObject(result, new TypeReference<CampsiteShopDetailVo>() { return JSONObject.parseObject(result, new TypeReference<CampsiteShopDetailVo>() {
}); });
} }
*/
CampsiteShopDetailVo campsiteShopDetailVo = new CampsiteShopDetailVo(); CampsiteShopDetailVo campsiteShopDetailVo = new CampsiteShopDetailVo();
CampsiteShopDetailDTO campsiteShopDetailDTO = mapper.findCampsiteShopDetailById(id); CampsiteShopDetailDTO campsiteShopDetailDTO = mapper.findCampsiteShopDetailById(id);
...@@ -181,7 +188,17 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -181,7 +188,17 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
campsiteShopDetailVo.setDistance(String.format("%.1f", distance)); campsiteShopDetailVo.setDistance(String.format("%.1f", distance));
} }
} }
campsiteValueOperations.set(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id), JSONObject.toJSONString(campsiteShopDetailVo));
if (Objects.nonNull(userId)){
boolean isCollection = userFeign.isCollectionByTypeAndTypeId(userId,CAMPSITE_COLLECTION_TYPE,id);
campsiteShopDetailVo.setHasCollection(isCollection);
}else {
campsiteShopDetailVo.setHasCollection(false);
}
/* campsiteValueOperations.set(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id), JSONObject.toJSONString(campsiteShopDetailVo));*/
return campsiteShopDetailVo; return campsiteShopDetailVo;
} }
...@@ -258,7 +275,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -258,7 +275,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
//保存或更新 * 营地与营地类型信息 //保存或更新 * 营地与营地类型信息
List<Integer> campsiteTagDTOS = campsiteShopAdminDTO.getCampsiteTagDTOS(); List<Integer> campsiteTagDTOS = campsiteShopAdminDTO.getCampsiteTagDTOS();
campsiteShopTagBiz.saveBatch(campsiteTagDTOS, campsiteShop.getId()); campsiteShopTagBiz.saveBatch(campsiteTagDTOS, campsiteShop.getId());
redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY); // redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY);
return effectRows; return effectRows;
} }
...@@ -294,8 +311,8 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -294,8 +311,8 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
} }
campsiteShopAdminVO.setCarouse(campsiteShopAdminVO.getCarouse() == null ? new ArrayList<CampsiteShopCarouselVo>() : campsiteShopAdminVO.getCarouse()); campsiteShopAdminVO.setCarouse(campsiteShopAdminVO.getCarouse() == null ? new ArrayList<CampsiteShopCarouselVo>() : campsiteShopAdminVO.getCarouse());
campsiteShopAdminVO.setCampsiteTagListVos(campsiteShopAdminVO.getCampsiteTagListVos() == null ? new ArrayList<CampsiteTagListVo>() : campsiteShopAdminVO.getCampsiteTagListVos()); campsiteShopAdminVO.setCampsiteTagListVos(campsiteShopAdminVO.getCampsiteTagListVos() == null ? new ArrayList<CampsiteTagListVo>() : campsiteShopAdminVO.getCampsiteTagListVos());
redisTemplate.delete(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id)); // redisTemplate.delete(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id));
redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY); // redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY);
return campsiteShopAdminVO; return campsiteShopAdminVO;
} }
...@@ -307,20 +324,20 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -307,20 +324,20 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
*/ */
public int updateCampsiteSatus(int id) { public int updateCampsiteSatus(int id) {
int effectRows = mapper.updateCampsiteStatusById(id, 1); int effectRows = mapper.updateCampsiteStatusById(id, 1);
if (effectRows > 0) { /* if (effectRows > 0) {
redisTemplate.delete(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id)); redisTemplate.delete(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id));
redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY); redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY);
} }*/
return effectRows; return effectRows;
} }
public int upperOrLowerShelves(Integer id, Integer status) { public int upperOrLowerShelves(Integer id, Integer status) {
int effectRows = mapper.updateCampsiteSaleStatusById(id, status); int effectRows = mapper.updateCampsiteSaleStatusById(id, status);
if (effectRows > 0) { /* if (effectRows > 0) {
redisTemplate.delete(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id)); redisTemplate.delete(String.format("%s%d", CAMSITE_DETAIL_CACHE_PREKEY, id));
redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY); redisTemplate.delete(CAMPSITE_LIST_CACHE_PREKEY);
} }*/
return effectRows; return effectRows;
} }
......
package com.xxfc.platform.campsite.mapper; package com.xxfc.platform.campsite.mapper;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.campsite.dto.CampsiteShopAdminFindDTO; import com.xxfc.platform.campsite.dto.*;
import com.xxfc.platform.campsite.dto.CampsiteShopAdminPageDTO;
import com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO;
import com.xxfc.platform.campsite.dto.CampsiteShopPageDTO;
import com.xxfc.platform.campsite.entity.CampsiteShop; import com.xxfc.platform.campsite.entity.CampsiteShop;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -24,12 +21,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> { ...@@ -24,12 +21,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
/** /**
* 根据店铺类型查找店铺列表 * 根据店铺类型查找店铺列表
* *
* @param typeId
*/ */
List<CampsiteShopPageDTO> findAllCampsiteShopsByTypeOrCodeOrName(@Param("typeId") Integer typeId, List<CampsiteShopPageDTO> findAllCampsiteShopsByTypeOrCodeOrName(CampsiteShopFindDTO campsiteShopFindDTO);
@Param("proviceCode") Integer proviceCode,
@Param("cityCode") Integer cityCode,
@Param("name") String name);
/** /**
* 首页营地列表 * 首页营地列表
......
package com.xxfc.platform.campsite.rest; package com.xxfc.platform.campsite.rest;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
...@@ -31,11 +32,13 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp ...@@ -31,11 +32,13 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
@GetMapping("/app/unauth/shops") @GetMapping("/app/unauth/shops")
public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsiteShopPageByTypeAndName(@RequestParam(value = "type", required = false) Integer type, public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsiteShopPageByTypeAndName(@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo, @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "6") Integer pageSize) { @RequestParam(value = "pageSize", required = false, defaultValue = "6") Integer pageSize,
@RequestParam(value = "keyWord",required = false) String keyWord) {
CampsiteShopFindDTO campsiteShopFindDTO = new CampsiteShopFindDTO(); CampsiteShopFindDTO campsiteShopFindDTO = new CampsiteShopFindDTO();
campsiteShopFindDTO.setType(type); campsiteShopFindDTO.setType(type);
campsiteShopFindDTO.setPage(pageNo); campsiteShopFindDTO.setPage(pageNo);
campsiteShopFindDTO.setLimit(pageSize); campsiteShopFindDTO.setLimit(pageSize);
campsiteShopFindDTO.setKeyWord(keyWord);
PageDataVO<CampsiteShopPageVo> pageDataVO = getBaseBiz().findCampsiteShopPageByType(campsiteShopFindDTO); PageDataVO<CampsiteShopPageVo> pageDataVO = getBaseBiz().findCampsiteShopPageByType(campsiteShopFindDTO);
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
} }
...@@ -55,8 +58,9 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp ...@@ -55,8 +58,9 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
@GetMapping("/app/unauth/shop") @GetMapping("/app/unauth/shop")
public ObjectRestResponse<CampsiteShopDetailVo> findCampsiteShopDetailById(@RequestParam(value = "id") Integer id, public ObjectRestResponse<CampsiteShopDetailVo> findCampsiteShopDetailById(@RequestParam(value = "id") Integer id,
@RequestParam(value = "longitude", required = false) Double longitude, @RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude) { @RequestParam(value = "latitude", required = false) Double latitude,
CampsiteShopDetailVo campsiteShopDetailVo = getBaseBiz().findCampsiteShopDetailById(id, longitude, latitude); AppUserDTO appUserDTO) {
CampsiteShopDetailVo campsiteShopDetailVo = getBaseBiz().findCampsiteShopDetailById(appUserDTO.getUserid(),id, longitude, latitude);
return ObjectRestResponse.succ(campsiteShopDetailVo); return ObjectRestResponse.succ(campsiteShopDetailVo);
} }
......
...@@ -66,18 +66,21 @@ ...@@ -66,18 +66,21 @@
cs.sale_state = 1 cs.sale_state = 1
AND cs.is_del = 0 AND cs.is_del = 0
<if test="typeId!=null"> <if test="type!=null">
and cst.tag_id=#{typeId} and cst.tag_id=#{type}
</if> </if>
<if test="proviceCode != null"> <if test="addrProvince != null">
and cs.`province`=#{proviceCode} and cs.`province`=#{addrProvince}
</if> </if>
<if test="cityCode != null"> <if test="addrCity != null">
and cs.`city`=#{cityCode} and cs.`city`=#{addrCity}
</if> </if>
<if test="name!=null and name!=''"> <if test="name!=null and name!=''">
and cs.`name` like concat('%',#{name},'%') and cs.`name` like concat('%',#{name},'%')
</if> </if>
<if test="keyWord!=null and keyWord!=''">
and cs.`name` like concat('%',#{keyWord},'%')
</if>
GROUP BY cs.id GROUP BY cs.id
order by cs.hot DESC,cs.crt_time DESC order by cs.hot DESC,cs.crt_time DESC
</select> </select>
......
package com.xxfc.platform.order.bo; package com.xxfc.platform.order.bo;
import cn.hutool.json.JSONObject;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.StatisticsStatusEnum;
import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/** /**
* @author libin * @author libin
...@@ -40,6 +30,7 @@ public class FeeTypeBo implements Serializable { ...@@ -40,6 +30,7 @@ public class FeeTypeBo implements Serializable {
private BigDecimal breakRulesRegulationAmount = BigDecimal.ZERO; private BigDecimal breakRulesRegulationAmount = BigDecimal.ZERO;
private BigDecimal lossSpecifiedAmount = BigDecimal.ZERO; private BigDecimal lossSpecifiedAmount = BigDecimal.ZERO;
private BigDecimal extraAmount = BigDecimal.ZERO; private BigDecimal extraAmount = BigDecimal.ZERO;
private BigDecimal extraNoDeductibleAmount = BigDecimal.ZERO;
} }
......
...@@ -6,7 +6,6 @@ import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo; ...@@ -6,7 +6,6 @@ import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
package com.xxfc.platform.order.contant.enumerate; package com.xxfc.platform.order.contant.enumerate;
import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.entity.OrderReceivedStatisticsBase; import com.xxfc.platform.order.entity.OrderReceivedStatisticsBase;
import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo; import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -29,6 +30,7 @@ public enum ReceivedStatisticsEnum { ...@@ -29,6 +30,7 @@ public enum ReceivedStatisticsEnum {
} }
return orderReceivedStatisticsBases.stream().peek(x -> { return orderReceivedStatisticsBases.stream().peek(x -> {
((OrderReceivedStatisticsBase) x).setDivisor(1); ((OrderReceivedStatisticsBase) x).setDivisor(1);
((OrderReceivedStatisticsBase) x).setDateStr(DateUtil.format(((OrderReceivedStatisticsBase) x).getDate(),"yyyy-MM-dd"));
}).collect(Collectors.groupingBy(OrderReceivedStatisticsBase::getDate, Collectors.toList())); }).collect(Collectors.groupingBy(OrderReceivedStatisticsBase::getDate, Collectors.toList()));
} }
}, },
...@@ -106,6 +108,7 @@ public enum ReceivedStatisticsEnum { ...@@ -106,6 +108,7 @@ public enum ReceivedStatisticsEnum {
.weekOfYear(orderReceivedStatisticsBase.getWeekOfYear()) .weekOfYear(orderReceivedStatisticsBase.getWeekOfYear())
.year(orderReceivedStatisticsBase.getYear()) .year(orderReceivedStatisticsBase.getYear())
.orderNum(quantity) .orderNum(quantity)
.dateStr(orderReceivedStatisticsBase.getDateStr())
.orderAmount(amount) .orderAmount(amount)
.build(); .build();
} }
......
...@@ -96,7 +96,7 @@ public enum StatisticsStatusEnum { ...@@ -96,7 +96,7 @@ public enum StatisticsStatusEnum {
x.getPayWay() == null ? NO_PAY_WAY : x.getPayWay() x.getPayWay() == null ? NO_PAY_WAY : x.getPayWay()
, x.getHasPay())); , x.getHasPay()));
stisticsActiveState.add(x.getStateGroup()); stisticsActiveState.add(x.getStateGroup());
}).collect(Collectors.partitioningBy(x -> Objects.nonNull(x.getPayWay()), Collectors.groupingBy(OrderDTO::getStateGroup, Collectors.toList()))); }).collect(Collectors.partitioningBy(x -> Objects.equals(x.getHasPay(),1), Collectors.groupingBy(OrderDTO::getStateGroup, Collectors.toList())));
return stateGroupMap == null ? Collections.EMPTY_MAP : stateGroupMap; return stateGroupMap == null ? Collections.EMPTY_MAP : stateGroupMap;
} }
...@@ -132,12 +132,14 @@ public enum StatisticsStatusEnum { ...@@ -132,12 +132,14 @@ public enum StatisticsStatusEnum {
if (orderAccountBo.getAccountType().equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) { if (orderAccountBo.getAccountType().equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
//订单押金 //订单押金
feeTypeBo.setDepositAmount(feeTypeBo.getDepositAmount().add(accountDetailEntity.getDepositAmount())); feeTypeBo.setDepositAmount(feeTypeBo.getDepositAmount().add(accountDetailEntity.getDepositAmount()));
//订单金额(不包含免赔和押金)
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().add(accountDetailEntity.getOrderAmount()));
if (hasDamageSafe) { if (hasDamageSafe) {
BigDecimal dameSafeAmount = getDameSafeAmount(orderAccountBo.getData()); BigDecimal dameSafeAmount = getDameSafeAmount(orderAccountBo.getData());
feeTypeBo.setNoDeductibleAmount(feeTypeBo.getNoDeductibleAmount().add(dameSafeAmount)); feeTypeBo.setNoDeductibleAmount(feeTypeBo.getNoDeductibleAmount().add(dameSafeAmount));
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().subtract(feeTypeBo.getNoDeductibleAmount()));
} }
//订单金额(不包含免赔和押金)
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleAmount()));
} else { } else {
//退款订单押金 //退款订单押金
feeTypeBo.setDepositRefundAmount(feeTypeBo.getDepositRefundAmount().add(accountDetailEntity.getDepositAmount())); feeTypeBo.setDepositRefundAmount(feeTypeBo.getDepositRefundAmount().add(accountDetailEntity.getDepositAmount()));
...@@ -182,6 +184,10 @@ public enum StatisticsStatusEnum { ...@@ -182,6 +184,10 @@ public enum StatisticsStatusEnum {
feeTypeBo.setExtraAmount(feeTypeBo.getExtraAmount().add(extendAmount)); feeTypeBo.setExtraAmount(feeTypeBo.getExtraAmount().add(extendAmount));
} }
} }
//其他费用-延迟用车不记免赔
if (Objects.equals(DeductionTypeEnum.OTHER_DELAY_SAFE.getCode(),deduction.getType())){
feeTypeBo.setExtraNoDeductibleAmount(feeTypeBo.getExtraNoDeductibleAmount().add(deductionAmount));
}
} }
//退款订单金额(不包含免赔和押金) //退款订单金额(不包含免赔和押金)
feeTypeBo.setOrderRefundAmount(feeTypeBo.getOrderRefundAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleRefundAmount())); feeTypeBo.setOrderRefundAmount(feeTypeBo.getOrderRefundAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleRefundAmount()));
......
...@@ -118,4 +118,7 @@ public class OrderReceivedStatisticsBase implements Serializable { ...@@ -118,4 +118,7 @@ public class OrderReceivedStatisticsBase implements Serializable {
@Transient @Transient
private String stateGroup; private String stateGroup;
@Transient
private String dateStr;
} }
...@@ -45,4 +45,6 @@ public class OrderRentVehicleReceivedStatistics extends OrderReceivedStatisticsB ...@@ -45,4 +45,6 @@ public class OrderRentVehicleReceivedStatistics extends OrderReceivedStatisticsB
@ApiModelProperty("不计免赔费用") @ApiModelProperty("不计免赔费用")
private BigDecimal noDeductibleRefundAmount; private BigDecimal noDeductibleRefundAmount;
@Column(name = "extra_no_deductible_amount")
private BigDecimal extraNoDeductibleAmount;
} }
...@@ -23,6 +23,7 @@ public class OrderReceivedStatisticsVo { ...@@ -23,6 +23,7 @@ public class OrderReceivedStatisticsVo {
private String year; private String year;
@ApiModelProperty("日期-->日统计方式") @ApiModelProperty("日期-->日统计方式")
private Date date; private Date date;
private String dateStr;
@ApiModelProperty("第几周---->周统计方式") @ApiModelProperty("第几周---->周统计方式")
private String weekOfYear; private String weekOfYear;
@ApiModelProperty("月统计") @ApiModelProperty("月统计")
......
...@@ -31,7 +31,6 @@ import java.time.LocalDate; ...@@ -31,7 +31,6 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -155,6 +154,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -155,6 +154,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
dataCell.setCellStyle(cellStyle); dataCell.setCellStyle(cellStyle);
String sign = signs.get(cellIndex - 1); String sign = signs.get(cellIndex - 1);
List<OrderReceivedStatisticsVo> orderReceivedStatisticsVos = data.get(sign); List<OrderReceivedStatisticsVo> orderReceivedStatisticsVos = data.get(sign);
if (ReceivedStatisticsEnum.DAY.getWayCode() == statisticalWay){
orderReceivedStatisticsVos.sort(Comparator.comparing(OrderReceivedStatisticsVo::getDate));
}
if (ReceivedStatisticsEnum.WEEK.getWayCode() == statisticalWay){
orderReceivedStatisticsVos.sort(Comparator.comparing(OrderReceivedStatisticsVo::getWeekOfYear));
}
if (ReceivedStatisticsEnum.MONTH.getWayCode() == statisticalWay){
orderReceivedStatisticsVos.sort(Comparator.comparing(OrderReceivedStatisticsVo::getMonth));
}
if (CollectionUtils.isEmpty(orderReceivedStatisticsVos) || i > orderReceivedStatisticsVos.size()) { if (CollectionUtils.isEmpty(orderReceivedStatisticsVos) || i > orderReceivedStatisticsVos.size()) {
continue; continue;
} }
......
...@@ -102,7 +102,7 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi ...@@ -102,7 +102,7 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
List<OrderRentVehicleReceivedStatistics> otherStatisticsStateGroupList = createOtherStatisticsStateGroupList(startDate, stisticsActiveState, companyMap); List<OrderRentVehicleReceivedStatistics> otherStatisticsStateGroupList = createOtherStatisticsStateGroupList(startDate, stisticsActiveState, companyMap);
orderRentVehicleReceivedStatisticsList.addAll(otherStatisticsStateGroupList); orderRentVehicleReceivedStatisticsList.addAll(otherStatisticsStateGroupList);
//保存 //保存
StatisticsStatusEnum.insertReceivedStatisticsBatch(orderRentVehicleReceivedStatisticsList,mapper); // StatisticsStatusEnum.insertReceivedStatisticsBatch(orderRentVehicleReceivedStatisticsList,mapper);
return orderRentVehicleReceivedStatisticsList; return orderRentVehicleReceivedStatisticsList;
} }
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
</resultMap> </resultMap>
<select id="selectOrderMemberReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics"> <select id="selectOrderMemberReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `date`,`year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`, select `date`,`year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`,
IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0), IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`,
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1 IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
</select> </select>
<select id="selectOrderMemberReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics"> <select id="selectOrderMemberReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`, select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`,
IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0), IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`,
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1 IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
</select> </select>
<select id="selectOrderMemberReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics"> <select id="selectOrderMemberReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount` select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`
,IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0), ,IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`,
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1 IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</resultMap> </resultMap>
<select id="selectOrderReceivedStatisticsDateList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsDateList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</select> </select>
<select id="selectOrderReceivedStatisticsMonthList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsMonthList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</select> </select>
<select id="selectOrderReceivedStatisticsWeekOfYearList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsWeekOfYearList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
......
...@@ -17,9 +17,20 @@ ...@@ -17,9 +17,20 @@
<result property="payWay" column="pay_way"/> <result property="payWay" column="pay_way"/>
<result property="companyId" column="company_id"/> <result property="companyId" column="company_id"/>
<result property="crtTime" column="crt_time"/> <result property="crtTime" column="crt_time"/>
<result property="extraNoDeductibleAmount" column="extral_no_deductible_amount"/>
<result property="orderRefundAmount" column="order_refund_amount"/>
<result property="lateFeeAmount" column="late_fee_amount"/>
<result property="extraAmount" column="extra_amount"/>
<result property="companyName" column="company_name"/>
<result property="noDeductibleAmount" column="no_deductible_amount"/>
<result property="noDeductibleRefundAmount" column="no_deductible_refund_amount"/>
<result property="lossSpecifiedAmount" column="loss_specified_amount"/>
<result property="depositRefundAmount" column="deposit_refund_amount"/>
<result property="depositAmount" column="deposit_amount"/>
<result property="breakRulesRegulationAmount" column="break_rules_regulation_amount"/>
</resultMap> </resultMap>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -47,7 +58,7 @@ ...@@ -47,7 +58,7 @@
</select> </select>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -75,7 +86,7 @@ ...@@ -75,7 +86,7 @@
</select> </select>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</resultMap> </resultMap>
<select id="selectOrderTourReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics"> <select id="selectOrderTourReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</select> </select>
<select id="selectOrderTourReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics"> <select id="selectOrderTourReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1 select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</select> </select>
<select id="selectOrderTourReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics"> <select id="selectOrderTourReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1 select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
......
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.OrderApplication; import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.*; import com.xxfc.platform.order.biz.*;
...@@ -16,8 +15,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -16,8 +15,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
...@@ -98,7 +95,7 @@ public class ServiceTest { ...@@ -98,7 +95,7 @@ public class ServiceTest {
@Test @Test
public void testMemberStatistics(){ public void testMemberStatistics(){
Date date = DateTime.parse("2019-11-28").toDate(); Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate(); Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate(); Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -107,7 +104,7 @@ public class ServiceTest { ...@@ -107,7 +104,7 @@ public class ServiceTest {
@Test @Test
public void testRentVehicleStatistics(){ public void testRentVehicleStatistics(){
Date date = DateTime.parse("2019-11-29").toDate(); Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate(); Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate(); Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -128,14 +125,13 @@ public class ServiceTest { ...@@ -128,14 +125,13 @@ public class ServiceTest {
public void testOrderReceivedStatisticsJobHandler(){ public void testOrderReceivedStatisticsJobHandler(){
cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd"); cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd");
// cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1); // cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
/* orderReceivedStatisticsJobHandler.execute("2019-11-29");*/ orderReceivedStatisticsJobHandler.execute("2019-11-15");
LocalDate startLocalDate = LocalDate.of(2019, 10, 1); /* LocalDate startLocalDate = LocalDate.of(2019, 10, 01);
LocalDate endLocalDate = LocalDate.of(2019,11,30); LocalDate endLocalDate = LocalDate.of(2019,12,19);
while (startLocalDate.isBefore(endLocalDate)){ while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1); startLocalDate = startLocalDate.plusDays(1);
orderReceivedStatisticsJobHandler.execute(dateStr); orderReceivedStatisticsJobHandler.execute(dateStr);
} }*/
} }
} }
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