保险管理、总平台保险、保险关系
This commit is contained in:
parent
02683fcfeb
commit
6357dc58d2
|
|
@ -1,5 +1,6 @@
|
|||
package com.ghy.web.controller.goods;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ghy.common.annotation.Log;
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
|
|
@ -11,14 +12,8 @@ import com.ghy.common.enums.ImgType;
|
|||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.common.utils.ShiroUtils;
|
||||
import com.ghy.common.utils.StringUtils;
|
||||
import com.ghy.goods.domain.CategoryInsuranceRelation;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.domain.GoodsImgs;
|
||||
import com.ghy.goods.domain.InsuranceManager;
|
||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||
import com.ghy.goods.service.GoodsImgsService;
|
||||
import com.ghy.goods.service.ICategoryInsuranceRelationService;
|
||||
import com.ghy.goods.service.IInsuranceManagerService;
|
||||
import com.ghy.goods.domain.*;
|
||||
import com.ghy.goods.service.*;
|
||||
import com.ghy.web.pojo.vo.AppCategoryRequest;
|
||||
import com.ghy.web.pojo.vo.HotCategoryResponse;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
|
@ -46,6 +41,9 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
@Resource
|
||||
ICategoryInsuranceRelationService categoryInsuranceRelationService;
|
||||
|
||||
@Resource
|
||||
IDeptCategoryInsuranceRelationService deptCategoryInsuranceRelationService;
|
||||
|
||||
@Resource
|
||||
IInsuranceManagerService insuranceManagerService;
|
||||
|
||||
|
|
@ -159,14 +157,40 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
CategoryInsuranceRelation relation = new CategoryInsuranceRelation();
|
||||
relation.setGoodsCategoryId(deptGoodsCategory.getGoodsCategoryId());
|
||||
List<CategoryInsuranceRelation> relations = categoryInsuranceRelationService.selectCategoryInsuranceRelationList(relation);
|
||||
List<InsuranceManager> list = null;
|
||||
// pc保险设置
|
||||
List<InsuranceManager> pcInsuranceList = new ArrayList<>();
|
||||
// 商城保险设置
|
||||
List<InsuranceManager> shopInsuranceList = new ArrayList<>();
|
||||
if(CollectionUtil.isNotEmpty(relations)){
|
||||
list = insuranceManagerService.selectByIds(relations.stream().map(CategoryInsuranceRelation::getInsuranceId).collect(Collectors.toList()));
|
||||
List<InsuranceManager> list = insuranceManagerService.selectByIds(relations.stream().map(CategoryInsuranceRelation::getInsuranceId).collect(Collectors.toList()));
|
||||
list.forEach(model->{
|
||||
model.setInsuranceName(model.getCompanyName() + "||" + model.getInsuranceName() + "||" + model.getInsuranceAmount() + "元");
|
||||
// 查看pc勾选状态
|
||||
DeptCategoryInsuranceRelation pcParam = new DeptCategoryInsuranceRelation();
|
||||
pcParam.setType("02");
|
||||
pcParam.setInsuranceId(model.getId());
|
||||
pcParam.setDeptCategoryId(deptGoodsCategory.getDeptGoodsCategoryId());
|
||||
InsuranceManager pcModel = new InsuranceManager();
|
||||
BeanUtil.copyProperties(model, pcModel);
|
||||
if(CollectionUtil.isNotEmpty(deptCategoryInsuranceRelationService.selectDeptCategoryInsuranceRelationList(pcParam))){
|
||||
pcModel.setFlag(true);
|
||||
}
|
||||
pcInsuranceList.add(pcModel);
|
||||
|
||||
DeptCategoryInsuranceRelation shopParam = new DeptCategoryInsuranceRelation();
|
||||
shopParam.setType("01");
|
||||
shopParam.setInsuranceId(model.getId());
|
||||
shopParam.setDeptCategoryId(deptGoodsCategory.getDeptGoodsCategoryId());
|
||||
InsuranceManager shopModel = new InsuranceManager();
|
||||
BeanUtil.copyProperties(model, shopModel);
|
||||
if(CollectionUtil.isNotEmpty(deptCategoryInsuranceRelationService.selectDeptCategoryInsuranceRelationList(shopParam))){
|
||||
shopModel.setFlag(true);
|
||||
}
|
||||
shopInsuranceList.add(shopModel);
|
||||
});
|
||||
}
|
||||
mmap.put("insurances", list);
|
||||
mmap.put("pcInsurances", pcInsuranceList);
|
||||
mmap.put("shopInsurances", shopInsuranceList);
|
||||
mmap.put("deptGoodsCategory", deptGoodsCategory);
|
||||
return PREFIX + "/edit";
|
||||
}
|
||||
|
|
@ -175,6 +199,8 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult edit(DeptGoodsCategory category) {
|
||||
// 更新保险设置
|
||||
deptCategoryInsuranceRelationService.updateDeptCategoryInsuranceRelation(category.getPcInsuranceIds(), category.getShopInsuranceIds(), category.getDeptGoodsCategoryId());
|
||||
category.setUpdateBy(getLoginName());
|
||||
deptGoodsCategoryService.edit(category);
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label">PC保险设定:</label>
|
||||
<div class="col-xs-9">
|
||||
<label th:each="insurance:${insurances}" class="check-box">
|
||||
<label th:each="insurance:${pcInsurances}" class="check-box">
|
||||
<input name="pcInsurance" type="checkbox" th:value="${insurance.id}" th:text="${insurance.insuranceName}" th:checked="${insurance.flag}">
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -259,7 +259,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label">商城保险设定:</label>
|
||||
<div class="col-xs-9">
|
||||
<label th:each="insurance:${insurances}" class="check-box">
|
||||
<label th:each="insurance:${shopInsurances}" class="check-box">
|
||||
<input name="shopInsurance" type="checkbox" th:value="${insurance.id}" th:text="${insurance.insuranceName}" th:checked="${insurance.flag}">
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -310,6 +310,10 @@
|
|||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var data = $("#form-deptGoodsCategory-edit").serializeArray();
|
||||
var pcInsuranceIds = $.form.selectCheckeds("pcInsurance");
|
||||
var shopInsuranceIds = $.form.selectCheckeds("shopInsurance");
|
||||
data.push({"name": "pcInsuranceIds", "value": pcInsuranceIds});
|
||||
data.push({"name": "shopInsuranceIds", "value": shopInsuranceIds});
|
||||
$.operate.saveTab(prefix + "/edit", data);
|
||||
$.modal.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package com.ghy.goods.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.ghy.common.annotation.Excel;
|
||||
import com.ghy.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 平台类目保险关联关系对象 dept_category_insurance_relation
|
||||
*
|
||||
* @author clunt
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeptCategoryInsuranceRelation extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 平台类目id */
|
||||
@Excel(name = "平台类目id")
|
||||
private Long deptCategoryId;
|
||||
|
||||
/** 类型 01.商城 02.PC */
|
||||
@Excel(name = "类型 01.商城 02.PC")
|
||||
private String type;
|
||||
|
||||
/** 保险id */
|
||||
@Excel(name = "保险id")
|
||||
private Long insuranceId;
|
||||
|
||||
}
|
||||
|
|
@ -101,4 +101,8 @@ public class DeptGoodsCategory extends GoodsCategory {
|
|||
// 是否需要证书 1.需要
|
||||
private Integer isCert;
|
||||
|
||||
private String pcInsuranceIds;
|
||||
|
||||
private String shopInsuranceIds;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ghy.goods.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ghy.goods.domain.DeptCategoryInsuranceRelation;
|
||||
|
||||
/**
|
||||
* 平台类目保险关联关系Mapper接口
|
||||
*
|
||||
* @author clunt
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
public interface DeptCategoryInsuranceRelationMapper
|
||||
{
|
||||
/**
|
||||
* 查询平台类目保险关联关系
|
||||
*
|
||||
* @param id 平台类目保险关联关系主键
|
||||
* @return 平台类目保险关联关系
|
||||
*/
|
||||
public DeptCategoryInsuranceRelation selectDeptCategoryInsuranceRelationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询平台类目保险关联关系列表
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 平台类目保险关联关系集合
|
||||
*/
|
||||
public List<DeptCategoryInsuranceRelation> selectDeptCategoryInsuranceRelationList(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation);
|
||||
|
||||
/**
|
||||
* 新增平台类目保险关联关系
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeptCategoryInsuranceRelation(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation);
|
||||
|
||||
/**
|
||||
* 修改平台类目保险关联关系
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptCategoryInsuranceRelation(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation);
|
||||
|
||||
/**
|
||||
* 删除平台类目保险关联关系
|
||||
*
|
||||
* @param id 平台类目保险关联关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptCategoryInsuranceRelationById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除平台类目保险关联关系
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptCategoryInsuranceRelationByIds(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.ghy.goods.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ghy.goods.domain.DeptCategoryInsuranceRelation;
|
||||
|
||||
/**
|
||||
* 平台类目保险关联关系Service接口
|
||||
*
|
||||
* @author clunt
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
public interface IDeptCategoryInsuranceRelationService
|
||||
{
|
||||
/**
|
||||
* 查询平台类目保险关联关系
|
||||
*
|
||||
* @param id 平台类目保险关联关系主键
|
||||
* @return 平台类目保险关联关系
|
||||
*/
|
||||
public DeptCategoryInsuranceRelation selectDeptCategoryInsuranceRelationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询平台类目保险关联关系列表
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 平台类目保险关联关系集合
|
||||
*/
|
||||
public List<DeptCategoryInsuranceRelation> selectDeptCategoryInsuranceRelationList(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation);
|
||||
|
||||
/**
|
||||
* 新增平台类目保险关联关系
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeptCategoryInsuranceRelation(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation);
|
||||
|
||||
/**
|
||||
* 修改平台类目保险关联关系
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptCategoryInsuranceRelation(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation);
|
||||
|
||||
/**
|
||||
* 批量删除平台类目保险关联关系
|
||||
*
|
||||
* @param ids 需要删除的平台类目保险关联关系主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptCategoryInsuranceRelationByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除平台类目保险关联关系信息
|
||||
*
|
||||
* @param id 平台类目保险关联关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptCategoryInsuranceRelationById(Long id);
|
||||
|
||||
void updateDeptCategoryInsuranceRelation(String pcInsuranceIds, String shopInsuranceIds, Long deptGoodsCategoryId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.ghy.goods.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ghy.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ghy.goods.mapper.DeptCategoryInsuranceRelationMapper;
|
||||
import com.ghy.goods.domain.DeptCategoryInsuranceRelation;
|
||||
import com.ghy.goods.service.IDeptCategoryInsuranceRelationService;
|
||||
import com.ghy.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 平台类目保险关联关系Service业务层处理
|
||||
*
|
||||
* @author clunt
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
@Service
|
||||
public class DeptCategoryInsuranceRelationServiceImpl implements IDeptCategoryInsuranceRelationService
|
||||
{
|
||||
@Autowired
|
||||
private DeptCategoryInsuranceRelationMapper deptCategoryInsuranceRelationMapper;
|
||||
|
||||
/**
|
||||
* 查询平台类目保险关联关系
|
||||
*
|
||||
* @param id 平台类目保险关联关系主键
|
||||
* @return 平台类目保险关联关系
|
||||
*/
|
||||
@Override
|
||||
public DeptCategoryInsuranceRelation selectDeptCategoryInsuranceRelationById(Long id)
|
||||
{
|
||||
return deptCategoryInsuranceRelationMapper.selectDeptCategoryInsuranceRelationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询平台类目保险关联关系列表
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 平台类目保险关联关系
|
||||
*/
|
||||
@Override
|
||||
public List<DeptCategoryInsuranceRelation> selectDeptCategoryInsuranceRelationList(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation)
|
||||
{
|
||||
return deptCategoryInsuranceRelationMapper.selectDeptCategoryInsuranceRelationList(deptCategoryInsuranceRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增平台类目保险关联关系
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDeptCategoryInsuranceRelation(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation)
|
||||
{
|
||||
deptCategoryInsuranceRelation.setCreateTime(DateUtils.getNowDate());
|
||||
return deptCategoryInsuranceRelationMapper.insertDeptCategoryInsuranceRelation(deptCategoryInsuranceRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改平台类目保险关联关系
|
||||
*
|
||||
* @param deptCategoryInsuranceRelation 平台类目保险关联关系
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDeptCategoryInsuranceRelation(DeptCategoryInsuranceRelation deptCategoryInsuranceRelation)
|
||||
{
|
||||
deptCategoryInsuranceRelation.setUpdateTime(DateUtils.getNowDate());
|
||||
return deptCategoryInsuranceRelationMapper.updateDeptCategoryInsuranceRelation(deptCategoryInsuranceRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除平台类目保险关联关系
|
||||
*
|
||||
* @param ids 需要删除的平台类目保险关联关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeptCategoryInsuranceRelationByIds(String ids)
|
||||
{
|
||||
return deptCategoryInsuranceRelationMapper.deleteDeptCategoryInsuranceRelationByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除平台类目保险关联关系信息
|
||||
*
|
||||
* @param id 平台类目保险关联关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeptCategoryInsuranceRelationById(Long id)
|
||||
{
|
||||
return deptCategoryInsuranceRelationMapper.deleteDeptCategoryInsuranceRelationById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeptCategoryInsuranceRelation(String pcInsuranceIds, String shopInsuranceIds, Long deptGoodsCategoryId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?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.ghy.goods.mapper.DeptCategoryInsuranceRelationMapper">
|
||||
|
||||
<resultMap type="DeptCategoryInsuranceRelation" id="DeptCategoryInsuranceRelationResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptCategoryId" column="dept_category_id" />
|
||||
<result property="type" column="type" />
|
||||
<result property="insuranceId" column="insurance_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeptCategoryInsuranceRelationVo">
|
||||
select id, dept_category_id, type, insurance_id, create_by, create_time, update_by, update_time, remark from dept_category_insurance_relation
|
||||
</sql>
|
||||
|
||||
<select id="selectDeptCategoryInsuranceRelationList" parameterType="DeptCategoryInsuranceRelation" resultMap="DeptCategoryInsuranceRelationResult">
|
||||
<include refid="selectDeptCategoryInsuranceRelationVo"/>
|
||||
<where>
|
||||
<if test="deptCategoryId != null "> and dept_category_id = #{deptCategoryId}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="insuranceId != null "> and insurance_id = #{insuranceId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDeptCategoryInsuranceRelationById" parameterType="Long" resultMap="DeptCategoryInsuranceRelationResult">
|
||||
<include refid="selectDeptCategoryInsuranceRelationVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeptCategoryInsuranceRelation" parameterType="DeptCategoryInsuranceRelation" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into dept_category_insurance_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptCategoryId != null">dept_category_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="insuranceId != null">insurance_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptCategoryId != null">#{deptCategoryId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="insuranceId != null">#{insuranceId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeptCategoryInsuranceRelation" parameterType="DeptCategoryInsuranceRelation">
|
||||
update dept_category_insurance_relation
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deptCategoryId != null">dept_category_id = #{deptCategoryId},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="insuranceId != null">insurance_id = #{insuranceId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeptCategoryInsuranceRelationById" parameterType="Long">
|
||||
delete from dept_category_insurance_relation where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDeptCategoryInsuranceRelationByIds" parameterType="String">
|
||||
delete from dept_category_insurance_relation where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue