| | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.domain.KeyValueVo; |
| | | import com.zy.crm.common.web.BaseController; |
| | |
| | | return R.ok(planService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/list/auth") |
| | | @RequestMapping(value = "/plan/page/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | public R page(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<Plan> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(Plan.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(planService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | @RequestParam(required = false, value = "dept_id") Long deptId, |
| | | @RequestParam(required = false, value = "user_id") Long userId) { |
| | | return R.ok(planService.getPage(new Page<>(curr, limit) |
| | | , getHostId() |
| | | , deptId == null ? null : String.valueOf(deptId) |
| | | , userId == null ? getUserId() : userId |
| | | , condition) |
| | | ); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/add/auth") |
| | |
| | | planService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<Plan> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("plan")); |
| | | convert(map, wrapper); |
| | | List<Plan> list = planService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/planQuery/auth") |
| | |
| | | private Integer beItem; |
| | | |
| | | /** |
| | | * 表单内容 |
| | | */ |
| | | @ApiModelProperty(value= "表单内容") |
| | | private String form; |
| | | |
| | | /** |
| | | * 规划员 |
| | | */ |
| | | @ApiModelProperty(value= "规划员") |
| | |
| | | @TableField("finish_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date finishTime; |
| | | |
| | | /** |
| | | * 表单内容 |
| | | */ |
| | | @ApiModelProperty(value= "表单内容") |
| | | private String form; |
| | | |
| | | /** |
| | | * 更改方案 1: 是 0: 否 |
| | |
| | | package com.zy.crm.manager.mapper; |
| | | |
| | | import com.zy.crm.manager.entity.Plan; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.zy.crm.manager.entity.Plan; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface PlanMapper extends BaseMapper<Plan> { |
| | | |
| | | Plan selectByUuid(@Param("hostId") Long hostId, @Param("uuid") String uuid); |
| | | |
| | | Plan selectPlanByNewestUuid(@Param("hostId") Long hostId); |
| | | |
| | | List<Plan> listByPage(Page<Plan> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId , @Param("condition") String condition); |
| | | |
| | | } |
| | |
| | | package com.zy.crm.manager.service; |
| | | |
| | | import com.zy.crm.manager.entity.Plan; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.crm.manager.entity.Plan; |
| | | |
| | | public interface PlanService extends IService<Plan> { |
| | | |
| | | Plan selectByUuid(Long hostId, String uuid); |
| | | |
| | | String getUuid(Long hostId); |
| | | |
| | | Page<Plan> getPage(Page<Plan> page, Long hostId, String deptId, Long userId, String condition); |
| | | |
| | | } |
| | |
| | | package com.zy.crm.manager.service.impl; |
| | | |
| | | import com.zy.crm.manager.mapper.PlanMapper; |
| | | import com.zy.crm.manager.entity.Plan; |
| | | import com.zy.crm.manager.service.PlanService; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.crm.manager.entity.Plan; |
| | | import com.zy.crm.manager.mapper.PlanMapper; |
| | | import com.zy.crm.manager.service.PlanService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("planService") |
| | | public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements PlanService { |
| | | |
| | | @Override |
| | | public Plan selectByUuid(Long hostId, String uuid) { |
| | | return this.baseMapper.selectByUuid(hostId, uuid); |
| | | } |
| | | |
| | | @Override |
| | | public String getUuid(Long hostId) { |
| | | String uuid = null; |
| | | int times = 0; |
| | | while (Cools.isEmpty(uuid)) { |
| | | if (times > 100) { break; } |
| | | String nextUuid = getNextUuid(hostId); |
| | | if (selectByUuid(hostId, nextUuid) == null) { |
| | | uuid = nextUuid; |
| | | } |
| | | times ++; |
| | | } |
| | | return uuid; |
| | | } |
| | | |
| | | @Override |
| | | public Page<Plan> getPage(Page<Plan> page, Long hostId, String deptId, Long userId, String condition) { |
| | | return page.setRecords(baseMapper.listByPage(page, hostId, deptId, userId, condition)); |
| | | } |
| | | |
| | | private String getNextUuid(Long hostId) { |
| | | Plan plan = this.baseMapper.selectPlanByNewestUuid(hostId); |
| | | if (plan == null) { |
| | | return "0001"; |
| | | } |
| | | return zerofill(String.valueOf(Integer.parseInt(plan.getUuid()) + 1), 4); |
| | | } |
| | | |
| | | public static String zerofill(String msg, Integer count){ |
| | | if (msg.length() == count){ |
| | | return msg; |
| | | } else if (msg.length() > count){ |
| | | return msg.substring(0, 16); |
| | | } else { |
| | | StringBuilder msgBuilder = new StringBuilder(msg); |
| | | for (int i = 0; i<count-msg.length(); i++){ |
| | | msgBuilder.insert(0,"0"); |
| | | } |
| | | return msgBuilder.toString(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <result column="apple_time" property="appleTime" /> |
| | | <result column="plan_need" property="planNeed" /> |
| | | <result column="be_item" property="beItem" /> |
| | | <result column="form" property="form" /> |
| | | <result column="planner" property="planner" /> |
| | | <result column="finish_time" property="finishTime" /> |
| | | <result column="form" property="form" /> |
| | | <result column="change" property="change" /> |
| | | <result column="change_time" property="changeTime" /> |
| | | <result column="change_reason" property="changeReason" /> |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="selectByUuid" resultMap="BaseResultMap"> |
| | | select * from man_plan |
| | | where 1=1 |
| | | and uuid = #{uuid} |
| | | <if test="hostId != null"> |
| | | and host_id = #{hostId} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectPlanByNewestUuid" resultMap="BaseResultMap"> |
| | | select top 1 * from man_plan |
| | | where 1=1 |
| | | <if test="hostId != null"> |
| | | and host_id = #{hostId} |
| | | </if> |
| | | order by uuid + 0 desc |
| | | </select> |
| | | |
| | | <select id="listByPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | mp.* |
| | | FROM man_plan mp |
| | | LEFT JOIN sys_dept sd ON mp.dept_id = sd.id |
| | | WHERE 1=1 |
| | | <choose> |
| | | <when test="deptId != null and deptId != ''"> |
| | | AND (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) |
| | | </when> |
| | | <otherwise> |
| | | and |
| | | ( |
| | | user_id = #{userId} |
| | | or |
| | | mp.id in |
| | | ( |
| | | select |
| | | order_id |
| | | from man_order_foll |
| | | where 1=1 |
| | | and user_id = #{userId} |
| | | ) |
| | | ) |
| | | </otherwise> |
| | | </choose> |
| | | <if test="hostId != null"> |
| | | and mp.host_id = #{hostId} |
| | | </if> |
| | | <if test="condition != null and condition != ''"> |
| | | and ( |
| | | mp.uuid like concat('%',#{condition},'%') |
| | | or mp.name like concat('%',#{condition},'%') |
| | | or mp.planner like concat('%',#{condition},'%') |
| | | or mp.remarks like concat('%',#{condition},'%') |
| | | ) |
| | | </if> |
| | | ORDER BY mp.create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | tableIns = table.render({ |
| | | elem: '#plan', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/plan/list/auth', |
| | | url: baseUrl+'/plan/page/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: 'ID'} |
| | | ,{field: 'hostId$', align: 'center',title: '所属商户'} |
| | | ,{field: 'deptId$', align: 'center',title: '所属部门'} |
| | | ,{field: 'planType$', align: 'center',title: '业务类型'} |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | // ,{field: 'hostId$', align: 'center',title: '所属商户'} |
| | | ,{field: 'userId$', align: 'center',title: '业务员'} |
| | | ,{field: 'planType$', align: 'center',title: '业务类型'} |
| | | ,{field: 'name', align: 'center',title: '售前规划申请单名称'} |
| | | ,{field: 'planNeed$', align: 'center',title: '所需'} |
| | | ,{field: 'deptId$', align: 'center',title: '所属部门'} |
| | | ,{field: 'orderId$', align: 'center',title: '跟踪项目'} |
| | | ,{field: 'cstmrId$', align: 'center',title: '甲方单位'} |
| | | ,{field: 'uuid', align: 'center',title: '规划单代号'} |
| | | ,{field: 'name', align: 'center',title: '规划单名称'} |
| | | ,{field: 'appleTime$', align: 'center',title: '申请日期'} |
| | | ,{field: 'planNeed$', align: 'center',title: '方案所需'} |
| | | |
| | | ,{field: 'beItem$', align: 'center',title: '立项'} |
| | | ,{field: 'planner', align: 'center',title: '规划员'} |
| | | ,{field: 'finishTime$', align: 'center',title: '完成时间'} |
| | |
| | | ,{field: 'changeReason', align: 'center',title: '更改方案原因'} |
| | | ,{field: 'planBonus', align: 'center',title: '规格奖金'} |
| | | ,{field: 'planLeaderBonus', align: 'center',title: '规格组长奖金'} |
| | | ,{field: 'files', align: 'center',title: '附件'} |
| | | ,{field: 'settle$', align: 'center',title: '进度'} |
| | | ,{field: 'settleMsg', align: 'center',title: '审核进度'} |
| | | ,{field: 'comment', align: 'center',title: '评论'} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | | ,{field: 'createBy$', align: 'center',title: '添加人员'} |
| | | ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | | // ,{field: 'files', align: 'center',title: '附件'} |
| | | // ,{field: 'settle$', align: 'center',title: '进度'} |
| | | // ,{field: 'settleMsg', align: 'center',title: '审核进度'} |
| | | // ,{field: 'comment', align: 'center',title: '评论'} |
| | | // ,{field: 'status$', align: 'center',title: '状态'} |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员'} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'memo', align: 'center',title: '注释'} |
| | |
| | | } |
| | | layDateRender(); |
| | | |
| | | window.loadHostSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#hostXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/host/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadDeptSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#deptXmlSel', |
| | |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/planType/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadUserSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#userXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/user/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadUserSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#userXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/user/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadUserSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#userXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/user/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | }); |