12 changed files with 613 additions and 0 deletions
-
47src/main/java/com/xujie/sys/modules/production/controller/OperatorGroupController.java
-
123src/main/java/com/xujie/sys/modules/production/data/Operator.java
-
43src/main/java/com/xujie/sys/modules/production/data/OperatorGroupMember.java
-
4src/main/java/com/xujie/sys/modules/production/data/OperatorGroupMemberData.java
-
67src/main/java/com/xujie/sys/modules/production/data/OperatorGroupPlanDetail.java
-
8src/main/java/com/xujie/sys/modules/production/data/OperatorGroupPlanDetailData.java
-
102src/main/java/com/xujie/sys/modules/production/data/OperatorGroupPlanHeader.java
-
12src/main/java/com/xujie/sys/modules/production/data/OperatorGroupPlanHeaderData.java
-
27src/main/java/com/xujie/sys/modules/production/mapper/OperatorGroupMapper.java
-
22src/main/java/com/xujie/sys/modules/production/service/OperatorGroupService.java
-
63src/main/java/com/xujie/sys/modules/production/service/impl/OperatorGroupServiceImpl.java
-
95src/main/resources/mapper/production/OperatorGroupMapper.xml
@ -0,0 +1,47 @@ |
|||
package com.xujie.sys.modules.production.controller; |
|||
|
|||
import com.xujie.sys.common.utils.R; |
|||
import com.xujie.sys.modules.production.data.*; |
|||
import com.xujie.sys.modules.production.service.OperatorGroupService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
@RequestMapping("/operatorGroup") |
|||
public class OperatorGroupController { |
|||
@Autowired |
|||
private OperatorGroupService operatorGroupService; |
|||
|
|||
@PostMapping(value="/getOperatorGroup") |
|||
@ResponseBody |
|||
public R getOperatorGroup(@RequestBody Operator data){ |
|||
return R.ok().put("rows", operatorGroupService.getOperatorGroup(data)); |
|||
} |
|||
|
|||
|
|||
@PostMapping(value="/getOperatorGroupPlanHeader") |
|||
@ResponseBody |
|||
public R getOperatorGroupPlanHeader(@RequestBody OperatorGroupPlanHeaderData data){ |
|||
return R.ok().put("rows", operatorGroupService.getOperatorGroupPlanHeader(data)); |
|||
} |
|||
|
|||
@PostMapping(value="/getOperatorGroupPlanDetail") |
|||
@ResponseBody |
|||
public R getOperatorGroupPlanDetail(@RequestBody OperatorGroupPlanDetailData data){ |
|||
return R.ok().put("rows", operatorGroupService.getOperatorGroupPlanDetail(data)); |
|||
} |
|||
|
|||
|
|||
@PostMapping(value="/getOperatorGroupDefault") |
|||
@ResponseBody |
|||
public R getOperatorGroupDefault(@RequestBody Operator data){ |
|||
return R.ok().put("rows", operatorGroupService.getOperatorGroupDefault(data)); |
|||
} |
|||
|
|||
@PostMapping(value="/saveOperatorGroupDetail") |
|||
@ResponseBody |
|||
public R saveOperatorGroupDetail(@RequestBody OperatorGroupPlanHeaderData data){ |
|||
return R.ok(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
public class Operator { |
|||
/** |
|||
* |
|||
*/ |
|||
private String site; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String operatorID; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String operatorName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String active; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String department; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Date createdDate; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String passwords; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String lineLeader; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String operatorGroupFlag; |
|||
|
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
|
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
|
|||
public String getOperatorID() { |
|||
return operatorID; |
|||
} |
|||
|
|||
public void setOperatorID(String operatorID) { |
|||
this.operatorID = operatorID; |
|||
} |
|||
|
|||
public String getOperatorName() { |
|||
return operatorName; |
|||
} |
|||
|
|||
public void setOperatorName(String operatorName) { |
|||
this.operatorName = operatorName; |
|||
} |
|||
|
|||
public String getActive() { |
|||
return active; |
|||
} |
|||
|
|||
public void setActive(String active) { |
|||
this.active = active; |
|||
} |
|||
|
|||
public String getDepartment() { |
|||
return department; |
|||
} |
|||
|
|||
public void setDepartment(String department) { |
|||
this.department = department; |
|||
} |
|||
|
|||
public Date getCreatedDate() { |
|||
return createdDate; |
|||
} |
|||
|
|||
public void setCreatedDate(Date createdDate) { |
|||
this.createdDate = createdDate; |
|||
} |
|||
|
|||
public String getPasswords() { |
|||
return passwords; |
|||
} |
|||
|
|||
public void setPasswords(String passwords) { |
|||
this.passwords = passwords; |
|||
} |
|||
|
|||
public String getLineLeader() { |
|||
return lineLeader; |
|||
} |
|||
|
|||
public void setLineLeader(String lineLeader) { |
|||
this.lineLeader = lineLeader; |
|||
} |
|||
|
|||
public String getOperatorGroupFlag() { |
|||
return operatorGroupFlag; |
|||
} |
|||
|
|||
public void setOperatorGroupFlag(String operatorGroupFlag) { |
|||
this.operatorGroupFlag = operatorGroupFlag; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,43 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
public class OperatorGroupMember { |
|||
/** |
|||
* |
|||
*/ |
|||
private String site; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String operatorID; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String memberOperatorID; |
|||
|
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
|
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
|
|||
public String getOperatorID() { |
|||
return operatorID; |
|||
} |
|||
|
|||
public void setOperatorID(String operatorID) { |
|||
this.operatorID = operatorID; |
|||
} |
|||
|
|||
public String getMemberOperatorID() { |
|||
return memberOperatorID; |
|||
} |
|||
|
|||
public void setMemberOperatorID(String memberOperatorID) { |
|||
this.memberOperatorID = memberOperatorID; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,4 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
public class OperatorGroupMemberData { |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
public class OperatorGroupPlanDetail { |
|||
private String site; |
|||
/** |
|||
* |
|||
*/ |
|||
private Integer planId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String operatorID; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private BigDecimal workTime; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private BigDecimal wagesRate; |
|||
|
|||
public Integer getPlanId() { |
|||
return planId; |
|||
} |
|||
|
|||
public void setPlanId(Integer planId) { |
|||
this.planId = planId; |
|||
} |
|||
|
|||
public String getOperatorID() { |
|||
return operatorID; |
|||
} |
|||
|
|||
public void setOperatorID(String operatorID) { |
|||
this.operatorID = operatorID; |
|||
} |
|||
|
|||
public BigDecimal getWorkTime() { |
|||
return workTime; |
|||
} |
|||
|
|||
public void setWorkTime(BigDecimal workTime) { |
|||
this.workTime = workTime; |
|||
} |
|||
|
|||
public BigDecimal getWagesRate() { |
|||
return wagesRate; |
|||
} |
|||
|
|||
public void setWagesRate(BigDecimal wagesRate) { |
|||
this.wagesRate = wagesRate; |
|||
} |
|||
|
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
|
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,8 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class OperatorGroupPlanDetailData extends OperatorGroupPlanDetail{ |
|||
private String operatorName; |
|||
} |
|||
@ -0,0 +1,102 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.util.Date; |
|||
|
|||
public class OperatorGroupPlanHeader { |
|||
/** |
|||
* |
|||
*/ |
|||
private String site; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String operatorGroupId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date workDate; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String shiftno; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Double allTime; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Double wagesTime; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Integer id; |
|||
|
|||
public String getSite() { |
|||
return site; |
|||
} |
|||
|
|||
public void setSite(String site) { |
|||
this.site = site; |
|||
} |
|||
|
|||
public String getOperatorGroupId() { |
|||
return operatorGroupId; |
|||
} |
|||
|
|||
public void setOperatorGroupId(String operatorGroupId) { |
|||
this.operatorGroupId = operatorGroupId; |
|||
} |
|||
|
|||
public Date getWorkDate() { |
|||
return workDate; |
|||
} |
|||
|
|||
public void setWorkDate(Date workDate) { |
|||
this.workDate = workDate; |
|||
} |
|||
|
|||
public String getShiftno() { |
|||
return shiftno; |
|||
} |
|||
|
|||
public void setShiftno(String shiftno) { |
|||
this.shiftno = shiftno; |
|||
} |
|||
|
|||
public Double getAllTime() { |
|||
return allTime; |
|||
} |
|||
|
|||
public void setAllTime(Double allTime) { |
|||
this.allTime = allTime; |
|||
} |
|||
|
|||
public Double getWagesTime() { |
|||
return wagesTime; |
|||
} |
|||
|
|||
public void setWagesTime(Double wagesTime) { |
|||
this.wagesTime = wagesTime; |
|||
} |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
package com.xujie.sys.modules.production.data; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class OperatorGroupPlanHeaderData extends OperatorGroupPlanHeader{ |
|||
private String operatorName; |
|||
private String shiftdesc; |
|||
private List<OperatorGroupPlanDetailData> detailList; |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.xujie.sys.modules.production.mapper; |
|||
|
|||
import com.xujie.sys.modules.production.data.*; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface OperatorGroupMapper { |
|||
|
|||
List<Operator> getOperatorGroup(Operator data); |
|||
|
|||
List<OperatorGroupPlanHeaderData> getOperatorGroupPlanHeader(OperatorGroupPlanHeaderData data); |
|||
|
|||
List<OperatorGroupPlanDetailData> getOperatorGroupPlanDetail(OperatorGroupPlanDetailData data); |
|||
|
|||
|
|||
List<OperatorGroupPlanDetailData> getOperatorGroupDefault(Operator data); |
|||
void updateHeader(OperatorGroupPlanHeaderData data); |
|||
|
|||
List<OperatorGroupPlanHeaderData> checkHeader(OperatorGroupPlanHeaderData inData); |
|||
Integer saveHeader(OperatorGroupPlanHeaderData inData); |
|||
|
|||
void saveDetail(OperatorGroupPlanDetailData data); |
|||
|
|||
void deleteDetail(OperatorGroupPlanHeaderData data); |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.xujie.sys.modules.production.service; |
|||
|
|||
|
|||
import com.xujie.sys.modules.production.data.Operator; |
|||
import com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData; |
|||
import com.xujie.sys.modules.production.data.OperatorGroupPlanHeader; |
|||
import com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface OperatorGroupService { |
|||
|
|||
List<Operator> getOperatorGroup(Operator data); |
|||
|
|||
List<OperatorGroupPlanHeaderData> getOperatorGroupPlanHeader(OperatorGroupPlanHeaderData inData); |
|||
|
|||
List<OperatorGroupPlanDetailData> getOperatorGroupPlanDetail(OperatorGroupPlanDetailData inData); |
|||
|
|||
List<OperatorGroupPlanDetailData> getOperatorGroupDefault(Operator data); |
|||
|
|||
void saveOperatorGroupDetail(OperatorGroupPlanHeaderData inData); |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
package com.xujie.sys.modules.production.service.impl; |
|||
|
|||
import com.xujie.sys.modules.production.data.Operator; |
|||
import com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData; |
|||
import com.xujie.sys.modules.production.data.OperatorGroupPlanHeader; |
|||
import com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData; |
|||
import com.xujie.sys.modules.production.mapper.OperatorGroupMapper; |
|||
import com.xujie.sys.modules.production.service.OperatorGroupService; |
|||
import com.xujie.sys.modules.sys.service.SysRoleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class OperatorGroupServiceImpl implements OperatorGroupService { |
|||
|
|||
@Autowired |
|||
private OperatorGroupMapper operatorGroupMapper; |
|||
|
|||
@Override |
|||
public List<Operator> getOperatorGroup(Operator data){ |
|||
return operatorGroupMapper.getOperatorGroup(data); |
|||
} |
|||
|
|||
@Override |
|||
public List<OperatorGroupPlanHeaderData> getOperatorGroupPlanHeader(OperatorGroupPlanHeaderData inData){ |
|||
return operatorGroupMapper.getOperatorGroupPlanHeader(inData); |
|||
} |
|||
|
|||
@Override |
|||
public List<OperatorGroupPlanDetailData> getOperatorGroupPlanDetail(OperatorGroupPlanDetailData inData){ |
|||
return operatorGroupMapper.getOperatorGroupPlanDetail(inData); |
|||
} |
|||
|
|||
@Override |
|||
public List<OperatorGroupPlanDetailData> getOperatorGroupDefault(Operator data){ |
|||
return operatorGroupMapper.getOperatorGroupDefault(data); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void saveOperatorGroupDetail(OperatorGroupPlanHeaderData inData){ |
|||
if(inData.getId()!=null){ |
|||
operatorGroupMapper.updateHeader(inData); |
|||
}else { |
|||
List<OperatorGroupPlanHeaderData> result= operatorGroupMapper.checkHeader(inData); |
|||
if(result.size()>0){ |
|||
throw new RuntimeException("该操作组班次已经存在!!!"); |
|||
} |
|||
Integer id =operatorGroupMapper.saveHeader(inData); |
|||
for (int i = 0; i <inData.getDetailList().size() ; i++) { |
|||
inData.getDetailList().get(i).setPlanId(id); |
|||
} |
|||
} |
|||
operatorGroupMapper.deleteDetail(inData); |
|||
for (int i = 0; i < inData.getDetailList().size(); i++) { |
|||
operatorGroupMapper.saveDetail(inData.getDetailList().get(i)); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
<?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.xujie.sys.modules.production.mapper.OperatorGroupMapper"> |
|||
<select id="getOperatorGroup" resultType="com.xujie.sys.modules.production.data.Operator"> |
|||
select Site,OperatorID,OperatorName,Active,Department,CreatedDate,Passwords,LineLeader,OperatorGroupFlag |
|||
from Operator |
|||
<where> |
|||
and OperatorGroupFlag = 'Y' |
|||
<if test = "site != null and site != ''"> |
|||
AND Site LIKE #{site} |
|||
</if> |
|||
<if test = "operatorID != null and operatorID != ''"> |
|||
AND OperatorID LIKE #{operatorID} |
|||
</if> |
|||
<if test = "operatorName != null and operatorName != ''"> |
|||
AND operatorName LIKE #{operatorName} |
|||
</if> |
|||
and Active='Y' |
|||
|
|||
</where> |
|||
</select> |
|||
|
|||
<select id="getOperatorGroupPlanHeader" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData"> |
|||
select a.Site,a.OperatorGroupId,a.WorkDate,a.Shiftno,a.allTime,a.WagesTime,a.id,b.OperatorName ,c.shiftdesc |
|||
from OperatorGroupPlanHeader a left join Operator b on a.OperatorGroupId=b.OperatorID |
|||
left join ShiftInfo C on a.Shiftno=c.shiftno |
|||
<where> |
|||
<if test = "site != null and site != ''"> |
|||
AND a.Site LIKE #{site} |
|||
</if> |
|||
<if test = "operatorGroupId != null and operatorGroupId != ''"> |
|||
AND a.operatorGroupId LIKE #{operatorGroupId} |
|||
</if> |
|||
<if test = "id != null and id != ''"> |
|||
AND a.id = #{id} |
|||
</if> |
|||
|
|||
<if test = "shiftdesc != null and shiftdesc != ''"> |
|||
AND c.shiftdesc like #{shiftdesc} |
|||
</if> |
|||
|
|||
|
|||
</where> |
|||
|
|||
order by a.WorkDate desc |
|||
</select> |
|||
|
|||
|
|||
<select id="getOperatorGroupPlanDetail" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData"> |
|||
select a.PlanId,a.operatorID,a.workTime,a.WagesRate,a.Site,b.OperatorName |
|||
from OperatorGroupPlanDetail a left join Operator b on a.operatorID=b.OperatorID |
|||
<where> |
|||
<if test = "site != null and site != ''"> |
|||
AND a.Site LIKE #{site} |
|||
</if> |
|||
<if test = "planId != null and planId != ''"> |
|||
AND a.PlanId LIKE #{planId} |
|||
</if> |
|||
|
|||
|
|||
|
|||
</where> |
|||
|
|||
|
|||
</select> |
|||
<select id="getOperatorGroupDefault" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData"> |
|||
select a.Member_OperatorID OperatorID,b.operatorName,null as workTime ,1 as WagesRate |
|||
from Operator_group_member a left join Operator b on a.Member_OperatorID=b.OperatorID |
|||
where a.OperatorID =#{operatorID} and b.Active='Y' |
|||
</select> |
|||
|
|||
<select id="updateHeader" > |
|||
update OperatorGroupPlanHeader set allTime=#{allTime,jdbcType=DOUBLE} and WagesTime=#{wagesTime,javaType=double} |
|||
where id=#{id} |
|||
</select> |
|||
|
|||
<select id="checkHeader" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData"> |
|||
select id from OperatorGroupPlanHeader where operatorID=#{operatorGroupId} and shiftno=#{shiftno} |
|||
</select> |
|||
|
|||
<insert id="saveHeader" keyProperty="id"> |
|||
insert into OperatorGroupPlanHeader(Site,OperatorGroupId,WorkDate,Shiftno,allTime,WagesTime) |
|||
values (#{site},#{operatorGroupId},#{workDate},#{shiftno},#{allTime},#{wagesTime} |
|||
} |
|||
</insert> |
|||
|
|||
<insert id="saveDetail"> |
|||
insert into OperatorGroupPlanDetail(PlanId,operatorID,workTime,WagesRate,Site) |
|||
valuse(#{planId},#{operatorID},#{workTime},#{wagesRate},#{site}) |
|||
</insert> |
|||
<delete id="deleteDetail"> |
|||
delete from OperatorGroupPlanDetail where PlanId=#{id} |
|||
</delete> |
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue