Commit e10f22cb authored by 赵啸非's avatar 赵啸非

修改工作人员

parent 2257d2ba
This diff is collapsed.
package com.mortals.xhx.module.business.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonPhpController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.apache.commons.lang3.ObjectUtils;
......@@ -79,6 +80,7 @@ public class BusinessController extends BaseCRUDJsonPhpController<BusinessServic
@Override
protected int doListAfter(HttpServletRequest request, HttpServletResponse response, BusinessForm form, Map<String, Object> model, Context context) throws AppException {
List<BusinessEntity> businessEntities = (List<BusinessEntity>) model.get(RESULT_KEY);
if(!ObjectUtils.isEmpty(businessEntities)){
businessEntities.stream().peek(item->{
List<BusinessEntity> childs = this.service.find(new BusinessQuery().parentId(item.getId()));
if(!ObjectUtils.isEmpty(childs)){
......@@ -88,6 +90,7 @@ public class BusinessController extends BaseCRUDJsonPhpController<BusinessServic
}
}).count();
model.put(RESULT_KEY,businessEntities);
}
return super.doListAfter(request, response, form, model, context);
}
......@@ -99,12 +102,12 @@ public class BusinessController extends BaseCRUDJsonPhpController<BusinessServic
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<String, Object>();
String businessIds=(String)map.get("businessIds");
Long siteId=(Long)map.get("siteId");
Long siteId= DataUtil.converObj2Long(map.get("siteId"));
try {
this.service.addBusinessToSite(businessIds,siteId,getContext());
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "添加业务到站点成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
......
......@@ -10,8 +10,10 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.site.model.SiteBusinessEntity;
import com.mortals.xhx.module.site.model.SiteBusinessQuery;
......@@ -25,49 +27,53 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.RESULT_KEY;
/**
*
* 站点事项
*
* @author zxfei
* @date 2022-01-13
*/
* 站点事项
*
* @author zxfei
* @date 2022-01-13
*/
@RestController
@RequestMapping("site/business")
public class SiteBusinessController extends BaseCRUDJsonPhpController<SiteBusinessService,SiteBusinessForm,SiteBusinessEntity,Long> {
public class SiteBusinessController extends BaseCRUDJsonPhpController<SiteBusinessService, SiteBusinessForm, SiteBusinessEntity, Long> {
@Autowired
private ParamService paramService;
public SiteBusinessController(){
public SiteBusinessController() {
super.setFormClass(SiteBusinessForm.class);
super.setModuleDesc( "站点事项");
super.setModuleDesc("站点事项");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, SiteBusinessForm form, Map<String, Object> model, Context context) {
this.addDict(model, "isBusiness", paramService.getParamBySecondOrganize("SiteBusiness","isBusiness"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("SiteBusiness","status"));
this.addDict(model, "isBusiness", paramService.getParamBySecondOrganize("SiteBusiness", "isBusiness"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("SiteBusiness", "status"));
super.init(request, response, form, model, context);
}
@Override
protected int doListAfter(HttpServletRequest request, HttpServletResponse response, SiteBusinessForm form, Map<String, Object> model, Context context) throws AppException {
List<SiteBusinessEntity> businessEntities = (List<SiteBusinessEntity>) model.get(RESULT_KEY);
businessEntities.stream().peek(item->{
if (!ObjectUtils.isEmpty(businessEntities)) {
businessEntities.stream().peek(item -> {
List<SiteBusinessEntity> childs = this.service.find(new SiteBusinessQuery().parentId(item.getBusinessId()));
if(!ObjectUtils.isEmpty(childs)){
if (!ObjectUtils.isEmpty(childs)) {
item.setChildren(childs);
}else{
} else {
item.setChildren(null);
}
}).count();
model.put(RESULT_KEY,businessEntities);
model.put(RESULT_KEY, businessEntities);
}
return super.doListAfter(request, response, form, model, context);
}
......@@ -77,7 +83,7 @@ public class SiteBusinessController extends BaseCRUDJsonPhpController<SiteBusine
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
Long id = form.getId()[0];
int code=VALUE_RESULT_SUCCESS;
int code = VALUE_RESULT_SUCCESS;
try {
List<SiteBusinessEntity> collect = this.service.find(new SiteBusinessQuery()).stream().map(item -> {
if (item.getId().intValue() == id || ArrayUtils.contains(StringUtils.split(item.getAncestors(), ","), id + "")) {
......@@ -105,7 +111,7 @@ public class SiteBusinessController extends BaseCRUDJsonPhpController<SiteBusine
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
int code = VALUE_RESULT_SUCCESS;
try {
List<SiteBusinessEntity> list = this.service.find(new SiteBusinessQuery());
List<SiteBusinessTreeSelect> treeSelects = this.service.buildSiteBusinessTreeSelect(list);
......@@ -121,7 +127,6 @@ public class SiteBusinessController extends BaseCRUDJsonPhpController<SiteBusine
}
/**
* 查询站点业务
*/
......
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.workman.model.vo.WorkmanVo;
* 工作人员实体对象
*
* @author zxfei
* @date 2022-01-20
* @date 2022-01-24
*/
public class WorkmanEntity extends WorkmanVo {
......@@ -120,6 +120,10 @@ public class WorkmanEntity extends WorkmanVo {
* 是否在线(0.离线,1.在线,2.暂离,3.点击暂离,4.回归,5.登陆)
*/
private Integer online;
/**
* 配置站点模块,逗号分隔
*/
private String modelIds;
......@@ -432,6 +436,20 @@ public class WorkmanEntity extends WorkmanVo {
public void setOnline(Integer online){
this.online = online;
}
/**
* 获取 配置站点模块,逗号分隔
* @return String
*/
public String getModelIds(){
return modelIds;
}
/**
* 设置 配置站点模块,逗号分隔
* @param modelIds
*/
public void setModelIds(String modelIds){
this.modelIds = modelIds;
}
......@@ -476,6 +494,7 @@ public class WorkmanEntity extends WorkmanVo {
sb.append(",promise:").append(getPromise());
sb.append(",business:").append(getBusiness());
sb.append(",online:").append(getOnline());
sb.append(",modelIds:").append(getModelIds());
return sb.toString();
}
......@@ -524,5 +543,7 @@ public class WorkmanEntity extends WorkmanVo {
this.business = null;
this.online = 1;
this.modelIds = "";
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.workman.model.WorkmanEntity;
* 工作人员查询对象
*
* @author zxfei
* @date 2022-01-20
* @date 2022-01-24
*/
public class WorkmanQuery extends WorkmanEntity {
/** 开始 序号,主键,自增长 */
......@@ -183,6 +183,9 @@ public class WorkmanQuery extends WorkmanEntity {
/** 结束 修改时间 */
private String updateTimeEnd;
/** 配置站点模块,逗号分隔 */
private List<String> modelIdsList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<WorkmanQuery> orConditionList;
......@@ -1105,6 +1108,21 @@ public class WorkmanQuery extends WorkmanEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 配置站点模块,逗号分隔
* @return modelIdsList
*/
public List<String> getModelIdsList(){
return this.modelIdsList;
}
/**
* 设置 配置站点模块,逗号分隔
* @param modelIdsList
*/
public void setModelIdsList(List<String> modelIdsList){
this.modelIdsList = modelIdsList;
}
/**
* 设置 序号,主键,自增长
* @param id
......@@ -1823,6 +1841,25 @@ public class WorkmanQuery extends WorkmanEntity {
}
/**
* 设置 配置站点模块,逗号分隔
* @param modelIds
*/
public WorkmanQuery modelIds(String modelIds){
setModelIds(modelIds);
return this;
}
/**
* 设置 配置站点模块,逗号分隔
* @param modelIdsList
*/
public WorkmanQuery modelIdsList(List<String> modelIdsList){
this.modelIdsList = modelIdsList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
......@@ -14,4 +14,15 @@ import java.util.List;
@Data
public class WorkmanVo extends BaseEntityLong {
/**
* 用户名
*/
private String userName;
/**
* 密码
*/
private String password;
}
\ No newline at end of file
package com.mortals.xhx.module.workman.service.impl;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.SecurityUtil;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.workman.dao.WorkmanDao;
import com.mortals.xhx.module.workman.model.WorkmanEntity;
import com.mortals.xhx.module.workman.service.WorkmanService;
import org.springframework.util.ObjectUtils;
import java.util.Date;
/**
* WorkmanService
* 工作人员 service实现
*
* @author zxfei
* @date 2022-01-12
*/
* WorkmanService
* 工作人员 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("workmanService")
public class WorkmanServiceImpl extends AbstractCRUDServiceImpl<WorkmanDao, WorkmanEntity, Long> implements WorkmanService {
@Autowired
private UserService userService;
@Override
protected void saveBefore(WorkmanEntity entity, Context context) throws AppException {
//新增 添加
try {
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setRealName(entity.getName());
userEntity.setLoginName(entity.getUserName());
userEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding(entity.getPassword()));
userEntity.setMobile(entity.getMobile());
userEntity.setUserType(2);
userEntity.setCreateTime(new Date());
userEntity.setCreateUser(context.getUser().getLoginName());
userEntity.setCreateUserName(context.getUser().getRealName());
userEntity.setSiteId(entity.getSiteId());
userEntity.setSiteName(entity.getSiteName());
userService.save(userEntity);
entity.setSystemUserId(userEntity.getId());
} catch (Exception e) {
log.error("创建工作人员异常!", e);
throw new AppException();
}
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(WorkmanEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getSystemUserId())) {
try {
UserEntity userEntity = userService.get(entity.getSystemUserId(), context);
userEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding(entity.getPassword()));
userService.update(userEntity, context);
} catch (Exception e) {
log.error("更新密码异常", e);
}
}
super.updateBefore(entity, context);
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@
<result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" />
<result property="modelIds" column="modelIds" />
</resultMap>
......@@ -116,23 +117,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime as updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('modelIds') or colPickMode == 1 and data.containsKey('modelIds')))">
a.modelIds as modelIds,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="WorkmanEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_sys_workman
(systemUserId,deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime)
(systemUserId,deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime,modelIds)
VALUES
(#{systemUserId},#{deptId},#{deptName},#{windowId},#{windowName},#{siteId},#{siteName},#{name},#{number},#{userpost},#{posttitle},#{politicalstatus},#{dangyuan},#{phone},#{mobile},#{starlevel},#{summary},#{photoPath},#{duty},#{promise},#{business},#{online},#{createTime},#{createUserId},#{updateTime})
(#{systemUserId},#{deptId},#{deptName},#{windowId},#{windowName},#{siteId},#{siteName},#{name},#{number},#{userpost},#{posttitle},#{politicalstatus},#{dangyuan},#{phone},#{mobile},#{starlevel},#{summary},#{photoPath},#{duty},#{promise},#{business},#{online},#{createTime},#{createUserId},#{updateTime},#{modelIds})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_sys_workman
(systemUserId,deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime)
(systemUserId,deptId,deptName,windowId,windowName,siteId,siteName,name,number,userpost,posttitle,politicalstatus,dangyuan,phone,mobile,starlevel,summary,photoPath,duty,promise,business,online,createTime,createUserId,updateTime,modelIds)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.systemUserId},#{item.deptId},#{item.deptName},#{item.windowId},#{item.windowName},#{item.siteId},#{item.siteName},#{item.name},#{item.number},#{item.userpost},#{item.posttitle},#{item.politicalstatus},#{item.dangyuan},#{item.phone},#{item.mobile},#{item.starlevel},#{item.summary},#{item.photoPath},#{item.duty},#{item.promise},#{item.business},#{item.online},#{item.createTime},#{item.createUserId},#{item.updateTime})
(#{item.systemUserId},#{item.deptId},#{item.deptName},#{item.windowId},#{item.windowName},#{item.siteId},#{item.siteName},#{item.name},#{item.number},#{item.userpost},#{item.posttitle},#{item.politicalstatus},#{item.dangyuan},#{item.phone},#{item.mobile},#{item.starlevel},#{item.summary},#{item.photoPath},#{item.duty},#{item.promise},#{item.business},#{item.online},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.modelIds})
</foreach>
</insert>
......@@ -244,6 +248,9 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('modelIds')) or (colPickMode==1 and !data.containsKey('modelIds'))">
a.modelIds=#{data.modelIds},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -476,6 +483,13 @@
</if>
</foreach>
</trim>
<trim prefix="modelIds=(case" suffix="ELSE modelIds end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('modelIds')) or (colPickMode==1 and !item.containsKey('modelIds'))">
when a.id=#{item.id} then #{item.modelIds}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -1027,6 +1041,21 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('modelIds')">
<if test="conditionParamRef.modelIds != null and conditionParamRef.modelIds != ''">
${_conditionType_} a.modelIds like #{${_conditionParam_}.modelIds}
</if>
<if test="conditionParamRef.modelIds == null">
${_conditionType_} a.modelIds is null
</if>
</if>
<if test="conditionParamRef.containsKey('modelIdsList')">
${_conditionType_} a.modelIds in
<foreach collection="conditionParamRef.modelIdsList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -1170,6 +1199,11 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('modelIds')">
a.modelIds
<if test='orderCol.modelIds != null and "DESC".equalsIgnoreCase(orderCol.modelIds)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
......
......@@ -4,6 +4,8 @@ POST {{baseUrl}}/business/list
Content-Type: application/json
{
"name":"测试业务",
"flownum":"k39shb",
"page":1,
"size":10
}
......@@ -14,19 +16,17 @@ POST {{baseUrl}}/business/save
Content-Type: application/json
{
"siteId":7636,
"siteName":"u4ol8i",
"parentId":6903,
"ancestors":"auv8jx",
"isBusiness":5720,
"name":"z9oh9n",
"remark":"9jywq7",
"canorder":3043,
"cantake":6463,
"datashow":3895,
"englishname":"but2ch",
"flownum":"q5nldn",
"status":5243
"parentId":0,
"isBusiness":0,
"name":"测试业务",
"remark":"fvnn84",
"canorder":1,
"cantake":1,
"datashow":1,
"englishname":"foe6s9",
"flownum":"k39shb",
"businessType":1,
"status":1
}
> {%
......@@ -47,5 +47,15 @@ GET {{baseUrl}}/business/delete?id={{Business_id}}
Accept: application/json
###添加业务到站点
POST {{baseUrl}}/business/addBusinessToSite
Content-Type: application/json
{
"siteId":1,
"businessIds":"1,2"
}
......@@ -19,20 +19,20 @@ Content-Type: application/json
{
"tid":"pnvi0e",
"tname":"g8b6wr",
"name":"gj4z8q",
"simpleName":"3v9ne7",
"siteId":822,
"name":"测试站点部门",
"simpleName":"测试站点部门",
"siteId":1,
"deptAbb":"mly6ov",
"deptTelphone":"26troq",
"deptNumber":"o9mdzw",
"isAutotable":3414,
"isOrder":3178,
"isBkb":9340,
"isWorkGuide":1311,
"usValid":1903,
"isSecphone":5758,
"isEnglish":627,
"sort":1366
"deptTelphone":"1328444586",
"deptNumber":"o9mdz123131w",
"isAutotable":1,
"isOrder":1,
"isBkb":1,
"isWorkGuide":1,
"usValid":1,
"isSecphone":1,
"isEnglish":1,
"sort":1
}
> {%
......
......@@ -4,6 +4,7 @@ POST {{baseUrl}}/site/business/list
Content-Type: application/json
{
"siteId": 1,
"page":1,
"size":10
}
......
......@@ -31,9 +31,9 @@ Content-Type: application/json
"detailAddress":"pe7sux",
"siteRemark":"isntkh",
"amWorkStartTime":19,
"amWorkEndTime":"2022-01-21",
"pmWorkStartTime":"2022-01-21",
"pmWorkEndTime":"2022-01-21",
"amWorkEndTime":1642987956000,
"pmWorkStartTime":1642987956000,
"pmWorkEndTime":1642987956000,
"workday1":1,
"workday2":1,
"workday3":1,
......
......@@ -14,19 +14,19 @@ POST {{baseUrl}}/window/save
Content-Type: application/json
{
"siteId":5687,
"siteName":"3to2ns",
"deptId":2868,
"deptName":"btfosi",
"name":"pkpeyz",
"siteId":1,
"siteName":"测试站点",
"deptId":1,
"deptName":"测试站点部门",
"name":"测试窗口1",
"englishName":"n1mu84",
"region":"v3gh02",
"englishRegion":"au277n",
"fromnum":"z7etfk",
"hongqi":539,
"hongqi":1,
"summary":"o0d5l4",
"building":7010,
"level":5992
"building":1,
"level":2
}
> {%
......
......@@ -22,28 +22,29 @@ POST {{baseUrl}}/workman/save
Content-Type: application/json
{
"systemUserId":3480,
"deptId":8468,
"deptName":"pn0ch2",
"windowId":3593,
"windowName":"spn8yt",
"siteId":8391,
"siteName":"7x471f",
"userName":"workman",
"password": "123456",
"deptId":1,
"deptName":"测试站点部门",
"windowId":1,
"windowName":"测试窗口1",
"siteId":1,
"siteName":"测试站点",
"name":"w8oamz",
"number":"8ylq9h",
"userpost":"4nl4dx",
"posttitle":"8qv5uh",
"politicalstatus":9557,
"dangyuan":2822,
"politicalstatus":1,
"dangyuan":1,
"phone":"sotmv2",
"mobile":"4oj2d8",
"starlevel":335,
"starlevel":1,
"summary":"ypajwa",
"photoPath":"t2ar5m",
"photoPath":"/xxxx/xx.jepg",
"duty":"aahncs",
"promise":"av4y8s",
"business":"eir0kk",
"online":4091
"online":1
}
> {%
......
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