Merge remote-tracking branch 'origin/api' into api
2 files added
13 files modified
| | |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.bean.Article; |
| | | import com.matrix.system.hive.bean.ArticleType; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.service.ArticleService; |
| | | import com.matrix.system.hive.service.ArticleTypeService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @GetMapping(value = "/findKnowledgeType") |
| | | public AjaxResult findKnowledgeType() { |
| | | ArticleType type = new ArticleType(); |
| | | type.setShopId(getMe().getCompanyId()); |
| | | type.setCompanyId(getMe().getCompanyId()); |
| | | type.setParentId(0L); |
| | | return AjaxResult.buildSuccessInstance(articleTypeService.findByModel(type)); |
| | | } |
| | |
| | | |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.EncrypUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | |
| | | if (StringUtils.isBlank(vipInfoListDto.getOrder())) { |
| | | vipInfoListDto.setOrder("asc"); |
| | | } |
| | | |
| | | int offset = (vipInfoListDto.getPageNum() - 1) * vipInfoListDto.getPageSize(); |
| | | int limit = vipInfoListDto.getPageSize(); |
| | | vipInfoListDto.setOffset(offset); |
| | | vipInfoListDto.setLimit(limit); |
| | | return AjaxResult.buildSuccessInstance(sysVipInfoService.findVipAddressBook(vipInfoListDto)); |
| | | } |
| | | |
| | |
| | | package com.matrix.system.app.action; |
| | | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.system.app.dto.LabelDto; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.bean.SysVipLabel; |
| | | import com.matrix.system.hive.dao.SysVipLabelDao; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2020-12-22 |
| | | **/ |
| | | //@Api(value = "ApiVipLabelAction", tags = "客户标签接口类") |
| | | @Api(value = "ApiVipLabelAction", tags = "客户标签接口类") |
| | | @RestController |
| | | @RequestMapping(value = "/api/label") |
| | | public class ApiVipLabelAction { |
| | | public class ApiVipLabelAction extends BaseController { |
| | | |
| | | @Autowired |
| | | private SysVipLabelDao sysVipLabelDao; |
| | | |
| | | @ApiOperation(value = "获取客户标签列表", notes = "获取客户标签列表") |
| | | @GetMapping(value = "/findLabelByVipId/{vipId}") |
| | | public AjaxResult findLabelByVipId(@PathVariable("vipId") Long vipId) { |
| | | return null; |
| | | @ApiOperation(value = "获取标签列表", notes = "获取标签列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SysVipLabel.class) |
| | | }) |
| | | @PostMapping(value = "/findLabelList") |
| | | public AjaxResult findLabelByVipId(@RequestBody LabelDto labelDto) { |
| | | SysVipLabel sysVipLabel = new SysVipLabel(); |
| | | sysVipLabel.setCompanyId(getMe().getCompanyId()); |
| | | sysVipLabel.setIsAll(1); |
| | | sysVipLabel.setLabel(labelDto.getLabel()); |
| | | List<SysVipLabel> zbLabel = sysVipLabelDao.selectByModel(sysVipLabel); |
| | | |
| | | sysVipLabel = new SysVipLabel(); |
| | | sysVipLabel.setUserId(getMe().getSuId()); |
| | | sysVipLabel.setLabel(labelDto.getLabel()); |
| | | List<SysVipLabel> userLabel = sysVipLabelDao.selectByModel(sysVipLabel); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); |
| | | ajaxResult.putInMap("allLabel", zbLabel); |
| | | ajaxResult.putInMap("myLabel", userLabel); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "添加客户标签", notes = "添加客户标签") |
| | | @ApiOperation(value = "添加标签", notes = "添加标签") |
| | | @PostMapping(value = "/addLabel") |
| | | public AjaxResult addLabel() { |
| | | return null; |
| | | public AjaxResult addLabel(@RequestBody LabelDto labelDto) { |
| | | SysVipLabel sysVipLabel = new SysVipLabel(); |
| | | sysVipLabel.setLabel(labelDto.getLabel()); |
| | | sysVipLabel.setColor(labelDto.getColor()); |
| | | sysVipLabel.setShopId(getMe().getShopId()); |
| | | sysVipLabel.setCompanyId(getMe().getCompanyId()); |
| | | sysVipLabel.setUserId(getMe().getSuId()); |
| | | sysVipLabel.setIsAll(2); |
| | | int i = sysVipLabelDao.insert(sysVipLabel); |
| | | if (i > 0) { |
| | | return AjaxResult.buildSuccessInstance("添加成功"); |
| | | } else { |
| | | return AjaxResult.buildFailInstance("添加失败"); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "删除标签", notes = "删除标签") |
| | | @GetMapping(value = "/delById/{id}") |
| | | public AjaxResult delById(@PathVariable("id") Long id) { |
| | | return null; |
| | | int i = sysVipLabelDao.deleteById(id); |
| | | if (i > 0) { |
| | | return AjaxResult.buildSuccessInstance("删除成功"); |
| | | } |
| | | return AjaxResult.buildFailInstance("删除失败"); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.matrix.system.app.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-01-22 |
| | | **/ |
| | | @ApiModel(value = "LabelDto", description = "添加标签接收参数接收类") |
| | | public class LabelDto { |
| | | |
| | | @ApiModelProperty(value = "标签内容", example = "123") |
| | | private String label; |
| | | |
| | | @ApiModelProperty(value = "颜色", example = "#FFFFFF") |
| | | private String color; |
| | | |
| | | public String getLabel() { |
| | | return label; |
| | | } |
| | | |
| | | public void setLabel(String label) { |
| | | this.label = label; |
| | | } |
| | | |
| | | public String getColor() { |
| | | return color; |
| | | } |
| | | |
| | | public void setColor(String color) { |
| | | this.color = color; |
| | | } |
| | | } |
| | |
| | | * @date 2020-12-21 |
| | | **/ |
| | | @ApiModel(value = "VipInfoListDto", description = "获取会员列表参数类") |
| | | public class VipInfoListDto { |
| | | public class VipInfoListDto extends BasePageDto { |
| | | |
| | | @ApiModelProperty(value = "查询参数(客户姓名/手机/会员编号/拼音)", example = "") |
| | | private String queryKey; |
| | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private int offset; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private int limit; |
| | | |
| | | public int getOffset() { |
| | | return offset; |
| | | } |
| | | |
| | | public void setOffset(int offset) { |
| | | this.offset = offset; |
| | | } |
| | | |
| | | public int getLimit() { |
| | | return limit; |
| | | } |
| | | |
| | | public void setLimit(int limit) { |
| | | this.limit = limit; |
| | | } |
| | | |
| | | public Long getCompanyId() { |
| | | return companyId; |
| | | } |
| | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if ("dev".equals(evn)) { |
| | | SysUsers sysUsers = sysUsersDao.selectById(1074L); |
| | | SysUsers sysUsers = sysUsersDao.selectById(1012L); |
| | | request.getSession().setAttribute(MatrixConstance.LOGIN_KEY, sysUsers); |
| | | return true; |
| | | } |
| | |
| | | public @ResponseBody AjaxResult queryAll(ArticleType articleType) { |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | articleType.setType(Dictionary.ARTICEL_TYPE_NAME_MDXY); |
| | | articleType.setShopId(users.getShopId()); |
| | | articleType.setCompanyId(users.getCompanyId()); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, currentService.findByModel(articleType), 0); |
| | | } |
| | | |
| | |
| | | articleType.setType(Dictionary.ARTICEL_TYPE_NAME_MDXY); |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | articleType.setShopId(users.getShopId()); |
| | | |
| | | articleType.setCompanyId(users.getCompanyId()); |
| | | Long parentId = articleType.getParentId(); |
| | | List<Long> ids = new ArrayList<>(); |
| | | while (parentId != 0) { |
| | |
| | | private Long shopId; |
| | | |
| | | private String parentIds; |
| | | |
| | | private Long companyId; |
| | | |
| | | /** |
| | | * 扩展属性 |
| | |
| | | public void setArticle(Article article) { |
| | | this.article = article; |
| | | }*/ |
| | | |
| | | public Long getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Long companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 会员ID |
| | | */ |
| | | private Long vipId; |
| | | |
| | | /** |
| | | * 标签内容 |
| | | */ |
| | | private String label; |
| | |
| | | private Long shopId; |
| | | |
| | | private Long companyId; |
| | | |
| | | private Long userId; |
| | | |
| | | private Integer isAll; |
| | | |
| | | private String color; |
| | | |
| | | public Long getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getIsAll() { |
| | | return isAll; |
| | | } |
| | | |
| | | public void setIsAll(Integer isAll) { |
| | | this.isAll = isAll; |
| | | } |
| | | |
| | | public String getColor() { |
| | | return color; |
| | | } |
| | | |
| | | public void setColor(String color) { |
| | | this.color = color; |
| | | } |
| | | |
| | | public Long getShopId() { |
| | | return shopId; |
| | |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getVipId() { |
| | | return vipId; |
| | | } |
| | | |
| | | public void setVipId(Long vipId) { |
| | | this.vipId = vipId; |
| | | } |
| | | |
| | | public String getLabel() { |
New file |
| | |
| | | package com.matrix.system.hive.bean; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-01-22 |
| | | **/ |
| | | public class SysVipLabelRelate implements Serializable { |
| | | private static final long serialVersionUID = 1860770077746416680L; |
| | | |
| | | private Long id; |
| | | |
| | | private Long labelId; |
| | | |
| | | private Long vipId; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getLabelId() { |
| | | return labelId; |
| | | } |
| | | |
| | | public void setLabelId(Long labelId) { |
| | | this.labelId = labelId; |
| | | } |
| | | |
| | | public Long getVipId() { |
| | | return vipId; |
| | | } |
| | | |
| | | public void setVipId(Long vipId) { |
| | | this.vipId = vipId; |
| | | } |
| | | } |
| | |
| | | package com.matrix.system.hive.dao; |
| | | |
| | | import com.matrix.system.hive.bean.SysVipLabel; |
| | | import com.matrix.system.hive.bean.SysVipLabelRelate; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | int insert(SysVipLabel sysVipLabel); |
| | | |
| | | int insertRelate(SysVipLabelRelate sysVipLabelRelate); |
| | | |
| | | int update(SysVipLabel sysVipLabel); |
| | | |
| | | int deleteById(@Param("id") Long id); |
| | | |
| | | List<SysVipLabel> selectByVipId(@Param("vipId") Long vipId); |
| | | |
| | | List<SysVipLabel> selectByModel(@Param("record") SysVipLabel sysVipLabel); |
| | | |
| | | int deleteByVipId(@Param("vipId") Long vipId); |
| | | int deleteRelateByVipId(@Param("vipId") Long vipId); |
| | | } |
| | |
| | | int i=sysVipInfoDao.insert(vipInfo); |
| | | |
| | | if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { |
| | | batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId()); |
| | | batchInsertLabel(addVipDto.getLabels(), vipInfo.getId()); |
| | | } |
| | | |
| | | //创建用户默认储值卡 |
| | |
| | | int i = sysVipInfoDao.update(vipInfo); |
| | | |
| | | if (CollectionUtils.isNotEmpty(modifyVipDto.getLabels())) { |
| | | sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId()); |
| | | |
| | | batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId()); |
| | | sysVipLabelDao.deleteRelateByVipId(modifyVipDto.getVipId()); |
| | | batchInsertLabel(modifyVipDto.getLabels(), vipInfo.getId()); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | private void batchInsertLabel(List<String> labelList, String suName, Long id) { |
| | | private void batchInsertLabel(List<String> labelList, Long id) { |
| | | Set<String> labels = new HashSet<>(labelList); |
| | | Iterator<String> iterator = labels.iterator(); |
| | | if (iterator.hasNext()) { |
| | | SysVipLabel sysVipLabel = new SysVipLabel(); |
| | | sysVipLabel.setCreateTime(new Date()); |
| | | sysVipLabel.setCreateBy(suName); |
| | | sysVipLabel.setLabel(iterator.next()); |
| | | sysVipLabel.setVipId(id); |
| | | sysVipLabelDao.insert(sysVipLabel); |
| | | SysVipLabelRelate relate = new SysVipLabelRelate(); |
| | | relate.setLabelId(Long.parseLong(iterator.next())); |
| | | relate.setVipId(id); |
| | | sysVipLabelDao.insertRelate(relate); |
| | | } |
| | | } |
| | | |
| | |
| | | <result property="type" column="type" /> |
| | | <result property="parentIds" column="parent_ids" /> |
| | | <result property="shopId" column="shop_id"/> |
| | | <result property="companyId" column="company_id" /> |
| | | <!--扩展属性 --> |
| | | <!-- <association property="article" javaType="Article" |
| | | column="{type_id=id}" select="com.matrix.system.hive.dao.ArticleDao.selectById" /> --> |
| | |
| | | icon, |
| | | type, |
| | | shop_id, |
| | | company_id, |
| | | parent_ids |
| | | ) |
| | | VALUES ( |
| | |
| | | #{icon}, |
| | | #{type}, |
| | | #{shopId}, |
| | | #{companyId}, |
| | | #{parentIds} |
| | | ) |
| | | </insert> |
| | |
| | | <if test="record.shopId != null and record.shopId !='' "> |
| | | and shop_id = #{record.shopId} |
| | | </if> |
| | | <if test="record.companyId != null and record.companyId !='' "> |
| | | and company_id = #{record.companyId} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="record.sort != 'monthArrived' and record.sort != 'yearArrived'"> |
| | | order by ${record.sort} ${record.order} |
| | | </if> |
| | | <if test="record.offset >=0 and record.limit >0"> |
| | | limit #{record.offset},#{record.limit} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectVipInfoById" resultType="com.matrix.system.app.vo.VipInfoVo"> |
| | |
| | | create_time, |
| | | create_by, |
| | | id, |
| | | vip_id, |
| | | label |
| | | label, |
| | | shop_id, |
| | | company_id, |
| | | is_all, |
| | | user_id, |
| | | color |
| | | ) values ( |
| | | #{createTime}, |
| | | #{createBy}, |
| | | #{id}, |
| | | #{vipId}, |
| | | #{label} |
| | | #{label}, |
| | | #{shopId}, |
| | | #{companyId}, |
| | | #{isAll}, |
| | | #{userId}, |
| | | #{color} |
| | | ) |
| | | </insert> |
| | | |
| | | <insert id="insertRelate" parameterType="com.matrix.system.hive.bean.SysVipLabel" useGeneratedKeys="true" |
| | | keyProperty="id"> |
| | | insert sys_vip_label_relate ( |
| | | id, |
| | | label_id, |
| | | vip_id |
| | | ) values ( |
| | | #{id}, |
| | | #{labelId}, |
| | | #{vipId} |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="update"> |
| | | update sys_vip_label |
| | | <set> |
| | | <if test="label != null and label !='' "> |
| | | label = #{label}, |
| | | </if> |
| | | <if test="color != null and color !='' "> |
| | | color = #{color}, |
| | | </if> |
| | | </set> |
| | | WHERE ID=#{id} |
| | | </update> |
| | | |
| | | <delete id="deleteById"> |
| | | delete from sys_vip_label |
| | |
| | | |
| | | |
| | | <select id="selectByVipId" resultType="com.matrix.system.hive.bean.SysVipLabel"> |
| | | select * |
| | | from sys_vip_label |
| | | where vip_id=#{vipId} |
| | | select b.* |
| | | from sys_vip_label_relate a |
| | | inner join sys_vip_label b on a.label_id=b.id |
| | | where a.vip_id=#{vipId} |
| | | </select> |
| | | |
| | | <select id="selectByModel" resultType="com.matrix.system.hive.bean.SysVipLabel"> |
| | | select * from sys_vip_label |
| | | select |
| | | create_time createTime, |
| | | create_by createBy, |
| | | id, |
| | | label, |
| | | shop_id shopId, |
| | | company_id companyId, |
| | | is_all isAll, |
| | | user_id userId, |
| | | color |
| | | from sys_vip_label |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | <if test="record.label!=null and record.label!=''"> |
| | | and label=#{record.label} |
| | | and label like CONCAT('%', CONCAT(#{record.label},'%')) |
| | | </if> |
| | | <if test="record.vipId!=null"> |
| | | and vip_id=#{record.vipId} |
| | | <if test="record.isAll!=null and record.isAll!=0"> |
| | | and is_all=#{record.isAll} |
| | | </if> |
| | | <if test="record.userId!=null and record.userId!=''"> |
| | | and user_id=#{record.userId} |
| | | </if> |
| | | <if test="record.companyId!=null and record.companyId!=''"> |
| | | and company_id=#{record.companyId} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <delete id="deleteByVipId"> |
| | | delete from sys_vip_label |
| | | <delete id="deleteRelateByVipId"> |
| | | delete from sys_vip_label_relate |
| | | where vip_id=#{vipId} |
| | | </delete> |
| | | </mapper> |